karo: fdt: move list of supported touchpanels out of common file
authorLothar Waßmann <LW@KARO-electronics.de>
Fri, 6 Dec 2013 09:31:18 +0000 (10:31 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 6 Dec 2013 09:31:18 +0000 (10:31 +0100)
board/karo/common/fdt.c
board/karo/common/karo.h
board/karo/tx28/tx28.c
board/karo/tx48/tx48.c
board/karo/tx51/tx51.c
board/karo/tx53/tx53.c
board/karo/tx6/tx6qdl.c

index 0d52ca2..f735d36 100644 (file)
@@ -203,14 +203,6 @@ void karo_fdt_enable_node(void *blob, const char *node, int enable)
        karo_set_fdtsize(blob);
 }
 
-static const char *karo_touchpanels[] = {
-       "ti,tsc2007",
-       "edt,edt-ft5x06",
-#ifdef CONFIG_MX28
-       "fsl,imx28-lradc",
-#endif
-};
-
 static void fdt_disable_tp_node(void *blob, const char *name)
 {
        int offs = fdt_node_offset_by_compatible(blob, -1, name);
@@ -224,25 +216,27 @@ static void fdt_disable_tp_node(void *blob, const char *name)
        fdt_set_node_status(blob, offs, FDT_STATUS_DISABLED, 0);
 }
 
-void karo_fdt_fixup_touchpanel(void *blob)
+void karo_fdt_fixup_touchpanel(void *blob, const char *panels[],
+                       size_t num_panels)
 {
        int i;
        const char *model = getenv("touchpanel");
 
-       for (i = 0; i < ARRAY_SIZE(karo_touchpanels); i++) {
-               const char *tp = karo_touchpanels[i];
-
-               if (model != NULL && strcmp(model, tp) == 0)
-                       continue;
+       for (i = 0; i < num_panels; i++) {
+               const char *tp = panels[i];
 
                if (model != NULL) {
                        if (strcmp(model, tp) == 0)
                                continue;
-                       tp = strchr(tp, ',');
-                       if (tp != NULL && *tp != '\0' && strcmp(model, tp + 1) == 0)
+                       while (tp != NULL) {
+                               if (*tp != '\0' && strcmp(model, tp + 1) == 0)
+                                       break;
+                               tp = strpbrk(tp + 1, ",-");
+                       }
+                       if (tp != NULL)
                                continue;
                }
-               fdt_disable_tp_node(blob, karo_touchpanels[i]);
+               fdt_disable_tp_node(blob, panels[i]);
        }
        karo_set_fdtsize(blob);
 }
index 996f69b..6ef5293 100644 (file)
@@ -19,7 +19,8 @@ struct fb_videomode;
 #ifdef CONFIG_OF_LIBFDT
 void karo_fdt_remove_node(void *blob, const char *node);
 void karo_fdt_move_fdt(void);
-void karo_fdt_fixup_touchpanel(void *blob);
+void karo_fdt_fixup_touchpanel(void *blob, const char *panels[],
+                       size_t num_panels);
 void karo_fdt_fixup_usb_otg(void *blob, const char *node, const char *phy);
 void karo_fdt_fixup_flexcan(void *blob, int xcvr_present);
 void karo_fdt_del_prop(void *blob, const char *compat, phys_addr_t offs,
@@ -39,7 +40,8 @@ static inline void karo_fdt_remove_node(void *blob, const char *node)
 static inline void karo_fdt_move_fdt(void)
 {
 }
-static inline void karo_fdt_fixup_touchpanel(void *blob)
+static inline void karo_fdt_fixup_touchpanel(void *blob, const char *panels[],
+                                       size_t num_panels)
 {
 }
 static inline void karo_fdt_fixup_usb_otg(void *blob, const char *node,
index 779f5ad..c3e2616 100644 (file)
@@ -908,6 +908,12 @@ struct node_info tx28_nand_nodes[] = {
 #define fdt_fixup_mtdparts(b,n,c) do { } while (0)
 #endif
 
+static const char *tx28_touchpanels[] = {
+       "ti,tsc2007",
+       "edt,edt-ft5x06",
+       "fsl,imx28-lradc",
+};
+
 void ft_board_setup(void *blob, bd_t *bd)
 {
        const char *baseboard = getenv("baseboard");
@@ -927,7 +933,8 @@ void ft_board_setup(void *blob, bd_t *bd)
        fdt_fixup_mtdparts(blob, tx28_nand_nodes, ARRAY_SIZE(tx28_nand_nodes));
        fdt_fixup_ethernet(blob);
 
-       karo_fdt_fixup_touchpanel(blob);
+       karo_fdt_fixup_touchpanel(blob, tx28_touchpanels,
+                               ARRAY_SIZE(tx28_touchpanels));
        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"));
index 7929edc..5f8d3cd 100644 (file)
@@ -1058,6 +1058,12 @@ struct node_info nodes[] = {
 #define fdt_fixup_mtdparts(b,n,c) do { } while (0)
 #endif /* CONFIG_FDT_FIXUP_PARTITIONS */
 
+static const char *tx48_touchpanels[] = {
+       "ti,tsc2007",
+       "edt,edt-ft5x06",
+       "ti,am3359-tscadc",
+};
+
 void ft_board_setup(void *blob, bd_t *bd)
 {
        const char *baseboard = getenv("baseboard");
@@ -1067,7 +1073,9 @@ void ft_board_setup(void *blob, bd_t *bd)
        fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
        fdt_fixup_ethernet(blob);
 
-       karo_fdt_fixup_touchpanel(blob);
+       karo_fdt_fixup_touchpanel(blob, tx48_touchpanels,
+                               ARRAY_SIZE(tx48_touchpanels));
+       karo_fdt_fixup_usb_otg(blob, "usb0", "phys");
        karo_fdt_fixup_flexcan(blob, stk5_v5);
 
        video_mode = karo_fdt_set_display(video_mode, "/panel", NULL);
index 11ec4f6..094fbd2 100644 (file)
@@ -1073,12 +1073,18 @@ struct node_info nodes[] = {
 #define fdt_fixup_mtdparts(b,n,c) do { } while (0)
 #endif
 
+static const char *tx51_touchpanels[] = {
+       "ti,tsc2007",
+       "edt,edt-ft5x06",
+};
+
 void ft_board_setup(void *blob, bd_t *bd)
 {
        fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
        fdt_fixup_ethernet(blob);
 
-       karo_fdt_fixup_touchpanel(blob);
+       karo_fdt_fixup_touchpanel(blob, tx51_touchpanels,
+                               ARRAY_SIZE(tx51_touchpanels));
        karo_fdt_fixup_usb_otg(blob, "fsl,imx-otg", "fsl,usbphy");
        karo_fdt_update_fb_mode(blob, getenv("video_mode"));
 }
index c80e7eb..7637ce1 100644 (file)
@@ -1194,6 +1194,11 @@ static inline void tx53_fixup_rtc(void *blob)
 }
 #endif /* CONFIG_SYS_TX53_HWREV_2 */
 
+static const char *tx53_touchpanels[] = {
+       "ti,tsc2007",
+       "edt,edt-ft5x06",
+};
+
 void ft_board_setup(void *blob, bd_t *bd)
 {
        const char *baseboard = getenv("baseboard");
@@ -1203,7 +1208,8 @@ void ft_board_setup(void *blob, bd_t *bd)
        fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
        fdt_fixup_ethernet(blob);
 
-       karo_fdt_fixup_touchpanel(blob);
+       karo_fdt_fixup_touchpanel(blob, tx53_touchpanels,
+                               ARRAY_SIZE(tx53_touchpanels));
        karo_fdt_fixup_usb_otg(blob, "fsl,imx-otg", "fsl,usbphy");
        karo_fdt_fixup_flexcan(blob, stk5_v5);
        tx53_fixup_rtc(blob);
index e748111..c03cc68 100644 (file)
@@ -1288,6 +1288,11 @@ struct node_info nodes[] = {
 #define fdt_fixup_mtdparts(b,n,c) do { } while (0)
 #endif
 
+static const char *tx6_touchpanels[] = {
+       "ti,tsc2007",
+       "edt,edt-ft5x06",
+};
+
 void ft_board_setup(void *blob, bd_t *bd)
 {
        const char *baseboard = getenv("baseboard");
@@ -1299,7 +1304,8 @@ void ft_board_setup(void *blob, bd_t *bd)
        fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
        fdt_fixup_ethernet(blob);
 
-       karo_fdt_fixup_touchpanel(blob);
+       karo_fdt_fixup_touchpanel(blob, tx6_touchpanels,
+                               ARRAY_SIZE(tx6_touchpanels));
        karo_fdt_fixup_usb_otg(blob, "usbotg", "fsl,usbphy");
        karo_fdt_fixup_flexcan(blob, stk5_v5);