[U-Boot] [PATCH 1/2] fsl:usb: Make fsl usb device-tree fixup arch independent

Move usb device-tree fixup from ehci drv so that it becomes available to all ppc and arm platforms
Signed-off-by: Ramneek Mehresh ramneek.mehresh@freescale.com --- board/freescale/common/Makefile | 2 + board/freescale/common/usb.c | 203 ++++++++++++++++++++++++++++++++ board/freescale/corenet_ds/corenet_ds.c | 1 - drivers/usb/host/ehci-fsl.c | 196 ------------------------------ include/fdt_support.h | 4 +- 5 files changed, 207 insertions(+), 199 deletions(-) create mode 100644 board/freescale/common/usb.c
diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile index 51d2814..4b83303 100644 --- a/board/freescale/common/Makefile +++ b/board/freescale/common/Makefile @@ -64,6 +64,8 @@ obj-$(CONFIG_POWER_PFUZE100) += pfuze.o
obj-$(CONFIG_LS102XA_STREAM_ID) += ls102xa_stream_id.o
+obj-$(CONFIG_USB_DEVTREE_FIXUP) += usb.o + # deal with common files for P-series corenet based devices obj-$(CONFIG_P2041RDB) += p_corenet/ obj-$(CONFIG_P3041DS) += p_corenet/ diff --git a/board/freescale/common/usb.c b/board/freescale/common/usb.c new file mode 100644 index 0000000..b99fa2b --- /dev/null +++ b/board/freescale/common/usb.c @@ -0,0 +1,203 @@ +/* + * (C) Copyright 2015 Freescale Semiconductor, Inc. + * + * Author: Ramneek Mehresh ramneek.mehresh@freescale.com + * + * SPDX-License-Identifier: GPL-2.0+ + * + * FSL board device-tree fix-up + */ +#include <common.h> +#include <hwconfig.h> +#include <fdt_support.h> +#include <fsl_usb.h> + +#ifndef CONFIG_USB_MAX_CONTROLLER_COUNT +#define CONFIG_USB_MAX_CONTROLLER_COUNT 1 +#endif + +static const char *fdt_usb_get_node_type(void *blob, int start_offset, + int *node_offset) +{ + const char *compat_dr = "fsl-usb2-dr"; + const char *compat_mph = "fsl-usb2-mph"; + const char *compat_snps = "snps,dwc3"; + const char *node_type = NULL; + + *node_offset = fdt_node_offset_by_compatible(blob, start_offset, + compat_mph); + if (*node_offset < 0) { + *node_offset = fdt_node_offset_by_compatible(blob, + start_offset, + compat_dr); + if (*node_offset < 0) { + *node_offset = fdt_node_offset_by_compatible(blob, + start_offset, compat_snps); + if (*node_offset < 0) { + printf("ERROR:could not find node:%s", + fdt_strerror(*node_offset)); + } else { + node_type = compat_snps; + } + } else { + node_type = compat_dr; + } + } else { + node_type = compat_mph; + } + + return node_type; +} + +static int fdt_fixup_usb_mode_phy_type(void *blob, const char *mode, + const char *phy_type, int start_offset) +{ + const char *prop_mode = "dr_mode"; + const char *prop_type = "phy_type"; + const char *node_type = NULL; + int node_offset; + int err; + + node_type = fdt_usb_get_node_type(blob, start_offset, &node_offset); + if (!node_type) + return -1; + + if (mode) { + err = fdt_setprop(blob, node_offset, prop_mode, mode, + strlen(mode) + 1); + if (err < 0) + printf("WARNING: could not set %s for %s: %s.\n", + prop_mode, node_type, fdt_strerror(err)); + } + + if (phy_type) { + err = fdt_setprop(blob, node_offset, prop_type, phy_type, + strlen(phy_type) + 1); + if (err < 0) + printf("WARNING: could not set %s for %s: %s.\n", + prop_type, node_type, fdt_strerror(err)); + } + + return node_offset; +} + +static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum, + int start_offset) +{ + int node_offset, err; + const char *node_type = NULL; + + node_type = fdt_usb_get_node_type(blob, start_offset, &node_offset); + if (!node_type) + return -1; + + err = fdt_setprop(blob, node_offset, prop_erratum, NULL, 0); + if (err < 0) { + printf("%s: ERROR: could not set %s for %s: %s.\n", __func__, + prop_erratum, node_type, fdt_strerror(err)); + } + + return node_offset; +} + +void fdt_fixup_dr_usb(void *blob, bd_t *bd) +{ + static const char * const modes[] = { "host", "peripheral", "otg" }; + static const char * const phys[] = { "ulpi", "utmi", "utmi_dual" }; + int usb_erratum_a006261_off = -1; + int usb_erratum_a007075_off = -1; + int usb_erratum_a007792_off = -1; + int usb_erratum_a005697_off = -1; + int usb_mode_off = -1; + int usb_phy_off = -1; + char str[5]; + int i, j; + + for (i = 1; i <= CONFIG_USB_MAX_CONTROLLER_COUNT; i++) { + const char *dr_mode_type = NULL; + const char *dr_phy_type = NULL; + int mode_idx = -1, phy_idx = -1; + + snprintf(str, 5, "%s%d", "usb", i); + if (hwconfig(str)) { + for (j = 0; j < ARRAY_SIZE(modes); j++) { + if (hwconfig_subarg_cmp(str, "dr_mode", + modes[j])) { + mode_idx = j; + break; + } + } + + for (j = 0; j < ARRAY_SIZE(phys); j++) { + if (hwconfig_subarg_cmp(str, "phy_type", + phys[j])) { + phy_idx = j; + break; + } + } + + if (mode_idx < 0 && phy_idx < 0) { + printf("WARNING: invalid phy or mode\n"); + return; + } + + if (mode_idx > -1) + dr_mode_type = modes[mode_idx]; + + if (phy_idx > -1) + dr_phy_type = phys[phy_idx]; + } + + if (has_dual_phy()) + dr_phy_type = phys[2]; + + usb_mode_off = fdt_fixup_usb_mode_phy_type(blob, + dr_mode_type, NULL, + usb_mode_off); + + if (usb_mode_off < 0) + return; + + usb_phy_off = fdt_fixup_usb_mode_phy_type(blob, + NULL, dr_phy_type, + usb_phy_off); + + if (usb_phy_off < 0) + return; + + if (has_erratum_a006261()) { + usb_erratum_a006261_off = fdt_fixup_usb_erratum + (blob, + "fsl,usb-erratum-a006261", + usb_erratum_a006261_off); + if (usb_erratum_a006261_off < 0) + return; + } + + if (has_erratum_a007075()) { + usb_erratum_a007075_off = fdt_fixup_usb_erratum + (blob, + "fsl,usb-erratum-a007075", + usb_erratum_a007075_off); + if (usb_erratum_a007075_off < 0) + return; + } + + if (has_erratum_a007792()) { + usb_erratum_a007792_off = fdt_fixup_usb_erratum + (blob, + "fsl,usb-erratum-a007792", + usb_erratum_a007792_off); + if (usb_erratum_a007792_off < 0) + return; + } + if (has_erratum_a005697()) { + usb_erratum_a005697_off = fdt_fixup_usb_erratum + (blob, + "fsl,usb-erratum-a005697", + usb_erratum_a005697_off); + if (usb_erratum_a005697_off < 0) + return; + } + } +} diff --git a/board/freescale/corenet_ds/corenet_ds.c b/board/freescale/corenet_ds/corenet_ds.c index 6f0fea1..2945339 100644 --- a/board/freescale/corenet_ds/corenet_ds.c +++ b/board/freescale/corenet_ds/corenet_ds.c @@ -207,7 +207,6 @@ int ft_board_setup(void *blob, bd_t *bd) #endif
fdt_fixup_liodn(blob); - fdt_fixup_dr_usb(blob, bd);
#ifdef CONFIG_SYS_DPAA_FMAN fdt_fixup_fman_ethernet(blob); diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 97b7f14..7b9e10a 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -15,7 +15,6 @@ #include <usb/ehci-fsl.h> #include <hwconfig.h> #include <fsl_usb.h> -#include <fdt_support.h>
#include "ehci.h"
@@ -173,198 +172,3 @@ static void set_txfifothresh(struct usb_ehci *ehci, u32 txfifo_thresh) cmd |= TXFIFO_THRESH(txfifo_thresh); ehci_writel(&ehci->txfilltuning, cmd); } - -#if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) -static int fdt_fixup_usb_mode_phy_type(void *blob, const char *mode, - const char *phy_type, int start_offset) -{ - const char *compat_dr = "fsl-usb2-dr"; - const char *compat_mph = "fsl-usb2-mph"; - const char *prop_mode = "dr_mode"; - const char *prop_type = "phy_type"; - const char *node_type = NULL; - int node_offset; - int err; - - node_offset = fdt_node_offset_by_compatible(blob, - start_offset, compat_mph); - if (node_offset < 0) { - node_offset = fdt_node_offset_by_compatible(blob, - start_offset, - compat_dr); - if (node_offset < 0) { - printf("WARNING: could not find compatible node: %s", - fdt_strerror(node_offset)); - return -1; - } - node_type = compat_dr; - } else { - node_type = compat_mph; - } - - if (mode) { - err = fdt_setprop(blob, node_offset, prop_mode, mode, - strlen(mode) + 1); - if (err < 0) - printf("WARNING: could not set %s for %s: %s.\n", - prop_mode, node_type, fdt_strerror(err)); - } - - if (phy_type) { - err = fdt_setprop(blob, node_offset, prop_type, phy_type, - strlen(phy_type) + 1); - if (err < 0) - printf("WARNING: could not set %s for %s: %s.\n", - prop_type, node_type, fdt_strerror(err)); - } - - return node_offset; -} - -static const char *fdt_usb_get_node_type(void *blob, int start_offset, - int *node_offset) -{ - const char *compat_dr = "fsl-usb2-dr"; - const char *compat_mph = "fsl-usb2-mph"; - const char *node_type = NULL; - - *node_offset = fdt_node_offset_by_compatible(blob, start_offset, - compat_mph); - if (*node_offset < 0) { - *node_offset = fdt_node_offset_by_compatible(blob, - start_offset, - compat_dr); - if (*node_offset < 0) { - printf("ERROR: could not find compatible node: %s\n", - fdt_strerror(*node_offset)); - } else { - node_type = compat_dr; - } - } else { - node_type = compat_mph; - } - - return node_type; -} - -static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum, - int start_offset) -{ - int node_offset, err; - const char *node_type = NULL; - - node_type = fdt_usb_get_node_type(blob, start_offset, &node_offset); - if (!node_type) - return -1; - - err = fdt_setprop(blob, node_offset, prop_erratum, NULL, 0); - if (err < 0) { - printf("ERROR: could not set %s for %s: %s.\n", - prop_erratum, node_type, fdt_strerror(err)); - } - - return node_offset; -} - -void fdt_fixup_dr_usb(void *blob, bd_t *bd) -{ - static const char * const modes[] = { "host", "peripheral", "otg" }; - static const char * const phys[] = { "ulpi", "utmi", "utmi_dual" }; - int usb_erratum_a006261_off = -1; - int usb_erratum_a007075_off = -1; - int usb_erratum_a007792_off = -1; - int usb_erratum_a005697_off = -1; - int usb_mode_off = -1; - int usb_phy_off = -1; - char str[5]; - int i, j; - - for (i = 1; i <= CONFIG_USB_MAX_CONTROLLER_COUNT; i++) { - const char *dr_mode_type = NULL; - const char *dr_phy_type = NULL; - int mode_idx = -1, phy_idx = -1; - - snprintf(str, 5, "%s%d", "usb", i); - if (hwconfig(str)) { - for (j = 0; j < ARRAY_SIZE(modes); j++) { - if (hwconfig_subarg_cmp(str, "dr_mode", - modes[j])) { - mode_idx = j; - break; - } - } - - for (j = 0; j < ARRAY_SIZE(phys); j++) { - if (hwconfig_subarg_cmp(str, "phy_type", - phys[j])) { - phy_idx = j; - break; - } - } - - if (mode_idx < 0 && phy_idx < 0) { - printf("WARNING: invalid phy or mode\n"); - return; - } - - if (mode_idx > -1) - dr_mode_type = modes[mode_idx]; - - if (phy_idx > -1) - dr_phy_type = phys[phy_idx]; - } - - if (has_dual_phy()) - dr_phy_type = phys[2]; - - usb_mode_off = fdt_fixup_usb_mode_phy_type(blob, - dr_mode_type, NULL, - usb_mode_off); - - if (usb_mode_off < 0) - return; - - usb_phy_off = fdt_fixup_usb_mode_phy_type(blob, - NULL, dr_phy_type, - usb_phy_off); - - if (usb_phy_off < 0) - return; - - if (has_erratum_a006261()) { - usb_erratum_a006261_off = fdt_fixup_usb_erratum - (blob, - "fsl,usb-erratum-a006261", - usb_erratum_a006261_off); - if (usb_erratum_a006261_off < 0) - return; - } - - if (has_erratum_a007075()) { - usb_erratum_a007075_off = fdt_fixup_usb_erratum - (blob, - "fsl,usb-erratum-a007075", - usb_erratum_a007075_off); - if (usb_erratum_a007075_off < 0) - return; - } - - if (has_erratum_a007792()) { - usb_erratum_a007792_off = fdt_fixup_usb_erratum - (blob, - "fsl,usb-erratum-a007792", - usb_erratum_a007792_off); - if (usb_erratum_a007792_off < 0) - return; - } - if (has_erratum_a005697()) { - usb_erratum_a005697_off = fdt_fixup_usb_erratum - (blob, - "fsl,usb-erratum-a005697", - usb_erratum_a005697_off); - if (usb_erratum_a005697_off < 0) - return; - } - } -} -#endif diff --git a/include/fdt_support.h b/include/fdt_support.h index 296add0..1d77336 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -113,11 +113,11 @@ void fdt_fixup_qe_firmware(void *fdt); */ int fdt_fixup_display(void *blob, const char *path, const char *display);
-#if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) +#ifdef CONFIG_USB_DEVTREE_FIXUP void fdt_fixup_dr_usb(void *blob, bd_t *bd); #else static inline void fdt_fixup_dr_usb(void *blob, bd_t *bd) {} -#endif /* defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) */ +#endif
#if defined(CONFIG_SYS_FSL_SEC_COMPAT) void fdt_fixup_crypto_node(void *blob, int sec_rev);

On Tuesday, January 26, 2016 at 12:36:57 PM, Ramneek Mehresh wrote:
Move usb device-tree fixup from ehci drv so that it becomes available to all ppc and arm platforms
Signed-off-by: Ramneek Mehresh ramneek.mehresh@freescale.com
board/freescale/common/Makefile | 2 + board/freescale/common/usb.c | 203 ++++++++++++++++++++++++++++++++ board/freescale/corenet_ds/corenet_ds.c | 1 - drivers/usb/host/ehci-fsl.c | 196 ------------------------------ include/fdt_support.h | 4 +- 5 files changed, 207 insertions(+), 199 deletions(-) create mode 100644 board/freescale/common/usb.c
Use git format-patch -M -C and resubmit, I am not gonna review this.
Best regards, Marek Vasut

