[PATCH 1/3] usb: musb-new: sunxi: do not attempt to access NULL SRAMC

Sam Edwards cfsworks at gmail.com
Fri Jun 2 23:49:56 CEST 2023


I believe that some sunxis (ncat2?) lack a SRAMC block,
as accessing this region results in a data abort. Checking
that it's non-null before accessing it allows this to be
set to NULL for SoCs where it's not present.

Signed-off-by: Sam Edwards <CFSworks at gmail.com>
---
 drivers/usb/musb-new/sunxi.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index dc4cfc2194..6e60dd47e0 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -174,13 +174,15 @@ static void USBC_ForceVbusValidToHigh(__iomem void *base)
 
 static void USBC_ConfigFIFO_Base(void)
 {
-	u32 reg_value;
-
-	/* config usb fifo, 8kb mode */
-	reg_value = readl(SUNXI_SRAMC_BASE + 0x04);
-	reg_value &= ~(0x03 << 0);
-	reg_value |= BIT(0);
-	writel(reg_value, SUNXI_SRAMC_BASE + 0x04);
+	if (SUNXI_SRAMC_BASE) {
+		u32 reg_value;
+
+		/* config usb fifo, 8kb mode */
+		reg_value = readl(SUNXI_SRAMC_BASE + 0x04);
+		reg_value &= ~(0x03 << 0);
+		reg_value |= BIT(0);
+		writel(reg_value, SUNXI_SRAMC_BASE + 0x04);
+	}
 }
 
 /******************************************************************************
-- 
2.39.2



More information about the U-Boot mailing list