From: Ladislav Michl <oss-lists@triops.cz>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Liang He <windhl@126.com>
Cc: linux-mips@vger.kernel.org, linux-usb@vger.kernel.org
Subject: [PATCH v5 3/7] usb: dwc3: dwc3-octeon: Pass dwc3_octeon to setup functions
Date: Mon, 31 Jul 2023 11:31:46 +0200 [thread overview]
Message-ID: <ZMd/gt58laSlqAAT@lenoch> (raw)
In-Reply-To: <ZMd/HzISn0mPsNWt@lenoch>
From: Ladislav Michl <ladis@linux-mips.org>
Pass dwc3_octeon instead of just the base. It fits with the
function names and it requires less change in the future if
access to dwc3_octeon is needed.
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
CHANGES:
- v4: new patch
- v5: Philippe's review tag
drivers/usb/dwc3/dwc3-octeon.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-octeon.c b/drivers/usb/dwc3/dwc3-octeon.c
index 69fe50cfa719..24e75881b5cf 100644
--- a/drivers/usb/dwc3/dwc3-octeon.c
+++ b/drivers/usb/dwc3/dwc3-octeon.c
@@ -300,12 +300,13 @@ static int dwc3_octeon_config_power(struct device *dev, void __iomem *base)
return 0;
}
-static int dwc3_octeon_clocks_start(struct device *dev, void __iomem *base)
+static int dwc3_octeon_clocks_start(struct dwc3_octeon *octeon)
{
int i, div, mpll_mul, ref_clk_fsel, ref_clk_sel = 2;
u32 clock_rate;
u64 val;
- void __iomem *uctl_ctl_reg = base + USBDRD_UCTL_CTL;
+ struct device *dev = octeon->dev;
+ void __iomem *uctl_ctl_reg = octeon->base + USBDRD_UCTL_CTL;
if (dev->of_node) {
const char *ss_clock_type;
@@ -452,8 +453,8 @@ static int dwc3_octeon_clocks_start(struct device *dev, void __iomem *base)
/* Step 8b: Wait 10 controller-clock cycles. */
udelay(10);
- /* Steo 8c: Setup power-power control. */
- if (dwc3_octeon_config_power(dev, base))
+ /* Step 8c: Setup power control. */
+ if (dwc3_octeon_config_power(dev, octeon->base))
return -EINVAL;
/* Step 8d: Deassert UAHC reset signal. */
@@ -477,10 +478,10 @@ static int dwc3_octeon_clocks_start(struct device *dev, void __iomem *base)
return 0;
}
-static void __init dwc3_octeon_set_endian_mode(void __iomem *base)
+static void dwc3_octeon_set_endian_mode(struct dwc3_octeon *octeon)
{
u64 val;
- void __iomem *uctl_shim_cfg_reg = base + USBDRD_UCTL_SHIM_CFG;
+ void __iomem *uctl_shim_cfg_reg = octeon->base + USBDRD_UCTL_SHIM_CFG;
val = dwc3_octeon_readq(uctl_shim_cfg_reg);
val &= ~USBDRD_UCTL_SHIM_CFG_DMA_ENDIAN_MODE;
@@ -492,10 +493,10 @@ static void __init dwc3_octeon_set_endian_mode(void __iomem *base)
dwc3_octeon_writeq(uctl_shim_cfg_reg, val);
}
-static void __init dwc3_octeon_phy_reset(void __iomem *base)
+static void dwc3_octeon_phy_reset(struct dwc3_octeon *octeon)
{
u64 val;
- void __iomem *uctl_ctl_reg = base + USBDRD_UCTL_CTL;
+ void __iomem *uctl_ctl_reg = octeon->base + USBDRD_UCTL_CTL;
val = dwc3_octeon_readq(uctl_ctl_reg);
val &= ~USBDRD_UCTL_CTL_UPHY_RST;
@@ -518,12 +519,12 @@ static int dwc3_octeon_probe(struct platform_device *pdev)
if (IS_ERR(octeon->base))
return PTR_ERR(octeon->base);
- err = dwc3_octeon_clocks_start(dev, octeon->base);
+ err = dwc3_octeon_clocks_start(octeon);
if (err)
return err;
- dwc3_octeon_set_endian_mode(octeon->base);
- dwc3_octeon_phy_reset(octeon->base);
+ dwc3_octeon_set_endian_mode(octeon);
+ dwc3_octeon_phy_reset(octeon);
platform_set_drvdata(pdev, octeon);
--
2.39.2
next prev parent reply other threads:[~2023-07-31 9:32 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 ` Ladislav Michl [this message]
2023-08-01 0:01 ` [PATCH v5 3/7] usb: dwc3: dwc3-octeon: Pass dwc3_octeon to setup functions 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
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=ZMd/gt58laSlqAAT@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).