Add usb device-tree fixup for all relevant fsl ppc and arm platforms
Signed-off-by: Ramneek Mehresh ramneek.mehresh@freescale.com --- board/freescale/b4860qds/b4860qds.c | 2 +- board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++ board/freescale/bsc9132qds/bsc9132qds.c | 2 ++ board/freescale/corenet_ds/corenet_ds.c | 4 ++++ board/freescale/ls2080aqds/ls2080aqds.c | 4 ++++ board/freescale/ls2080ardb/ls2080ardb.c | 4 ++++ board/freescale/mpc8308rdb/mpc8308rdb.c | 4 ++++ board/freescale/mpc8315erdb/mpc8315erdb.c | 2 ++ board/freescale/mpc837xemds/mpc837xemds.c | 2 ++ board/freescale/mpc837xerdb/mpc837xerdb.c | 2 ++ board/freescale/mpc8536ds/mpc8536ds.c | 2 +- board/freescale/p1010rdb/p1010rdb.c | 2 +- board/freescale/p1022ds/p1022ds.c | 2 +- board/freescale/p1023rdb/p1023rdb.c | 2 +- board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- board/freescale/p1_twr/p1_twr.c | 3 +++ board/freescale/p2041rdb/p2041rdb.c | 2 +- board/freescale/t102xqds/t102xqds.c | 2 +- board/freescale/t102xrdb/t102xrdb.c | 3 +++ board/freescale/t1040qds/t1040qds.c | 2 +- board/freescale/t104xrdb/t104xrdb.c | 2 +- board/freescale/t208xqds/t208xqds.c | 3 +++ board/freescale/t208xrdb/t208xrdb.c | 3 +++ board/freescale/t4qds/t4240emu.c | 3 +++ board/freescale/t4qds/t4240qds.c | 3 +++ board/freescale/t4rdb/t4240rdb.c | 3 +++ include/configs/B4860QDS.h | 1 + include/configs/BSC9131RDB.h | 1 + include/configs/BSC9132QDS.h | 3 ++- include/configs/MPC8308RDB.h | 3 +++ include/configs/MPC8315ERDB.h | 1 + include/configs/MPC837XEMDS.h | 3 ++- include/configs/MPC837XERDB.h | 1 + include/configs/MPC8536DS.h | 1 + include/configs/P1010RDB.h | 1 + include/configs/P1022DS.h | 1 + include/configs/P1023RDB.h | 1 + include/configs/P2041RDB.h | 1 + include/configs/T102xQDS.h | 1 + include/configs/T102xRDB.h | 1 + include/configs/T1040QDS.h | 1 + include/configs/T104xRDB.h | 1 + include/configs/T208xQDS.h | 1 + include/configs/T208xRDB.h | 1 + include/configs/T4240QDS.h | 1 + include/configs/corenet_ds.h | 1 + include/configs/ls2080aqds.h | 1 + include/configs/ls2080ardb.h | 1 + include/configs/p1_p2_rdb_pc.h | 1 + include/configs/p1_twr.h | 1 + 50 files changed, 85 insertions(+), 12 deletions(-)
diff --git a/board/freescale/b4860qds/b4860qds.c b/board/freescale/b4860qds/b4860qds.c index 6a8fca6..0831cda 100644 --- a/board/freescale/b4860qds/b4860qds.c +++ b/board/freescale/b4860qds/b4860qds.c @@ -1213,7 +1213,7 @@ int ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_liodn(blob);
-#ifdef CONFIG_HAS_FSL_DR_USB +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); #endif
diff --git a/board/freescale/bsc9131rdb/bsc9131rdb.c b/board/freescale/bsc9131rdb/bsc9131rdb.c index 75e1142..c3be910 100644 --- a/board/freescale/bsc9131rdb/bsc9131rdb.c +++ b/board/freescale/bsc9131rdb/bsc9131rdb.c @@ -73,7 +73,9 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes)); #endif
+#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); +#endif
return 0; } diff --git a/board/freescale/bsc9132qds/bsc9132qds.c b/board/freescale/bsc9132qds/bsc9132qds.c index 586dacc..61f96f8 100644 --- a/board/freescale/bsc9132qds/bsc9132qds.c +++ b/board/freescale/bsc9132qds/bsc9132qds.c @@ -394,7 +394,9 @@ int ft_board_setup(void *blob, bd_t *bd) /* remove dts usb node */ fdt_del_node_compat(blob, "fsl-usb2-dr"); } else { +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); +#endif fdt_del_node_and_alias(blob, "serial2"); } } diff --git a/board/freescale/corenet_ds/corenet_ds.c b/board/freescale/corenet_ds/corenet_ds.c index 2945339..77f33c2 100644 --- a/board/freescale/corenet_ds/corenet_ds.c +++ b/board/freescale/corenet_ds/corenet_ds.c @@ -208,6 +208,10 @@ int ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_liodn(blob);
+#ifdef CONFIG_USB_DEVTREE_FIXUP + fdt_fixup_dr_usb(blob, bd); +#endif + #ifdef CONFIG_SYS_DPAA_FMAN fdt_fixup_fman_ethernet(blob); fdt_fixup_board_enet(blob); diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c index aa256a2..6b3a15e 100644 --- a/board/freescale/ls2080aqds/ls2080aqds.c +++ b/board/freescale/ls2080aqds/ls2080aqds.c @@ -300,6 +300,10 @@ int ft_board_setup(void *blob, bd_t *bd) return err; #endif
+#ifdef CONFIG_USB_DEVTREE_FIXUP + fdt_fixup_dr_usb(blob, bd); +#endif + return 0; } #endif diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c index c63b639..5f1d886 100644 --- a/board/freescale/ls2080ardb/ls2080ardb.c +++ b/board/freescale/ls2080ardb/ls2080ardb.c @@ -266,6 +266,10 @@ int ft_board_setup(void *blob, bd_t *bd) return err; #endif
+#ifdef CONFIG_USB_DEVTREE_FIXUP + fdt_fixup_dr_usb(blob, bd); +#endif + return 0; } #endif diff --git a/board/freescale/mpc8308rdb/mpc8308rdb.c b/board/freescale/mpc8308rdb/mpc8308rdb.c index 93e1c50..266f70a 100644 --- a/board/freescale/mpc8308rdb/mpc8308rdb.c +++ b/board/freescale/mpc8308rdb/mpc8308rdb.c @@ -164,7 +164,11 @@ int misc_init_r(void) int ft_board_setup(void *blob, bd_t *bd) { ft_cpu_setup(blob, bd); + +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); +#endif + fdt_fixup_esdhc(blob, bd);
return 0; diff --git a/board/freescale/mpc8315erdb/mpc8315erdb.c b/board/freescale/mpc8315erdb/mpc8315erdb.c index ed611c5..85cc45e 100644 --- a/board/freescale/mpc8315erdb/mpc8315erdb.c +++ b/board/freescale/mpc8315erdb/mpc8315erdb.c @@ -194,7 +194,9 @@ int ft_board_setup(void *blob, bd_t *bd) #ifdef CONFIG_PCI ft_pci_setup(blob, bd); #endif +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); +#endif fdt_tsec1_fixup(blob, bd);
return 0; diff --git a/board/freescale/mpc837xemds/mpc837xemds.c b/board/freescale/mpc837xemds/mpc837xemds.c index 572913c..5107934 100644 --- a/board/freescale/mpc837xemds/mpc837xemds.c +++ b/board/freescale/mpc837xemds/mpc837xemds.c @@ -332,7 +332,9 @@ int ft_board_setup(void *blob, bd_t *bd) { ft_cpu_setup(blob, bd); ft_tsec_fixup(blob, bd); +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); +#endif fdt_fixup_esdhc(blob, bd); #ifdef CONFIG_PCI ft_pci_setup(blob, bd); diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c b/board/freescale/mpc837xerdb/mpc837xerdb.c index 565f815..a17c0e1 100644 --- a/board/freescale/mpc837xerdb/mpc837xerdb.c +++ b/board/freescale/mpc837xerdb/mpc837xerdb.c @@ -210,7 +210,9 @@ int ft_board_setup(void *blob, bd_t *bd) ft_pci_setup(blob, bd); #endif ft_cpu_setup(blob, bd); +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); +#endif fdt_fixup_esdhc(blob, bd);
return 0; diff --git a/board/freescale/mpc8536ds/mpc8536ds.c b/board/freescale/mpc8536ds/mpc8536ds.c index 7b0f461..017ed99 100644 --- a/board/freescale/mpc8536ds/mpc8536ds.c +++ b/board/freescale/mpc8536ds/mpc8536ds.c @@ -281,7 +281,7 @@ int ft_board_setup(void *blob, bd_t *bd) fsl_sgmii_riser_fdt_fixup(blob); #endif
-#ifdef CONFIG_HAS_FSL_MPH_USB +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); #endif
diff --git a/board/freescale/p1010rdb/p1010rdb.c b/board/freescale/p1010rdb/p1010rdb.c index ebffe9a..77ad58a 100644 --- a/board/freescale/p1010rdb/p1010rdb.c +++ b/board/freescale/p1010rdb/p1010rdb.c @@ -462,7 +462,7 @@ int ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_memory(blob, (u64)base, (u64)size);
-#if defined(CONFIG_HAS_FSL_DR_USB) +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); #endif
diff --git a/board/freescale/p1022ds/p1022ds.c b/board/freescale/p1022ds/p1022ds.c index d7dd478..7d49738 100644 --- a/board/freescale/p1022ds/p1022ds.c +++ b/board/freescale/p1022ds/p1022ds.c @@ -344,7 +344,7 @@ int ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_memory(blob, (u64)base, (u64)size);
-#ifdef CONFIG_HAS_FSL_DR_USB +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); #endif
diff --git a/board/freescale/p1023rdb/p1023rdb.c b/board/freescale/p1023rdb/p1023rdb.c index 074b713..af81fbf 100644 --- a/board/freescale/p1023rdb/p1023rdb.c +++ b/board/freescale/p1023rdb/p1023rdb.c @@ -142,7 +142,7 @@ int ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_memory(blob, (u64)base, (u64)size);
-#ifdef CONFIG_HAS_FSL_DR_USB +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); #endif
diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c index 61b7a91..0247149 100644 --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c @@ -453,7 +453,7 @@ int ft_board_setup(void *blob, bd_t *bd) #endif #endif
-#if defined(CONFIG_HAS_FSL_DR_USB) +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); #endif
diff --git a/board/freescale/p1_twr/p1_twr.c b/board/freescale/p1_twr/p1_twr.c index a40bea3..bfdcfa0 100644 --- a/board/freescale/p1_twr/p1_twr.c +++ b/board/freescale/p1_twr/p1_twr.c @@ -282,7 +282,10 @@ int ft_board_setup(void *blob, bd_t *bd) #if defined(CONFIG_TWR_P1025) fdt_board_fixup_qe_pins(blob); #endif + +#ifdef CONFIG_HAS_FSL_DR_USB fdt_fixup_dr_usb(blob, bd); +#endif
return 0; } diff --git a/board/freescale/p2041rdb/p2041rdb.c b/board/freescale/p2041rdb/p2041rdb.c index e600bdb..250ab08 100644 --- a/board/freescale/p2041rdb/p2041rdb.c +++ b/board/freescale/p2041rdb/p2041rdb.c @@ -227,7 +227,7 @@ int ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_memory(blob, (u64)base, (u64)size);
-#if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); #endif
diff --git a/board/freescale/t102xqds/t102xqds.c b/board/freescale/t102xqds/t102xqds.c index 708afca..a6a14cf 100644 --- a/board/freescale/t102xqds/t102xqds.c +++ b/board/freescale/t102xqds/t102xqds.c @@ -379,7 +379,7 @@ int ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_liodn(blob);
-#ifdef CONFIG_HAS_FSL_DR_USB +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); #endif
diff --git a/board/freescale/t102xrdb/t102xrdb.c b/board/freescale/t102xrdb/t102xrdb.c index fddd240..bd648e1 100644 --- a/board/freescale/t102xrdb/t102xrdb.c +++ b/board/freescale/t102xrdb/t102xrdb.c @@ -194,7 +194,10 @@ int ft_board_setup(void *blob, bd_t *bd) #endif
fdt_fixup_liodn(blob); + +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); +#endif
#ifdef CONFIG_SYS_DPAA_FMAN fdt_fixup_fman_ethernet(blob); diff --git a/board/freescale/t1040qds/t1040qds.c b/board/freescale/t1040qds/t1040qds.c index eaca57f..33e69dd 100644 --- a/board/freescale/t1040qds/t1040qds.c +++ b/board/freescale/t1040qds/t1040qds.c @@ -261,7 +261,7 @@ int ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_liodn(blob);
-#ifdef CONFIG_HAS_FSL_DR_USB +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); #endif
diff --git a/board/freescale/t104xrdb/t104xrdb.c b/board/freescale/t104xrdb/t104xrdb.c index 3227652..e2487e6 100644 --- a/board/freescale/t104xrdb/t104xrdb.c +++ b/board/freescale/t104xrdb/t104xrdb.c @@ -149,7 +149,7 @@ int ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_liodn(blob);
-#ifdef CONFIG_HAS_FSL_DR_USB +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); #endif
diff --git a/board/freescale/t208xqds/t208xqds.c b/board/freescale/t208xqds/t208xqds.c index 7c89cd5..539d1ee 100644 --- a/board/freescale/t208xqds/t208xqds.c +++ b/board/freescale/t208xqds/t208xqds.c @@ -467,7 +467,10 @@ int ft_board_setup(void *blob, bd_t *bd) #endif
fdt_fixup_liodn(blob); + +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); +#endif
#ifdef CONFIG_SYS_DPAA_FMAN fdt_fixup_fman_ethernet(blob); diff --git a/board/freescale/t208xrdb/t208xrdb.c b/board/freescale/t208xrdb/t208xrdb.c index 0c2c1c5..49548d4 100644 --- a/board/freescale/t208xrdb/t208xrdb.c +++ b/board/freescale/t208xrdb/t208xrdb.c @@ -134,7 +134,10 @@ int ft_board_setup(void *blob, bd_t *bd) #endif
fdt_fixup_liodn(blob); + +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); +#endif
#ifdef CONFIG_SYS_DPAA_FMAN fdt_fixup_fman_ethernet(blob); diff --git a/board/freescale/t4qds/t4240emu.c b/board/freescale/t4qds/t4240emu.c index 5441094..d1acee2 100644 --- a/board/freescale/t4qds/t4240emu.c +++ b/board/freescale/t4qds/t4240emu.c @@ -82,7 +82,10 @@ int ft_board_setup(void *blob, bd_t *bd) fdt_fixup_memory(blob, (u64)base, (u64)size);
fdt_fixup_liodn(blob); + +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); +#endif
return 0; } diff --git a/board/freescale/t4qds/t4240qds.c b/board/freescale/t4qds/t4240qds.c index 4f2cccd..7ac705e 100644 --- a/board/freescale/t4qds/t4240qds.c +++ b/board/freescale/t4qds/t4240qds.c @@ -700,7 +700,10 @@ int ft_board_setup(void *blob, bd_t *bd) #endif
fdt_fixup_liodn(blob); + +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); +#endif
#ifdef CONFIG_SYS_DPAA_FMAN fdt_fixup_fman_ethernet(blob); diff --git a/board/freescale/t4rdb/t4240rdb.c b/board/freescale/t4rdb/t4240rdb.c index fac442b..09a2231 100644 --- a/board/freescale/t4rdb/t4240rdb.c +++ b/board/freescale/t4rdb/t4240rdb.c @@ -105,7 +105,10 @@ int ft_board_setup(void *blob, bd_t *bd) #endif
fdt_fixup_liodn(blob); + +#ifdef CONFIG_USB_DEVTREE_FIXUP fdt_fixup_dr_usb(blob, bd); +#endif
#ifdef CONFIG_SYS_DPAA_FMAN fdt_fixup_fman_ethernet(blob); diff --git a/include/configs/B4860QDS.h b/include/configs/B4860QDS.h index 9fb5cee..e5b3d66 100644 --- a/include/configs/B4860QDS.h +++ b/include/configs/B4860QDS.h @@ -773,6 +773,7 @@ unsigned long get_board_ddr_clk(void); /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_DR_USB
#ifdef CONFIG_HAS_FSL_DR_USB diff --git a/include/configs/BSC9131RDB.h b/include/configs/BSC9131RDB.h index 4b5ad0e..698f760 100644 --- a/include/configs/BSC9131RDB.h +++ b/include/configs/BSC9131RDB.h @@ -381,6 +381,7 @@ extern unsigned long get_sdram_size(void); #define CONFIG_SHA_HW_ACCEL #endif
+#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_USB_EHCI
#ifdef CONFIG_USB_EHCI diff --git a/include/configs/BSC9132QDS.h b/include/configs/BSC9132QDS.h index d0e5a25..cf9c2db 100644 --- a/include/configs/BSC9132QDS.h +++ b/include/configs/BSC9132QDS.h @@ -525,7 +525,8 @@ combinations. this should be removed later #define CONFIG_SYS_FSL_ESDHC_ADDR CONFIG_SYS_MPC85xx_ESDHC_ADDR #endif
-#define CONFIG_USB_EHCI /* USB */ +#define CONFIG_USB_DEVTREE_FIXUP /* USB */ +#define CONFIG_USB_EHCI #ifdef CONFIG_USB_EHCI #define CONFIG_CMD_USB #define CONFIG_EHCI_HCD_INIT_AFTER_RESET diff --git a/include/configs/MPC8308RDB.h b/include/configs/MPC8308RDB.h index 955ce62..a6e9a05 100644 --- a/include/configs/MPC8308RDB.h +++ b/include/configs/MPC8308RDB.h @@ -333,6 +333,9 @@ #define CONFIG_OF_BOARD_SETUP 1 #define CONFIG_OF_STDOUT_VIA_ALIAS 1
+/* USB */ +#define CONFIG_USB_DEVTREE_FIXUP + /* I2C */ #define CONFIG_SYS_I2C #define CONFIG_SYS_I2C_FSL diff --git a/include/configs/MPC8315ERDB.h b/include/configs/MPC8315ERDB.h index ba952e3..f3edd75 100644 --- a/include/configs/MPC8315ERDB.h +++ b/include/configs/MPC8315ERDB.h @@ -377,6 +377,7 @@ #undef CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ #define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1957 /* Freescale */
+#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_DR_USB #define CONFIG_SYS_SCCR_USBDRCM 3
diff --git a/include/configs/MPC837XEMDS.h b/include/configs/MPC837XEMDS.h index df47888..d088444 100644 --- a/include/configs/MPC837XEMDS.h +++ b/include/configs/MPC837XEMDS.h @@ -386,7 +386,8 @@ extern int board_pci_host_broken(void); #define CONFIG_PCIE #define CONFIG_PQ_MDS_PIB 1 /* PQ MDS Platform IO Board */
-#define CONFIG_HAS_FSL_DR_USB 1 /* fixup device tree for the DR USB */ +#define CONFIG_USB_DEVTREE_FIXUP /* fixup device tree for the DR USB */ +#define CONFIG_HAS_FSL_DR_USB 1 #define CONFIG_CMD_USB #define CONFIG_USB_STORAGE #define CONFIG_USB_EHCI diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h index e77848e..2759893 100644 --- a/include/configs/MPC837XERDB.h +++ b/include/configs/MPC837XERDB.h @@ -677,6 +677,7 @@ */ #define CONFIG_ENV_OVERWRITE
+#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_DR_USB #define CONFIG_CMD_USB #define CONFIG_USB_STORAGE diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h index 294be3b..2fa53f0 100644 --- a/include/configs/MPC8536DS.h +++ b/include/configs/MPC8536DS.h @@ -654,6 +654,7 @@ /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_MPH_USB #ifdef CONFIG_HAS_FSL_MPH_USB #define CONFIG_USB_EHCI diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h index f9776c0..4822699 100644 --- a/include/configs/P1010RDB.h +++ b/include/configs/P1010RDB.h @@ -744,6 +744,7 @@ extern unsigned long get_sdram_size(void); #define CONFIG_SYS_FSL_ESDHC_ADDR CONFIG_SYS_MPC85xx_ESDHC_ADDR #endif
+#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_DR_USB
#if defined(CONFIG_HAS_FSL_DR_USB) diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h index 6235bbb..0277565 100644 --- a/include/configs/P1022DS.h +++ b/include/configs/P1022DS.h @@ -688,6 +688,7 @@ /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_DR_USB #ifdef CONFIG_HAS_FSL_DR_USB #define CONFIG_USB_EHCI diff --git a/include/configs/P1023RDB.h b/include/configs/P1023RDB.h index bc479f6..6d135f6 100644 --- a/include/configs/P1023RDB.h +++ b/include/configs/P1023RDB.h @@ -280,6 +280,7 @@ extern unsigned long get_clock_freq(void); /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_DR_USB #ifdef CONFIG_HAS_FSL_DR_USB #define CONFIG_USB_EHCI diff --git a/include/configs/P2041RDB.h b/include/configs/P2041RDB.h index b2e51b5..d3d0b13 100644 --- a/include/configs/P2041RDB.h +++ b/include/configs/P2041RDB.h @@ -628,6 +628,7 @@ unsigned long get_board_sys_clk(unsigned long dummy); /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_DR_USB #define CONFIG_HAS_FSL_MPH_USB
diff --git a/include/configs/T102xQDS.h b/include/configs/T102xQDS.h index 951cbc4..3b2c0df 100644 --- a/include/configs/T102xQDS.h +++ b/include/configs/T102xQDS.h @@ -686,6 +686,7 @@ unsigned long get_board_ddr_clk(void); /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_DR_USB
#ifdef CONFIG_HAS_FSL_DR_USB diff --git a/include/configs/T102xRDB.h b/include/configs/T102xRDB.h index 4a0f5b2..3aff72f 100644 --- a/include/configs/T102xRDB.h +++ b/include/configs/T102xRDB.h @@ -683,6 +683,7 @@ unsigned long get_board_ddr_clk(void); /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_DR_USB
#ifdef CONFIG_HAS_FSL_DR_USB diff --git a/include/configs/T1040QDS.h b/include/configs/T1040QDS.h index 9e151da..e77c95a 100644 --- a/include/configs/T1040QDS.h +++ b/include/configs/T1040QDS.h @@ -569,6 +569,7 @@ unsigned long get_board_ddr_clk(void); /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_DR_USB
#ifdef CONFIG_HAS_FSL_DR_USB diff --git a/include/configs/T104xRDB.h b/include/configs/T104xRDB.h index da65f56..bfd1ef1 100644 --- a/include/configs/T104xRDB.h +++ b/include/configs/T104xRDB.h @@ -626,6 +626,7 @@ $(SRCTREE)/board/freescale/t104xrdb/t1042d4_rcw.cfg /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_DR_USB
#ifdef CONFIG_HAS_FSL_DR_USB diff --git a/include/configs/T208xQDS.h b/include/configs/T208xQDS.h index a0cecc6..87cda4e 100644 --- a/include/configs/T208xQDS.h +++ b/include/configs/T208xQDS.h @@ -733,6 +733,7 @@ unsigned long get_board_ddr_clk(void); /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #ifdef CONFIG_USB_EHCI #define CONFIG_CMD_USB #define CONFIG_USB_STORAGE diff --git a/include/configs/T208xRDB.h b/include/configs/T208xRDB.h index 312b0eb..e7c7409 100644 --- a/include/configs/T208xRDB.h +++ b/include/configs/T208xRDB.h @@ -15,6 +15,7 @@ #define CONFIG_T2080RDB #define CONFIG_ICS307_REFCLK_HZ 25000000 /* ICS307 ref clk freq */ #define CONFIG_MMC +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_USB_EHCI #define CONFIG_FSL_SATA_V2
diff --git a/include/configs/T4240QDS.h b/include/configs/T4240QDS.h index 1b94f64..00bdd69 100644 --- a/include/configs/T4240QDS.h +++ b/include/configs/T4240QDS.h @@ -528,6 +528,7 @@ unsigned long get_board_ddr_clk(void); /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_CMD_USB #define CONFIG_USB_STORAGE #define CONFIG_USB_EHCI diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h index aef37dd..8cc581e 100644 --- a/include/configs/corenet_ds.h +++ b/include/configs/corenet_ds.h @@ -639,6 +639,7 @@ /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_DR_USB #define CONFIG_HAS_FSL_MPH_USB
diff --git a/include/configs/ls2080aqds.h b/include/configs/ls2080aqds.h index ba84248..366be59 100644 --- a/include/configs/ls2080aqds.h +++ b/include/configs/ls2080aqds.h @@ -387,6 +387,7 @@ unsigned long get_board_ddr_clk(void); /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_XHCI_USB #define CONFIG_USB_XHCI #define CONFIG_USB_XHCI_FSL diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h index 116dbcd..aa0689b 100644 --- a/include/configs/ls2080ardb.h +++ b/include/configs/ls2080ardb.h @@ -305,6 +305,7 @@ unsigned long get_board_sys_clk(void); /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_XHCI_USB #define CONFIG_USB_XHCI #define CONFIG_USB_XHCI_FSL diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h index 60bedaa..718d9de 100644 --- a/include/configs/p1_p2_rdb_pc.h +++ b/include/configs/p1_p2_rdb_pc.h @@ -895,6 +895,7 @@ /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_DR_USB
#if defined(CONFIG_HAS_FSL_DR_USB) diff --git a/include/configs/p1_twr.h b/include/configs/p1_twr.h index 77ba2d8..fde397e 100644 --- a/include/configs/p1_twr.h +++ b/include/configs/p1_twr.h @@ -426,6 +426,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); /* * USB */ +#define CONFIG_USB_DEVTREE_FIXUP #define CONFIG_HAS_FSL_DR_USB
#if defined(CONFIG_HAS_FSL_DR_USB)

