]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
dts: tx28: use karo_fdt_fixup_flexcan()
authorLothar Waßmann <LW@KARO-electronics.de>
Fri, 25 Oct 2013 12:51:15 +0000 (14:51 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 25 Oct 2013 12:51:15 +0000 (14:51 +0200)
board/karo/tx28/tx28.c

index 327e3b0f80d3b8d8dbb945ba6f9a678f72242c63..779f5adac25af8dcb56e13c307dcc0a83824e2e6 100644 (file)
@@ -1,14 +1,13 @@
 /*
- * Copyright (C) 2011 Lothar Waßmann <LW@KARO-electronics.de>
- * based on: board/freesclae/mx28_evk.c (C) 2010 Freescale Semiconductor, Inc.
+ * Copyright (C) 2011-2013 Lothar Waßmann <LW@KARO-electronics.de>
+ * based on: board/freescale/mx28_evk.c (C) 2010 Freescale Semiconductor, Inc.
  *
  * See file CREDITS for list of people who contributed to this
  * project.
  *
  * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -909,81 +908,6 @@ struct node_info tx28_nand_nodes[] = {
 #define fdt_fixup_mtdparts(b,n,c) do { } while (0)
 #endif
 
-static int flexcan_enabled(void *blob)
-{
-       const char *status;
-       int off = fdt_path_offset(blob, "can0");
-
-       if (off < 0) {
-               printf("node 'can0' not found\n");
-       } else {
-               status = fdt_getprop(blob, off, "status", NULL);
-               if (status && strcmp(status, "okay") == 0) {
-                       printf("can0 is enabled\n");
-                       return 1;
-               }
-       }
-       off = fdt_path_offset(blob, "can1");
-       if (off < 0) {
-               printf("node 'can1' not found\n");
-               return 0;
-       }
-       status = fdt_getprop(blob, off, "status", NULL);
-       if (status && strcmp(status, "okay") == 0) {
-               printf("can1 is enabled\n");
-               return 1;
-       }
-       printf("can driver disabled\n");
-       return 0;
-}
-
-static void tx28_set_lcd_pins(void *blob, const char *name)
-{
-       int off = fdt_path_offset(blob, name);
-       u32 ph;
-       const struct fdt_property *pc;
-       int len;
-
-       if (off < 0)
-               return;
-
-       ph = fdt32_to_cpu(fdt_create_phandle(blob, off));
-       if (!ph)
-               return;
-
-       off = fdt_path_offset(blob, "lcdif");
-       if (off < 0)
-               return;
-
-       pc = fdt_get_property(blob, off, "pinctrl-0", &len);
-       if (!pc || len < sizeof(ph))
-               return;
-
-       memcpy((void *)pc->data, &ph, sizeof(ph));
-       fdt_setprop(blob, off, "pinctrl-0", pc->data, len);
-}
-
-static void tx28_fixup_flexcan(void *blob, int stk5_v5)
-{
-       const char *can_xcvr = "disabled";
-
-       if (stk5_v5) {
-               if (flexcan_enabled(blob)) {
-                       tx28_set_lcd_pins(blob, "lcdif_23bit_pins_a");
-                       can_xcvr = "okay";
-               } else {
-                       tx28_set_lcd_pins(blob, "lcdif_24bit_pins_a");
-               }
-       } else {
-               const char *otg_mode = getenv("otg_mode");
-
-               if (otg_mode && (strcmp(otg_mode, "host") == 0))
-                       karo_fdt_enable_node(blob, "can1", 0);
-       }
-       fdt_find_and_setprop(blob, "/regulators/can-xcvr", "status",
-                       can_xcvr, strlen(can_xcvr) + 1, 1);
-}
-
 void ft_board_setup(void *blob, bd_t *bd)
 {
        const char *baseboard = getenv("baseboard");
@@ -999,13 +923,13 @@ void ft_board_setup(void *blob, bd_t *bd)
        if (stk5_v5) {
                karo_fdt_remove_node(blob, "stk5led");
        }
-       tx28_fixup_flexcan(blob, stk5_v5);
 
        fdt_fixup_mtdparts(blob, tx28_nand_nodes, ARRAY_SIZE(tx28_nand_nodes));
        fdt_fixup_ethernet(blob);
 
        karo_fdt_fixup_touchpanel(blob);
        karo_fdt_fixup_usb_otg(blob, "usbotg", "fsl,usbphy");
+       karo_fdt_fixup_flexcan(blob, stk5_v5);
        karo_fdt_update_fb_mode(blob, getenv("video_mode"));
 }
-#endif
+#endif /* CONFIG_OF_BOARD_SETUP */