public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 0/5] Supporting ARM v8 USB errata for FSL
@ 2016-06-09 12:21 Sriram Dash
  2016-06-09 12:21 ` [U-Boot] [PATCH v3 1/5] arm64: fsl-layerscape: add get_svr and IS_SVR_REV helper Sriram Dash
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Sriram Dash @ 2016-06-09 12:21 UTC (permalink / raw)
  To: u-boot

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 --
 .../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/Makefile                        |   4 +-
 drivers/usb/common/fsl-dt-fixup.c                  |  94 ++++++----
 .../fsl_usb.h => drivers/usb/common/fsl-errata.c   | 152 ++++------------
 drivers/usb/host/xhci-fsl.c                        |  24 +++
 include/fsl_usb.h                                  | 198 ++-------------------
 12 files changed, 153 insertions(+), 348 deletions(-)
 copy include/fsl_usb.h => drivers/usb/common/fsl-errata.c (50%)

-- 
2.1.0

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH v3 1/5] arm64: fsl-layerscape: add get_svr and IS_SVR_REV helper
  2016-06-09 12:21 [U-Boot] [PATCH v3 0/5] Supporting ARM v8 USB errata for FSL Sriram Dash
@ 2016-06-09 12:21 ` Sriram Dash
  2016-06-09 13:28   ` Marek Vasut
  2016-06-09 12:21 ` [U-Boot] [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers Sriram Dash
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Sriram Dash @ 2016-06-09 12:21 UTC (permalink / raw)
  To: u-boot

Adds get_svr and IS_SVR_REV helpers for ARMv8 platforms,
similar to PPC and ARMv7.

Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
---

Changes in v1:
  - Added commit message

Changes in v2:
  - No update

 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(+)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index 9a5a6b5..9c575c1 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -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)
 {
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
index e98e055..8b8a7c1 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
@@ -596,4 +596,6 @@ struct ccsr_cci400 {
 #define SCR0_CLIENTPD_MASK		0x00000001
 #define SCR0_USFCFG_MASK		0x00000400
 
+uint get_svr(void);
+
 #endif	/* __ARCH_FSL_LSCH2_IMMAP_H__*/
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 65b3357..e48bbaf 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
@@ -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_ */
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/soc.h b/arch/arm/include/asm/arch-fsl-layerscape/soc.h
index 02ecc62..f244904 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/soc.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/soc.h
@@ -53,6 +53,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
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers
  2016-06-09 12:21 [U-Boot] [PATCH v3 0/5] Supporting ARM v8 USB errata for FSL Sriram Dash
  2016-06-09 12:21 ` [U-Boot] [PATCH v3 1/5] arm64: fsl-layerscape: add get_svr and IS_SVR_REV helper Sriram Dash
@ 2016-06-09 12:21 ` Sriram Dash
  2016-06-09 13:30   ` Marek Vasut
  2016-06-09 12:21 ` [U-Boot] [PATCH v3 3/5] fsl: usb: make errata function common for PPC and ARM Sriram Dash
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Sriram Dash @ 2016-06-09 12:21 UTC (permalink / raw)
  To: u-boot

Performs code cleanup for device tree fixup for fsl usb controllers by
making functions to handle these similar errata checking code.

Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
---

Changes in v3:
  - Inverted the condition for has_erratum for better readability
  - If fdt_fixup_usb_erratum fails, return ENOSPC and exit the fixup
  - Added logic for handling the condition with different controllers
	with different erratas
		- first check if the errata is applicable for the SoC
		- then check if it is applicable for the controller
		- if both are successful, then fix dt.

Changes in v2:
  - Added patch description
  - Removed the MACRO and use fdt_fixup_erratum function instead

 drivers/usb/common/fsl-dt-fixup.c | 88 ++++++++++++++++++++++-----------------
 include/fsl_usb.h                 |  6 +++
 2 files changed, 56 insertions(+), 38 deletions(-)

diff --git a/drivers/usb/common/fsl-dt-fixup.c b/drivers/usb/common/fsl-dt-fixup.c
index 6f31932..9cbd9d2 100644
--- a/drivers/usb/common/fsl-dt-fixup.c
+++ b/drivers/usb/common/fsl-dt-fixup.c
@@ -20,9 +20,9 @@
 #endif
 
 static const char * const compat_usb_fsl[] = {
-	"fsl-usb2-mph",
-	"fsl-usb2-dr",
-	"snps,dwc3",
+	FSL_USB2_MPH,
+	FSL_USB2_DR,
+	SNPS_DWC3,
 	NULL
 };
 
@@ -80,16 +80,24 @@ static int fdt_fixup_usb_mode_phy_type(void *blob, const char *mode,
 }
 
 static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum,
-				 int start_offset)
+				 const char *controller_type, int start_offset)
 {
 	int node_offset, err;
 	const char *node_type = NULL;
+	const char *node_name = NULL;
 
 	err = fdt_usb_get_node_type(blob, start_offset,
 				    &node_offset, &node_type);
 	if (err < 0)
 		return err;
 
+	if (!strcmp(node_type, FSL_USB2_MPH) || !strcmp(node_type, FSL_USB2_DR))
+		node_name = USB2_CI;
+	else
+		node_name = node_type;
+	if (strcmp(node_name, controller_type))
+		return err;
+
 	err = fdt_setprop(blob, node_offset, prop_erratum, NULL, 0);
 	if (err < 0) {
 		printf("ERROR: could not set %s for %s: %s.\n",
@@ -99,6 +107,23 @@ static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum,
 	return node_offset;
 }
 
+static int fdt_fixup_erratum(int *usb_erratum_off, void *blob,
+			     const char *controller_type, char *str,
+			     bool (*has_erratum)(void))
+{
+	char buf[32] = {0};
+
+	snprintf(buf, sizeof(buf), "fsl,usb-erratum-%s", str);
+	if (!(has_erratum()))
+		return -EINVAL;
+	*usb_erratum_off = fdt_fixup_usb_erratum(blob, buf, controller_type,
+						 *usb_erratum_off);
+	if (*usb_erratum_off < 0)
+		return -ENOSPC;
+	debug("Adding USB erratum %s\n", str);
+	return 0;
+}
+
 void fdt_fixup_dr_usb(void *blob, bd_t *bd)
 {
 	static const char * const modes[] = { "host", "peripheral", "otg" };
@@ -111,6 +136,7 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
 	int usb_phy_off = -1;
 	char str[5];
 	int i, j;
+	int ret;
 
 	for (i = 1; i <= CONFIG_USB_MAX_CONTROLLER_COUNT; i++) {
 		const char *dr_mode_type = NULL;
@@ -164,39 +190,25 @@ 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;
-		}
+		ret = fdt_fixup_erratum(&usb_erratum_a006261_off, blob,
+					USB2_CI, "a006261",
+					has_erratum_a006261);
+		if (ret == -ENOSPC)
+			return;
+		ret = fdt_fixup_erratum(&usb_erratum_a007075_off, blob,
+					USB2_CI, "a007075",
+					has_erratum_a007075);
+		if (ret == -ENOSPC)
+			return;
+		ret = fdt_fixup_erratum(&usb_erratum_a007792_off, blob,
+					USB2_CI, "a007792",
+					has_erratum_a007792);
+		if (ret == -ENOSPC)
+			return;
+		ret = fdt_fixup_erratum(&usb_erratum_a005697_off, blob,
+					USB2_CI, "a005697",
+					has_erratum_a005697);
+		if (ret == -ENOSPC)
+			return;
 	}
 }
diff --git a/include/fsl_usb.h b/include/fsl_usb.h
index 187e384..882a5f5 100644
--- a/include/fsl_usb.h
+++ b/include/fsl_usb.h
@@ -85,6 +85,12 @@ struct ccsr_usb_phy {
 #define CONFIG_SYS_FSL_USB_SQUELCH_PROG_MASK 0x07
 #endif
 
+/* USB Controllers */
+#define FSL_USB2_MPH	"fsl-usb2-mph"
+#define FSL_USB2_DR	"fsl-usb2-dr"
+#define USB2_CI		"usb2-ci"
+#define SNPS_DWC3	"snps,dwc3"
+
 /* USB Erratum Checking code */
 #ifdef CONFIG_PPC
 static inline bool has_dual_phy(void)
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH v3 3/5] fsl: usb: make errata function common for PPC and ARM
  2016-06-09 12:21 [U-Boot] [PATCH v3 0/5] Supporting ARM v8 USB errata for FSL Sriram Dash
  2016-06-09 12:21 ` [U-Boot] [PATCH v3 1/5] arm64: fsl-layerscape: add get_svr and IS_SVR_REV helper Sriram Dash
  2016-06-09 12:21 ` [U-Boot] [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers Sriram Dash
@ 2016-06-09 12:21 ` Sriram Dash
  2016-06-09 12:21 ` [U-Boot] [PATCH v3 4/5] armv8/ls2080: Remove workaround for erratum A008751 Sriram Dash
  2016-06-09 12:21 ` [U-Boot] [PATCH v3 5/5] usb: xhci: fsl: Add workaround for USB erratum A-008751 Sriram Dash
  4 siblings, 0 replies; 14+ messages in thread
From: Sriram Dash @ 2016-06-09 12:21 UTC (permalink / raw)
  To: u-boot

This patch does the following things:
1. Makes the errata checking code common for PPC and ARM
2. Moves all these static inline functions into a dedicated C file

Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
---

Changes in v3:
  - Rework done according to previous patches.

Changes in v2:
  - Moves all the static inline functions into a dedicated C file

 drivers/usb/common/Makefile       |   4 +-
 drivers/usb/common/fsl-dt-fixup.c |   1 +
 drivers/usb/common/fsl-errata.c   | 178 +++++++++++++++++++++++++++++++++++
 include/fsl_usb.h                 | 191 ++------------------------------------
 4 files changed, 189 insertions(+), 185 deletions(-)
 create mode 100644 drivers/usb/common/fsl-errata.c

diff --git a/drivers/usb/common/Makefile b/drivers/usb/common/Makefile
index 2f46d38..aee7e32 100644
--- a/drivers/usb/common/Makefile
+++ b/drivers/usb/common/Makefile
@@ -4,5 +4,5 @@
 #
 
 obj-$(CONFIG_DM_USB) += common.o
-obj-$(CONFIG_USB_EHCI_FSL) += fsl-dt-fixup.o
-obj-$(CONFIG_USB_XHCI_FSL) += fsl-dt-fixup.o
+obj-$(CONFIG_USB_EHCI_FSL) += fsl-dt-fixup.o fsl-errata.o
+obj-$(CONFIG_USB_XHCI_FSL) += fsl-dt-fixup.o fsl-errata.o
diff --git a/drivers/usb/common/fsl-dt-fixup.c b/drivers/usb/common/fsl-dt-fixup.c
index 9cbd9d2..49d1140 100644
--- a/drivers/usb/common/fsl-dt-fixup.c
+++ b/drivers/usb/common/fsl-dt-fixup.c
@@ -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>
 
diff --git a/drivers/usb/common/fsl-errata.c b/drivers/usb/common/fsl-errata.c
new file mode 100644
index 0000000..95918fc
--- /dev/null
+++ b/drivers/usb/common/fsl-errata.c
@@ -0,0 +1,178 @@
+/*
+ * Freescale USB Controller
+ *
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <fsl_errata.h>
+#include<fsl_usb.h>
+
+/* USB Erratum Checking code */
+#if defined(CONFIG_PPC) || defined(CONFIG_ARM)
+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:
+	case SVR_T1014:
+		return IS_SVR_REV(svr, 1, 0);
+	case SVR_T1040:
+	case SVR_T1042:
+	case SVR_T1020:
+	case SVR_T1022:
+	case SVR_T2080:
+	case SVR_T2081:
+		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
+	case SVR_T4240:
+	case SVR_T4160:
+	case SVR_T4080:
+		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
+#endif
+	}
+
+	return false;
+}
+
+bool has_erratum_a006261(void)
+{
+	u32 svr = get_svr();
+	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:
+	case SVR_P2040:
+		return IS_SVR_REV(svr, 1, 0) ||
+			IS_SVR_REV(svr, 1, 1) || IS_SVR_REV(svr, 2, 1);
+	case SVR_P3041:
+		return IS_SVR_REV(svr, 1, 0) ||
+			IS_SVR_REV(svr, 1, 1) ||
+			IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
+	case SVR_P5010:
+	case SVR_P5020:
+	case SVR_P5021:
+		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
+	case SVR_T4240:
+	case SVR_T4160:
+	case SVR_T4080:
+		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
+	case SVR_T1040:
+		return IS_SVR_REV(svr, 1, 0);
+	case SVR_T2080:
+	case SVR_T2081:
+		return IS_SVR_REV(svr, 1, 0);
+	case SVR_P5040:
+		return IS_SVR_REV(svr, 1, 0);
+#endif
+	}
+
+	return false;
+}
+
+bool has_erratum_a007075(void)
+{
+	u32 svr = get_svr();
+	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);
+	case SVR_P1010:
+		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;
+}
+
+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;
+}
+
+bool has_erratum_a007792(void)
+{
+	u32 svr = get_svr();
+	u32 soc = SVR_SOC_VER(svr);
+
+	switch (soc) {
+#ifdef CONFIG_PPC
+	case SVR_T4240:
+	case SVR_T4160:
+	case SVR_T4080:
+		return IS_SVR_REV(svr, 2, 0);
+	case SVR_T1024:
+	case SVR_T1023:
+		return IS_SVR_REV(svr, 1, 0);
+	case SVR_T1040:
+	case SVR_T1042:
+	case SVR_T1020:
+	case SVR_T1022:
+	case SVR_T2080:
+	case SVR_T2081:
+		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
+#endif
+	}
+	return false;
+}
+
+bool has_erratum_a005697(void)
+{
+	u32 svr = get_svr();
+	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;
+}
+
+bool has_erratum_a004477(void)
+{
+	u32 svr = get_svr();
+	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:
+	case SVR_9131:
+	case SVR_9132:
+		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
+	case SVR_P2020:
+		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0) ||
+			IS_SVR_REV(svr, 2, 1);
+	case SVR_B4860:
+	case SVR_B4420:
+		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;
+}
+
+#endif
diff --git a/include/fsl_usb.h b/include/fsl_usb.h
index 882a5f5..54a5fe3 100644
--- a/include/fsl_usb.h
+++ b/include/fsl_usb.h
@@ -92,188 +92,13 @@ struct ccsr_usb_phy {
 #define SNPS_DWC3	"snps,dwc3"
 
 /* USB Erratum Checking code */
-#ifdef CONFIG_PPC
-static inline bool has_dual_phy(void)
-{
-	u32 svr = get_svr();
-	u32 soc = SVR_SOC_VER(svr);
-
-	switch (soc) {
-	case SVR_T1023:
-	case SVR_T1024:
-	case SVR_T1013:
-	case SVR_T1014:
-		return IS_SVR_REV(svr, 1, 0);
-	case SVR_T1040:
-	case SVR_T1042:
-	case SVR_T1020:
-	case SVR_T1022:
-	case SVR_T2080:
-	case SVR_T2081:
-		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
-	case SVR_T4240:
-	case SVR_T4160:
-	case SVR_T4080:
-		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
-	}
-
-	return false;
-}
-
-static inline bool has_erratum_a006261(void)
-{
-	u32 svr = get_svr();
-	u32 soc = SVR_SOC_VER(svr);
-
-	switch (soc) {
-	case SVR_P1010:
-		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
-	case SVR_P2041:
-	case SVR_P2040:
-		return IS_SVR_REV(svr, 1, 0) ||
-			IS_SVR_REV(svr, 1, 1) || IS_SVR_REV(svr, 2, 1);
-	case SVR_P3041:
-		return IS_SVR_REV(svr, 1, 0) ||
-			IS_SVR_REV(svr, 1, 1) ||
-			IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
-	case SVR_P5010:
-	case SVR_P5020:
-	case SVR_P5021:
-		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
-	case SVR_T4240:
-	case SVR_T4160:
-	case SVR_T4080:
-		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
-	case SVR_T1040:
-		return IS_SVR_REV(svr, 1, 0);
-	case SVR_T2080:
-	case SVR_T2081:
-		return IS_SVR_REV(svr, 1, 0);
-	case SVR_P5040:
-		return IS_SVR_REV(svr, 1, 0);
-	}
-
-	return false;
-}
-
-static inline bool has_erratum_a007075(void)
-{
-	u32 svr = get_svr();
-	u32 soc = SVR_SOC_VER(svr);
-
-	switch (soc) {
-	case SVR_B4860:
-	case SVR_B4420:
-		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
-	case SVR_P1010:
-		return IS_SVR_REV(svr, 1, 0);
-	case SVR_P4080:
-		return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
-	}
-	return false;
-}
-
-static inline bool has_erratum_a007798(void)
-{
-	return SVR_SOC_VER(get_svr()) == SVR_T4240 &&
-		IS_SVR_REV(get_svr(), 2, 0);
-}
-
-static inline bool has_erratum_a007792(void)
-{
-	u32 svr = get_svr();
-	u32 soc = SVR_SOC_VER(svr);
-
-	switch (soc) {
-	case SVR_T4240:
-	case SVR_T4160:
-	case SVR_T4080:
-		return IS_SVR_REV(svr, 2, 0);
-	case SVR_T1024:
-	case SVR_T1023:
-		return IS_SVR_REV(svr, 1, 0);
-	case SVR_T1040:
-	case SVR_T1042:
-	case SVR_T1020:
-	case SVR_T1022:
-	case SVR_T2080:
-	case SVR_T2081:
-		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
-	}
-	return false;
-}
-
-static inline bool has_erratum_a005697(void)
-{
-	u32 svr = get_svr();
-	u32 soc = SVR_SOC_VER(svr);
-
-	switch (soc) {
-	case SVR_9131:
-	case SVR_9132:
-		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
-	}
-	return false;
-}
-
-static inline bool has_erratum_a004477(void)
-{
-	u32 svr = get_svr();
-	u32 soc = SVR_SOC_VER(svr);
-
-	switch (soc) {
-	case SVR_P1010:
-		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
-	case SVR_P1022:
-	case SVR_9131:
-	case SVR_9132:
-		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
-	case SVR_P2020:
-		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0) ||
-			IS_SVR_REV(svr, 2, 1);
-	case SVR_B4860:
-	case SVR_B4420:
-		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);
-	}
-
-	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;
-}
+#if defined(CONFIG_PPC) || defined(CONFIG_ARM)
+bool has_dual_phy(void);
+bool has_erratum_a006261(void);
+bool has_erratum_a007075(void);
+bool has_erratum_a007798(void);
+bool has_erratum_a007792(void);
+bool has_erratum_a005697(void);
+bool has_erratum_a004477(void);
 #endif
 #endif /*_ASM_FSL_USB_H_ */
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH v3 4/5] armv8/ls2080: Remove workaround for erratum A008751
  2016-06-09 12:21 [U-Boot] [PATCH v3 0/5] Supporting ARM v8 USB errata for FSL Sriram Dash
                   ` (2 preceding siblings ...)
  2016-06-09 12:21 ` [U-Boot] [PATCH v3 3/5] fsl: usb: make errata function common for PPC and ARM Sriram Dash
@ 2016-06-09 12:21 ` Sriram Dash
  2016-06-09 12:21 ` [U-Boot] [PATCH v3 5/5] usb: xhci: fsl: Add workaround for USB erratum A-008751 Sriram Dash
  4 siblings, 0 replies; 14+ messages in thread
From: Sriram Dash @ 2016-06-09 12:21 UTC (permalink / raw)
  To: u-boot

This errata a008751 is applied on Soc specific file currently.This will be
moved to a file where all the errata implementation will take place for usb
for fsl. This patch removes the errata workaround from soc specific file
for LS2080.

Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
---

Changes in v2:
  - Modified commit message

Changes in v2:
  - No update

 arch/arm/cpu/armv8/fsl-layerscape/soc.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
index dd633f3..d8ec426 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
@@ -124,15 +124,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)
@@ -189,7 +180,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();
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH v3 5/5] usb: xhci: fsl: Add workaround for USB erratum A-008751
  2016-06-09 12:21 [U-Boot] [PATCH v3 0/5] Supporting ARM v8 USB errata for FSL Sriram Dash
                   ` (3 preceding siblings ...)
  2016-06-09 12:21 ` [U-Boot] [PATCH v3 4/5] armv8/ls2080: Remove workaround for erratum A008751 Sriram Dash
@ 2016-06-09 12:21 ` Sriram Dash
  4 siblings, 0 replies; 14+ messages in thread
From: Sriram Dash @ 2016-06-09 12:21 UTC (permalink / raw)
  To: u-boot

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@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
---

Changes in v3:
  - Reworked for changes done in errata checking code.
  - made inline bool erratum_a008751 as int erratum_a008751
  - return 0 for success, 1 for failure for erratum_a008751
  - dropped the APPLY_ERRATUM macro.

Changes in v2:
  - Reworked for changes done in errata checking code.


 .../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                  |  7 +++++++
 drivers/usb/common/fsl-errata.c                    | 15 ++++++++++++++
 drivers/usb/host/xhci-fsl.c                        | 24 ++++++++++++++++++++++
 include/fsl_usb.h                                  |  1 +
 7 files changed, 52 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 897793d..479f689 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -298,6 +298,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 52e5e3f..a65cd4a 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -281,6 +281,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 49d1140..2133b88 100644
--- a/drivers/usb/common/fsl-dt-fixup.c
+++ b/drivers/usb/common/fsl-dt-fixup.c
@@ -133,6 +133,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];
@@ -211,5 +212,11 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
 					has_erratum_a005697);
 		if (ret == -ENOSPC)
 			return;