On Tuesday, January 26, 2016 at 12:36:58 PM, Ramneek Mehresh wrote:
Add usb device-tree fixup for all relevant fsl ppc and arm platforms
Signed-off-by: Ramneek Mehresh ramneek.mehresh@freescale.com
board/freescale/b4860qds/b4860qds.c | 2 +- board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++ board/freescale/bsc9132qds/bsc9132qds.c | 2 ++ board/freescale/corenet_ds/corenet_ds.c | 4 ++++ board/freescale/ls2080aqds/ls2080aqds.c | 4 ++++ board/freescale/ls2080ardb/ls2080ardb.c | 4 ++++ board/freescale/mpc8308rdb/mpc8308rdb.c | 4 ++++ board/freescale/mpc8315erdb/mpc8315erdb.c | 2 ++ board/freescale/mpc837xemds/mpc837xemds.c | 2 ++ board/freescale/mpc837xerdb/mpc837xerdb.c | 2 ++ board/freescale/mpc8536ds/mpc8536ds.c | 2 +- board/freescale/p1010rdb/p1010rdb.c | 2 +- board/freescale/p1022ds/p1022ds.c | 2 +- board/freescale/p1023rdb/p1023rdb.c | 2 +- board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- board/freescale/p1_twr/p1_twr.c | 3 +++ board/freescale/p2041rdb/p2041rdb.c | 2 +- board/freescale/t102xqds/t102xqds.c | 2 +- board/freescale/t102xrdb/t102xrdb.c | 3 +++ board/freescale/t1040qds/t1040qds.c | 2 +- board/freescale/t104xrdb/t104xrdb.c | 2 +- board/freescale/t208xqds/t208xqds.c | 3 +++ board/freescale/t208xrdb/t208xrdb.c | 3 +++ board/freescale/t4qds/t4240emu.c | 3 +++ board/freescale/t4qds/t4240qds.c | 3 +++ board/freescale/t4rdb/t4240rdb.c | 3 +++ include/configs/B4860QDS.h | 1 + include/configs/BSC9131RDB.h | 1 + include/configs/BSC9132QDS.h | 3 ++- include/configs/MPC8308RDB.h | 3 +++ include/configs/MPC8315ERDB.h | 1 + include/configs/MPC837XEMDS.h | 3 ++- include/configs/MPC837XERDB.h | 1 + include/configs/MPC8536DS.h | 1 + include/configs/P1010RDB.h | 1 + include/configs/P1022DS.h | 1 + include/configs/P1023RDB.h | 1 + include/configs/P2041RDB.h | 1 + include/configs/T102xQDS.h | 1 + include/configs/T102xRDB.h | 1 + include/configs/T1040QDS.h | 1 + include/configs/T104xRDB.h | 1 + include/configs/T208xQDS.h | 1 + include/configs/T208xRDB.h | 1 + include/configs/T4240QDS.h | 1 + include/configs/corenet_ds.h | 1 + include/configs/ls2080aqds.h | 1 + include/configs/ls2080ardb.h | 1 + include/configs/p1_p2_rdb_pc.h | 1 + include/configs/p1_twr.h | 1 + 50 files changed, 85 insertions(+), 12 deletions(-)
Each such new macro must be documented. What is the point of this bulk rename anyway?

-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Tuesday, January 26, 2016 4:58 PM To: Ramneek Mehresh ramneek.mehresh@freescale.com Cc: u-boot@lists.denx.de Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Tuesday, January 26, 2016 at 12:36:58 PM, Ramneek Mehresh wrote:
Add usb device-tree fixup for all relevant fsl ppc and arm platforms
Signed-off-by: Ramneek Mehresh ramneek.mehresh@freescale.com
board/freescale/b4860qds/b4860qds.c | 2 +- board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++ board/freescale/bsc9132qds/bsc9132qds.c | 2 ++ board/freescale/corenet_ds/corenet_ds.c | 4 ++++ board/freescale/ls2080aqds/ls2080aqds.c | 4 ++++ board/freescale/ls2080ardb/ls2080ardb.c | 4 ++++ board/freescale/mpc8308rdb/mpc8308rdb.c | 4 ++++ board/freescale/mpc8315erdb/mpc8315erdb.c | 2 ++ board/freescale/mpc837xemds/mpc837xemds.c | 2 ++ board/freescale/mpc837xerdb/mpc837xerdb.c | 2 ++ board/freescale/mpc8536ds/mpc8536ds.c | 2 +- board/freescale/p1010rdb/p1010rdb.c | 2 +- board/freescale/p1022ds/p1022ds.c | 2 +- board/freescale/p1023rdb/p1023rdb.c | 2 +- board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- board/freescale/p1_twr/p1_twr.c | 3 +++ board/freescale/p2041rdb/p2041rdb.c | 2 +- board/freescale/t102xqds/t102xqds.c | 2 +- board/freescale/t102xrdb/t102xrdb.c | 3 +++ board/freescale/t1040qds/t1040qds.c | 2 +- board/freescale/t104xrdb/t104xrdb.c | 2 +- board/freescale/t208xqds/t208xqds.c | 3 +++ board/freescale/t208xrdb/t208xrdb.c | 3 +++ board/freescale/t4qds/t4240emu.c | 3 +++ board/freescale/t4qds/t4240qds.c | 3 +++ board/freescale/t4rdb/t4240rdb.c | 3 +++ include/configs/B4860QDS.h | 1 + include/configs/BSC9131RDB.h | 1 + include/configs/BSC9132QDS.h | 3 ++- include/configs/MPC8308RDB.h | 3 +++ include/configs/MPC8315ERDB.h | 1 + include/configs/MPC837XEMDS.h | 3 ++- include/configs/MPC837XERDB.h | 1 + include/configs/MPC8536DS.h | 1 + include/configs/P1010RDB.h | 1 + include/configs/P1022DS.h | 1 + include/configs/P1023RDB.h | 1 + include/configs/P2041RDB.h | 1 + include/configs/T102xQDS.h | 1 + include/configs/T102xRDB.h | 1 + include/configs/T1040QDS.h | 1 + include/configs/T104xRDB.h | 1 + include/configs/T208xQDS.h | 1 + include/configs/T208xRDB.h | 1 + include/configs/T4240QDS.h | 1 + include/configs/corenet_ds.h | 1 + include/configs/ls2080aqds.h | 1 + include/configs/ls2080ardb.h | 1 + include/configs/p1_p2_rdb_pc.h | 1 + include/configs/p1_twr.h | 1 + 50 files changed, 85 insertions(+), 12 deletions(-)
Each such new macro must be documented. What is the point of this bulk rename anyway?
Yes, I'll document the new MACRO defined for usb device-tree fixup. However, this is not bulk rename. I just modified all these files to include usb device-tree fixup for all fsl ppc platforms. Most of these platforms were already using this mechanism (some via different ways), but now its consistent across them.

On Wednesday, January 27, 2016 at 05:14:00 AM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Tuesday, January 26, 2016 4:58 PM To: Ramneek Mehresh ramneek.mehresh@freescale.com Cc: u-boot@lists.denx.de Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Tuesday, January 26, 2016 at 12:36:58 PM, Ramneek Mehresh wrote:
Add usb device-tree fixup for all relevant fsl ppc and arm platforms
Signed-off-by: Ramneek Mehresh ramneek.mehresh@freescale.com
board/freescale/b4860qds/b4860qds.c | 2 +- board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++ board/freescale/bsc9132qds/bsc9132qds.c | 2 ++ board/freescale/corenet_ds/corenet_ds.c | 4 ++++ board/freescale/ls2080aqds/ls2080aqds.c | 4 ++++ board/freescale/ls2080ardb/ls2080ardb.c | 4 ++++ board/freescale/mpc8308rdb/mpc8308rdb.c | 4 ++++ board/freescale/mpc8315erdb/mpc8315erdb.c | 2 ++ board/freescale/mpc837xemds/mpc837xemds.c | 2 ++ board/freescale/mpc837xerdb/mpc837xerdb.c | 2 ++ board/freescale/mpc8536ds/mpc8536ds.c | 2 +- board/freescale/p1010rdb/p1010rdb.c | 2 +- board/freescale/p1022ds/p1022ds.c | 2 +- board/freescale/p1023rdb/p1023rdb.c | 2 +- board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- board/freescale/p1_twr/p1_twr.c | 3 +++ board/freescale/p2041rdb/p2041rdb.c | 2 +- board/freescale/t102xqds/t102xqds.c | 2 +- board/freescale/t102xrdb/t102xrdb.c | 3 +++ board/freescale/t1040qds/t1040qds.c | 2 +- board/freescale/t104xrdb/t104xrdb.c | 2 +- board/freescale/t208xqds/t208xqds.c | 3 +++ board/freescale/t208xrdb/t208xrdb.c | 3 +++ board/freescale/t4qds/t4240emu.c | 3 +++ board/freescale/t4qds/t4240qds.c | 3 +++ board/freescale/t4rdb/t4240rdb.c | 3 +++ include/configs/B4860QDS.h | 1 + include/configs/BSC9131RDB.h | 1 + include/configs/BSC9132QDS.h | 3 ++- include/configs/MPC8308RDB.h | 3 +++ include/configs/MPC8315ERDB.h | 1 + include/configs/MPC837XEMDS.h | 3 ++- include/configs/MPC837XERDB.h | 1 + include/configs/MPC8536DS.h | 1 + include/configs/P1010RDB.h | 1 + include/configs/P1022DS.h | 1 + include/configs/P1023RDB.h | 1 + include/configs/P2041RDB.h | 1 + include/configs/T102xQDS.h | 1 + include/configs/T102xRDB.h | 1 + include/configs/T1040QDS.h | 1 + include/configs/T104xRDB.h | 1 + include/configs/T208xQDS.h | 1 + include/configs/T208xRDB.h | 1 + include/configs/T4240QDS.h | 1 + include/configs/corenet_ds.h | 1 + include/configs/ls2080aqds.h | 1 + include/configs/ls2080ardb.h | 1 + include/configs/p1_p2_rdb_pc.h | 1 + include/configs/p1_twr.h | 1 + 50 files changed, 85 insertions(+), 12 deletions(-)
Each such new macro must be documented. What is the point of this bulk rename anyway?
Yes, I'll document the new MACRO defined for usb device-tree fixup. However, this is not bulk rename. I just modified all these files to include usb device-tree fixup for all fsl ppc platforms. Most of these platforms were already using this mechanism (some via different ways), but now its consistent across them.
Wouldn't it make more sense to make this generic then instead of patching zillion files ?

-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 9:57 AM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 05:14:00 AM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Tuesday, January 26, 2016 4:58 PM To: Ramneek Mehresh ramneek.mehresh@freescale.com Cc: u-boot@lists.denx.de Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Tuesday, January 26, 2016 at 12:36:58 PM, Ramneek Mehresh wrote:
Add usb device-tree fixup for all relevant fsl ppc and arm platforms
Signed-off-by: Ramneek Mehresh
board/freescale/b4860qds/b4860qds.c | 2 +- board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++ board/freescale/bsc9132qds/bsc9132qds.c | 2 ++ board/freescale/corenet_ds/corenet_ds.c | 4 ++++ board/freescale/ls2080aqds/ls2080aqds.c | 4 ++++ board/freescale/ls2080ardb/ls2080ardb.c | 4 ++++ board/freescale/mpc8308rdb/mpc8308rdb.c | 4 ++++ board/freescale/mpc8315erdb/mpc8315erdb.c | 2 ++ board/freescale/mpc837xemds/mpc837xemds.c | 2 ++ board/freescale/mpc837xerdb/mpc837xerdb.c | 2 ++ board/freescale/mpc8536ds/mpc8536ds.c | 2 +- board/freescale/p1010rdb/p1010rdb.c | 2 +- board/freescale/p1022ds/p1022ds.c | 2 +- board/freescale/p1023rdb/p1023rdb.c | 2 +- board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- board/freescale/p1_twr/p1_twr.c | 3 +++ board/freescale/p2041rdb/p2041rdb.c | 2 +- board/freescale/t102xqds/t102xqds.c | 2 +- board/freescale/t102xrdb/t102xrdb.c | 3 +++ board/freescale/t1040qds/t1040qds.c | 2 +- board/freescale/t104xrdb/t104xrdb.c | 2 +- board/freescale/t208xqds/t208xqds.c | 3 +++ board/freescale/t208xrdb/t208xrdb.c | 3 +++ board/freescale/t4qds/t4240emu.c | 3 +++ board/freescale/t4qds/t4240qds.c | 3 +++ board/freescale/t4rdb/t4240rdb.c | 3 +++ include/configs/B4860QDS.h | 1 + include/configs/BSC9131RDB.h | 1 + include/configs/BSC9132QDS.h | 3 ++- include/configs/MPC8308RDB.h | 3 +++ include/configs/MPC8315ERDB.h | 1 + include/configs/MPC837XEMDS.h | 3 ++- include/configs/MPC837XERDB.h | 1 + include/configs/MPC8536DS.h | 1 + include/configs/P1010RDB.h | 1 + include/configs/P1022DS.h | 1 + include/configs/P1023RDB.h | 1 + include/configs/P2041RDB.h | 1 + include/configs/T102xQDS.h | 1 + include/configs/T102xRDB.h | 1 + include/configs/T1040QDS.h | 1 + include/configs/T104xRDB.h | 1 + include/configs/T208xQDS.h | 1 + include/configs/T208xRDB.h | 1 + include/configs/T4240QDS.h | 1 + include/configs/corenet_ds.h | 1 + include/configs/ls2080aqds.h | 1 + include/configs/ls2080ardb.h | 1 + include/configs/p1_p2_rdb_pc.h | 1 + include/configs/p1_twr.h | 1 + 50 files changed, 85 insertions(+), 12 deletions(-)
Each such new macro must be documented. What is the point of this bulk rename anyway?
Yes, I'll document the new MACRO defined for usb device-tree fixup. However, this is not bulk rename. I just modified all these files to include usb device-tree fixup for all fsl ppc platforms. Most of these platforms were already using this mechanism (some via different ways),
but
now its consistent across them.
Wouldn't it make more sense to make this generic then instead of patching zillion files ?
The patch set is to make this support generic, but I do need to make these platforms use this generic support in consistent way via single macro inclusion in their configs...

