[PATCH 04/19] ARM: layerscape: cleanup erratum_a009007

Sascha Hauer s.hauer at pengutronix.de
Thu Jan 4 06:17:31 PST 2024


Drop the generic erratum_a009007_layerscape() function and move the
code into its SoC specific pendants to make the way free for additional
SoCs.

While at it remove the USB_PHY_RX_EQ_VAL_x defines from immap_lsch2.h
to get rid of conflicting defines in that file.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/mach-layerscape/errata.c | 29 +++++++++++++----------------
 include/soc/fsl/immap_lsch2.h     | 13 +------------
 2 files changed, 14 insertions(+), 28 deletions(-)

diff --git a/arch/arm/mach-layerscape/errata.c b/arch/arm/mach-layerscape/errata.c
index e3793b3bcd..8feb98b0f7 100644
--- a/arch/arm/mach-layerscape/errata.c
+++ b/arch/arm/mach-layerscape/errata.c
@@ -30,27 +30,24 @@ static void erratum_a008997_ls1046a(void)
 	set_usb_pcstxswingfull(scfg, SCFG_USB3PRM2CR_USB3);
 }
 
-#define PROGRAM_USB_PHY_RX_OVRD_IN_HI(phy)      \
-	out_be16((phy) + SCFG_USB_PHY_RX_OVRD_IN_HI, USB_PHY_RX_EQ_VAL_1);      \
-	out_be16((phy) + SCFG_USB_PHY_RX_OVRD_IN_HI, USB_PHY_RX_EQ_VAL_2);      \
-	out_be16((phy) + SCFG_USB_PHY_RX_OVRD_IN_HI, USB_PHY_RX_EQ_VAL_3);      \
-	out_be16((phy) + SCFG_USB_PHY_RX_OVRD_IN_HI, USB_PHY_RX_EQ_VAL_4)
-
-static void erratum_a009007_layerscape(void)
+static void erratum_a009007(void __iomem *phy, u16 val1, u16 val2, u16 val3, u16 val4)
 {
-	void __iomem *usb_phy = IOMEM(SCFG_USB_PHY1);
-
-	usb_phy = (void __iomem *)SCFG_USB_PHY3;
-	PROGRAM_USB_PHY_RX_OVRD_IN_HI(usb_phy);
+	scfg_out16(phy + SCFG_USB_PHY_RX_OVRD_IN_HI, val1);
+	scfg_out16(phy + SCFG_USB_PHY_RX_OVRD_IN_HI, val2);
+	scfg_out16(phy + SCFG_USB_PHY_RX_OVRD_IN_HI, val3);
+	scfg_out16(phy + SCFG_USB_PHY_RX_OVRD_IN_HI, val4);
 }
 
 static void erratum_a009007_ls1046a(void)
 {
-	void __iomem *usb_phy = IOMEM(SCFG_USB_PHY1);
+	erratum_a009007(IOMEM(SCFG_USB_PHY1), 0x0000, 0x0080, 0x0380, 0x0b80);
+	erratum_a009007(IOMEM(SCFG_USB_PHY2), 0x0000, 0x0080, 0x0380, 0x0b80);
+	erratum_a009007(IOMEM(SCFG_USB_PHY3), 0x0000, 0x0080, 0x0380, 0x0b80);
+}
 
-	PROGRAM_USB_PHY_RX_OVRD_IN_HI(usb_phy);
-	usb_phy = (void __iomem *)SCFG_USB_PHY2;
-	PROGRAM_USB_PHY_RX_OVRD_IN_HI(usb_phy);
+static void erratum_a009007_ls1021a(void)
+{
+	erratum_a009007(IOMEM(SCFG_USB_PHY1), 0x0000, 0x8000, 0x8004, 0x800C);
 }
 
 static inline void set_usb_txvreftune(u32 __iomem *scfg, u32 offset)
@@ -125,7 +122,6 @@ static void layerscape_errata(void)
 	erratum_a009008_layerscape();
 	erratum_a009798_layerscape();
 	erratum_a008997_layerscape();
-	erratum_a009007_layerscape();
 }
 
 void ls1046a_errata(void)
@@ -140,6 +136,7 @@ void ls1046a_errata(void)
 void ls1021a_errata(void)
 {
 	layerscape_errata();
+	erratum_a009007_ls1021a();
 	erratum_a009008_ls1021a();
 }
 
diff --git a/include/soc/fsl/immap_lsch2.h b/include/soc/fsl/immap_lsch2.h
index ce840d4223..0993fa1cd8 100644
--- a/include/soc/fsl/immap_lsch2.h
+++ b/include/soc/fsl/immap_lsch2.h
@@ -301,17 +301,6 @@ struct ls102xa_ccsr_gur {
 #define SCFG_USB_PHY2			0x08500000
 #define SCFG_USB_PHY3			0x08510000
 #define SCFG_USB_PHY_RX_OVRD_IN_HI		0x200c
-#if defined CONFIG_ARCH_LS1046
-#define USB_PHY_RX_EQ_VAL_1		0x0000
-#define USB_PHY_RX_EQ_VAL_2		0x0080
-#define USB_PHY_RX_EQ_VAL_3		0x0380
-#define USB_PHY_RX_EQ_VAL_4		0x0b80
-#elif defined CONFIG_ARCH_LS1021
-#define USB_PHY_RX_EQ_VAL_1		0x0000
-#define USB_PHY_RX_EQ_VAL_2		0x8000
-#define USB_PHY_RX_EQ_VAL_3		0x8004
-#define USB_PHY_RX_EQ_VAL_4		0x800C
-#endif
 
 #define SCFG_ETSECDMAMCR_LE_BD_FR	0x00000c00
 #define SCFG_SNPCNFGCR_SEC_RD_WR	0xc0000000
@@ -516,4 +505,4 @@ struct ls102xa_ccsr_scfg {
 	u32 core0sftrstsr;
 	u32 clusterpmcr;
 };
-#endif	/* __ARCH_FSL_LSCH2_IMMAP_H__*/
+#endif /* __ARCH_FSL_LSCH2_IMMAP_H__*/
-- 
2.39.2




More information about the barebox mailing list