Skip to contentSkip to conversation

Supporting ARM v8 USB errata for FSL

PATCH Superseded Sriram Dash 2 participants 12 messages May 26, 2016 – May 27, 2016

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover Supporting ARM v8 USB errata for FSL

The patch-set does the following :

1. Adds support for ARM for USB Erratum Checking code for implementing the USB Erratum for fsl.
2. Performs code cleanup to reduce redundancy when adding fsl device tree fixup.
3. Implements Erratum A008751 for LS2 platform.

Sriram Dash (5):
arm64: fsl-layerscape: add get_svr and IS_SVR_REV helper
usb: xhci: fsl: code cleanup for device tree fixup for fsl usb
controllers
fsl: usb: make errata function common for PPC and ARM armv8/ls2080: Remove workaround for erratum A008751
usb: xhci: fsl: Add workaround for USB erratum A-008751

 arch/arm/cpu/armv8/fsl-layerscape/cpu.c            |  7 +++
 arch/arm/cpu/armv8/fsl-layerscape/soc.c            | 10 ----
 arch/arm/include/asm/arch-fsl-layerscape/config.h  |  1 -
 .../include/asm/arch-fsl-layerscape/immap_lsch2.h  |  2 +
 .../include/asm/arch-fsl-layerscape/immap_lsch3.h  |  4 ++
 arch/arm/include/asm/arch-fsl-layerscape/soc.h     |  2 +
 board/freescale/ls2080aqds/ls2080aqds.c            |  2 +
 board/freescale/ls2080ardb/ls2080ardb.c            |  2 +
 drivers/usb/common/fsl-dt-fixup.c                  | 54 ++++++++-------------
 drivers/usb/host/xhci-fsl.c                        | 24 ++++++++++
 include/fsl_usb.h                                  | 56 ++++++++++------------
 11 files changed, 89 insertions(+), 75 deletions(-)
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/5 arm64: fsl-layerscape: add get_svr and IS_SVR_REV helper

---
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c                | 7 +++++++
 arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h | 2 ++
 arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h | 3 +++
 arch/arm/include/asm/arch-fsl-layerscape/soc.h         | 2 ++
 4 files changed, 14 insertions(+)
arch/arm/cpu/armv8/fsl-layerscape/cpu.c +7 -0
index 9a5a6b5..9c575c1 100644
@@ -528,6 +528,13 @@ u32 fsl_qoriq_core_to_type(unsigned int core)
 	return -1;      /* cannot identify the cluster */
 }
 