On Wednesday, January 27, 2016 at 05:30:51 AM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 9:57 AM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 05:14:00 AM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Tuesday, January 26, 2016 4:58 PM To: Ramneek Mehresh ramneek.mehresh@freescale.com Cc: u-boot@lists.denx.de Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Tuesday, January 26, 2016 at 12:36:58 PM, Ramneek Mehresh wrote:
Add usb device-tree fixup for all relevant fsl ppc and arm platforms
Signed-off-by: Ramneek Mehresh
board/freescale/b4860qds/b4860qds.c | 2 +- board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++ board/freescale/bsc9132qds/bsc9132qds.c | 2 ++ board/freescale/corenet_ds/corenet_ds.c | 4 ++++ board/freescale/ls2080aqds/ls2080aqds.c | 4 ++++ board/freescale/ls2080ardb/ls2080ardb.c | 4 ++++ board/freescale/mpc8308rdb/mpc8308rdb.c | 4 ++++ board/freescale/mpc8315erdb/mpc8315erdb.c | 2 ++ board/freescale/mpc837xemds/mpc837xemds.c | 2 ++ board/freescale/mpc837xerdb/mpc837xerdb.c | 2 ++ board/freescale/mpc8536ds/mpc8536ds.c | 2 +- board/freescale/p1010rdb/p1010rdb.c | 2 +- board/freescale/p1022ds/p1022ds.c | 2 +- board/freescale/p1023rdb/p1023rdb.c | 2 +- board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- board/freescale/p1_twr/p1_twr.c | 3 +++ board/freescale/p2041rdb/p2041rdb.c | 2 +- board/freescale/t102xqds/t102xqds.c | 2 +- board/freescale/t102xrdb/t102xrdb.c | 3 +++ board/freescale/t1040qds/t1040qds.c | 2 +- board/freescale/t104xrdb/t104xrdb.c | 2 +- board/freescale/t208xqds/t208xqds.c | 3 +++ board/freescale/t208xrdb/t208xrdb.c | 3 +++ board/freescale/t4qds/t4240emu.c | 3 +++ board/freescale/t4qds/t4240qds.c | 3 +++ board/freescale/t4rdb/t4240rdb.c | 3 +++ include/configs/B4860QDS.h | 1 + include/configs/BSC9131RDB.h | 1 + include/configs/BSC9132QDS.h | 3 ++- include/configs/MPC8308RDB.h | 3 +++ include/configs/MPC8315ERDB.h | 1 + include/configs/MPC837XEMDS.h | 3 ++- include/configs/MPC837XERDB.h | 1 + include/configs/MPC8536DS.h | 1 + include/configs/P1010RDB.h | 1 + include/configs/P1022DS.h | 1 + include/configs/P1023RDB.h | 1 + include/configs/P2041RDB.h | 1 + include/configs/T102xQDS.h | 1 + include/configs/T102xRDB.h | 1 + include/configs/T1040QDS.h | 1 + include/configs/T104xRDB.h | 1 + include/configs/T208xQDS.h | 1 + include/configs/T208xRDB.h | 1 + include/configs/T4240QDS.h | 1 + include/configs/corenet_ds.h | 1 + include/configs/ls2080aqds.h | 1 + include/configs/ls2080ardb.h | 1 + include/configs/p1_p2_rdb_pc.h | 1 + include/configs/p1_twr.h | 1 + 50 files changed, 85 insertions(+), 12 deletions(-)
Each such new macro must be documented. What is the point of this bulk rename anyway?
Yes, I'll document the new MACRO defined for usb device-tree fixup. However, this is not bulk rename. I just modified all these files to include usb device-tree fixup for all fsl ppc platforms. Most of these platforms were already using this mechanism (some via different ways),
but
now its consistent across them.
Wouldn't it make more sense to make this generic then instead of patching zillion files ?
The patch set is to make this support generic, but I do need to make these platforms use this generic support in consistent way via single macro inclusion in their configs...
You can also just modify the function itself instead of million board files. Adding ifdef-endif combo all around the place is just not gonna work, sorry.
Also, the macro should probably contain _OF_ instead of DEVTREE ...

-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 1:05 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 05:30:51 AM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 9:57 AM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 05:14:00 AM, Ramneek Mehresh
wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Tuesday, January 26, 2016 4:58 PM To: Ramneek Mehresh ramneek.mehresh@freescale.com Cc: u-boot@lists.denx.de Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Tuesday, January 26, 2016 at 12:36:58 PM, Ramneek Mehresh
wrote:
Add usb device-tree fixup for all relevant fsl ppc and arm platforms
Signed-off-by: Ramneek Mehresh
board/freescale/b4860qds/b4860qds.c | 2 +- board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++ board/freescale/bsc9132qds/bsc9132qds.c | 2 ++ board/freescale/corenet_ds/corenet_ds.c | 4 ++++ board/freescale/ls2080aqds/ls2080aqds.c | 4 ++++ board/freescale/ls2080ardb/ls2080ardb.c | 4 ++++ board/freescale/mpc8308rdb/mpc8308rdb.c | 4 ++++ board/freescale/mpc8315erdb/mpc8315erdb.c | 2 ++ board/freescale/mpc837xemds/mpc837xemds.c | 2 ++ board/freescale/mpc837xerdb/mpc837xerdb.c | 2 ++ board/freescale/mpc8536ds/mpc8536ds.c | 2 +- board/freescale/p1010rdb/p1010rdb.c | 2 +- board/freescale/p1022ds/p1022ds.c | 2 +- board/freescale/p1023rdb/p1023rdb.c | 2 +- board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- board/freescale/p1_twr/p1_twr.c | 3 +++ board/freescale/p2041rdb/p2041rdb.c | 2 +- board/freescale/t102xqds/t102xqds.c | 2 +- board/freescale/t102xrdb/t102xrdb.c | 3 +++ board/freescale/t1040qds/t1040qds.c | 2 +- board/freescale/t104xrdb/t104xrdb.c | 2 +- board/freescale/t208xqds/t208xqds.c | 3 +++ board/freescale/t208xrdb/t208xrdb.c | 3 +++ board/freescale/t4qds/t4240emu.c | 3 +++ board/freescale/t4qds/t4240qds.c | 3 +++ board/freescale/t4rdb/t4240rdb.c | 3 +++ include/configs/B4860QDS.h | 1 + include/configs/BSC9131RDB.h | 1 + include/configs/BSC9132QDS.h | 3 ++- include/configs/MPC8308RDB.h | 3 +++ include/configs/MPC8315ERDB.h | 1 + include/configs/MPC837XEMDS.h | 3 ++- include/configs/MPC837XERDB.h | 1 + include/configs/MPC8536DS.h | 1 + include/configs/P1010RDB.h | 1 + include/configs/P1022DS.h | 1 + include/configs/P1023RDB.h | 1 + include/configs/P2041RDB.h | 1 + include/configs/T102xQDS.h | 1 + include/configs/T102xRDB.h | 1 + include/configs/T1040QDS.h | 1 + include/configs/T104xRDB.h | 1 + include/configs/T208xQDS.h | 1 + include/configs/T208xRDB.h | 1 + include/configs/T4240QDS.h | 1 + include/configs/corenet_ds.h | 1 + include/configs/ls2080aqds.h | 1 + include/configs/ls2080ardb.h | 1 + include/configs/p1_p2_rdb_pc.h | 1 + include/configs/p1_twr.h | 1 + 50 files changed, 85 insertions(+), 12 deletions(-)
Each such new macro must be documented. What is the point of this bulk rename anyway?
Yes, I'll document the new MACRO defined for usb device-tree fixup. However, this is not bulk rename. I just modified all these files to include usb device-tree fixup for all fsl ppc platforms. Most of these platforms were already using this mechanism (some via different ways),
but
now its consistent across them.
Wouldn't it make more sense to make this generic then instead of patching zillion files ?
The patch set is to make this support generic, but I do need to make these platforms use this generic support in consistent way via single macro inclusion in their configs...
You can also just modify the function itself instead of million board files. Adding ifdef-endif combo all around the place is just not gonna work, sorry.
Also, the macro should probably contain _OF_ instead of DEVTREE ...
Ok, in this case, I'll use the already defined macros used by these platforms. However, this approach will not make sure that all these platforms are using this feature in a consistent/similar way.

On Wednesday, January 27, 2016 at 09:26:08 AM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 1:05 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 05:30:51 AM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 9:57 AM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 05:14:00 AM, Ramneek Mehresh
wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Tuesday, January 26, 2016 4:58 PM To: Ramneek Mehresh ramneek.mehresh@freescale.com Cc: u-boot@lists.denx.de Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Tuesday, January 26, 2016 at 12:36:58 PM, Ramneek Mehresh
wrote:
> Add usb device-tree fixup for all relevant fsl ppc and arm > platforms > > Signed-off-by: Ramneek Mehresh
> --- > > board/freescale/b4860qds/b4860qds.c | 2 +- > board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++ > board/freescale/bsc9132qds/bsc9132qds.c | 2 ++ > board/freescale/corenet_ds/corenet_ds.c | 4 ++++ > board/freescale/ls2080aqds/ls2080aqds.c | 4 ++++ > board/freescale/ls2080ardb/ls2080ardb.c | 4 ++++ > board/freescale/mpc8308rdb/mpc8308rdb.c | 4 ++++ > board/freescale/mpc8315erdb/mpc8315erdb.c | 2 ++ > board/freescale/mpc837xemds/mpc837xemds.c | 2 ++ > board/freescale/mpc837xerdb/mpc837xerdb.c | 2 ++ > board/freescale/mpc8536ds/mpc8536ds.c | 2 +- > board/freescale/p1010rdb/p1010rdb.c | 2 +- > board/freescale/p1022ds/p1022ds.c | 2 +- > board/freescale/p1023rdb/p1023rdb.c | 2 +- > board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- > board/freescale/p1_twr/p1_twr.c | 3 +++ > board/freescale/p2041rdb/p2041rdb.c | 2 +- > board/freescale/t102xqds/t102xqds.c | 2 +- > board/freescale/t102xrdb/t102xrdb.c | 3 +++ > board/freescale/t1040qds/t1040qds.c | 2 +- > board/freescale/t104xrdb/t104xrdb.c | 2 +- > board/freescale/t208xqds/t208xqds.c | 3 +++ > board/freescale/t208xrdb/t208xrdb.c | 3 +++ > board/freescale/t4qds/t4240emu.c | 3 +++ > board/freescale/t4qds/t4240qds.c | 3 +++ > board/freescale/t4rdb/t4240rdb.c | 3 +++ > include/configs/B4860QDS.h | 1 + > include/configs/BSC9131RDB.h | 1 + > include/configs/BSC9132QDS.h | 3 ++- > include/configs/MPC8308RDB.h | 3 +++ > include/configs/MPC8315ERDB.h | 1 + > include/configs/MPC837XEMDS.h | 3 ++- > include/configs/MPC837XERDB.h | 1 + > include/configs/MPC8536DS.h | 1 + > include/configs/P1010RDB.h | 1 + > include/configs/P1022DS.h | 1 + > include/configs/P1023RDB.h | 1 + > include/configs/P2041RDB.h | 1 + > include/configs/T102xQDS.h | 1 + > include/configs/T102xRDB.h | 1 + > include/configs/T1040QDS.h | 1 + > include/configs/T104xRDB.h | 1 + > include/configs/T208xQDS.h | 1 + > include/configs/T208xRDB.h | 1 + > include/configs/T4240QDS.h | 1 + > include/configs/corenet_ds.h | 1 + > include/configs/ls2080aqds.h | 1 + > include/configs/ls2080ardb.h | 1 + > include/configs/p1_p2_rdb_pc.h | 1 + > include/configs/p1_twr.h | 1 + > 50 files changed, 85 insertions(+), 12 deletions(-)
Each such new macro must be documented. What is the point of this bulk rename anyway?
Yes, I'll document the new MACRO defined for usb device-tree fixup. However, this is not bulk rename. I just modified all these files to include usb device-tree fixup for all fsl ppc platforms. Most of these platforms were already using this mechanism (some via different ways),
but
now its consistent across them.
Wouldn't it make more sense to make this generic then instead of patching zillion files ?
The patch set is to make this support generic, but I do need to make these platforms use this generic support in consistent way via single macro inclusion in their configs...
You can also just modify the function itself instead of million board files. Adding ifdef-endif combo all around the place is just not gonna work, sorry.
Also, the macro should probably contain _OF_ instead of DEVTREE ...
Ok, in this case, I'll use the already defined macros used by these platforms. However, this approach will not make sure that all these platforms are using this feature in a consistent/similar way.
Why not ?

-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 1:57 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 09:26:08 AM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 1:05 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 05:30:51 AM, Ramneek Mehresh
wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 9:57 AM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 05:14:00 AM, Ramneek Mehresh
wrote:
> -----Original Message----- > From: Marek Vasut [mailto:marex@denx.de] > Sent: Tuesday, January 26, 2016 4:58 PM > To: Ramneek Mehresh ramneek.mehresh@freescale.com > Cc: u-boot@lists.denx.de > Subject: Re: [PATCH 2/2] include:configs: Add usb > device-tree fixup for all fsl platforms > > On Tuesday, January 26, 2016 at 12:36:58 PM, Ramneek Mehresh
wrote:
> > Add usb device-tree fixup for all relevant fsl ppc and arm > > platforms > > > > Signed-off-by: Ramneek Mehresh
> > --- > > > > board/freescale/b4860qds/b4860qds.c | 2 +- > > board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++ > > board/freescale/bsc9132qds/bsc9132qds.c | 2 ++ > > board/freescale/corenet_ds/corenet_ds.c | 4 ++++ > > board/freescale/ls2080aqds/ls2080aqds.c | 4 ++++ > > board/freescale/ls2080ardb/ls2080ardb.c | 4 ++++ > > board/freescale/mpc8308rdb/mpc8308rdb.c | 4 ++++ > > board/freescale/mpc8315erdb/mpc8315erdb.c | 2 ++ > > board/freescale/mpc837xemds/mpc837xemds.c | 2 ++ > > board/freescale/mpc837xerdb/mpc837xerdb.c | 2 ++ > > board/freescale/mpc8536ds/mpc8536ds.c | 2 +- > > board/freescale/p1010rdb/p1010rdb.c | 2 +- > > board/freescale/p1022ds/p1022ds.c | 2 +- > > board/freescale/p1023rdb/p1023rdb.c | 2 +- > > board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- > > board/freescale/p1_twr/p1_twr.c | 3 +++ > > board/freescale/p2041rdb/p2041rdb.c | 2 +- > > board/freescale/t102xqds/t102xqds.c | 2 +- > > board/freescale/t102xrdb/t102xrdb.c | 3 +++ > > board/freescale/t1040qds/t1040qds.c | 2 +- > > board/freescale/t104xrdb/t104xrdb.c | 2 +- > > board/freescale/t208xqds/t208xqds.c | 3 +++ > > board/freescale/t208xrdb/t208xrdb.c | 3 +++ > > board/freescale/t4qds/t4240emu.c | 3 +++ > > board/freescale/t4qds/t4240qds.c | 3 +++ > > board/freescale/t4rdb/t4240rdb.c | 3 +++ > > include/configs/B4860QDS.h | 1 + > > include/configs/BSC9131RDB.h | 1 + > > include/configs/BSC9132QDS.h | 3 ++- > > include/configs/MPC8308RDB.h | 3 +++ > > include/configs/MPC8315ERDB.h | 1 + > > include/configs/MPC837XEMDS.h | 3 ++- > > include/configs/MPC837XERDB.h | 1 + > > include/configs/MPC8536DS.h | 1 + > > include/configs/P1010RDB.h | 1 + > > include/configs/P1022DS.h | 1 + > > include/configs/P1023RDB.h | 1 + > > include/configs/P2041RDB.h | 1 + > > include/configs/T102xQDS.h | 1 + > > include/configs/T102xRDB.h | 1 + > > include/configs/T1040QDS.h | 1 + > > include/configs/T104xRDB.h | 1 + > > include/configs/T208xQDS.h | 1 + > > include/configs/T208xRDB.h | 1 + > > include/configs/T4240QDS.h | 1 + > > include/configs/corenet_ds.h | 1 + > > include/configs/ls2080aqds.h | 1 + > > include/configs/ls2080ardb.h | 1 + > > include/configs/p1_p2_rdb_pc.h | 1 + > > include/configs/p1_twr.h | 1 + > > 50 files changed, 85 insertions(+), 12 deletions(-) > > Each such new macro must be documented. What is the point of > this bulk rename anyway?
Yes, I'll document the new MACRO defined for usb device-tree
fixup.
However, this is not bulk rename. I just modified all these files to include usb device-tree fixup for all fsl ppc platforms. Most of these platforms were already using this mechanism (some via different ways),
but
now its consistent across them.
Wouldn't it make more sense to make this generic then instead of patching zillion files ?
The patch set is to make this support generic, but I do need to make these platforms use this generic support in consistent way via single macro inclusion in their configs...
You can also just modify the function itself instead of million board files. Adding ifdef-endif combo all around the place is just not gonna work, sorry.
Also, the macro should probably contain _OF_ instead of DEVTREE ...
Ok, in this case, I'll use the already defined macros used by these platforms. However, this approach will not make sure that all these platforms are using this feature in a consistent/similar way.
Why not ?
All the platforms files are calling fdt_fixup_dr_usb() under following conditions: 1. no macro usage, direct call 2. Using CONFIG_HAS_FSL_DR_USB macro (for socs having DR controller) 2. Using CONFIG_HAS_FSL_MPH_USB (for socs having MPH controller) 3. Using CONFIG_HAS_FSL_XHCI_USB (for socs having XHCI controller)
This is why I wanted a single macro (CONFIG_USB_DEVTREE_FIXUP) for invocation of fdt_fixup_dr_usb() from all platforms. One macro --> one feature

