diff options
author | Wolfgang Denk <wd@denx.de> | 2012-02-17 23:54:17 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2012-02-17 23:54:17 +0100 |
commit | 7dda0c3759c6ee190d44b8ceaeab58047cb9a957 (patch) | |
tree | 0f57973c1ee7fa4344e07cf271fe16d2616b82f4 /arch | |
parent | dbe20fc79736d4f99a9bfaafeae600c9348504df (diff) | |
parent | 79f49120ba481ed736face73ecf11a6c1070a861 (diff) | |
download | u-boot-imx-7dda0c3759c6ee190d44b8ceaeab58047cb9a957.zip u-boot-imx-7dda0c3759c6ee190d44b8ceaeab58047cb9a957.tar.gz u-boot-imx-7dda0c3759c6ee190d44b8ceaeab58047cb9a957.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
* 'master' of git://git.denx.de/u-boot-mpc85xx:
powerpc/8xxx:Add MPH controller support in USB device-tree fixup
powerpc/8xxx: Cleanup USB device-tree fixup
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/cpu/mpc8xxx/fdt.c | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c index d07ae1b..09810be 100644 --- a/arch/powerpc/cpu/mpc8xxx/fdt.c +++ b/arch/powerpc/cpu/mpc8xxx/fdt.c @@ -1,5 +1,5 @@ /* - * Copyright 2009-2011 Freescale Semiconductor, Inc. + * Copyright 2009-2012 Freescale Semiconductor, Inc. * * This file is derived from arch/powerpc/cpu/mpc85xx/cpu.c and * arch/powerpc/cpu/mpc86xx/cpu.c. Basically this file contains @@ -86,30 +86,39 @@ void ft_fixup_num_cores(void *blob) { } #endif /* defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) */ -#ifdef CONFIG_HAS_FSL_DR_USB +#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 = "fsl-usb2-dr"; + 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); + start_offset, compat_mph); if (node_offset < 0) { - printf("WARNING: could not find compatible node %s: %s.\n", - compat, fdt_strerror(node_offset)); - return -1; - } + node_offset = fdt_node_offset_by_compatible(blob, + start_offset, compat_dr); + if (node_offset < 0) { + printf("WARNING: could not find compatible" + " node %s or %s: %s.\n", compat_mph, + compat_dr, fdt_strerror(node_offset)); + return -1; + } else + 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, compat, fdt_strerror(err)); + prop_mode, node_type, fdt_strerror(err)); } if (phy_type) { @@ -117,7 +126,7 @@ static int fdt_fixup_usb_mode_phy_type(void *blob, const char *mode, strlen(phy_type) + 1); if (err < 0) printf("WARNING: could not set %s for %s: %s.\n", - prop_type, compat, fdt_strerror(err)); + prop_type, node_type, fdt_strerror(err)); } return node_offset; @@ -137,28 +146,34 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd) for (i = 1; i <= FSL_MAX_NUM_USB_CTRLS; i++) { int mode_idx = -1, phy_idx = -1; - sprintf(str, "%s%d", "usb", i); + snprintf(str, 5, "%s%d", "usb", i); if (hwconfig(str)) { - for (j = 0; j < sizeof(modes); j++) { + 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 < sizeof(phys); j++) { + 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) + if (mode_idx >= 0) { usb_mode_off = fdt_fixup_usb_mode_phy_type(blob, modes[mode_idx], NULL, usb_mode_off); - if (phy_idx >= 0) + if (usb_mode_off < 0) + return; + } + if (phy_idx >= 0) { usb_phy_off = fdt_fixup_usb_mode_phy_type(blob, NULL, phys[phy_idx], usb_phy_off); + if (usb_phy_off < 0) + return; + } if (!strcmp(str, "usb1")) usb1_defined = 1; if (mode_idx < 0 && phy_idx < 0) @@ -174,7 +189,7 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd) fdt_fixup_usb_mode_phy_type(blob, mode, phy_type, usb_off); } } -#endif /* CONFIG_HAS_FSL_DR_USB */ +#endif /* defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) */ /* * update crypto node properties to a specified revision of the SEC |