+uint get_svr(void)
+{
+	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+
+	return gur_in32(&gur->svr);
+}
+
 #ifdef CONFIG_DISPLAY_CPUINFO
 int print_cpuinfo(void)
 {
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +2 -0
index 57b99d4..4151994 100644
@@ -592,4 +592,6 @@ struct ccsr_cci400 {
 #define SCR0_CLIENTPD_MASK		0x00000001
 #define SCR0_USFCFG_MASK		0x00000400
 
+uint get_svr(void);
+
 #endif	/* __ARCH_FSL_LSCH2_IMMAP_H__*/
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h +3 -0
index 65b3357..e48bbaf 100644
@@ -319,4 +319,7 @@ struct ccsr_reset {
 	u32 ip_rev1;			/* 0xbf8 */
 	u32 ip_rev2;			/* 0xbfc */
 };
+
+uint get_svr(void);
+
 #endif /* __ARCH_FSL_LSCH3_IMMAP_H_ */
arch/arm/include/asm/arch-fsl-layerscape/soc.h +2 -0
index 831d817..3f1a0a8 100644
@@ -52,6 +52,8 @@ struct cpu_type {
 #define SVR_MIN(svr)		(((svr) >> 0) & 0xf)
 #define SVR_SOC_VER(svr)	(((svr) >> 8) & SVR_WO_E)
 #define IS_E_PROCESSOR(svr)	(!((svr >> 8) & 0x1))
+#define IS_SVR_REV(svr, maj, min) \
+		((SVR_MAJ(svr) == maj) && (SVR_MIN(svr) == min))
 
 /* ahci port register default value */
 #define AHCI_PORT_PHY_1_CFG    0xa003fffe
Signature · 1 line
2.1.0
#2 lore raw

PATCH 2/5 usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers

In reply to Sriram Dash
---
 drivers/usb/common/fsl-dt-fixup.c | 51 +++++++++++++--------------------------
 1 file changed, 17 insertions(+), 34 deletions(-)
drivers/usb/common/fsl-dt-fixup.c +17 -34
index 6f31932..520130e 100644
@@ -99,6 +99,19 @@ static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum,
 	return node_offset;
 }
 
+#define FDT_FIXUP_ERRATUM(id)						\
+do {									\
+	if (has_erratum_##id()) {					\
+		usb_erratum_##id##_off =  fdt_fixup_usb_erratum		\
+					   (blob,			\
+					    "fsl,usb-erratum-"#id,	\
+					    usb_erratum_##id##_off);	\
+		if (usb_erratum_##id##_off < 0)				\
+			return;						\
+		debug("Adding USB erratum "#id"\n");			\
+	}								\
+} while (0)
+
 void fdt_fixup_dr_usb(void *blob, bd_t *bd)
 {
 	static const char * const modes[] = { "host", "peripheral", "otg" };
@@ -164,39 +177,9 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
 		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;
-		}
+		FDT_FIXUP_ERRATUM(a006261);
+		FDT_FIXUP_ERRATUM(a007075);
+		FDT_FIXUP_ERRATUM(a007792);
+		FDT_FIXUP_ERRATUM(a005697);
 	}
 }
Signature · 1 line
2.1.0
#3 lore raw

PATCH 2/5 usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers

On 05/26/2016 07:59 AM, Sriram Dash wrote:

Commit message, please.

Quoted 16 lines
---
 drivers/usb/common/fsl-dt-fixup.c | 51 +++++++++++++--------------------------
 1 file changed, 17 insertions(+), 34 deletions(-)
drivers/usb/common/fsl-dt-fixup.c +2 -0
index 6f31932..520130e 100644
@@ -99,6 +99,19 @@ static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum,
 	return node_offset;
 }
 
+#define FDT_FIXUP_ERRATUM(id)						\
+do {									\

drivers/usb/common/fsl-dt-fixup.c static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum, · line 113

Quoted 10 lines
drivers/usb/common/fsl-dt-fixup.c +10 -0
+	if (has_erratum_##id()) {					\
+		usb_erratum_##id##_off =  fdt_fixup_usb_erratum		\
+					   (blob,			\
+					    "fsl,usb-erratum-"#id,	\
+					    usb_erratum_##id##_off);	\
+		if (usb_erratum_##id##_off < 0)				\
+			return;						\
+		debug("Adding USB erratum "#id"\n");			\
+	}								\
+} while (0)

Would it be difficult to turn this into a function ?

You can likely implement some function like
int fsl_has_erratum(const unsigned int erratum) and then do the string concatenation with snprintf().

Quoted 48 lines
drivers/usb/common/fsl-dt-fixup.c +4 -34
 void fdt_fixup_dr_usb(void *blob, bd_t *bd)
 {
 	static const char * const modes[] = { "host", "peripheral", "otg" };
@@ -164,39 +177,9 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
 		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;
-		}
+		FDT_FIXUP_ERRATUM(a006261);
+		FDT_FIXUP_ERRATUM(a007075);
+		FDT_FIXUP_ERRATUM(a007792);
+		FDT_FIXUP_ERRATUM(a005697);
 	}
 }
Signature · 2 lines
Best regards,
Marek Vasut
#4 lore raw

PATCH 2/5 usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers

Quoted 9 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: Thursday, May 26, 2016 5:49 PM
To: Sriram Dash <[email protected]>; u-boot at lists.denx.de
Cc: york sun <[email protected]>; albert.u.boot at aribaud.net; Rajesh Bhagat <[email protected]>
Subject: Re: [PATCH 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers

Quoted 4 lines

On 05/26/2016 07:59 AM, Sriram Dash wrote:

Commit message, please.

Will take care in v2.

Quoted 32 lines

drivers/usb/common/fsl-dt-fixup.c static int fdt_fixup_usb_erratum(void *blob, const char

Quoted 13 lines
---
 drivers/usb/common/fsl-dt-fixup.c | 51
+++++++++++++--------------------------
 1 file changed, 17 insertions(+), 34 deletions(-)
drivers/usb/common/fsl-dt-fixup.c +0 -0
index 6f31932..520130e 100644
@@ -99,6 +99,19 @@ static int fdt_fixup_usb_erratum(void *blob, const char

*prop_erratum,

Quoted 5 lines
drivers/usb/common/fsl-dt-fixup.c +2 -0
 	return node_offset;
 }
 
+#define FDT_FIXUP_ERRATUM(id)						\
+do {									\

drivers/usb/common/fsl-dt-fixup.c static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum, · line 113

Quoted 10 lines
drivers/usb/common/fsl-dt-fixup.c +10 -0
+	if (has_erratum_##id()) {					\
+		usb_erratum_##id##_off =  fdt_fixup_usb_erratum		\
+					   (blob,			\
+					    "fsl,usb-erratum-"#id,	\
+					    usb_erratum_##id##_off);	\
+		if (usb_erratum_##id##_off < 0)				\
+			return;						\
+		debug("Adding USB erratum "#id"\n");			\
+	}								\
+} while (0)

Would it be difficult to turn this into a function ?

Quoted 3 lines

You can likely implement some function like int fsl_has_erratum(const unsigned int erratum) and then do the string concatenation with snprintf().

Do you suspect any possible issue with macro implementation, or your comment is for reducing the size of U boot by making it a function?

Quoted 52 lines
Quoted 37 lines
drivers/usb/common/fsl-dt-fixup.c +0 -30
 void fdt_fixup_dr_usb(void *blob, bd_t *bd)  {
 	static const char * const modes[] = { "host", "peripheral", "otg" };
@@ -164,39 +177,9 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
 		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",

drivers/usb/common/fsl-dt-fixup.c void fdt_fixup_dr_usb(void *blob, bd_t *bd) · line 185

Quoted 10 lines
drivers/usb/common/fsl-dt-fixup.c +4 -4
-						    usb_erratum_a005697_off);
-			if (usb_erratum_a005697_off < 0)
-				return;
-		}
+		FDT_FIXUP_ERRATUM(a006261);
+		FDT_FIXUP_ERRATUM(a007075);
+		FDT_FIXUP_ERRATUM(a007792);
+		FDT_FIXUP_ERRATUM(a005697);
 	}
 }

--
Best regards,
Marek Vasut

#5 lore raw

PATCH 2/5 usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers

Quoted 48 lines · Sriram Dash
Quoted 9 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: Thursday, May 26, 2016 5:49 PM
To: Sriram Dash <[email protected]>; u-boot at lists.denx.de
Cc: york sun <[email protected]>; albert.u.boot at aribaud.net; Rajesh Bhagat <[email protected]>
Subject: Re: [PATCH 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers

Quoted 4 lines

On 05/26/2016 07:59 AM, Sriram Dash wrote:

Commit message, please.

Will take care in v2.

Quoted 32 lines

drivers/usb/common/fsl-dt-fixup.c static int fdt_fixup_usb_erratum(void *blob, const char

Quoted 13 lines
---
 drivers/usb/common/fsl-dt-fixup.c | 51
+++++++++++++--------------------------
 1 file changed, 17 insertions(+), 34 deletions(-)
drivers/usb/common/fsl-dt-fixup.c +0 -0
index 6f31932..520130e 100644
@@ -99,6 +99,19 @@ static int fdt_fixup_usb_erratum(void *blob, const char

*prop_erratum,

Quoted 5 lines
drivers/usb/common/fsl-dt-fixup.c +2 -0
 	return node_offset;
 }
 
+#define FDT_FIXUP_ERRATUM(id)						\
+do {									\

drivers/usb/common/fsl-dt-fixup.c static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum, · line 113

Quoted 10 lines
drivers/usb/common/fsl-dt-fixup.c +10 -0
+	if (has_erratum_##id()) {					\
+		usb_erratum_##id##_off =  fdt_fixup_usb_erratum		\
+					   (blob,			\
+					    "fsl,usb-erratum-"#id,	\
+					    usb_erratum_##id##_off);	\
+		if (usb_erratum_##id##_off < 0)				\
+			return;						\
+		debug("Adding USB erratum "#id"\n");			\
+	}								\
+} while (0)

Would it be difficult to turn this into a function ?

Quoted 5 lines
Quoted 3 lines

You can likely implement some function like int fsl_has_erratum(const unsigned int erratum) and then do the string concatenation with snprintf().

Do you suspect any possible issue with macro implementation, or your comment is for reducing the size of U boot by making it a function?

I'm not a fan of huge macros, since they often introduce various subtle issues and in this case it would most likely reduce size of the u-boot.

Quoted 52 lines
Quoted 52 lines
Quoted 37 lines
drivers/usb/common/fsl-dt-fixup.c +0 -30
 void fdt_fixup_dr_usb(void *blob, bd_t *bd)  {
 	static const char * const modes[] = { "host", "peripheral", "otg" };
@@ -164,39 +177,9 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
 		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",

drivers/usb/common/fsl-dt-fixup.c void fdt_fixup_dr_usb(void *blob, bd_t *bd) · line 185

Quoted 10 lines
drivers/usb/common/fsl-dt-fixup.c +4 -4
-						    usb_erratum_a005697_off);
-			if (usb_erratum_a005697_off < 0)
-				return;
-		}
+		FDT_FIXUP_ERRATUM(a006261);
+		FDT_FIXUP_ERRATUM(a007075);
+		FDT_FIXUP_ERRATUM(a007792);
+		FDT_FIXUP_ERRATUM(a005697);
 	}
 }

--
Best regards,
Marek Vasut

Signature · 2 lines
Best regards,
Marek Vasut
#6 lore raw

PATCH 3/5 fsl: usb: make errata function common for PPC and ARM

In reply to Sriram Dash
---
 drivers/usb/common/fsl-dt-fixup.c |  1 +
 include/fsl_usb.h                 | 51 ++++++++++++---------------------------
 2 files changed, 17 insertions(+), 35 deletions(-)
drivers/usb/common/fsl-dt-fixup.c +1 -0
index 520130e..47e1049 100644
@@ -12,6 +12,7 @@
 #include <usb.h>
 #include <asm/io.h>
 #include <hwconfig.h>
+#include <fsl_errata.h>
 #include <fsl_usb.h>
 #include <fdt_support.h>
 
include/fsl_usb.h +16 -35

138 lines not on this page · raw message

Signature · 1 line
2.1.0
#7 lore raw

PATCH 3/5 fsl: usb: make errata function common for PPC and ARM

On 05/26/2016 07:59 AM, Sriram Dash wrote:

Since there is no commit message, I have no clue what the rationale for this patch is, sorry. Please explain.

Besides, I would much rather see a patch which moves all these static inline functions into a dedicated C file and converts this header into just a list of prototypes. I wouldn't be surprised if the U-Boot size dropped a bit too.

Quoted 173 lines
---
 drivers/usb/common/fsl-dt-fixup.c |  1 +
 include/fsl_usb.h                 | 51 ++++++++++++---------------------------
 2 files changed, 17 insertions(+), 35 deletions(-)
drivers/usb/common/fsl-dt-fixup.c +1 -0
index 520130e..47e1049 100644
@@ -12,6 +12,7 @@
 #include <usb.h>
 #include <asm/io.h>
 #include <hwconfig.h>
+#include <fsl_errata.h>
 #include <fsl_usb.h>
 #include <fdt_support.h>
 
include/fsl_usb.h +16 -35
index 187e384..d9db0ea 100644
@@ -86,13 +86,14 @@ struct ccsr_usb_phy {
 #endif
 
 /* USB Erratum Checking code */
-#ifdef CONFIG_PPC
+#if defined(CONFIG_PPC) || defined(CONFIG_ARM)
 static inline bool has_dual_phy(void)
 {
 	u32 svr = get_svr();
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_T1023:
 	case SVR_T1024:
 	case SVR_T1013:
@@ -109,6 +110,7 @@ static inline bool has_dual_phy(void)
 	case SVR_T4160:
 	case SVR_T4080:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
+#endif
 	}
 
 	return false;
@@ -120,6 +122,7 @@ static inline bool has_erratum_a006261(void)
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_P1010:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
 	case SVR_P2041:
@@ -145,6 +148,7 @@ static inline bool has_erratum_a006261(void)
 		return IS_SVR_REV(svr, 1, 0);
 	case SVR_P5040:
 		return IS_SVR_REV(svr, 1, 0);
+#endif
 	}
 
 	return false;
@@ -156,6 +160,7 @@ static inline bool has_erratum_a007075(void)
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_B4860:
 	case SVR_B4420:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
@@ -163,14 +168,18 @@ static inline bool has_erratum_a007075(void)
 		return IS_SVR_REV(svr, 1, 0);
 	case SVR_P4080:
 		return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
+#endif
 	}
 	return false;
 }
 
 static inline bool has_erratum_a007798(void)
 {
+#ifdef CONFIG_PPC
 	return SVR_SOC_VER(get_svr()) == SVR_T4240 &&
 		IS_SVR_REV(get_svr(), 2, 0);
+#endif
+	return false;
 }
 
 static inline bool has_erratum_a007792(void)
@@ -179,6 +188,7 @@ static inline bool has_erratum_a007792(void)
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_T4240:
 	case SVR_T4160:
 	case SVR_T4080:
@@ -193,6 +203,7 @@ static inline bool has_erratum_a007792(void)
 	case SVR_T2080:
 	case SVR_T2081:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
+#endif
 	}
 	return false;
 }
@@ -203,9 +214,11 @@ static inline bool has_erratum_a005697(void)
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_9131:
 	case SVR_9132:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
+#endif
 	}
 	return false;
 }
@@ -216,6 +229,7 @@ static inline bool has_erratum_a004477(void)
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_P1010:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
 	case SVR_P1022:
@@ -230,44 +244,11 @@ static inline bool has_erratum_a004477(void)
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
 	case SVR_P4080:
 		return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
+#endif
 	}
 
 	return false;
 }