On Wednesday, January 27, 2016 at 12:33:04 PM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 1:57 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 09:26:08 AM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 1:05 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 05:30:51 AM, Ramneek Mehresh
wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 9:57 AM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 05:14:00 AM, Ramneek Mehresh
wrote:
> > -----Original Message----- > > From: Marek Vasut [mailto:marex@denx.de] > > Sent: Tuesday, January 26, 2016 4:58 PM > > To: Ramneek Mehresh ramneek.mehresh@freescale.com > > Cc: u-boot@lists.denx.de > > Subject: Re: [PATCH 2/2] include:configs: Add usb > > device-tree fixup for all fsl platforms > > > > On Tuesday, January 26, 2016 at 12:36:58 PM, Ramneek Mehresh
wrote:
> > > Add usb device-tree fixup for all relevant fsl ppc and arm > > > platforms > > > > > > Signed-off-by: Ramneek Mehresh
> > > --- > > > > > > board/freescale/b4860qds/b4860qds.c | 2 +- > > > board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++ > > > board/freescale/bsc9132qds/bsc9132qds.c | 2 ++ > > > board/freescale/corenet_ds/corenet_ds.c | 4 ++++ > > > board/freescale/ls2080aqds/ls2080aqds.c | 4 ++++ > > > board/freescale/ls2080ardb/ls2080ardb.c | 4 ++++ > > > board/freescale/mpc8308rdb/mpc8308rdb.c | 4 ++++ > > > board/freescale/mpc8315erdb/mpc8315erdb.c | 2 ++ > > > board/freescale/mpc837xemds/mpc837xemds.c | 2 ++ > > > board/freescale/mpc837xerdb/mpc837xerdb.c | 2 ++ > > > board/freescale/mpc8536ds/mpc8536ds.c | 2 +- > > > board/freescale/p1010rdb/p1010rdb.c | 2 +- > > > board/freescale/p1022ds/p1022ds.c | 2 +- > > > board/freescale/p1023rdb/p1023rdb.c | 2 +- > > > board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- > > > board/freescale/p1_twr/p1_twr.c | 3 +++ > > > board/freescale/p2041rdb/p2041rdb.c | 2 +- > > > board/freescale/t102xqds/t102xqds.c | 2 +- > > > board/freescale/t102xrdb/t102xrdb.c | 3 +++ > > > board/freescale/t1040qds/t1040qds.c | 2 +- > > > board/freescale/t104xrdb/t104xrdb.c | 2 +- > > > board/freescale/t208xqds/t208xqds.c | 3 +++ > > > board/freescale/t208xrdb/t208xrdb.c | 3 +++ > > > board/freescale/t4qds/t4240emu.c | 3 +++ > > > board/freescale/t4qds/t4240qds.c | 3 +++ > > > board/freescale/t4rdb/t4240rdb.c | 3 +++ > > > include/configs/B4860QDS.h | 1 + > > > include/configs/BSC9131RDB.h | 1 + > > > include/configs/BSC9132QDS.h | 3 ++- > > > include/configs/MPC8308RDB.h | 3 +++ > > > include/configs/MPC8315ERDB.h | 1 + > > > include/configs/MPC837XEMDS.h | 3 ++- > > > include/configs/MPC837XERDB.h | 1 + > > > include/configs/MPC8536DS.h | 1 + > > > include/configs/P1010RDB.h | 1 + > > > include/configs/P1022DS.h | 1 + > > > include/configs/P1023RDB.h | 1 + > > > include/configs/P2041RDB.h | 1 + > > > include/configs/T102xQDS.h | 1 + > > > include/configs/T102xRDB.h | 1 + > > > include/configs/T1040QDS.h | 1 + > > > include/configs/T104xRDB.h | 1 + > > > include/configs/T208xQDS.h | 1 + > > > include/configs/T208xRDB.h | 1 + > > > include/configs/T4240QDS.h | 1 + > > > include/configs/corenet_ds.h | 1 + > > > include/configs/ls2080aqds.h | 1 + > > > include/configs/ls2080ardb.h | 1 + > > > include/configs/p1_p2_rdb_pc.h | 1 + > > > include/configs/p1_twr.h | 1 + > > > 50 files changed, 85 insertions(+), 12 deletions(-) > > > > Each such new macro must be documented. What is the point of > > this bulk rename anyway? > > Yes, I'll document the new MACRO defined for usb device-tree
fixup.
> However, this is not bulk rename. I just modified all these > files to include usb device-tree fixup for all fsl ppc > platforms. Most of these platforms were already using this > mechanism (some via different ways),
but
> now its consistent across them.
Wouldn't it make more sense to make this generic then instead of patching zillion files ?
The patch set is to make this support generic, but I do need to make these platforms use this generic support in consistent way via single macro inclusion in their configs...
You can also just modify the function itself instead of million board files. Adding ifdef-endif combo all around the place is just not gonna work, sorry.
Also, the macro should probably contain _OF_ instead of DEVTREE ...
Ok, in this case, I'll use the already defined macros used by these platforms. However, this approach will not make sure that all these platforms are using this feature in a consistent/similar way.
Why not ?
All the platforms files are calling fdt_fixup_dr_usb() under following conditions: 1. no macro usage, direct call 2. Using CONFIG_HAS_FSL_DR_USB macro (for socs having DR controller) 2. Using CONFIG_HAS_FSL_MPH_USB (for socs having MPH controller) 3. Using CONFIG_HAS_FSL_XHCI_USB (for socs having XHCI controller)
This is why I wanted a single macro (CONFIG_USB_DEVTREE_FIXUP) for invocation of fdt_fixup_dr_usb() from all platforms. One macro --> one feature
That'd be fine, but you're adding ifdefs all around the place and that is not fine. You can solve this without ifdefs too, for example by having a __weak empty version of the function where applicable.

-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 5:13 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 12:33:04 PM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 1:57 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 09:26:08 AM, Ramneek Mehresh
wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 1:05 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 05:30:51 AM, Ramneek Mehresh
wrote:
> -----Original Message----- > From: Marek Vasut [mailto:marex@denx.de] > Sent: Wednesday, January 27, 2016 9:57 AM > To: Ramneek Mehresh ramneek.mehresh@nxp.com > Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- > boot@lists.denx.de; Simon Glass sjg@chromium.org > Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree > fixup for all fsl platforms > > On Wednesday, January 27, 2016 at 05:14:00 AM, Ramneek
Mehresh
wrote:
> > > -----Original Message----- > > > From: Marek Vasut [mailto:marex@denx.de] > > > Sent: Tuesday, January 26, 2016 4:58 PM > > > To: Ramneek Mehresh ramneek.mehresh@freescale.com > > > Cc: u-boot@lists.denx.de > > > Subject: Re: [PATCH 2/2] include:configs: Add usb > > > device-tree fixup for all fsl platforms > > > > > > On Tuesday, January 26, 2016 at 12:36:58 PM, Ramneek
Mehresh
wrote:
> > > > Add usb device-tree fixup for all relevant fsl ppc and arm > > > > platforms > > > > > > > > Signed-off-by: Ramneek Mehresh > > ramneek.mehresh@freescale.com > > > > > --- > > > > > > > > board/freescale/b4860qds/b4860qds.c | 2 +- > > > > board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++ > > > > board/freescale/bsc9132qds/bsc9132qds.c | 2 ++ > > > > board/freescale/corenet_ds/corenet_ds.c | 4 ++++ > > > > board/freescale/ls2080aqds/ls2080aqds.c | 4 ++++ > > > > board/freescale/ls2080ardb/ls2080ardb.c | 4 ++++ > > > > board/freescale/mpc8308rdb/mpc8308rdb.c | 4 ++++ > > > > board/freescale/mpc8315erdb/mpc8315erdb.c | 2 ++ > > > > board/freescale/mpc837xemds/mpc837xemds.c | 2 ++ > > > > board/freescale/mpc837xerdb/mpc837xerdb.c | 2 ++ > > > > board/freescale/mpc8536ds/mpc8536ds.c | 2 +- > > > > board/freescale/p1010rdb/p1010rdb.c | 2 +- > > > > board/freescale/p1022ds/p1022ds.c | 2 +- > > > > board/freescale/p1023rdb/p1023rdb.c | 2 +- > > > > board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- > > > > board/freescale/p1_twr/p1_twr.c | 3 +++ > > > > board/freescale/p2041rdb/p2041rdb.c | 2 +- > > > > board/freescale/t102xqds/t102xqds.c | 2 +- > > > > board/freescale/t102xrdb/t102xrdb.c | 3 +++ > > > > board/freescale/t1040qds/t1040qds.c | 2 +- > > > > board/freescale/t104xrdb/t104xrdb.c | 2 +- > > > > board/freescale/t208xqds/t208xqds.c | 3 +++ > > > > board/freescale/t208xrdb/t208xrdb.c | 3 +++ > > > > board/freescale/t4qds/t4240emu.c | 3 +++ > > > > board/freescale/t4qds/t4240qds.c | 3 +++ > > > > board/freescale/t4rdb/t4240rdb.c | 3 +++ > > > > include/configs/B4860QDS.h | 1 + > > > > include/configs/BSC9131RDB.h | 1 + > > > > include/configs/BSC9132QDS.h | 3 ++- > > > > include/configs/MPC8308RDB.h | 3 +++ > > > > include/configs/MPC8315ERDB.h | 1 + > > > > include/configs/MPC837XEMDS.h | 3 ++- > > > > include/configs/MPC837XERDB.h | 1 + > > > > include/configs/MPC8536DS.h | 1 + > > > > include/configs/P1010RDB.h | 1 + > > > > include/configs/P1022DS.h | 1 + > > > > include/configs/P1023RDB.h | 1 + > > > > include/configs/P2041RDB.h | 1 + > > > > include/configs/T102xQDS.h | 1 + > > > > include/configs/T102xRDB.h | 1 + > > > > include/configs/T1040QDS.h | 1 + > > > > include/configs/T104xRDB.h | 1 + > > > > include/configs/T208xQDS.h | 1 + > > > > include/configs/T208xRDB.h | 1 + > > > > include/configs/T4240QDS.h | 1 + > > > > include/configs/corenet_ds.h | 1 + > > > > include/configs/ls2080aqds.h | 1 + > > > > include/configs/ls2080ardb.h | 1 + > > > > include/configs/p1_p2_rdb_pc.h | 1 + > > > > include/configs/p1_twr.h | 1 + > > > > 50 files changed, 85 insertions(+), 12 deletions(-) > > > > > > Each such new macro must be documented. What is the point
of
> > > this bulk rename anyway? > > > > Yes, I'll document the new MACRO defined for usb device-tree
fixup.
> > However, this is not bulk rename. I just modified all these > > files to include usb device-tree fixup for all fsl ppc > > platforms. Most of these platforms were already using this > > mechanism (some via different ways), > > but > > > now its consistent across them. > > Wouldn't it make more sense to make this generic then instead of > patching zillion files ?
The patch set is to make this support generic, but I do need to make these platforms use this generic support in consistent way via single macro inclusion in their configs...
You can also just modify the function itself instead of million board files. Adding ifdef-endif combo all around the place is just not gonna work, sorry.
Also, the macro should probably contain _OF_ instead of DEVTREE ...
Ok, in this case, I'll use the already defined macros used by these platforms. However, this approach will not make sure that all these platforms are using this feature in a consistent/similar way.
Why not ?
All the platforms files are calling fdt_fixup_dr_usb() under following conditions: 1. no macro usage, direct call 2. Using CONFIG_HAS_FSL_DR_USB macro (for socs having DR controller) 2. Using CONFIG_HAS_FSL_MPH_USB (for socs having MPH controller) 3. Using CONFIG_HAS_FSL_XHCI_USB (for socs having XHCI controller)
This is why I wanted a single macro (CONFIG_USB_DEVTREE_FIXUP) for invocation of fdt_fixup_dr_usb() from all platforms. One macro --> one feature
That'd be fine, but you're adding ifdefs all around the place and that is not fine. You can solve this without ifdefs too, for example by having a __weak empty version of the function where applicable.
Ok, so you're suggesting me to have multiple definitions of this function...the function Itself being __weak...one for ehci and another for xhci. In this case, we'll be having problem with boards of an soc having both ehci and xhci controller...then how do we handle that situation?

On Thursday, January 28, 2016 at 12:05:29 PM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 5:13 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 12:33:04 PM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 1:57 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 09:26:08 AM, Ramneek Mehresh
wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 1:05 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 05:30:51 AM, Ramneek Mehresh
wrote:
> > -----Original Message----- > > From: Marek Vasut [mailto:marex@denx.de] > > Sent: Wednesday, January 27, 2016 9:57 AM > > To: Ramneek Mehresh ramneek.mehresh@nxp.com > > Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- > > boot@lists.denx.de; Simon Glass sjg@chromium.org > > Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree > > fixup for all fsl platforms > > > > On Wednesday, January 27, 2016 at 05:14:00 AM, Ramneek
Mehresh
wrote: > > > > -----Original Message----- > > > > From: Marek Vasut [mailto:marex@denx.de] > > > > Sent: Tuesday, January 26, 2016 4:58 PM > > > > To: Ramneek Mehresh ramneek.mehresh@freescale.com > > > > Cc: u-boot@lists.denx.de > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb > > > > device-tree fixup for all fsl platforms > > > > > > > > On Tuesday, January 26, 2016 at 12:36:58 PM, Ramneek
Mehresh
wrote: > > > > > Add usb device-tree fixup for all relevant fsl ppc and > > > > > arm platforms > > > > > > > > > > Signed-off-by: Ramneek Mehresh > > > > ramneek.mehresh@freescale.com > > > > > > > --- > > > > > > > > > > board/freescale/b4860qds/b4860qds.c | 2 +- > > > > > board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++ > > > > > board/freescale/bsc9132qds/bsc9132qds.c | 2 ++ > > > > > board/freescale/corenet_ds/corenet_ds.c | 4 ++++ > > > > > board/freescale/ls2080aqds/ls2080aqds.c | 4 ++++ > > > > > board/freescale/ls2080ardb/ls2080ardb.c | 4 ++++ > > > > > board/freescale/mpc8308rdb/mpc8308rdb.c | 4 ++++ > > > > > board/freescale/mpc8315erdb/mpc8315erdb.c | 2 ++ > > > > > board/freescale/mpc837xemds/mpc837xemds.c | 2 ++ > > > > > board/freescale/mpc837xerdb/mpc837xerdb.c | 2 ++ > > > > > board/freescale/mpc8536ds/mpc8536ds.c | 2 +- > > > > > board/freescale/p1010rdb/p1010rdb.c | 2 +- > > > > > board/freescale/p1022ds/p1022ds.c | 2 +- > > > > > board/freescale/p1023rdb/p1023rdb.c | 2 +- > > > > > board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- > > > > > board/freescale/p1_twr/p1_twr.c | 3 +++ > > > > > board/freescale/p2041rdb/p2041rdb.c | 2 +- > > > > > board/freescale/t102xqds/t102xqds.c | 2 +- > > > > > board/freescale/t102xrdb/t102xrdb.c | 3 +++ > > > > > board/freescale/t1040qds/t1040qds.c | 2 +- > > > > > board/freescale/t104xrdb/t104xrdb.c | 2 +- > > > > > board/freescale/t208xqds/t208xqds.c | 3 +++ > > > > > board/freescale/t208xrdb/t208xrdb.c | 3 +++ > > > > > board/freescale/t4qds/t4240emu.c | 3 +++ > > > > > board/freescale/t4qds/t4240qds.c | 3 +++ > > > > > board/freescale/t4rdb/t4240rdb.c | 3 +++ > > > > > include/configs/B4860QDS.h | 1 + > > > > > include/configs/BSC9131RDB.h | 1 + > > > > > include/configs/BSC9132QDS.h | 3 ++- > > > > > include/configs/MPC8308RDB.h | 3 +++ > > > > > include/configs/MPC8315ERDB.h | 1 + > > > > > include/configs/MPC837XEMDS.h | 3 ++- > > > > > include/configs/MPC837XERDB.h | 1 + > > > > > include/configs/MPC8536DS.h | 1 + > > > > > include/configs/P1010RDB.h | 1 + > > > > > include/configs/P1022DS.h | 1 + > > > > > include/configs/P1023RDB.h | 1 + > > > > > include/configs/P2041RDB.h | 1 + > > > > > include/configs/T102xQDS.h | 1 + > > > > > include/configs/T102xRDB.h | 1 + > > > > > include/configs/T1040QDS.h | 1 + > > > > > include/configs/T104xRDB.h | 1 + > > > > > include/configs/T208xQDS.h | 1 + > > > > > include/configs/T208xRDB.h | 1 + > > > > > include/configs/T4240QDS.h | 1 + > > > > > include/configs/corenet_ds.h | 1 + > > > > > include/configs/ls2080aqds.h | 1 + > > > > > include/configs/ls2080ardb.h | 1 + > > > > > include/configs/p1_p2_rdb_pc.h | 1 + > > > > > include/configs/p1_twr.h | 1 + > > > > > 50 files changed, 85 insertions(+), 12 deletions(-) > > > > > > > > Each such new macro must be documented. What is the point
of
> > > > this bulk rename anyway? > > > > > > Yes, I'll document the new MACRO defined for usb > > > device-tree
fixup.
> > > However, this is not bulk rename. I just modified all these > > > files to include usb device-tree fixup for all fsl ppc > > > platforms. Most of these platforms were already using this > > > mechanism (some via different ways), > > > > but > > > > > now its consistent across them. > > > > Wouldn't it make more sense to make this generic then instead > > of patching zillion files ? > > The patch set is to make this support generic, but I do need to > make these platforms use this generic support in consistent way > via single macro inclusion in their configs...
You can also just modify the function itself instead of million board files. Adding ifdef-endif combo all around the place is just not gonna work, sorry.
Also, the macro should probably contain _OF_ instead of DEVTREE ...
Ok, in this case, I'll use the already defined macros used by these platforms. However, this approach will not make sure that all these platforms are using this feature in a consistent/similar way.
Why not ?
All the platforms files are calling fdt_fixup_dr_usb() under following conditions: 1. no macro usage, direct call 2. Using CONFIG_HAS_FSL_DR_USB macro (for socs having DR controller) 2. Using CONFIG_HAS_FSL_MPH_USB (for socs having MPH controller) 3. Using CONFIG_HAS_FSL_XHCI_USB (for socs having XHCI controller)
This is why I wanted a single macro (CONFIG_USB_DEVTREE_FIXUP) for invocation of fdt_fixup_dr_usb() from all platforms. One macro --> one feature
That'd be fine, but you're adding ifdefs all around the place and that is not fine. You can solve this without ifdefs too, for example by having a __weak empty version of the function where applicable.
Ok, so you're suggesting me to have multiple definitions of this function...the function Itself being __weak...one for ehci and another for xhci. In this case, we'll be having problem with boards of an soc having both ehci and xhci controller...then how do we handle that situation?
I only see one implementation of fdt_fixup_dr_usb(blob, bd); being invoked throughout this patch. Where are these "multiple" implementations ?

