All of lore.kernel.org
 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>,
	Marek Vasut <marex@denx.de>,
	Maksim Kiselev <bigunclemax@gmail.com>,
	Sam Edwards <CFSworks@gmail.com>
Subject: [PATCH 1/3] usb: musb-new: sunxi: do not attempt to access NULL SRAMC
Date: Fri,  2 Jun 2023 15:49:56 -0600	[thread overview]
Message-ID: <20230602214958.167909-2-CFSworks@gmail.com> (raw)
In-Reply-To: <20230602214958.167909-1-CFSworks@gmail.com>

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@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


  reply	other threads:[~2023-06-02 21:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02 21:49 [PATCH 0/3] Allwinner sunxi USB gadget improvements Sam Edwards
2023-06-02 21:49 ` Sam Edwards [this message]
2023-06-05 10:00   ` [PATCH 1/3] usb: musb-new: sunxi: do not attempt to access NULL SRAMC Marek Vasut
2023-06-05 11:04   ` Andre Przywara
2023-06-07  5:39     ` Sam Edwards
2023-06-07 10:45       ` Andre Przywara
2023-06-07 23:29         ` Sam Edwards
2023-06-02 21:49 ` [PATCH 2/3] usb: musb-new: sunxi: fix error check Sam Edwards
2023-06-05 10:01   ` Marek Vasut
2023-06-02 21:49 ` [PATCH 3/3] usb: musb-new: sunxi: make compatible with UDC/DM gadget model Sam Edwards
2023-06-05 10:02   ` Marek Vasut

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=20230602214958.167909-2-CFSworks@gmail.com \
    --to=cfsworks@gmail.com \
    --cc=andre.przywara@arm.com \
    --cc=bigunclemax@gmail.com \
    --cc=jagan@amarulasolutions.com \
    --cc=marex@denx.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.