From: Ladislav Michl <oss-lists@triops.cz>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Liang He <windhl@126.com>,
"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: [PATCH v5 4/7] usb: dwc3: dwc3-octeon: Avoid half-initialized controller state
Date: Tue, 1 Aug 2023 10:42:44 +0200 [thread overview]
Message-ID: <ZMjFhMrnrJRQ2Qlf@lenoch> (raw)
In-Reply-To: <ZMiaIUy6d5gVl7mA@lenoch>
On Tue, Aug 01, 2023 at 07:37:37AM +0200, Ladislav Michl wrote:
> Anyway, what about just passing octeon into dwc3_octeon_config_gpio
> and use all that dirty magic inside. Would that work work for you?
Something like this:
[PATCH] usb: dwc3: dwc3-octeon: Consolidate pinmux configuration
As there is no pinctrl driver for Octeon, pinmux configuration is done
in dwc3_octeon_config_gpio function. It has been always done the tricky
way: there are two UCTLs; first at 0x1180068000000 and second at
0x1180069000000, so address based test is used to get index to configure
pin muxing, because DT does not provide that information.
To make pinmux configuration a little less hackish until proper solution
is developed, move all its logic into dwc3_octeon_config_gpio function.
---
drivers/usb/dwc3/dwc3-octeon.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-octeon.c b/drivers/usb/dwc3/dwc3-octeon.c
index 90e1ae66769f..f35dca899d6e 100644
--- a/drivers/usb/dwc3/dwc3-octeon.c
+++ b/drivers/usb/dwc3/dwc3-octeon.c
@@ -206,9 +206,10 @@ static inline void dwc3_octeon_writeq(void __iomem *base, uint64_t val)
cvmx_writeq_csr(base, val);
}
-static void dwc3_octeon_config_gpio(int index, int gpio)
+static void dwc3_octeon_config_gpio(struct dwc3_octeon *octeon, int gpio)
{
union cvmx_gpio_bit_cfgx gpio_bit;
+ int index = ((__force uintptr_t)octeon->base >> 24) & 1;
if ((OCTEON_IS_MODEL(OCTEON_CN73XX) ||
OCTEON_IS_MODEL(OCTEON_CNF75XX))
@@ -237,7 +238,7 @@ static inline uint64_t dwc3_octeon_readq(void __iomem *addr)
static inline void dwc3_octeon_writeq(void __iomem *base, uint64_t val) { }
-static inline void dwc3_octeon_config_gpio(int index, int gpio) { }
+static inline void dwc3_octeon_config_gpio(struct dwc3_octeon *octeon, int gpio) { }
static uint64_t octeon_get_io_clock_rate(void)
{
@@ -422,7 +423,7 @@ static int dwc3_octeon_setup(struct dwc3_octeon *octeon,
val &= ~USBDRD_UCTL_HOST_PPC_EN;
} else {
val |= USBDRD_UCTL_HOST_PPC_EN;
- dwc3_octeon_config_gpio(((u64)octeon->base >> 24) & 1, power_gpio);
+ dwc3_octeon_config_gpio(octeon, power_gpio);
dev_dbg(dev, "power control is using gpio%d\n", power_gpio);
}
if (power_active_low)
--
2.39.2
next prev parent reply other threads:[~2023-08-01 8:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 9:30 [PATCH v5 0/7] Cleanup Octeon DWC3 glue code Ladislav Michl
2023-07-31 9:30 ` [PATCH v5 1/7] usb: dwc3: dwc3-octeon: Convert to glue driver Ladislav Michl
2023-07-31 9:31 ` [PATCH v5 2/7] usb: dwc3: dwc3-octeon: Use _ULL bitfields defines Ladislav Michl
2023-07-31 23:54 ` Thinh Nguyen
2023-08-01 13:41 ` Philippe Mathieu-Daudé
2023-07-31 9:31 ` [PATCH v5 3/7] usb: dwc3: dwc3-octeon: Pass dwc3_octeon to setup functions Ladislav Michl
2023-08-01 0:01 ` Thinh Nguyen
2023-08-01 0:06 ` Thinh Nguyen
2023-07-31 9:32 ` [PATCH v5 4/7] usb: dwc3: dwc3-octeon: Avoid half-initialized controller state Ladislav Michl
2023-08-01 0:38 ` Thinh Nguyen
2023-08-01 5:37 ` Ladislav Michl
2023-08-01 8:42 ` Ladislav Michl [this message]
2023-08-02 0:47 ` Thinh Nguyen
2023-08-02 0:42 ` Thinh Nguyen
2023-08-02 0:45 ` Thinh Nguyen
2023-07-31 9:32 ` [PATCH v5 5/7] usb: dwc3: dwc3-octeon: Move node parsing into driver probe Ladislav Michl
2023-08-01 0:42 ` Thinh Nguyen
2023-07-31 9:33 ` [PATCH v5 6/7] usb: dwc3: dwc3-octeon: Dump control register on clock init failure Ladislav Michl
2023-08-01 0:44 ` Thinh Nguyen
2023-07-31 9:33 ` [PATCH v5 7/7] usb: dwc3: dwc3-octeon: Add SPDX header and copyright Ladislav Michl
2023-08-01 0:45 ` Thinh Nguyen
2023-08-01 13:50 ` Philippe Mathieu-Daudé
2023-08-01 14:24 ` [EXTERNAL] " David Daney
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=ZMjFhMrnrJRQ2Qlf@lenoch \
--to=oss-lists@triops.cz \
--cc=Thinh.Nguyen@synopsys.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=tsbogend@alpha.franken.de \
--cc=windhl@126.com \
/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;
as well as URLs for NNTP newsgroup(s).