-#else
-static inline bool has_dual_phy(void)
-{
-	return false;
-}
-
-static inline bool has_erratum_a006261(void)
-{
-	return false;
-}
-
-static inline bool has_erratum_a007075(void)
-{
-	return false;
-}
 
-static inline bool has_erratum_a007798(void)
-{
-	return false;
-}
-
-static inline bool has_erratum_a007792(void)
-{
-	return false;
-}
-
-static inline bool has_erratum_a005697(void)
-{
-	return false;
-}
-
-static inline bool has_erratum_a004477(void)
-{
-	return false;
-}
 #endif
 #endif /*_ASM_FSL_USB_H_ */
Signature · 2 lines
Best regards,
Marek Vasut
#8 lore raw

PATCH 3/5 fsl: usb: make errata function common for PPC and ARM

Quoted 8 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: Thursday, May 26, 2016 5:51 PM
To: Sriram Dash <[email protected]>; u-boot at lists.denx.de
Cc: york sun <[email protected]>; albert.u.boot at aribaud.net; Rajesh Bhagat <[email protected]>
Subject: Re: [PATCH 3/5] fsl: usb: make errata function common for PPC and ARM

Quoted 5 lines

On 05/26/2016 07:59 AM, Sriram Dash wrote:

Since there is no commit message, I have no clue what the rationale for this patch is, sorry. Please explain.

This patch adds support for ARM for the errata applicability checking code. Will take care in v2.

Quoted 4 lines

Besides, I would much rather see a patch which moves all these static inline functions into a dedicated C file and converts this header into just a list of prototypes. I wouldn't be surprised if the U-Boot size dropped a bit too.

Will move the function definitions to a new file in v2.
Shall I place the file in drivers/usb/common/fsl_usb.c or drivers/usb/host/fsl_usb.c and keep fsl_usb.h at same place.

Please suggest.

Quoted 169 lines
Quoted 154 lines
---
 drivers/usb/common/fsl-dt-fixup.c |  1 +
 include/fsl_usb.h                 | 51 ++++++++++++---------------------------
 2 files changed, 17 insertions(+), 35 deletions(-)
drivers/usb/common/fsl-dt-fixup.c +1 -0
index 520130e..47e1049 100644
@@ -12,6 +12,7 @@
 #include <usb.h>
 #include <asm/io.h>
 #include <hwconfig.h>
+#include <fsl_errata.h>
 #include <fsl_usb.h>
 #include <fdt_support.h>
 
include/fsl_usb.h index renamed from include/fsl_usb.h +0 -0

187e384..d9db0ea 100644

include/fsl_usb.h +11 -1
@@ -86,13 +86,14 @@ struct ccsr_usb_phy {  #endif
 
 /* USB Erratum Checking code */
-#ifdef CONFIG_PPC
+#if defined(CONFIG_PPC) || defined(CONFIG_ARM)
 static inline bool has_dual_phy(void)  {
 	u32 svr = get_svr();
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_T1023:
 	case SVR_T1024:
 	case SVR_T1013:
@@ -109,6 +110,7 @@ static inline bool has_dual_phy(void)
 	case SVR_T4160:
 	case SVR_T4080:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
+#endif
 	}
 
 	return false;
@@ -120,6 +122,7 @@ static inline bool has_erratum_a006261(void)
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_P1010:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
 	case SVR_P2041:
@@ -145,6 +148,7 @@ static inline bool has_erratum_a006261(void)
 		return IS_SVR_REV(svr, 1, 0);
 	case SVR_P5040:
 		return IS_SVR_REV(svr, 1, 0);
+#endif
 	}
 
 	return false;
@@ -156,6 +160,7 @@ static inline bool has_erratum_a007075(void)
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_B4860:
 	case SVR_B4420:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); @@ -163,14
+168,18 @@ static inline bool has_erratum_a007075(void)
 		return IS_SVR_REV(svr, 1, 0);
 	case SVR_P4080:
 		return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
+#endif
 	}
 	return false;
 }
 
 static inline bool has_erratum_a007798(void)  {
+#ifdef CONFIG_PPC
 	return SVR_SOC_VER(get_svr()) == SVR_T4240 &&
 		IS_SVR_REV(get_svr(), 2, 0);
+#endif
+	return false;
 }
 
 static inline bool has_erratum_a007792(void) @@ -179,6 +188,7 @@

static inline bool has_erratum_a007792(void)

include/fsl_usb.h +6 -19
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_T4240:
 	case SVR_T4160:
 	case SVR_T4080:
@@ -193,6 +203,7 @@ static inline bool has_erratum_a007792(void)
 	case SVR_T2080:
 	case SVR_T2081:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
+#endif
 	}
 	return false;
 }
@@ -203,9 +214,11 @@ static inline bool has_erratum_a005697(void)
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_9131:
 	case SVR_9132:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
+#endif
 	}
 	return false;
 }
@@ -216,6 +229,7 @@ static inline bool has_erratum_a004477(void)
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_P1010:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
 	case SVR_P1022:
