public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sam Edwards <cfsworks@gmail.com>
To: u-boot@lists.denx.de
Cc: Andre Przywara <andre.przywara@arm.com>,
	Jagan Teki <jagan@amarulasolutions.com>,
	Sam Edwards <CFSworks@gmail.com>
Subject: [PATCH v3 1/2] usb: musb-new: sunxi: only perform SRAM initialization when necessary
Date: Mon, 12 Jun 2023 14:03:01 -0600	[thread overview]
Message-ID: <20230612200302.21354-2-CFSworks@gmail.com> (raw)
In-Reply-To: <20230612200302.21354-1-CFSworks@gmail.com>

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 --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 = {
-- 
2.39.2


  reply	other threads:[~2023-06-12 20:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 20:03 [PATCH v3 0/2] sunxi, usb: Clean up SRAM initialization code Sam Edwards
2023-06-12 20:03 ` Sam Edwards [this message]
2023-06-12 20:03 ` [PATCH v3 2/2] usb: musb-new: sunxi: clarify the purpose of SRAM initialization Sam Edwards
2023-06-15 10:32   ` Andre Przywara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230612200302.21354-2-CFSworks@gmail.com \
    --to=cfsworks@gmail.com \
    --cc=andre.przywara@arm.com \
    --cc=jagan@amarulasolutions.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox