Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01FB5C7EE25 for ; Fri, 9 Jun 2023 10:01:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 93F7D856D1; Fri, 9 Jun 2023 12:01:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 3AE0A8612C; Fri, 9 Jun 2023 12:01:01 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 10B9D856D1 for ; Fri, 9 Jun 2023 12:00:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 73971AB6; Fri, 9 Jun 2023 03:01:41 -0700 (PDT) Received: from donnerap.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 85C733F587; Fri, 9 Jun 2023 03:00:55 -0700 (PDT) Date: Fri, 9 Jun 2023 11:00:51 +0100 From: Andre Przywara To: Sam Edwards Cc: u-boot@lists.denx.de, Jagan Teki , Marek Vasut Subject: Re: [PATCH 1/2] usb: musb-new: sunxi: only perform SRAM initialization when necessary Message-ID: <20230609110051.51ae5b91@donnerap.cambridge.arm.com> In-Reply-To: <20230607231644.28203-2-CFSworks@gmail.com> References: <20230607231644.28203-1-CFSworks@gmail.com> <20230607231644.28203-2-CFSworks@gmail.com> Organization: ARM X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; aarch64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On Wed, 7 Jun 2023 17:16:43 -0600 Sam Edwards wrote: Hi, > 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. So I grabbed a BananaPi (A20) and played with it a little. Gadgets still work with this patch, also I can confirm that this bit is necessary (turned it off with mw.l, and the gadget stopped working), and also that the bit flip works (set "has_sram = false;" and it didn't work anymore). Also tested on an OrangePi Zero (H3), which doesn't need the SRAM switch. It worked with both the bit set and cleared, also before and after the patch, so it's all fine. > Signed-off-by: Sam Edwards Reviewed-by: Andre Przywara Tested-by: Andre Przywara Thanks, Andre > --- > 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 ab55d68620..c05c0d5561 100644 > --- a/drivers/usb/musb-new/sunxi.c > +++ b/drivers/usb/musb-new/sunxi.c > @@ -85,6 +85,7 @@ > > struct sunxi_musb_config { > struct musb_hdrc_config *config; > + bool has_sram; > }; > > struct sunxi_glue { > @@ -313,7 +314,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); > > @@ -525,6 +529,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 = {