diff options
author | Ramneek Mehresh <ramneek.mehresh@freescale.com> | 2011-05-12 14:00:36 (GMT) |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2011-07-11 18:24:20 (GMT) |
commit | 86dda504847e6b05b01a4c37ebbafff4cbf78eac (patch) | |
tree | 32cfe77afc5f42123112e8d268102b5571943f52 /board/freescale/p1_p2_rdb | |
parent | 636c316f9b1d75242c6b53dbfe308414067f20f4 (diff) | |
download | u-boot-fsl-qoriq-86dda504847e6b05b01a4c37ebbafff4cbf78eac.tar.xz |
qoriq/p1_p2_rdb: USB device-tree fixups for P1020
Resolve P1020 second USB controller multiplexing with eLBC
- mandatory to mention USB2 in hwconfig string to select it
over eLBC, otherwise USB2 node is removed
- works only for SPI and SD boot
Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'board/freescale/p1_p2_rdb')
-rw-r--r-- | board/freescale/p1_p2_rdb/p1_p2_rdb.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/board/freescale/p1_p2_rdb/p1_p2_rdb.c b/board/freescale/p1_p2_rdb/p1_p2_rdb.c index d66b130..864b3ce 100644 --- a/board/freescale/p1_p2_rdb/p1_p2_rdb.c +++ b/board/freescale/p1_p2_rdb/p1_p2_rdb.c @@ -37,6 +37,7 @@ #include <netdev.h> #include <rtc.h> #include <i2c.h> +#include <hwconfig.h> DECLARE_GLOBAL_DATA_PTR; @@ -247,6 +248,8 @@ extern void ft_pci_board_setup(void *blob); void ft_board_setup(void *blob, bd_t *bd) { + const char *soc_usb_compat = "fsl-usb2-dr"; + int err, usb1_off, usb2_off; phys_addr_t base; phys_size_t size; @@ -260,5 +263,49 @@ void ft_board_setup(void *blob, bd_t *bd) #endif /* #if defined(CONFIG_PCI) */ fdt_fixup_memory(blob, (u64)base, (u64)size); + + fdt_fixup_dr_usb(blob, bd); + +#if defined(CONFIG_SDCARD) || defined(CONFIG_SPIFLASH) + /* Delete eLBC node as it is muxed with USB2 controller */ + if (hwconfig("usb2")) { + const char *soc_elbc_compat = "fsl,p1020-elbc"; + int off = fdt_node_offset_by_compatible(blob, -1, + soc_elbc_compat); + if (off < 0) { + printf("WARNING: could not find compatible node" + " %s: %s.\n", soc_elbc_compat, + fdt_strerror(off)); + return; + } + err = fdt_del_node(blob, off); + if (err < 0) { + printf("WARNING: could not remove %s: %s.\n", + soc_elbc_compat, fdt_strerror(err)); + } + return; + } +#endif + /* Delete USB2 node as it is muxed with eLBC */ + usb1_off = fdt_node_offset_by_compatible(blob, -1, + soc_usb_compat); + if (usb1_off < 0) { + printf("WARNING: could not find compatible node" + " %s: %s.\n", soc_usb_compat, + fdt_strerror(usb1_off)); + return; + } + usb2_off = fdt_node_offset_by_compatible(blob, usb1_off, + soc_usb_compat); + if (usb2_off < 0) { + printf("WARNING: could not find compatible node" + " %s: %s.\n", soc_usb_compat, + fdt_strerror(usb2_off)); + return; + } + err = fdt_del_node(blob, usb2_off); + if (err < 0) + printf("WARNING: could not remove %s: %s.\n", + soc_usb_compat, fdt_strerror(err)); } #endif |