diff mbox series

[v2,1/2] usb: musb-new: sunxi: only perform SRAM initialization when necessary

Message ID 20230609213716.107339-2-CFSworks@gmail.com
State Superseded
Delegated to: Marek Vasut
Headers show
Series sunxi, usb: Clean up SRAM initialization code | expand

Commit Message

Sam Edwards June 9, 2023, 9:37 p.m. UTC
Only the older (ca. A10, A20) sunxis need this poke for the MUSB to
function. Mimic the Linux kernel and add a `has_sram` flag to the config
structure that is only set for the specific compatibles that require
this initialization.

Signed-off-by: Sam Edwards <CFSworks@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Andre Przywara <andre.przywara@arm.com>
---
 drivers/usb/musb-new/sunxi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index c5c63249aa..1111a67eaf 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -83,6 +83,7 @@ 
 
 struct sunxi_musb_config {
 	struct musb_hdrc_config *config;
+	bool has_sram;
 };
 
 struct sunxi_glue {
@@ -311,7 +312,10 @@  static int sunxi_musb_init(struct musb *musb)
 
 	musb->isr = sunxi_musb_interrupt;
 
-	USBC_ConfigFIFO_Base();
+	if (glue->cfg->has_sram) {
+		USBC_ConfigFIFO_Base();
+	}
+
 	USBC_EnableDpDmPullUp(musb->mregs);
 	USBC_EnableIdPullUp(musb->mregs);
 
@@ -517,6 +521,7 @@  static int musb_usb_remove(struct udevice *dev)
 
 static const struct sunxi_musb_config sun4i_a10_cfg = {
 	.config = &musb_config,
+	.has_sram = true,
 };
 
 static const struct sunxi_musb_config sun6i_a31_cfg = {