@@ -230,44 +244,11 @@ static inline bool has_erratum_a004477(void)
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
 	case SVR_P4080:
 		return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
+#endif
 	}
 
 	return false;
 }
-#else
-static inline bool has_dual_phy(void) -{
-	return false;
-}
-
-static inline bool has_erratum_a006261(void) -{
-	return false;
-}
-
-static inline bool has_erratum_a007075(void) -{
-	return false;
-}
 
-static inline bool has_erratum_a007798(void) -{
-	return false;
-}
-
-static inline bool has_erratum_a007792(void) -{
-	return false;
-}

include/fsl_usb.h static inline bool has_erratum_a004477(void) · line 254

Quoted 10 lines
include/fsl_usb.h +0 -8
-
-static inline bool has_erratum_a005697(void) -{
-	return false;
-}
-
-static inline bool has_erratum_a004477(void) -{
-	return false;
-}
 #endif
 #endif /*_ASM_FSL_USB_H_ */

--
Best regards,
Marek Vasut

#9 lore raw

PATCH 3/5 fsl: usb: make errata function common for PPC and ARM

Quoted 17 lines · Sriram Dash
Quoted 8 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: Thursday, May 26, 2016 5:51 PM
To: Sriram Dash <[email protected]>; u-boot at lists.denx.de
Cc: york sun <[email protected]>; albert.u.boot at aribaud.net; Rajesh Bhagat <[email protected]>
Subject: Re: [PATCH 3/5] fsl: usb: make errata function common for PPC and ARM

Quoted 5 lines

On 05/26/2016 07:59 AM, Sriram Dash wrote:

Since there is no commit message, I have no clue what the rationale for this patch is, sorry. Please explain.

This patch adds support for ARM for the errata applicability checking code. Will take care in v2.

Quoted 8 lines
Quoted 4 lines

Besides, I would much rather see a patch which moves all these static inline functions into a dedicated C file and converts this header into just a list of prototypes. I wouldn't be surprised if the U-Boot size dropped a bit too.

Will move the function definitions to a new file in v2.
Shall I place the file in drivers/usb/common/fsl_usb.c or drivers/usb/host/fsl_usb.c and keep fsl_usb.h at same place.

Most likely the former, since it's a common stuff used by some platforms. The fsl_usb.h needs to stay. Make sure to use buildman to test for breakage on powerpc.

Quoted 171 lines

Please suggest.

Quoted 169 lines
Quoted 154 lines
---
 drivers/usb/common/fsl-dt-fixup.c |  1 +
 include/fsl_usb.h                 | 51 ++++++++++++---------------------------
 2 files changed, 17 insertions(+), 35 deletions(-)
drivers/usb/common/fsl-dt-fixup.c +1 -0
index 520130e..47e1049 100644
@@ -12,6 +12,7 @@
 #include <usb.h>
 #include <asm/io.h>
 #include <hwconfig.h>
+#include <fsl_errata.h>
 #include <fsl_usb.h>
 #include <fdt_support.h>
 
include/fsl_usb.h index renamed from include/fsl_usb.h +0 -0

187e384..d9db0ea 100644

include/fsl_usb.h +11 -1
@@ -86,13 +86,14 @@ struct ccsr_usb_phy {  #endif
 
 /* USB Erratum Checking code */
-#ifdef CONFIG_PPC
+#if defined(CONFIG_PPC) || defined(CONFIG_ARM)
 static inline bool has_dual_phy(void)  {
 	u32 svr = get_svr();
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_T1023:
 	case SVR_T1024:
 	case SVR_T1013:
@@ -109,6 +110,7 @@ static inline bool has_dual_phy(void)
 	case SVR_T4160:
 	case SVR_T4080:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
+#endif
 	}
 
 	return false;
@@ -120,6 +122,7 @@ static inline bool has_erratum_a006261(void)
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_P1010:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
 	case SVR_P2041:
@@ -145,6 +148,7 @@ static inline bool has_erratum_a006261(void)
 		return IS_SVR_REV(svr, 1, 0);
 	case SVR_P5040:
 		return IS_SVR_REV(svr, 1, 0);
+#endif
 	}
 
 	return false;
@@ -156,6 +160,7 @@ static inline bool has_erratum_a007075(void)
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_B4860:
 	case SVR_B4420:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); @@ -163,14
+168,18 @@ static inline bool has_erratum_a007075(void)
 		return IS_SVR_REV(svr, 1, 0);
 	case SVR_P4080:
 		return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
+#endif
 	}
 	return false;
 }
 
 static inline bool has_erratum_a007798(void)  {
+#ifdef CONFIG_PPC
 	return SVR_SOC_VER(get_svr()) == SVR_T4240 &&
 		IS_SVR_REV(get_svr(), 2, 0);
+#endif
+	return false;
 }
 
 static inline bool has_erratum_a007792(void) @@ -179,6 +188,7 @@

static inline bool has_erratum_a007792(void)