-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Thursday, January 28, 2016 5:04 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Thursday, January 28, 2016 at 12:05:29 PM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 5:13 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 12:33:04 PM, Ramneek Mehresh
wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 1:57 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 09:26:08 AM, Ramneek Mehresh
wrote:
> -----Original Message----- > From: Marek Vasut [mailto:marex@denx.de] > Sent: Wednesday, January 27, 2016 1:05 PM > To: Ramneek Mehresh ramneek.mehresh@nxp.com > Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- > boot@lists.denx.de; Simon Glass sjg@chromium.org > Subject: Re: [PATCH 2/2] include:configs: Add usb > device-tree fixup for all fsl platforms > > On Wednesday, January 27, 2016 at 05:30:51 AM, Ramneek > Mehresh
wrote:
> > > -----Original Message----- > > > From: Marek Vasut [mailto:marex@denx.de] > > > Sent: Wednesday, January 27, 2016 9:57 AM > > > To: Ramneek Mehresh ramneek.mehresh@nxp.com > > > Cc: Ramneek Mehresh ramneek.mehresh@freescale.com;
u-
> > > boot@lists.denx.de; Simon Glass sjg@chromium.org > > > Subject: Re: [PATCH 2/2] include:configs: Add usb > > > device-tree fixup for all fsl platforms > > > > > > On Wednesday, January 27, 2016 at 05:14:00 AM, Ramneek
Mehresh
> wrote: > > > > > -----Original Message----- > > > > > From: Marek Vasut [mailto:marex@denx.de] > > > > > Sent: Tuesday, January 26, 2016 4:58 PM > > > > > To: Ramneek Mehresh
> > > > > Cc: u-boot@lists.denx.de > > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb > > > > > device-tree fixup for all fsl platforms > > > > > > > > > > On Tuesday, January 26, 2016 at 12:36:58 PM, Ramneek
Mehresh
> wrote: > > > > > > Add usb device-tree fixup for all relevant fsl ppc > > > > > > and arm platforms > > > > > > > > > > > > Signed-off-by: Ramneek Mehresh > > > > > > ramneek.mehresh@freescale.com > > > > > > > > > --- > > > > > > > > > > > > board/freescale/b4860qds/b4860qds.c | 2 +- > > > > > > board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++ > > > > > > board/freescale/bsc9132qds/bsc9132qds.c | 2 ++ > > > > > > board/freescale/corenet_ds/corenet_ds.c | 4 ++++ > > > > > > board/freescale/ls2080aqds/ls2080aqds.c | 4 ++++ > > > > > > board/freescale/ls2080ardb/ls2080ardb.c | 4 ++++ > > > > > > board/freescale/mpc8308rdb/mpc8308rdb.c | 4 ++++ > > > > > > board/freescale/mpc8315erdb/mpc8315erdb.c | 2 ++ > > > > > > board/freescale/mpc837xemds/mpc837xemds.c | 2 ++ > > > > > > board/freescale/mpc837xerdb/mpc837xerdb.c | 2 ++ > > > > > > board/freescale/mpc8536ds/mpc8536ds.c | 2 +- > > > > > > board/freescale/p1010rdb/p1010rdb.c | 2 +- > > > > > > board/freescale/p1022ds/p1022ds.c | 2 +- > > > > > > board/freescale/p1023rdb/p1023rdb.c | 2 +- > > > > > > board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- > > > > > > board/freescale/p1_twr/p1_twr.c | 3 +++ > > > > > > board/freescale/p2041rdb/p2041rdb.c | 2 +- > > > > > > board/freescale/t102xqds/t102xqds.c | 2 +- > > > > > > board/freescale/t102xrdb/t102xrdb.c | 3 +++ > > > > > > board/freescale/t1040qds/t1040qds.c | 2 +- > > > > > > board/freescale/t104xrdb/t104xrdb.c | 2 +- > > > > > > board/freescale/t208xqds/t208xqds.c | 3 +++ > > > > > > board/freescale/t208xrdb/t208xrdb.c | 3 +++ > > > > > > board/freescale/t4qds/t4240emu.c | 3 +++ > > > > > > board/freescale/t4qds/t4240qds.c | 3 +++ > > > > > > board/freescale/t4rdb/t4240rdb.c | 3 +++ > > > > > > include/configs/B4860QDS.h | 1 + > > > > > > include/configs/BSC9131RDB.h | 1 + > > > > > > include/configs/BSC9132QDS.h | 3 ++- > > > > > > include/configs/MPC8308RDB.h | 3 +++ > > > > > > include/configs/MPC8315ERDB.h | 1 + > > > > > > include/configs/MPC837XEMDS.h | 3 ++- > > > > > > include/configs/MPC837XERDB.h | 1 + > > > > > > include/configs/MPC8536DS.h | 1 + > > > > > > include/configs/P1010RDB.h | 1 + > > > > > > include/configs/P1022DS.h | 1 + > > > > > > include/configs/P1023RDB.h | 1 + > > > > > > include/configs/P2041RDB.h | 1 + > > > > > > include/configs/T102xQDS.h | 1 + > > > > > > include/configs/T102xRDB.h | 1 + > > > > > > include/configs/T1040QDS.h | 1 + > > > > > > include/configs/T104xRDB.h | 1 + > > > > > > include/configs/T208xQDS.h | 1 + > > > > > > include/configs/T208xRDB.h | 1 + > > > > > > include/configs/T4240QDS.h | 1 + > > > > > > include/configs/corenet_ds.h | 1 + > > > > > > include/configs/ls2080aqds.h | 1 + > > > > > > include/configs/ls2080ardb.h | 1 + > > > > > > include/configs/p1_p2_rdb_pc.h | 1 + > > > > > > include/configs/p1_twr.h | 1 + > > > > > > 50 files changed, 85 insertions(+), 12 > > > > > > deletions(-) > > > > > > > > > > Each such new macro must be documented. What is the > > > > > point
of
> > > > > this bulk rename anyway? > > > > > > > > Yes, I'll document the new MACRO defined for usb > > > > device-tree
fixup.
> > > > However, this is not bulk rename. I just modified all > > > > these files to include usb device-tree fixup for all > > > > fsl ppc platforms. Most of these platforms were > > > > already using this mechanism (some via different > > > > ways), > > > > > > but > > > > > > > now its consistent across them. > > > > > > Wouldn't it make more sense to make this generic then > > > instead of patching zillion files ? > > > > The patch set is to make this support generic, but I do > > need to make these platforms use this generic support in > > consistent way via single macro inclusion in their configs... > > You can also just modify the function itself instead of > million board files. Adding ifdef-endif combo all around the > place is just not gonna work, sorry. > > Also, the macro should probably contain _OF_ instead of > DEVTREE ...
Ok, in this case, I'll use the already defined macros used by these platforms. However, this approach will not make sure that all these platforms are using this feature in a consistent/similar
way.
Why not ?
All the platforms files are calling fdt_fixup_dr_usb() under following conditions: 1. no macro usage, direct call 2. Using CONFIG_HAS_FSL_DR_USB macro (for socs having DR controller) 2. Using CONFIG_HAS_FSL_MPH_USB (for socs having MPH controller) 3. Using CONFIG_HAS_FSL_XHCI_USB (for socs having XHCI controller)
This is why I wanted a single macro (CONFIG_USB_DEVTREE_FIXUP) for invocation of fdt_fixup_dr_usb() from all platforms. One macro --> one feature
That'd be fine, but you're adding ifdefs all around the place and that is not fine. You can solve this without ifdefs too, for example by having a __weak empty version of the function where applicable.
Ok, so you're suggesting me to have multiple definitions of this function...the function Itself being __weak...one for ehci and another for xhci. In this case, we'll be having problem with boards of an soc having both ehci and xhci controller...then how do we handle that situation?
I only see one implementation of fdt_fixup_dr_usb(blob, bd); being invoked throughout this patch. Where are these "multiple" implementations ?
The only implementation right now was in drivers/usb/host/ehci-fsl.c which I moved to boards/freescale/common/usb.c This was done so as not to have another definition of this function in drivers/usb/host/xhci-fsl.c.

-----Original Message----- From: Ramneek Mehresh Sent: Thursday, January 28, 2016 5:45 PM To: 'Marek Vasut' marex@denx.de Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: RE: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Thursday, January 28, 2016 5:04 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Thursday, January 28, 2016 at 12:05:29 PM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 5:13 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 12:33:04 PM, Ramneek Mehresh
wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 1:57 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 09:26:08 AM, Ramneek
Mehresh
wrote:
> > -----Original Message----- > > From: Marek Vasut [mailto:marex@denx.de] > > Sent: Wednesday, January 27, 2016 1:05 PM > > To: Ramneek Mehresh ramneek.mehresh@nxp.com > > Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- > > boot@lists.denx.de; Simon Glass sjg@chromium.org > > Subject: Re: [PATCH 2/2] include:configs: Add usb > > device-tree fixup for all fsl platforms > > > > On Wednesday, January 27, 2016 at 05:30:51 AM, Ramneek > > Mehresh
wrote: > > > > -----Original Message----- > > > > From: Marek Vasut [mailto:marex@denx.de] > > > > Sent: Wednesday, January 27, 2016 9:57 AM > > > > To: Ramneek Mehresh ramneek.mehresh@nxp.com > > > > Cc: Ramneek Mehresh
ramneek.mehresh@freescale.com;
u-
> > > > boot@lists.denx.de; Simon Glass sjg@chromium.org > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb > > > > device-tree fixup for all fsl platforms > > > > > > > > On Wednesday, January 27, 2016 at 05:14:00 AM, Ramneek
Mehresh
> > wrote: > > > > > > -----Original Message----- > > > > > > From: Marek Vasut [mailto:marex@denx.de] > > > > > > Sent: Tuesday, January 26, 2016 4:58 PM > > > > > > To: Ramneek Mehresh
> > > > > > Cc: u-boot@lists.denx.de > > > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb > > > > > > device-tree fixup for all fsl platforms > > > > > > > > > > > > On Tuesday, January 26, 2016 at 12:36:58 PM, > > > > > > Ramneek
Mehresh
> > wrote: > > > > > > > Add usb device-tree fixup for all relevant fsl > > > > > > > ppc and arm platforms > > > > > > > > > > > > > > Signed-off-by: Ramneek Mehresh > > > > > > > > ramneek.mehresh@freescale.com > > > > > > > > > > > --- > > > > > > > > > > > > > > board/freescale/b4860qds/b4860qds.c | 2 +- > > > > > > > board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++ > > > > > > > board/freescale/bsc9132qds/bsc9132qds.c | 2 ++ > > > > > > > board/freescale/corenet_ds/corenet_ds.c | 4 ++++ > > > > > > > board/freescale/ls2080aqds/ls2080aqds.c | 4 ++++ > > > > > > > board/freescale/ls2080ardb/ls2080ardb.c | 4 ++++ > > > > > > > board/freescale/mpc8308rdb/mpc8308rdb.c | 4
++++
> > > > > > > board/freescale/mpc8315erdb/mpc8315erdb.c | 2 ++ > > > > > > > board/freescale/mpc837xemds/mpc837xemds.c | 2
++
> > > > > > > board/freescale/mpc837xerdb/mpc837xerdb.c | 2 ++ > > > > > > > board/freescale/mpc8536ds/mpc8536ds.c | 2 +- > > > > > > > board/freescale/p1010rdb/p1010rdb.c | 2 +- > > > > > > > board/freescale/p1022ds/p1022ds.c | 2 +- > > > > > > > board/freescale/p1023rdb/p1023rdb.c | 2 +- > > > > > > > board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- > > > > > > > board/freescale/p1_twr/p1_twr.c | 3 +++ > > > > > > > board/freescale/p2041rdb/p2041rdb.c | 2 +- > > > > > > > board/freescale/t102xqds/t102xqds.c | 2 +- > > > > > > > board/freescale/t102xrdb/t102xrdb.c | 3 +++ > > > > > > > board/freescale/t1040qds/t1040qds.c | 2 +- > > > > > > > board/freescale/t104xrdb/t104xrdb.c | 2 +- > > > > > > > board/freescale/t208xqds/t208xqds.c | 3 +++ > > > > > > > board/freescale/t208xrdb/t208xrdb.c | 3 +++ > > > > > > > board/freescale/t4qds/t4240emu.c | 3 +++ > > > > > > > board/freescale/t4qds/t4240qds.c | 3 +++ > > > > > > > board/freescale/t4rdb/t4240rdb.c | 3 +++ > > > > > > > include/configs/B4860QDS.h | 1 + > > > > > > > include/configs/BSC9131RDB.h | 1 + > > > > > > > include/configs/BSC9132QDS.h | 3 ++- > > > > > > > include/configs/MPC8308RDB.h | 3 +++ > > > > > > > include/configs/MPC8315ERDB.h | 1 + > > > > > > > include/configs/MPC837XEMDS.h | 3 ++- > > > > > > > include/configs/MPC837XERDB.h | 1 + > > > > > > > include/configs/MPC8536DS.h | 1 + > > > > > > > include/configs/P1010RDB.h | 1 + > > > > > > > include/configs/P1022DS.h | 1 + > > > > > > > include/configs/P1023RDB.h | 1 + > > > > > > > include/configs/P2041RDB.h | 1 + > > > > > > > include/configs/T102xQDS.h | 1 + > > > > > > > include/configs/T102xRDB.h | 1 + > > > > > > > include/configs/T1040QDS.h | 1 + > > > > > > > include/configs/T104xRDB.h | 1 + > > > > > > > include/configs/T208xQDS.h | 1 + > > > > > > > include/configs/T208xRDB.h | 1 + > > > > > > > include/configs/T4240QDS.h | 1 + > > > > > > > include/configs/corenet_ds.h | 1 + > > > > > > > include/configs/ls2080aqds.h | 1 + > > > > > > > include/configs/ls2080ardb.h | 1 + > > > > > > > include/configs/p1_p2_rdb_pc.h | 1 + > > > > > > > include/configs/p1_twr.h | 1 + > > > > > > > 50 files changed, 85 insertions(+), 12 > > > > > > > deletions(-) > > > > > > > > > > > > Each such new macro must be documented. What is > > > > > > the point
of
> > > > > > this bulk rename anyway? > > > > > > > > > > Yes, I'll document the new MACRO defined for usb > > > > > device-tree
fixup.
> > > > > However, this is not bulk rename. I just modified > > > > > all these files to include usb device-tree fixup for > > > > > all fsl ppc platforms. Most of these platforms were > > > > > already using this mechanism (some via different > > > > > ways), > > > > > > > > but > > > > > > > > > now its consistent across them. > > > > > > > > Wouldn't it make more sense to make this generic then > > > > instead of patching zillion files ? > > > > > > The patch set is to make this support generic, but I do > > > need to make these platforms use this generic support in > > > consistent way via single macro inclusion in their configs... > > > > You can also just modify the function itself instead of > > million board files. Adding ifdef-endif combo all around > > the place is just not gonna work, sorry. > > > > Also, the macro should probably contain _OF_ instead of > > DEVTREE ... > > Ok, in this case, I'll use the already defined macros used > by these platforms. However, this approach will not make > sure that all these platforms are using this feature in a > consistent/similar
way.
Why not ?
All the platforms files are calling fdt_fixup_dr_usb() under following conditions: 1. no macro usage, direct call 2. Using CONFIG_HAS_FSL_DR_USB macro (for socs having DR controller) 2. Using CONFIG_HAS_FSL_MPH_USB (for socs having MPH controller)
Using CONFIG_HAS_FSL_XHCI_USB (for socs having XHCI controller)
This is why I wanted a single macro (CONFIG_USB_DEVTREE_FIXUP) for invocation of fdt_fixup_dr_usb() from all platforms. One macro --> one feature
That'd be fine, but you're adding ifdefs all around the place and that is not fine. You can solve this without ifdefs too, for example by having a __weak empty version of the function where
applicable.
Ok, so you're suggesting me to have multiple definitions of this function...the function Itself being __weak...one for ehci and another for xhci. In this case, we'll be having problem with boards of an soc having both ehci and xhci controller...then how do we handle that situation?
I only see one implementation of fdt_fixup_dr_usb(blob, bd); being invoked throughout this patch. Where are these "multiple"
implementations ? The only implementation right now was in drivers/usb/host/ehci-fsl.c which I moved to boards/freescale/common/usb.c This was done so as not to have another definition of this function in drivers/usb/host/xhci-fsl.c.
Hi Marek...a kind reminder for the above discussion...please let me know if you're ok with the above patch or shall I resend the patch with #defines removed. Please suggest.