+		ret = fdt_fixup_erratum(&usb_erratum_a008751_off, blob,
+					SNPS_DWC3, "a008751",
+					has_erratum_a008751);
+		if (ret == -ENOSPC)
+			return;
+
 	}
 }
diff --git a/drivers/usb/common/fsl-errata.c b/drivers/usb/common/fsl-errata.c
index 95918fc..ebe60a8 100644
--- a/drivers/usb/common/fsl-errata.c
+++ b/drivers/usb/common/fsl-errata.c
@@ -175,4 +175,19 @@ bool has_erratum_a004477(void)
 	return false;
 }
 
+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
diff --git a/drivers/usb/host/xhci-fsl.c b/drivers/usb/host/xhci-fsl.c
index 05f09d7..c12a189 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,26 @@ __weak int __board_usb_init(int index, enum usb_init_type init)
 	return 0;
 }
 
+static int 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 0;
+#endif
+	return 1;
+}
+
+static void fsl_apply_xhci_errata(void)
+{
+	int ret;
+	if (has_erratum_a008751()) {
+		ret = erratum_a008751();
+		if (ret != 0)
+			puts("Failed to apply erratum a008751\n");
+	}
+}
+
 static int fsl_xhci_core_init(struct fsl_xhci *fsl_xhci)
 {
 	int ret = 0;
@@ -69,6 +91,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 54a5fe3..72f42db 100644
--- a/include/fsl_usb.h
+++ b/include/fsl_usb.h
@@ -100,5 +100,6 @@ bool has_erratum_a007798(void);
 bool has_erratum_a007792(void);
 bool has_erratum_a005697(void);
 bool has_erratum_a004477(void);
+bool has_erratum_a008751(void);
 #endif
 #endif /*_ASM_FSL_USB_H_ */
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH v3 1/5] arm64: fsl-layerscape: add get_svr and IS_SVR_REV helper
  2016-06-09 12:21 ` [U-Boot] [PATCH v3 1/5] arm64: fsl-layerscape: add get_svr and IS_SVR_REV helper Sriram Dash
@ 2016-06-09 13:28   ` Marek Vasut
  2016-06-10  3:47     ` Sriram Dash
  0 siblings, 1 reply; 14+ messages in thread
From: Marek Vasut @ 2016-06-09 13:28 UTC (permalink / raw)
  To: u-boot

On 06/09/2016 02:21 PM, Sriram Dash wrote:
> Adds get_svr and IS_SVR_REV helpers for ARMv8 platforms,
> similar to PPC and ARMv7.
> 
> Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
> Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
> ---
> 
> Changes in v1:
>   - Added commit message
> 
> Changes in v2:
>   - No update

So what changed in V3 here ?

>  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(+)
> 
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
> index 9a5a6b5..9c575c1 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
> @@ -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)
>  {
> diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
> index e98e055..8b8a7c1 100644
> --- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
> +++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
> @@ -596,4 +596,6 @@ struct ccsr_cci400 {
>  #define SCR0_CLIENTPD_MASK		0x00000001
>  #define SCR0_USFCFG_MASK		0x00000400
>  
> +uint get_svr(void);
> +
>  #endif	/* __ARCH_FSL_LSCH2_IMMAP_H__*/
> 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 65b3357..e48bbaf 100644
> --- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
> +++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
> @@ -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_ */
> diff --git a/arch/arm/include/asm/arch-fsl-layerscape/soc.h b/arch/arm/include/asm/arch-fsl-layerscape/soc.h
> index 02ecc62..f244904 100644
> --- a/arch/arm/include/asm/arch-fsl-layerscape/soc.h
> +++ b/arch/arm/include/asm/arch-fsl-layerscape/soc.h
> @@ -53,6 +53,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))

This is susceptible to macro expansion problems, you need parenthesis
around all the macro args:
((SVR_MAJ(svr) == (maj)) && (SVR_MIN(svr) == (min)))

>  /* ahci port register default value */
>  #define AHCI_PORT_PHY_1_CFG    0xa003fffe
> 


-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers
  2016-06-09 12:21 ` [U-Boot] [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers Sriram Dash
@ 2016-06-09 13:30   ` Marek Vasut
  2016-06-10  3:47     ` Sriram Dash
  0 siblings, 1 reply; 14+ messages in thread
From: Marek Vasut @ 2016-06-09 13:30 UTC (permalink / raw)
  To: u-boot

On 06/09/2016 02:21 PM, Sriram Dash wrote:
> Performs code cleanup for device tree fixup for fsl usb controllers by
> making functions to handle these similar errata checking code.
> 
> Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
> Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
> ---
> 
> Changes in v3:
>   - Inverted the condition for has_erratum for better readability
>   - If fdt_fixup_usb_erratum fails, return ENOSPC and exit the fixup
>   - Added logic for handling the condition with different controllers
> 	with different erratas
> 		- first check if the errata is applicable for the SoC
> 		- then check if it is applicable for the controller
> 		- if both are successful, then fix dt.
> 
> Changes in v2:
>   - Added patch description
>   - Removed the MACRO and use fdt_fixup_erratum function instead
> 
>  drivers/usb/common/fsl-dt-fixup.c | 88 ++++++++++++++++++++++-----------------
>  include/fsl_usb.h                 |  6 +++
>  2 files changed, 56 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/usb/common/fsl-dt-fixup.c b/drivers/usb/common/fsl-dt-fixup.c
> index 6f31932..9cbd9d2 100644
> --- a/drivers/usb/common/fsl-dt-fixup.c
> +++ b/drivers/usb/common/fsl-dt-fixup.c
> @@ -20,9 +20,9 @@
>  #endif
>  
>  static const char * const compat_usb_fsl[] = {
> -	"fsl-usb2-mph",
> -	"fsl-usb2-dr",
> -	"snps,dwc3",
> +	FSL_USB2_MPH,
> +	FSL_USB2_DR,
> +	SNPS_DWC3,
>  	NULL
>  };
>  
> @@ -80,16 +80,24 @@ static int fdt_fixup_usb_mode_phy_type(void *blob, const char *mode,
>  }
>  
>  static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum,
> -				 int start_offset)
> +				 const char *controller_type, int start_offset)
>  {
>  	int node_offset, err;
>  	const char *node_type = NULL;
> +	const char *node_name = NULL;
>  
>  	err = fdt_usb_get_node_type(blob, start_offset,
>  				    &node_offset, &node_type);
>  	if (err < 0)
>  		return err;
>  
> +	if (!strcmp(node_type, FSL_USB2_MPH) || !strcmp(node_type, FSL_USB2_DR))
> +		node_name = USB2_CI;
> +	else
> +		node_name = node_type;
> +	if (strcmp(node_name, controller_type))
> +		return err;
> +
>  	err = fdt_setprop(blob, node_offset, prop_erratum, NULL, 0);
>  	if (err < 0) {
>  		printf("ERROR: could not set %s for %s: %s.\n",
> @@ -99,6 +107,23 @@ static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum,
>  	return node_offset;
>  }
>  
> +static int fdt_fixup_erratum(int *usb_erratum_off, void *blob,
> +			     const char *controller_type, char *str,
> +			     bool (*has_erratum)(void))
> +{
> +	char buf[32] = {0};
> +
> +	snprintf(buf, sizeof(buf), "fsl,usb-erratum-%s", str);
> +	if (!(has_erratum()))

No need for the extra parenthesis around has_erratum() .

> +		return -EINVAL;
> +	*usb_erratum_off = fdt_fixup_usb_erratum(blob, buf, controller_type,
> +						 *usb_erratum_off);
> +	if (*usb_erratum_off < 0)
> +		return -ENOSPC;
> +	debug("Adding USB erratum %s\n", str);
> +	return 0;
> +}
> +
>  void fdt_fixup_dr_usb(void *blob, bd_t *bd)
>  {
>  	static const char * const modes[] = { "host", "peripheral", "otg" };
> @@ -111,6 +136,7 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
>  	int usb_phy_off = -1;
>  	char str[5];
>  	int i, j;
> +	int ret;
>  
>  	for (i = 1; i <= CONFIG_USB_MAX_CONTROLLER_COUNT; i++) {
>  		const char *dr_mode_type = NULL;
> @@ -164,39 +190,25 @@ 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;
> -		}
> +		ret = fdt_fixup_erratum(&usb_erratum_a006261_off, blob,
> +					USB2_CI, "a006261",
> +					has_erratum_a006261);
> +		if (ret == -ENOSPC)
> +			return;
> +		ret = fdt_fixup_erratum(&usb_erratum_a007075_off, blob,
> +					USB2_CI, "a007075",
> +					has_erratum_a007075);
> +		if (ret == -ENOSPC)
> +			return;
> +		ret = fdt_fixup_erratum(&usb_erratum_a007792_off, blob,
> +					USB2_CI, "a007792",
> +					has_erratum_a007792);
> +		if (ret == -ENOSPC)
> +			return;
> +		ret = fdt_fixup_erratum(&usb_erratum_a005697_off, blob,
> +					USB2_CI, "a005697",
> +					has_erratum_a005697);
> +		if (ret == -ENOSPC)
> +			return;
>  	}
>  }
> diff --git a/include/fsl_usb.h b/include/fsl_usb.h
> index 187e384..882a5f5 100644
> --- a/include/fsl_usb.h
> +++ b/include/fsl_usb.h
> @@ -85,6 +85,12 @@ struct ccsr_usb_phy {
>  #define CONFIG_SYS_FSL_USB_SQUELCH_PROG_MASK 0x07
>  #endif
>  
> +/* USB Controllers */
> +#define FSL_USB2_MPH	"fsl-usb2-mph"
> +#define FSL_USB2_DR	"fsl-usb2-dr"
> +#define USB2_CI		"usb2-ci"
> +#define SNPS_DWC3	"snps,dwc3"

Is this needed as a global macro or can it be local to fsl-dt-fixup.c ?

>  /* USB Erratum Checking code */
>  #ifdef CONFIG_PPC
>  static inline bool has_dual_phy(void)
> 


-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH v3 1/5] arm64: fsl-layerscape: add get_svr and IS_SVR_REV helper
  2016-06-09 13:28   ` Marek Vasut
@ 2016-06-10  3:47     ` Sriram Dash
  0 siblings, 0 replies; 14+ messages in thread
From: Sriram Dash @ 2016-06-10  3:47 UTC (permalink / raw)
  To: u-boot

>-----Original Message-----
>From: Marek Vasut [mailto:marex at denx.de]
>Sent: Thursday, June 09, 2016 6:58 PM
>To: Sriram Dash <sriram.dash@nxp.com>; u-boot at lists.denx.de
>Cc: york sun <york.sun@nxp.com>; albert.u.boot at aribaud.net; Rajesh Bhagat
><rajesh.bhagat@nxp.com>
>Subject: Re: [PATCH v3 1/5] arm64: fsl-layerscape: add get_svr and IS_SVR_REV
>helper
>
>On 06/09/2016 02:21 PM, Sriram Dash wrote:
>> Adds get_svr and IS_SVR_REV helpers for ARMv8 platforms, similar to
>> PPC and ARMv7.
>>
>> Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
>> Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
>> ---
>>
>> Changes in v1:
>>   - Added commit message
>>
>> Changes in v2:
>>   - No update
>
>So what changed in V3 here ?
>

Typo mistake. Will take care in v4.

>>  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(+)
>>
>> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>> b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>> index 9a5a6b5..9c575c1 100644
>> --- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>> +++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>> @@ -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)
>>  {
>> diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
>> b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
>> index e98e055..8b8a7c1 100644
>> --- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
>> +++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
>> @@ -596,4 +596,6 @@ struct ccsr_cci400 {
>>  #define SCR0_CLIENTPD_MASK		0x00000001
>>  #define SCR0_USFCFG_MASK		0x00000400
>>
>> +uint get_svr(void);
>> +
>>  #endif	/* __ARCH_FSL_LSCH2_IMMAP_H__*/
>> 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 65b3357..e48bbaf 100644
>> --- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
>> +++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
>> @@ -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_ */ diff --git
>> a/arch/arm/include/asm/arch-fsl-layerscape/soc.h
>> b/arch/arm/include/asm/arch-fsl-layerscape/soc.h
>> index 02ecc62..f244904 100644
>> --- a/arch/arm/include/asm/arch-fsl-layerscape/soc.h
>> +++ b/arch/arm/include/asm/arch-fsl-layerscape/soc.h
>> @@ -53,6 +53,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))
>
>This is susceptible to macro expansion problems, you need parenthesis around all
>the macro args:
>((SVR_MAJ(svr) == (maj)) && (SVR_MIN(svr) == (min)))
>