include/fsl_usb.h +6 -19
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_T4240:
 	case SVR_T4160:
 	case SVR_T4080:
@@ -193,6 +203,7 @@ static inline bool has_erratum_a007792(void)
 	case SVR_T2080:
 	case SVR_T2081:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
+#endif
 	}
 	return false;
 }
@@ -203,9 +214,11 @@ static inline bool has_erratum_a005697(void)
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_9131:
 	case SVR_9132:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
+#endif
 	}
 	return false;
 }
@@ -216,6 +229,7 @@ static inline bool has_erratum_a004477(void)
 	u32 soc = SVR_SOC_VER(svr);
 
 	switch (soc) {
+#ifdef CONFIG_PPC
 	case SVR_P1010:
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
 	case SVR_P1022:
@@ -230,44 +244,11 @@ static inline bool has_erratum_a004477(void)
 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
 	case SVR_P4080:
 		return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
+#endif
 	}
 
 	return false;
 }
-#else
-static inline bool has_dual_phy(void) -{
-	return false;
-}
-
-static inline bool has_erratum_a006261(void) -{
-	return false;
-}
-
-static inline bool has_erratum_a007075(void) -{
-	return false;
-}
 
-static inline bool has_erratum_a007798(void) -{
-	return false;
-}
-
-static inline bool has_erratum_a007792(void) -{
-	return false;
-}

include/fsl_usb.h static inline bool has_erratum_a004477(void) · line 254

Quoted 10 lines
include/fsl_usb.h +0 -8
-
-static inline bool has_erratum_a005697(void) -{
-	return false;
-}
-
-static inline bool has_erratum_a004477(void) -{
-	return false;
-}
 #endif
 #endif /*_ASM_FSL_USB_H_ */

--
Best regards,
Marek Vasut

Signature · 2 lines
Best regards,
Marek Vasut
#10 lore raw

PATCH 4/5 armv8/ls2080: Remove workaround for erratum A008751

In reply to Sriram Dash

Remove the errata workaround from soc specific file for LS2080

---
 arch/arm/cpu/armv8/fsl-layerscape/soc.c | 10 ----------
 1 file changed, 10 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/soc.c +0 -10
index 0fb5c7f..5636531 100644
@@ -122,15 +122,6 @@ void erratum_a009635(void)
 }
 #endif	/* CONFIG_SYS_FSL_ERRATUM_A009635 */
 
-static void erratum_a008751(void)
-{
-#ifdef CONFIG_SYS_FSL_ERRATUM_A008751
-	u32 __iomem *scfg = (u32 __iomem *)SCFG_BASE;
-
-	writel(0x27672b2a, scfg + SCFG_USB3PRM1CR / 4);
-#endif
-}
-
 static void erratum_rcw_src(void)
 {
 #if defined(CONFIG_SPL)
@@ -187,7 +178,6 @@ void bypass_smmu(void)
 }
 void fsl_lsch3_early_init_f(void)
 {
-	erratum_a008751();
 	erratum_rcw_src();
 	init_early_memctl_regs();	/* tighten IFC timing */
 	erratum_a009203();
Signature · 1 line
2.1.0
#11 lore raw

PATCH 5/5 usb: xhci: fsl: Add workaround for USB erratum A-008751

In reply to Sriram Dash

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

---
 .../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(+)
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h +1 -0
index e48bbaf..9b60bd3 100644
@@ -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 */
board/freescale/ls2080aqds/ls2080aqds.c +2 -0
index b3bd40a..97892f8 100644
@@ -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);
board/freescale/ls2080ardb/ls2080ardb.c +2 -0
index fb39af6..39b8ea3 100644
@@ -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);
drivers/usb/common/fsl-dt-fixup.c +2 -0
index 47e1049..6b2e47c 100644
@@ -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);
 	}
 }
drivers/usb/host/xhci-fsl.c +29 -0
index 05f09d7..d55ed87 100644
@@ -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");
include/fsl_usb.h +15 -0
index d9db0ea..97f9dd6 100644
@@ -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_ */
Signature · 1 line
2.1.0