On Monday, February 08, 2016 at 12:07:29 PM, Ramneek Mehresh wrote:
-----Original Message----- From: Ramneek Mehresh Sent: Thursday, January 28, 2016 5:45 PM To: 'Marek Vasut' marex@denx.de Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: RE: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Thursday, January 28, 2016 5:04 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Thursday, January 28, 2016 at 12:05:29 PM, Ramneek Mehresh wrote:
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Wednesday, January 27, 2016 5:13 PM To: Ramneek Mehresh ramneek.mehresh@nxp.com Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- boot@lists.denx.de; Simon Glass sjg@chromium.org Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms
On Wednesday, January 27, 2016 at 12:33:04 PM, Ramneek Mehresh
wrote:
> -----Original Message----- > From: Marek Vasut [mailto:marex@denx.de] > Sent: Wednesday, January 27, 2016 1:57 PM > To: Ramneek Mehresh ramneek.mehresh@nxp.com > Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- > boot@lists.denx.de; Simon Glass sjg@chromium.org > Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree > fixup for all fsl platforms > > On Wednesday, January 27, 2016 at 09:26:08 AM, Ramneek
Mehresh
wrote:
> > > -----Original Message----- > > > From: Marek Vasut [mailto:marex@denx.de] > > > Sent: Wednesday, January 27, 2016 1:05 PM > > > To: Ramneek Mehresh ramneek.mehresh@nxp.com > > > Cc: Ramneek Mehresh ramneek.mehresh@freescale.com; u- > > > boot@lists.denx.de; Simon Glass sjg@chromium.org > > > Subject: Re: [PATCH 2/2] include:configs: Add usb > > > device-tree fixup for all fsl platforms > > > > > > On Wednesday, January 27, 2016 at 05:30:51 AM, Ramneek > > > Mehresh > > wrote: > > > > > -----Original Message----- > > > > > From: Marek Vasut [mailto:marex@denx.de] > > > > > Sent: Wednesday, January 27, 2016 9:57 AM > > > > > To: Ramneek Mehresh ramneek.mehresh@nxp.com > > > > > Cc: Ramneek Mehresh
ramneek.mehresh@freescale.com;
u-
> > > > > boot@lists.denx.de; Simon Glass sjg@chromium.org > > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb > > > > > device-tree fixup for all fsl platforms > > > > > > > > > > On Wednesday, January 27, 2016 at 05:14:00 AM, Ramneek
Mehresh
> > > wrote: > > > > > > > -----Original Message----- > > > > > > > From: Marek Vasut [mailto:marex@denx.de] > > > > > > > Sent: Tuesday, January 26, 2016 4:58 PM > > > > > > > To: Ramneek Mehresh
> > > > > > > Cc: u-boot@lists.denx.de > > > > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb > > > > > > > device-tree fixup for all fsl platforms > > > > > > > > > > > > > > On Tuesday, January 26, 2016 at 12:36:58 PM, > > > > > > > Ramneek
Mehresh
> > > wrote: > > > > > > > > Add usb device-tree fixup for all relevant fsl > > > > > > > > ppc and arm platforms > > > > > > > > > > > > > > > > Signed-off-by: Ramneek Mehresh > > > > > > > > > > ramneek.mehresh@freescale.com > > > > > > > > > > > > > --- > > > > > > > > > > > > > > > > board/freescale/b4860qds/b4860qds.c | 2 > > > > > > > > +- board/freescale/bsc9131rdb/bsc9131rdb.c > > > > > > > > | 2 ++ board/freescale/bsc9132qds/bsc9132qds.c > > > > > > > > | 2 ++ > > > > > > > > board/freescale/corenet_ds/corenet_ds.c | 4 > > > > > > > > ++++ board/freescale/ls2080aqds/ls2080aqds.c > > > > > > > > | 4 ++++ > > > > > > > > board/freescale/ls2080ardb/ls2080ardb.c | 4 > > > > > > > > ++++ board/freescale/mpc8308rdb/mpc8308rdb.c > > > > > > > > | 4
++++
> > > > > > > > board/freescale/mpc8315erdb/mpc8315erdb.c | 2 > > > > > > > > ++ board/freescale/mpc837xemds/mpc837xemds.c > > > > > > > > | 2
++
> > > > > > > > board/freescale/mpc837xerdb/mpc837xerdb.c | 2 > > > > > > > > ++ board/freescale/mpc8536ds/mpc8536ds.c > > > > > > > > | 2 +- board/freescale/p1010rdb/p1010rdb.c > > > > > > > > | 2 +- board/freescale/p1022ds/p1022ds.c > > > > > > > > | 2 +- > > > > > > > > board/freescale/p1023rdb/p1023rdb.c | 2 > > > > > > > > +- board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c > > > > > > > > | 2 +- board/freescale/p1_twr/p1_twr.c > > > > > > > > | 3 +++ board/freescale/p2041rdb/p2041rdb.c > > > > > > > > | 2 +- > > > > > > > > board/freescale/t102xqds/t102xqds.c | 2 > > > > > > > > +- board/freescale/t102xrdb/t102xrdb.c > > > > > > > > | 3 +++ board/freescale/t1040qds/t1040qds.c > > > > > > > > | 2 +- board/freescale/t104xrdb/t104xrdb.c > > > > > > > > | 2 +- > > > > > > > > board/freescale/t208xqds/t208xqds.c | 3 > > > > > > > > +++ board/freescale/t208xrdb/t208xrdb.c > > > > > > > > | 3 +++ board/freescale/t4qds/t4240emu.c > > > > > > > > | 3 +++ board/freescale/t4qds/t4240qds.c > > > > > > > > | 3 +++ > > > > > > > > board/freescale/t4rdb/t4240rdb.c | 3 > > > > > > > > +++ include/configs/B4860QDS.h > > > > > > > > | 1 + include/configs/BSC9131RDB.h > > > > > > > > | 1 + include/configs/BSC9132QDS.h > > > > > > > > | 3 ++- include/configs/MPC8308RDB.h > > > > > > > > | 3 +++ include/configs/MPC8315ERDB.h > > > > > > > > | 1 + include/configs/MPC837XEMDS.h > > > > > > > > | 3 ++- > > > > > > > > include/configs/MPC837XERDB.h | 1 > > > > > > > > + include/configs/MPC8536DS.h | > > > > > > > > 1 + include/configs/P1010RDB.h > > > > > > > > | 1 + include/configs/P1022DS.h > > > > > > > > | 1 + include/configs/P1023RDB.h > > > > > > > > | 1 + include/configs/P2041RDB.h > > > > > > > > | 1 + include/configs/T102xQDS.h > > > > > > > > | 1 + include/configs/T102xRDB.h > > > > > > > > | 1 + include/configs/T1040QDS.h > > > > > > > > | 1 + include/configs/T104xRDB.h > > > > > > > > | 1 + include/configs/T208xQDS.h > > > > > > > > | 1 + > > > > > > > > include/configs/T208xRDB.h | 1 > > > > > > > > + include/configs/T4240QDS.h | > > > > > > > > 1 + include/configs/corenet_ds.h > > > > > > > > | 1 + include/configs/ls2080aqds.h > > > > > > > > | 1 + include/configs/ls2080ardb.h > > > > > > > > | 1 + include/configs/p1_p2_rdb_pc.h > > > > > > > > | 1 + include/configs/p1_twr.h > > > > > > > > | 1 + 50 files changed, 85 > > > > > > > > insertions(+), 12 > > > > > > > > > > > > > > > > deletions(-) > > > > > > > > > > > > > > Each such new macro must be documented. What is > > > > > > > the point
of
> > > > > > > this bulk rename anyway? > > > > > > > > > > > > Yes, I'll document the new MACRO defined for usb > > > > > > device-tree > > fixup. > > > > > > > However, this is not bulk rename. I just modified > > > > > > all these files to include usb device-tree fixup for > > > > > > all fsl ppc platforms. Most of these platforms were > > > > > > already using this mechanism (some via different > > > > > > ways), > > > > > > > > > > but > > > > > > > > > > > now its consistent across them. > > > > > > > > > > Wouldn't it make more sense to make this generic then > > > > > instead of patching zillion files ? > > > > > > > > The patch set is to make this support generic, but I do > > > > need to make these platforms use this generic support in > > > > consistent way via single macro inclusion in their > > > > configs... > > > > > > You can also just modify the function itself instead of > > > million board files. Adding ifdef-endif combo all around > > > the place is just not gonna work, sorry. > > > > > > Also, the macro should probably contain _OF_ instead of > > > DEVTREE ... > > > > Ok, in this case, I'll use the already defined macros used > > by these platforms. However, this approach will not make > > sure that all these platforms are using this feature in a > > consistent/similar
way.
> Why not ?
All the platforms files are calling fdt_fixup_dr_usb() under following conditions: 1. no macro usage, direct call 2. Using CONFIG_HAS_FSL_DR_USB macro (for socs having DR controller) 2. Using CONFIG_HAS_FSL_MPH_USB (for socs having MPH controller)
Using CONFIG_HAS_FSL_XHCI_USB (for socs having XHCI controller)
This is why I wanted a single macro (CONFIG_USB_DEVTREE_FIXUP) for invocation of fdt_fixup_dr_usb() from all platforms. One macro --> one feature
That'd be fine, but you're adding ifdefs all around the place and that is not fine. You can solve this without ifdefs too, for example by having a __weak empty version of the function where
applicable.
Ok, so you're suggesting me to have multiple definitions of this function...the function Itself being __weak...one for ehci and another for xhci. In this case, we'll be having problem with boards of an soc having both ehci and xhci controller...then how do we handle that situation?
I only see one implementation of fdt_fixup_dr_usb(blob, bd); being invoked throughout this patch. Where are these "multiple"
implementations ? The only implementation right now was in drivers/usb/host/ehci-fsl.c which I moved to boards/freescale/common/usb.c This was done so as not to have another definition of this function in drivers/usb/host/xhci-fsl.c.
Hi Marek...a kind reminder for the above discussion...please let me know if you're ok with the above patch or shall I resend the patch with #defines removed. Please suggest.
The later, patch which does not add billion #defines .

Makes usb device-tree fixup independent of Controller type. This enables the usage of device-tree fixup as a common framework for EHCI and XHCI controllers.
Sriram Dash (2): board:freescale:common: Move device-tree fixup framework to common file board:freescale:usb: Add device-tree fixup support for xhci controller
board/freescale/common/Makefile | 4 + board/freescale/common/usb.c | 206 ++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/ehci-fsl.c | 194 ------------------------------------- include/fdt_support.h | 4 +- 4 files changed, 212 insertions(+), 196 deletions(-) create mode 100644 board/freescale/common/usb.c

Move usb device-tree fixup framework from ehci-fsl.c to common place so that it can be used by other drivers as well (xhci-fsl.c). Also, call fdt_usb_get_node_type() from fdt_fixup_usb_mode_phy_type() to avoid code duplication.
Signed-off-by: Ramneek Mehresh ramneek.mehresh@nxp.com Signed-off-by: Sriram Dash sriram.dash@nxp.com --- board/freescale/common/Makefile | 2 + board/freescale/common/usb.c | 199 ++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/ehci-fsl.c | 194 --------------------------------------- 3 files changed, 201 insertions(+), 194 deletions(-) create mode 100644 board/freescale/common/usb.c
diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile index be114ce..62de45c 100644 --- a/board/freescale/common/Makefile +++ b/board/freescale/common/Makefile @@ -13,6 +13,8 @@ MINIMAL=y endif endif
+obj-$(CONFIG_USB_EHCI_FSL) += usb.o + ifdef MINIMAL # necessary to create built-in.o obj- := __dummy__.o diff --git a/board/freescale/common/usb.c b/board/freescale/common/usb.c new file mode 100644 index 0000000..7a35e92 --- /dev/null +++ b/board/freescale/common/usb.c @@ -0,0 +1,199 @@ +/* + * (C) Copyright 2016 Freescale Semiconductor, Inc. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <pci.h> +#include <usb.h> +#include <asm/io.h> +#include <usb/ehci-fsl.h> +#include <hwconfig.h> +#include <fsl_usb.h> +#include <fdt_support.h> + + +#ifndef CONFIG_USB_MAX_CONTROLLER_COUNT +#define CONFIG_USB_MAX_CONTROLLER_COUNT 1 +#endif + +static const char *fdt_usb_get_node_type(void *blob, int start_offset, + int *node_offset) +{ + const char *compat_dr = "fsl-usb2-dr"; + const char *compat_mph = "fsl-usb2-mph"; + const char *node_type = NULL; + + *node_offset = fdt_node_offset_by_compatible(blob, start_offset, + compat_mph); + if (*node_offset < 0) { + *node_offset = fdt_node_offset_by_compatible(blob, + start_offset, + compat_dr); + if (*node_offset < 0) { + printf("ERROR: could not find compatible node: %s\n", + fdt_strerror(*node_offset)); + } else { + node_type = compat_dr; + } + } else { + node_type = compat_mph; + } + + return node_type; +} + + +static int fdt_fixup_usb_mode_phy_type(void *blob, const char *mode, + const char *phy_type, int start_offset) +{ + const char *prop_mode = "dr_mode"; + const char *prop_type = "phy_type"; + const char *node_type = NULL; + int node_offset; + int err; + + node_type = fdt_usb_get_node_type(blob, start_offset, &node_offset); + if (!node_type) + return -1; + + if (mode) { + err = fdt_setprop(blob, node_offset, prop_mode, mode, + strlen(mode) + 1); + if (err < 0) + printf("WARNING: could not set %s for %s: %s.\n", + prop_mode, node_type, fdt_strerror(err)); + } + + if (phy_type) { + err = fdt_setprop(blob, node_offset, prop_type, phy_type, + strlen(phy_type) + 1); + if (err < 0) + printf("WARNING: could not set %s for %s: %s.\n", + prop_type, node_type, fdt_strerror(err)); + } + + return node_offset; +} + +static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum, + int start_offset) +{ + int node_offset, err; + const char *node_type = NULL; + + node_type = fdt_usb_get_node_type(blob, start_offset, &node_offset); + if (!node_type) + return -1; + + err = fdt_setprop(blob, node_offset, prop_erratum, NULL, 0); + if (err < 0) { + printf("ERROR: could not set %s for %s: %s.\n", + prop_erratum, node_type, fdt_strerror(err)); + } + + return node_offset; +} + +void fdt_fixup_dr_usb(void *blob, bd_t *bd) +{ + static const char * const modes[] = { "host", "peripheral", "otg" }; + static const char * const phys[] = { "ulpi", "utmi", "utmi_dual" }; + int usb_erratum_a006261_off = -1; + int usb_erratum_a007075_off = -1; + int usb_erratum_a007792_off = -1; + int usb_erratum_a005697_off = -1; + int usb_mode_off = -1; + int usb_phy_off = -1; + char str[5]; + int i, j; + + for (i = 1; i <= CONFIG_USB_MAX_CONTROLLER_COUNT; i++) { + const char *dr_mode_type = NULL; + const char *dr_phy_type = NULL; + int mode_idx = -1, phy_idx = -1; + + snprintf(str, 5, "%s%d", "usb", i); + if (hwconfig(str)) { + for (j = 0; j < ARRAY_SIZE(modes); j++) { + if (hwconfig_subarg_cmp(str, "dr_mode", + modes[j])) { + mode_idx = j; + break; + } + } + + for (j = 0; j < ARRAY_SIZE(phys); j++) { + if (hwconfig_subarg_cmp(str, "phy_type", + phys[j])) { + phy_idx = j; + break; + } + } + + if (mode_idx < 0 && phy_idx < 0) { + printf("WARNING: invalid phy or mode\n"); + return; + } + + if (mode_idx > -1) + dr_mode_type = modes[mode_idx]; + + if (phy_idx > -1) + dr_phy_type = phys[phy_idx]; + } + + if (has_dual_phy()) + dr_phy_type = phys[2]; + + usb_mode_off = fdt_fixup_usb_mode_phy_type(blob, + dr_mode_type, NULL, + usb_mode_off); + + if (usb_mode_off < 0) + return; + + usb_phy_off = fdt_fixup_usb_mode_phy_type(blob, + NULL, dr_phy_type, + usb_phy_off); + + if (usb_phy_off < 0) + return; + + if (has_erratum_a006261()) { + usb_erratum_a006261_off = fdt_fixup_usb_erratum + (blob, + "fsl,usb-erratum-a006261", + usb_erratum_a006261_off); + if (usb_erratum_a006261_off < 0) + return; + } + + if (has_erratum_a007075()) { + usb_erratum_a007075_off = fdt_fixup_usb_erratum + (blob, + "fsl,usb-erratum-a007075", + usb_erratum_a007075_off); + if (usb_erratum_a007075_off < 0) + return; + } + + if (has_erratum_a007792()) { + usb_erratum_a007792_off = fdt_fixup_usb_erratum + (blob, + "fsl,usb-erratum-a007792", + usb_erratum_a007792_off); + if (usb_erratum_a007792_off < 0) + return; + } + if (has_erratum_a005697()) { + usb_erratum_a005697_off = fdt_fixup_usb_erratum + (blob, + "fsl,usb-erratum-a005697", + usb_erratum_a005697_off); + if (usb_erratum_a005697_off < 0) + return; + } + } +} diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 97b7f14..1680320 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -174,197 +174,3 @@ static void set_txfifothresh(struct usb_ehci *ehci, u32 txfifo_thresh) ehci_writel(&ehci->txfilltuning, cmd); }
-#if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) -static int fdt_fixup_usb_mode_phy_type(void *blob, const char *mode, - const char *phy_type, int start_offset) -{ - const char *compat_dr = "fsl-usb2-dr"; - const char *compat_mph = "fsl-usb2-mph"; - const char *prop_mode = "dr_mode"; - const char *prop_type = "phy_type"; - const char *node_type = NULL; - int node_offset; - int err; - - node_offset = fdt_node_offset_by_compatible(blob, - start_offset, compat_mph); - if (node_offset < 0) { - node_offset = fdt_node_offset_by_compatible(blob, - start_offset, - compat_dr); - if (node_offset < 0) { - printf("WARNING: could not find compatible node: %s", - fdt_strerror(node_offset)); - return -1; - } - node_type = compat_dr; - } else { - node_type = compat_mph; - } - - if (mode) { - err = fdt_setprop(blob, node_offset, prop_mode, mode, - strlen(mode) + 1); - if (err < 0) - printf("WARNING: could not set %s for %s: %s.\n", - prop_mode, node_type, fdt_strerror(err)); - } - - if (phy_type) { - err = fdt_setprop(blob, node_offset, prop_type, phy_type, - strlen(phy_type) + 1); - if (err < 0) - printf("WARNING: could not set %s for %s: %s.\n", - prop_type, node_type, fdt_strerror(err)); - } - - return node_offset; -} - -static const char *fdt_usb_get_node_type(void *blob, int start_offset, - int *node_offset) -{ - const char *compat_dr = "fsl-usb2-dr"; - const char *compat_mph = "fsl-usb2-mph"; - const char *node_type = NULL; - - *node_offset = fdt_node_offset_by_compatible(blob, start_offset, - compat_mph); - if (*node_offset < 0) { - *node_offset = fdt_node_offset_by_compatible(blob, - start_offset, - compat_dr); - if (*node_offset < 0) { - printf("ERROR: could not find compatible node: %s\n", - fdt_strerror(*node_offset)); - } else { - node_type = compat_dr; - } - } else { - node_type = compat_mph; - } - - return node_type; -} - -static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum, - int start_offset) -{ - int node_offset, err; - const char *node_type = NULL; - - node_type = fdt_usb_get_node_type(blob, start_offset, &node_offset); - if (!node_type) - return -1; - - err = fdt_setprop(blob, node_offset, prop_erratum, NULL, 0); - if (err < 0) { - printf("ERROR: could not set %s for %s: %s.\n", - prop_erratum, node_type, fdt_strerror(err)); - } - - return node_offset; -} - -void fdt_fixup_dr_usb(void *blob, bd_t *bd) -{ - static const char * const modes[] = { "host", "peripheral", "otg" }; - static const char * const phys[] = { "ulpi", "utmi", "utmi_dual" }; - int usb_erratum_a006261_off = -1; - int usb_erratum_a007075_off = -1; - int usb_erratum_a007792_off = -1; - int usb_erratum_a005697_off = -1; - int usb_mode_off = -1; - int usb_phy_off = -1; - char str[5]; - int i, j; - - for (i = 1; i <= CONFIG_USB_MAX_CONTROLLER_COUNT; i++) { - const char *dr_mode_type = NULL; - const char *dr_phy_type = NULL; - int mode_idx = -1, phy_idx = -1; - - snprintf(str, 5, "%s%d", "usb", i); - if (hwconfig(str)) { - for (j = 0; j < ARRAY_SIZE(modes); j++) { - if (hwconfig_subarg_cmp(str, "dr_mode", - modes[j])) { - mode_idx = j; - break; - } - } - - for (j = 0; j < ARRAY_SIZE(phys); j++) { - if (hwconfig_subarg_cmp(str, "phy_type", - phys[j])) { - phy_idx = j; - break; - } - } - - if (mode_idx < 0 && phy_idx < 0) { - printf("WARNING: invalid phy or mode\n"); - return; - } - - if (mode_idx > -1) - dr_mode_type = modes[mode_idx]; - - if (phy_idx > -1) - dr_phy_type = phys[phy_idx]; - } - - if (has_dual_phy()) - dr_phy_type = phys[2]; - - usb_mode_off = fdt_fixup_usb_mode_phy_type(blob, - dr_mode_type, NULL, - usb_mode_off); - - if (usb_mode_off < 0) - return; - - usb_phy_off = fdt_fixup_usb_mode_phy_type(blob, - NULL, dr_phy_type, - usb_phy_off); - - if (usb_phy_off < 0) - return; - - if (has_erratum_a006261()) { - usb_erratum_a006261_off = fdt_fixup_usb_erratum - (blob, - "fsl,usb-erratum-a006261", - usb_erratum_a006261_off); - if (usb_erratum_a006261_off < 0) - return; - } - - if (has_erratum_a007075()) { - usb_erratum_a007075_off = fdt_fixup_usb_erratum - (blob, - "fsl,usb-erratum-a007075", - usb_erratum_a007075_off); - if (usb_erratum_a007075_off < 0) - return; - } - - if (has_erratum_a007792()) { - usb_erratum_a007792_off = fdt_fixup_usb_erratum - (blob, - "fsl,usb-erratum-a007792", - usb_erratum_a007792_off); - if (usb_erratum_a007792_off < 0) - return; - } - if (has_erratum_a005697()) { - usb_erratum_a005697_off = fdt_fixup_usb_erratum - (blob, - "fsl,usb-erratum-a005697", - usb_erratum_a005697_off); - if (usb_erratum_a005697_off < 0) - return; - } - } -} -#endif