Ok. Will take care in v4.

>>  /* ahci port register default value */
>>  #define AHCI_PORT_PHY_1_CFG    0xa003fffe
>>
>
>
>--
>Best regards,
>Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers
  2016-06-09 13:30   ` Marek Vasut
@ 2016-06-10  3:47     ` Sriram Dash
  2016-06-10  4:08       ` Marek Vasut
  0 siblings, 1 reply; 14+ messages in thread
From: Sriram Dash @ 2016-06-10  3:47 UTC (permalink / raw)
  To: u-boot

>-----Original Message-----
>From: Marek Vasut [mailto:marex at denx.de]
>Sent: Thursday, June 09, 2016 7:01 PM
>To: Sriram Dash <sriram.dash@nxp.com>; u-boot at lists.denx.de
>Cc: york sun <york.sun@nxp.com>; albert.u.boot at aribaud.net; Rajesh Bhagat
><rajesh.bhagat@nxp.com>
>Subject: Re: [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl
>usb controllers
>
>On 06/09/2016 02:21 PM, Sriram Dash wrote:
>> Performs code cleanup for device tree fixup for fsl usb controllers by
>> making functions to handle these similar errata checking code.
>>
>> Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
>> Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
>> ---
>>
>> Changes in v3:
>>   - Inverted the condition for has_erratum for better readability
>>   - If fdt_fixup_usb_erratum fails, return ENOSPC and exit the fixup
>>   - Added logic for handling the condition with different controllers
>> 	with different erratas
>> 		- first check if the errata is applicable for the SoC
>> 		- then check if it is applicable for the controller
>> 		- if both are successful, then fix dt.
>>
>> Changes in v2:
>>   - Added patch description
>>   - Removed the MACRO and use fdt_fixup_erratum function instead
>>
>>  drivers/usb/common/fsl-dt-fixup.c | 88 ++++++++++++++++++++++-----------------
>>  include/fsl_usb.h                 |  6 +++
>>  2 files changed, 56 insertions(+), 38 deletions(-)
>>
>> diff --git a/drivers/usb/common/fsl-dt-fixup.c
>> b/drivers/usb/common/fsl-dt-fixup.c
>> index 6f31932..9cbd9d2 100644
>> --- a/drivers/usb/common/fsl-dt-fixup.c
>> +++ b/drivers/usb/common/fsl-dt-fixup.c
>> @@ -20,9 +20,9 @@
>>  #endif
>>
>>  static const char * const compat_usb_fsl[] = {
>> -	"fsl-usb2-mph",
>> -	"fsl-usb2-dr",
>> -	"snps,dwc3",
>> +	FSL_USB2_MPH,
>> +	FSL_USB2_DR,
>> +	SNPS_DWC3,
>>  	NULL
>>  };
>>
>> @@ -80,16 +80,24 @@ static int fdt_fixup_usb_mode_phy_type(void *blob,
>> const char *mode,  }
>>
>>  static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum,
>> -				 int start_offset)
>> +				 const char *controller_type, int start_offset)
>>  {
>>  	int node_offset, err;
>>  	const char *node_type = NULL;
>> +	const char *node_name = NULL;
>>
>>  	err = fdt_usb_get_node_type(blob, start_offset,
>>  				    &node_offset, &node_type);
>>  	if (err < 0)
>>  		return err;
>>
>> +	if (!strcmp(node_type, FSL_USB2_MPH) || !strcmp(node_type,
>FSL_USB2_DR))
>> +		node_name = USB2_CI;
>> +	else
>> +		node_name = node_type;
>> +	if (strcmp(node_name, controller_type))
>> +		return err;
>> +
>>  	err = fdt_setprop(blob, node_offset, prop_erratum, NULL, 0);
>>  	if (err < 0) {
>>  		printf("ERROR: could not set %s for %s: %s.\n", @@ -99,6 +107,23
>@@
>> static int fdt_fixup_usb_erratum(void *blob, const char *prop_erratum,
>>  	return node_offset;
>>  }
>>
>> +static int fdt_fixup_erratum(int *usb_erratum_off, void *blob,
>> +			     const char *controller_type, char *str,
>> +			     bool (*has_erratum)(void))
>> +{
>> +	char buf[32] = {0};
>> +
>> +	snprintf(buf, sizeof(buf), "fsl,usb-erratum-%s", str);
>> +	if (!(has_erratum()))
>
>No need for the extra parenthesis around has_erratum() .
>

Ok. Will remove parenthesis in v4.

>> +		return -EINVAL;
>> +	*usb_erratum_off = fdt_fixup_usb_erratum(blob, buf, controller_type,
>> +						 *usb_erratum_off);
>> +	if (*usb_erratum_off < 0)
>> +		return -ENOSPC;
>> +	debug("Adding USB erratum %s\n", str);
>> +	return 0;
>> +}
>> +
>>  void fdt_fixup_dr_usb(void *blob, bd_t *bd)  {
>>  	static const char * const modes[] = { "host", "peripheral", "otg" };
>> @@ -111,6 +136,7 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
>>  	int usb_phy_off = -1;
>>  	char str[5];
>>  	int i, j;
>> +	int ret;
>>
>>  	for (i = 1; i <= CONFIG_USB_MAX_CONTROLLER_COUNT; i++) {
>>  		const char *dr_mode_type = NULL;
>> @@ -164,39 +190,25 @@ 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;
>> -		}
>> +		ret = fdt_fixup_erratum(&usb_erratum_a006261_off, blob,
>> +					USB2_CI, "a006261",
>> +					has_erratum_a006261);
>> +		if (ret == -ENOSPC)
>> +			return;
>> +		ret = fdt_fixup_erratum(&usb_erratum_a007075_off, blob,
>> +					USB2_CI, "a007075",
>> +					has_erratum_a007075);
>> +		if (ret == -ENOSPC)
>> +			return;
>> +		ret = fdt_fixup_erratum(&usb_erratum_a007792_off, blob,
>> +					USB2_CI, "a007792",
>> +					has_erratum_a007792);
>> +		if (ret == -ENOSPC)
>> +			return;
>> +		ret = fdt_fixup_erratum(&usb_erratum_a005697_off, blob,
>> +					USB2_CI, "a005697",
>> +					has_erratum_a005697);
>> +		if (ret == -ENOSPC)
>> +			return;
>>  	}
>>  }
>> diff --git a/include/fsl_usb.h b/include/fsl_usb.h index
>> 187e384..882a5f5 100644
>> --- a/include/fsl_usb.h
>> +++ b/include/fsl_usb.h
>> @@ -85,6 +85,12 @@ struct ccsr_usb_phy {  #define
>> CONFIG_SYS_FSL_USB_SQUELCH_PROG_MASK 0x07  #endif
>>
>> +/* USB Controllers */
>> +#define FSL_USB2_MPH	"fsl-usb2-mph"
>> +#define FSL_USB2_DR	"fsl-usb2-dr"
>> +#define USB2_CI		"usb2-ci"
>> +#define SNPS_DWC3	"snps,dwc3"
>
>Is this needed as a global macro or can it be local to fsl-dt-fixup.c ?
>

Currently, the macro are only being used for dt fixup for fsl usb.
However, in the near future, they might be needed for some other purpose,
for example, board specific settings.
So, i think i will stick with the global macro.

>>  /* USB Erratum Checking code */
>>  #ifdef CONFIG_PPC
>>  static inline bool has_dual_phy(void)
>>
>
>
>--
>Best regards,
>Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers
  2016-06-10  3:47     ` Sriram Dash
@ 2016-06-10  4:08       ` Marek Vasut
  2016-06-10  5:20         ` Sriram Dash
  0 siblings, 1 reply; 14+ messages in thread
From: Marek Vasut @ 2016-06-10  4:08 UTC (permalink / raw)
  To: u-boot

On 06/10/2016 05:47 AM, Sriram Dash wrote:
>> -----Original Message-----
>> From: Marek Vasut [mailto:marex at denx.de]
>> Sent: Thursday, June 09, 2016 7:01 PM
>> To: Sriram Dash <sriram.dash@nxp.com>; u-boot at lists.denx.de
>> Cc: york sun <york.sun@nxp.com>; albert.u.boot at aribaud.net; Rajesh Bhagat
>> <rajesh.bhagat@nxp.com>
>> Subject: Re: [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl
>> usb controllers

Would you please fix your mailer to omit this useless header ?

[...]

>>> diff --git a/include/fsl_usb.h b/include/fsl_usb.h index
>>> 187e384..882a5f5 100644
>>> --- a/include/fsl_usb.h
>>> +++ b/include/fsl_usb.h
>>> @@ -85,6 +85,12 @@ struct ccsr_usb_phy {  #define
>>> CONFIG_SYS_FSL_USB_SQUELCH_PROG_MASK 0x07  #endif
>>>
>>> +/* USB Controllers */
>>> +#define FSL_USB2_MPH	"fsl-usb2-mph"
>>> +#define FSL_USB2_DR	"fsl-usb2-dr"
>>> +#define USB2_CI		"usb2-ci"

What is this "usb2-ci" string ? Is this some DT property or DT
compatible property or just some random string?

>>> +#define SNPS_DWC3	"snps,dwc3"
>>
>> Is this needed as a global macro or can it be local to fsl-dt-fixup.c ?
>>
> 
> Currently, the macro are only being used for dt fixup for fsl usb.
> However, in the near future, they might be needed for some other purpose,
> for example, board specific settings.

If they will be used for other purpose, then they can be moved. They are
local now, so keep them local.

> So, i think i will stick with the global macro.
> 
>>>  /* USB Erratum Checking code */
>>>  #ifdef CONFIG_PPC
>>>  static inline bool has_dual_phy(void)
>>>
>>
>>
>> --
>> Best regards,
>> Marek Vasut


-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers
  2016-06-10  4:08       ` Marek Vasut
@ 2016-06-10  5:20         ` Sriram Dash
  2016-06-10  5:33           ` Marek Vasut
  0 siblings, 1 reply; 14+ messages in thread
From: Sriram Dash @ 2016-06-10  5:20 UTC (permalink / raw)
  To: u-boot

>From: Marek Vasut [mailto:marex at denx.de]
>On 06/10/2016 05:47 AM, Sriram Dash wrote:
>>> -----Original Message-----
>>> From: Marek Vasut [mailto:marex at denx.de]
>>> Sent: Thursday, June 09, 2016 7:01 PM
>>> To: Sriram Dash <sriram.dash@nxp.com>; u-boot at lists.denx.de
>>> Cc: york sun <york.sun@nxp.com>; albert.u.boot at aribaud.net; Rajesh
>>> Bhagat <rajesh.bhagat@nxp.com>
>>> Subject: Re: [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device
>>> tree fixup for fsl usb controllers
>
>Would you please fix your mailer to omit this useless header ?
>
>[...]
>

Will take care next time onwards.

>>>> diff --git a/include/fsl_usb.h b/include/fsl_usb.h index
>>>> 187e384..882a5f5 100644
>>>> --- a/include/fsl_usb.h
>>>> +++ b/include/fsl_usb.h
>>>> @@ -85,6 +85,12 @@ struct ccsr_usb_phy {  #define
>>>> CONFIG_SYS_FSL_USB_SQUELCH_PROG_MASK 0x07  #endif
>>>>
>>>> +/* USB Controllers */
>>>> +#define FSL_USB2_MPH	"fsl-usb2-mph"
>>>> +#define FSL_USB2_DR	"fsl-usb2-dr"
>>>> +#define USB2_CI		"usb2-ci"
>
>What is this "usb2-ci" string ? Is this some DT property or DT compatible property or
>just some random string?
>

Currently, for chipidea usb 2 controller, there is no generic 
DT compatible property. Some names used are "qcom,ci-hdrc",
"chipidea,usb2","fsl-usb2-dr","fsl-usb2-mph ". This string "usb2-ci"
is not used currently for DT property.

>>>> +#define SNPS_DWC3	"snps,dwc3"
>>>
>>> Is this needed as a global macro or can it be local to fsl-dt-fixup.c ?
>>>
>>
>> Currently, the macro are only being used for dt fixup for fsl usb.
>> However, in the near future, they might be needed for some other
>> purpose, for example, board specific settings.
>
>If they will be used for other purpose, then they can be moved. They are local now,
>so keep them local.
>

Ok. I will move the global macro to fsl-dt-fixup.c.

>> So, i think i will stick with the global macro.
>>
>>>>  /* USB Erratum Checking code */
>>>>  #ifdef CONFIG_PPC
>>>>  static inline bool has_dual_phy(void)
>>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Marek Vasut
>
>
>--
>Best regards,
>Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers
  2016-06-10  5:20         ` Sriram Dash
@ 2016-06-10  5:33           ` Marek Vasut
  2016-06-10  6:09             ` Sriram Dash
  0 siblings, 1 reply; 14+ messages in thread
From: Marek Vasut @ 2016-06-10  5:33 UTC (permalink / raw)
  To: u-boot

On 06/10/2016 07:20 AM, Sriram Dash wrote:
>> From: Marek Vasut [mailto:marex at denx.de]
>> On 06/10/2016 05:47 AM, Sriram Dash wrote:
>>>> -----Original Message-----
>>>> From: Marek Vasut [mailto:marex at denx.de]
>>>> Sent: Thursday, June 09, 2016 7:01 PM
>>>> To: Sriram Dash <sriram.dash@nxp.com>; u-boot at lists.denx.de
>>>> Cc: york sun <york.sun@nxp.com>; albert.u.boot at aribaud.net; Rajesh
>>>> Bhagat <rajesh.bhagat@nxp.com>
>>>> Subject: Re: [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device
>>>> tree fixup for fsl usb controllers
>>
>> Would you please fix your mailer to omit this useless header ?
>>
>> [...]
>>
> 
> Will take care next time onwards.
> 
>>>>> diff --git a/include/fsl_usb.h b/include/fsl_usb.h index
>>>>> 187e384..882a5f5 100644
>>>>> --- a/include/fsl_usb.h
>>>>> +++ b/include/fsl_usb.h
>>>>> @@ -85,6 +85,12 @@ struct ccsr_usb_phy {  #define
>>>>> CONFIG_SYS_FSL_USB_SQUELCH_PROG_MASK 0x07  #endif
>>>>>
>>>>> +/* USB Controllers */
>>>>> +#define FSL_USB2_MPH	"fsl-usb2-mph"
>>>>> +#define FSL_USB2_DR	"fsl-usb2-dr"
>>>>> +#define USB2_CI		"usb2-ci"
>>
>> What is this "usb2-ci" string ? Is this some DT property or DT compatible property or
>> just some random string?
>>
> 
> Currently, for chipidea usb 2 controller, there is no generic 
> DT compatible property.

Linux kernel documentation says there is "chipidea,usb2":

https://www.kernel.org/doc/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt

> Some names used are "qcom,ci-hdrc",
> "chipidea,usb2","fsl-usb2-dr","fsl-usb2-mph ". This string "usb2-ci"
> is not used currently for DT property.

The "chipidea,usb2" is generic one, all the others are either heritage
from the past or more precise specifiers of the IP block. Do not invent
yet another new compatible property in this case, it makes zero sense.

>>>>> +#define SNPS_DWC3	"snps,dwc3"
>>>>
>>>> Is this needed as a global macro or can it be local to fsl-dt-fixup.c ?
>>>>
>>>
>>> Currently, the macro are only being used for dt fixup for fsl usb.
>>> However, in the near future, they might be needed for some other
>>> purpose, for example, board specific settings.
>>
>> If they will be used for other purpose, then they can be moved. They are local now,
>> so keep them local.
>>
> 
> Ok. I will move the global macro to fsl-dt-fixup.c.
> 
>>> So, i think i will stick with the global macro.
>>>
>>>>>  /* USB Erratum Checking code */
>>>>>  #ifdef CONFIG_PPC
>>>>>  static inline bool has_dual_phy(void)
>>>>>
>>>>
>>>>
>>>> --
>>>> Best regards,
>>>> Marek Vasut
>>
>>
>> --
>> Best regards,
>> Marek Vasut


-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers
  2016-06-10  5:33           ` Marek Vasut
@ 2016-06-10  6:09             ` Sriram Dash
  0 siblings, 0 replies; 14+ messages in thread
From: Sriram Dash @ 2016-06-10  6:09 UTC (permalink / raw)
  To: u-boot

>From: Marek Vasut [mailto:marex at denx.de]
>On 06/10/2016 07:20 AM, Sriram Dash wrote:
>>> From: Marek Vasut [mailto:marex at denx.de] On 06/10/2016 05:47 AM,
>>> Sriram Dash wrote:
>>>>> -----Original Message-----
>>>>> From: Marek Vasut [mailto:marex at denx.de]
>>>>> Sent: Thursday, June 09, 2016 7:01 PM
>>>>> To: Sriram Dash <sriram.dash@nxp.com>; u-boot at lists.denx.de
>>>>> Cc: york sun <york.sun@nxp.com>; albert.u.boot at aribaud.net; Rajesh
>>>>> Bhagat <rajesh.bhagat@nxp.com>
>>>>> Subject: Re: [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device
>>>>> tree fixup for fsl usb controllers
>>>
>>> Would you please fix your mailer to omit this useless header ?
>>>
>>> [...]
>>>
>>
>> Will take care next time onwards.
>>
>>>>>> diff --git a/include/fsl_usb.h b/include/fsl_usb.h index
>>>>>> 187e384..882a5f5 100644
>>>>>> --- a/include/fsl_usb.h
>>>>>> +++ b/include/fsl_usb.h
>>>>>> @@ -85,6 +85,12 @@ struct ccsr_usb_phy {  #define
>>>>>> CONFIG_SYS_FSL_USB_SQUELCH_PROG_MASK 0x07  #endif
>>>>>>
>>>>>> +/* USB Controllers */
>>>>>> +#define FSL_USB2_MPH	"fsl-usb2-mph"
>>>>>> +#define FSL_USB2_DR	"fsl-usb2-dr"
>>>>>> +#define USB2_CI		"usb2-ci"
>>>
>>> What is this "usb2-ci" string ? Is this some DT property or DT
>>> compatible property or just some random string?
>>>
>>
>> Currently, for chipidea usb 2 controller, there is no generic DT
>> compatible property.
>
>Linux kernel documentation says there is "chipidea,usb2":
>
>https://www.kernel.org/doc/Documentation/devicetree/bindings/usb/ci-hdrc-
>usb2.txt
>
>> Some names used are "qcom,ci-hdrc",
>> "chipidea,usb2","fsl-usb2-dr","fsl-usb2-mph ". This string "usb2-ci"
>> is not used currently for DT property.
>
>The "chipidea,usb2" is generic one, all the others are either heritage from the past
>or more precise specifiers of the IP block. Do not invent yet another new
>compatible property in this case, it makes zero sense.
>

Ok. Will change the "usb2-ci" into "chipidea,usb2" and "USB2_CI" into 
CHIPIDEA_USB2 in v4.

>>>>>> +#define SNPS_DWC3	"snps,dwc3"
>>>>>
>>>>> Is this needed as a global macro or can it be local to fsl-dt-fixup.c ?
>>>>>
>>>>
>>>> Currently, the macro are only being used for dt fixup for fsl usb.
>>>> However, in the near future, they might be needed for some other
>>>> purpose, for example, board specific settings.
>>>
>>> If they will be used for other purpose, then they can be moved. They
>>> are local now, so keep them local.
>>>
>>
>> Ok. I will move the global macro to fsl-dt-fixup.c.
>>
>>>> So, i think i will stick with the global macro.
>>>>
>>>>>>  /* USB Erratum Checking code */
>>>>>>  #ifdef CONFIG_PPC
>>>>>>  static inline bool has_dual_phy(void)
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Best regards,
>>>>> Marek Vasut
>>>
>>>
>>> --
>>> Best regards,
>>> Marek Vasut
>
>
>--
>Best regards,
>Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-06-10  6:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-09 12:21 [U-Boot] [PATCH v3 0/5] Supporting ARM v8 USB errata for FSL Sriram Dash
2016-06-09 12:21 ` [U-Boot] [PATCH v3 1/5] arm64: fsl-layerscape: add get_svr and IS_SVR_REV helper Sriram Dash
2016-06-09 13:28   ` Marek Vasut
2016-06-10  3:47     ` Sriram Dash
2016-06-09 12:21 ` [U-Boot] [PATCH v3 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers Sriram Dash
2016-06-09 13:30   ` Marek Vasut
2016-06-10  3:47     ` Sriram Dash
2016-06-10  4:08       ` Marek Vasut
2016-06-10  5:20         ` Sriram Dash
2016-06-10  5:33           ` Marek Vasut
2016-06-10  6:09             ` Sriram Dash
2016-06-09 12:21 ` [U-Boot] [PATCH v3 3/5] fsl: usb: make errata function common for PPC and ARM Sriram Dash
2016-06-09 12:21 ` [U-Boot] [PATCH v3 4/5] armv8/ls2080: Remove workaround for erratum A008751 Sriram Dash
2016-06-09 12:21 ` [U-Boot] [PATCH v3 5/5] usb: xhci: fsl: Add workaround for USB erratum A-008751 Sriram Dash

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox