[U-Boot] [PATCH v2 2/2] board:freescale:usb: Add device-tree fixup support for xhci controller

Sriram Dash
2016-02-24T04:44:08Z

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);
--
2.1.0