[U-Boot] [PATCH 5/5] usb: xhci: fsl: Add workaround for USB erratum A-008751

Sriram Dash sriram.dash at nxp.com
Thu May 26 07:59:27 CEST 2016


This patch is doing the following:
1. Implementing the errata for LS2080.
2. Adding fixup for fdt for LS2080.

Signed-off-by: Sriram Dash <sriram.dash at nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat at nxp.com>
---
 .../include/asm/arch-fsl-layerscape/immap_lsch3.h  |  1 +
 board/freescale/ls2080aqds/ls2080aqds.c            |  2 ++
 board/freescale/ls2080ardb/ls2080ardb.c            |  2 ++
 drivers/usb/common/fsl-dt-fixup.c                  |  2 ++
 drivers/usb/host/xhci-fsl.c                        | 29 ++++++++++++++++++++++
 include/fsl_usb.h                                  | 15 +++++++++++
 6 files changed, 51 insertions(+)

diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
index e48bbaf..9b60bd3 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
@@ -139,6 +139,7 @@
 /* Supplemental Configuration */
 #define SCFG_BASE		0x01fc0000
 #define SCFG_USB3PRM1CR			0x000
+#define SCFG_USB3PRM1CR_INIT		0x27672b2a
 
 #define TP_ITYP_AV		0x00000001	/* Initiator available */
 #define TP_ITYP_TYPE(x)	(((x) & 0x6) >> 1)	/* Initiator Type */
diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c
index b3bd40a..97892f8 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -296,6 +296,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 	fdt_fixup_memory_banks(blob, base, size, 2);
 
+	fdt_fixup_dr_usb(blob, bd);
+
 #ifdef CONFIG_FSL_MC_ENET
 	fdt_fixup_board_enet(blob);
 	err = fsl_mc_ldpaa_exit(bd);
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
index fb39af6..39b8ea3 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -275,6 +275,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 	fdt_fixup_memory_banks(blob, base, size, 2);
 
+	fdt_fixup_dr_usb(blob, bd);
+
 #ifdef CONFIG_FSL_MC_ENET
 	fdt_fixup_board_enet(blob);
 	err = fsl_mc_ldpaa_exit(bd);
diff --git a/drivers/usb/common/fsl-dt-fixup.c b/drivers/usb/common/fsl-dt-fixup.c
index 47e1049..6b2e47c 100644
--- a/drivers/usb/common/fsl-dt-fixup.c
+++ b/drivers/usb/common/fsl-dt-fixup.c
@@ -121,6 +121,7 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
 	int usb_erratum_a007075_off = -1;
 	int usb_erratum_a007792_off = -1;
 	int usb_erratum_a005697_off = -1;
+	int usb_erratum_a008751_off = -1;
 	int usb_mode_off = -1;
 	int usb_phy_off = -1;
 	char str[5];
@@ -182,5 +183,6 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
 		FDT_FIXUP_ERRATUM(a007075);
 		FDT_FIXUP_ERRATUM(a007792);
 		FDT_FIXUP_ERRATUM(a005697);
+		FDT_FIXUP_ERRATUM(a008751);
 	}
 }
diff --git a/drivers/usb/host/xhci-fsl.c b/drivers/usb/host/xhci-fsl.c
index 05f09d7..d55ed87 100644
--- a/drivers/usb/host/xhci-fsl.c
+++ b/drivers/usb/host/xhci-fsl.c
@@ -15,6 +15,8 @@
 #include <linux/usb/xhci-fsl.h>
 #include <linux/usb/dwc3.h>
 #include "xhci.h"
+#include <fsl_errata.h>
+#include <fsl_usb.h>
 
 /* Declare global data pointer */
 DECLARE_GLOBAL_DATA_PTR;
@@ -27,6 +29,31 @@ __weak int __board_usb_init(int index, enum usb_init_type init)
 	return 0;
 }
 
+static inline bool  erratum_a008751(void)
+{
+#if defined(CONFIG_TARGET_LS2080AQDS) || defined(CONFIG_TARGET_LS2080ARDB)
+	u32 __iomem *scfg = (u32 __iomem *)SCFG_BASE;
+	writel(SCFG_USB3PRM1CR_INIT, scfg + SCFG_USB3PRM1CR / 4);
+	return true;
+#endif
+	return false;
+}
+
+#define APPLY_ERRATUM(id)						\
+do {									\
+	bool ret;							\
+	if (has_erratum_##id()) {					\
+		ret = erratum_##id();					\
+		if (ret <= 0)						\
+			puts("Failed to apply erratum " #id "\n");	\
+	}								\
+} while (0)
+
+static void fsl_apply_xhci_errata(void)
+{
+	APPLY_ERRATUM(a008751);
+}
+
 static int fsl_xhci_core_init(struct fsl_xhci *fsl_xhci)
 {
 	int ret = 0;
@@ -69,6 +96,8 @@ int xhci_hcd_init(int index, struct xhci_hccr **hccr, struct xhci_hcor **hcor)
 		return ret;
 	}
 
+	fsl_apply_xhci_errata();
+
 	ret = fsl_xhci_core_init(ctx);
 	if (ret < 0) {
 		puts("Failed to initialize xhci\n");
diff --git a/include/fsl_usb.h b/include/fsl_usb.h
index d9db0ea..97f9dd6 100644
--- a/include/fsl_usb.h
+++ b/include/fsl_usb.h
@@ -250,5 +250,20 @@ static inline bool has_erratum_a004477(void)
 	return false;
 }
 
+static inline bool has_erratum_a008751(void)
+{
+	u32 svr = get_svr();
+	u32 soc = SVR_SOC_VER(svr);
+
+	switch (soc) {
+#ifdef CONFIG_ARM64
+	case SVR_LS2080:
+	case SVR_LS2085:
+		return IS_SVR_REV(svr, 1, 0);
+#endif
+	}
+	return false;
+}
+
 #endif
 #endif /*_ASM_FSL_USB_H_ */
-- 
2.1.0



More information about the U-Boot mailing list