On 02/24/2016 05:44 AM, Sriram Dash wrote:
Move usb device-tree fixup framework from ehci-fsl.c to common place so that it can be used by other drivers as well (xhci-fsl.c). Also, call fdt_usb_get_node_type() from fdt_fixup_usb_mode_phy_type() to avoid code duplication.
Signed-off-by: Ramneek Mehresh ramneek.mehresh@nxp.com Signed-off-by: Sriram Dash sriram.dash@nxp.com
Is this just moving the code ? If so, please resubmit and use git format-patch -M -C to generate the patches for the submission. It makes it much easier to detect moved files.

Please find my reply inline
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Thursday, February 25, 2016 11:28 PM To: Sriram Dash sriram.dash@nxp.com; u-boot@lists.denx.de Cc: york sun york.sun@nxp.com; Ramneek Mehresh ramneek.mehresh@nxp.com; Rajesh Bhagat rajesh.bhagat@nxp.com Subject: Re: [PATCH v2 1/2] board:freescale:common: Move device-tree fixup framework to common file
On 02/24/2016 05:44 AM, Sriram Dash wrote:
Move usb device-tree fixup framework from ehci-fsl.c to common place so that it can be used by other drivers as well (xhci-fsl.c). Also, call fdt_usb_get_node_type() from fdt_fixup_usb_mode_phy_type() to avoid code duplication.
Signed-off-by: Ramneek Mehresh ramneek.mehresh@nxp.com Signed-off-by: Sriram Dash sriram.dash@nxp.com
Is this just moving the code ? If so, please resubmit and use git format-patch -M -C to generate the patches for the submission. It makes it much easier to detect moved files.
[Sriram] No, this patch is performing two actions:
1. Move usb device-tree fixup framework from ehci-fsl.c to common place so that it can be used by other drivers as well (xhci-fsl.c).
2. Call fdt_usb_get_node_type() from fdt_fixup_usb_mode_phy_type() to avoid code duplication.

On 02/26/2016 05:07 PM, Sriram Dash wrote:
Please find my reply inline
Please stop top-posting.
Also please fix your mailer so it quotes correctly with '>'
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Thursday, February 25, 2016 11:28 PM To: Sriram Dash sriram.dash@nxp.com; u-boot@lists.denx.de Cc: york sun york.sun@nxp.com; Ramneek Mehresh ramneek.mehresh@nxp.com; Rajesh Bhagat rajesh.bhagat@nxp.com Subject: Re: [PATCH v2 1/2] board:freescale:common: Move device-tree fixup framework to common file
On 02/24/2016 05:44 AM, Sriram Dash wrote:
Move usb device-tree fixup framework from ehci-fsl.c to common place so that it can be used by other drivers as well (xhci-fsl.c). Also, call fdt_usb_get_node_type() from fdt_fixup_usb_mode_phy_type() to avoid code duplication.
Signed-off-by: Ramneek Mehresh ramneek.mehresh@nxp.com Signed-off-by: Sriram Dash sriram.dash@nxp.com
Is this just moving the code ? If so, please resubmit and use git format-patch -M -C to generate the patches for the submission. It makes it much easier to detect moved files.
[Sriram] No, this patch is performing two actions:
- Move usb device-tree fixup framework from ehci-fsl.c to common
place so that it can be used by other drivers as well (xhci-fsl.c).
- Call fdt_usb_get_node_type() from fdt_fixup_usb_mode_phy_type() to
avoid code duplication.
Then it should be two patches.

Enables usb device-tree fixup code to incorporate xhci controller
Signed-off-by: Ramneek Mehresh ramneek.mehresh@nxp.com Signed-off-by: Sriram Dash sriram.dash@nxp.com --- board/freescale/common/Makefile | 4 +++- board/freescale/common/usb.c | 11 +++++++++-- include/fdt_support.h | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile index 62de45c..8388f47 100644 --- a/board/freescale/common/Makefile +++ b/board/freescale/common/Makefile @@ -13,7 +13,9 @@ MINIMAL=y endif endif
-obj-$(CONFIG_USB_EHCI_FSL) += usb.o +ifneq ($(filter y,$(CONFIG_USB_EHCI_FSL) $(CONFIG_USB_XHCI_FSL)),) +obj-y += usb.o +endif
ifdef MINIMAL # necessary to create built-in.o diff --git a/board/freescale/common/usb.c b/board/freescale/common/usb.c index 7a35e92..b06daa0 100644 --- a/board/freescale/common/usb.c +++ b/board/freescale/common/usb.c @@ -23,6 +23,7 @@ static const char *fdt_usb_get_node_type(void *blob, int start_offset, { const char *compat_dr = "fsl-usb2-dr"; const char *compat_mph = "fsl-usb2-mph"; + const char *compat_snps = "snps,dwc3"; const char *node_type = NULL;
*node_offset = fdt_node_offset_by_compatible(blob, start_offset, @@ -32,8 +33,14 @@ static const char *fdt_usb_get_node_type(void *blob, int start_offset, start_offset, compat_dr); if (*node_offset < 0) { - printf("ERROR: could not find compatible node: %s\n", - fdt_strerror(*node_offset)); + *node_offset = fdt_node_offset_by_compatible + (blob, start_offset, compat_snps); + if (*node_offset < 0) { + printf("ERROR:could not find node:%s", + fdt_strerror(*node_offset)); + } else { + node_type = compat_snps; + } } else { node_type = compat_dr; } diff --git a/include/fdt_support.h b/include/fdt_support.h index 296add0..d34e959 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -113,11 +113,11 @@ void fdt_fixup_qe_firmware(void *fdt); */ int fdt_fixup_display(void *blob, const char *path, const char *display);
-#if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) +#if defined(CONFIG_USB_EHCI_FSL) || defined(CONFIG_USB_XHCI_FSL) void fdt_fixup_dr_usb(void *blob, bd_t *bd); #else static inline void fdt_fixup_dr_usb(void *blob, bd_t *bd) {} -#endif /* defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) */ +#endif /* defined(CONFIG_USB_EHCI_FSL) || defined(CONFIG_USB_XHCI_FSL) */
#if defined(CONFIG_SYS_FSL_SEC_COMPAT) void fdt_fixup_crypto_node(void *blob, int sec_rev);

On 02/24/2016 05:44 AM, Sriram Dash wrote:
Enables usb device-tree fixup code to incorporate xhci controller
Signed-off-by: Ramneek Mehresh ramneek.mehresh@nxp.com Signed-off-by: Sriram Dash sriram.dash@nxp.com
board/freescale/common/Makefile | 4 +++- board/freescale/common/usb.c | 11 +++++++++-- include/fdt_support.h | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile index 62de45c..8388f47 100644 --- a/board/freescale/common/Makefile +++ b/board/freescale/common/Makefile @@ -13,7 +13,9 @@ MINIMAL=y endif endif
-obj-$(CONFIG_USB_EHCI_FSL) += usb.o +ifneq ($(filter y,$(CONFIG_USB_EHCI_FSL) $(CONFIG_USB_XHCI_FSL)),) +obj-y += usb.o +endif
Please just add:
obj-$(CONFIG_USB_XHCI_FSL) += usb.o
here. Kbuild takes care of duplicities.
ifdef MINIMAL # necessary to create built-in.o diff --git a/board/freescale/common/usb.c b/board/freescale/common/usb.c index 7a35e92..b06daa0 100644 --- a/board/freescale/common/usb.c +++ b/board/freescale/common/usb.c @@ -23,6 +23,7 @@ static const char *fdt_usb_get_node_type(void *blob, int start_offset, { const char *compat_dr = "fsl-usb2-dr"; const char *compat_mph = "fsl-usb2-mph";
- const char *compat_snps = "snps,dwc3";
Will you add more random variables here once you add another DT compat string for another controller? You might want to learn about C arrays :)
const char *node_type = NULL;
*node_offset = fdt_node_offset_by_compatible(blob, start_offset, @@ -32,8 +33,14 @@ static const char *fdt_usb_get_node_type(void *blob, int start_offset, start_offset, compat_dr); if (*node_offset < 0) {
printf("ERROR: could not find compatible node: %s\n",
fdt_strerror(*node_offset));
*node_offset = fdt_node_offset_by_compatible
(blob, start_offset, compat_snps);
if (*node_offset < 0) {
printf("ERROR:could not find node:%s",
fdt_strerror(*node_offset));
} else {
node_type = compat_snps;
} else { node_type = compat_dr; }}
diff --git a/include/fdt_support.h b/include/fdt_support.h index 296add0..d34e959 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -113,11 +113,11 @@ void fdt_fixup_qe_firmware(void *fdt); */ int fdt_fixup_display(void *blob, const char *path, const char *display);
-#if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) +#if defined(CONFIG_USB_EHCI_FSL) || defined(CONFIG_USB_XHCI_FSL)
This change looks unrelated.
void fdt_fixup_dr_usb(void *blob, bd_t *bd); #else static inline void fdt_fixup_dr_usb(void *blob, bd_t *bd) {} -#endif /* defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) */ +#endif /* defined(CONFIG_USB_EHCI_FSL) || defined(CONFIG_USB_XHCI_FSL) */
#if defined(CONFIG_SYS_FSL_SEC_COMPAT) void fdt_fixup_crypto_node(void *blob, int sec_rev);

Please find my reply inline
-----Original Message----- From: Marek Vasut [mailto:marex@denx.de] Sent: Thursday, February 25, 2016 11:31 PM To: Sriram Dash sriram.dash@nxp.com; u-boot@lists.denx.de Cc: york sun york.sun@nxp.com; Ramneek Mehresh ramneek.mehresh@nxp.com; Rajesh Bhagat rajesh.bhagat@nxp.com Subject: Re: [PATCH v2 2/2] board:freescale:usb: Add device-tree fixup support for xhci controller
On 02/24/2016 05:44 AM, Sriram Dash wrote:
Enables usb device-tree fixup code to incorporate xhci controller
Signed-off-by: Ramneek Mehresh ramneek.mehresh@nxp.com Signed-off-by: Sriram Dash sriram.dash@nxp.com
board/freescale/common/Makefile | 4 +++- board/freescale/common/usb.c | 11 +++++++++-- include/fdt_support.h | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile index 62de45c..8388f47 100644 --- a/board/freescale/common/Makefile +++ b/board/freescale/common/Makefile @@ -13,7 +13,9 @@ MINIMAL=y endif endif
-obj-$(CONFIG_USB_EHCI_FSL) += usb.o +ifneq ($(filter y,$(CONFIG_USB_EHCI_FSL) $(CONFIG_USB_XHCI_FSL)),) +obj-y += usb.o endif
Please just add:
obj-$(CONFIG_USB_XHCI_FSL) += usb.o
here. Kbuild takes care of duplicities.
[Sriram] Accepted, Will change in v3 of patch
ifdef MINIMAL # necessary to create built-in.o diff --git a/board/freescale/common/usb.c b/board/freescale/common/usb.c index 7a35e92..b06daa0 100644 --- a/board/freescale/common/usb.c +++ b/board/freescale/common/usb.c @@ -23,6 +23,7 @@ static const char *fdt_usb_get_node_type(void *blob, int start_offset, { const char *compat_dr = "fsl-usb2-dr"; const char *compat_mph = "fsl-usb2-mph";
- const char *compat_snps = "snps,dwc3";
Will you add more random variables here once you add another DT compat string for another controller? You might want to learn about C arrays :)
[Sriram] Accepted, Will change in v3 of patch
const char *node_type = NULL;
*node_offset = fdt_node_offset_by_compatible(blob, start_offset, @@ -32,8 +33,14 @@ static const char *fdt_usb_get_node_type(void *blob, int start_offset, start_offset, compat_dr); if (*node_offset < 0) {
printf("ERROR: could not find compatible node: %s\n",
fdt_strerror(*node_offset));
*node_offset = fdt_node_offset_by_compatible
(blob, start_offset, compat_snps);
if (*node_offset < 0) {
printf("ERROR:could not find node:%s",
fdt_strerror(*node_offset));
} else {
node_type = compat_snps;
} else { node_type = compat_dr; }}
diff --git a/include/fdt_support.h b/include/fdt_support.h index 296add0..d34e959 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -113,11 +113,11 @@ void fdt_fixup_qe_firmware(void *fdt); */ int fdt_fixup_display(void *blob, const char *path, const char *display);
-#if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) +#if defined(CONFIG_USB_EHCI_FSL) || defined(CONFIG_USB_XHCI_FSL)
This change looks unrelated.
[Sriram] fdt_fixup_dr_usb is currently for fixing device tree for EHCI. We are planning to use this for XHCI also.
void fdt_fixup_dr_usb(void *blob, bd_t *bd); #else static inline void fdt_fixup_dr_usb(void *blob, bd_t *bd) {} -#endif /* defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) */ +#endif /* defined(CONFIG_USB_EHCI_FSL) || +defined(CONFIG_USB_XHCI_FSL) */
#if defined(CONFIG_SYS_FSL_SEC_COMPAT) void fdt_fixup_crypto_node(void *blob, int sec_rev);
participants (4)
-
Marek Vasut
-
Ramneek Mehresh
-
Ramneek Mehresh
-
Sriram Dash