From: Jagan Teki <jagan@amarulasolutions.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v6 03/34] musb: sunxi: Use simple way to fill musb_hdrc pdata
Date: Thu, 26 Apr 2018 15:50:19 +0530 [thread overview]
Message-ID: <20180426102020.31058-4-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20180426102020.31058-1-jagan@amarulasolutions.com>
Filling musb_hdrc pdata using structure will unnecessary
add extra ifdefs, so fill them inside probe call for
better code understanding and get rid ifdefs using
devicetree compatible.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v6:
- memset to pdata
drivers/usb/musb-new/sunxi.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index 3f3b89886a..637e8b9b52 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -308,22 +308,12 @@ static struct musb_hdrc_config musb_config = {
.ram_bits = SUNXI_MUSB_RAM_BITS,
};
-static struct musb_hdrc_platform_data musb_plat = {
-#if defined(CONFIG_USB_MUSB_HOST)
- .mode = MUSB_HOST,
-#else
- .mode = MUSB_PERIPHERAL,
-#endif
- .config = &musb_config,
- .power = 250,
- .platform_ops = &sunxi_musb_ops,
-};
-
static int musb_usb_probe(struct udevice *dev)
{
struct sunxi_glue *glue = dev_get_priv(dev);
struct musb_host_data *host = &glue->mdata;
struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
+ struct musb_hdrc_platform_data pdata;
void *base = dev_read_addr_ptr(dev);
int ret;
@@ -336,8 +326,14 @@ static int musb_usb_probe(struct udevice *dev)
priv->desc_before_addr = true;
+ memset(&pdata, 0, sizeof(pdata));
+ pdata.power = 250;
+ pdata.platform_ops = &sunxi_musb_ops;
+ pdata.config = &musb_config;
+
#ifdef CONFIG_USB_MUSB_HOST
- host->host = musb_init_controller(&musb_plat, &glue->dev, base);
+ pdata.mode = MUSB_HOST;
+ host->host = musb_init_controller(&pdata, &glue->dev, base);
if (!host->host)
return -EIO;
@@ -345,7 +341,8 @@ static int musb_usb_probe(struct udevice *dev)
if (!ret)
printf("Allwinner mUSB OTG (Host)\n");
#else
- ret = musb_register(&musb_plat, &glue->dev, base);
+ pdata.mode = MUSB_PERIPHERAL;
+ ret = musb_register(&pdata, &glue->dev, base);
if (!ret)
printf("Allwinner mUSB OTG (Peripheral)\n");
#endif
--
2.14.3
next prev parent reply other threads:[~2018-04-26 10:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-26 10:20 [U-Boot] [PATCH v6 04/34] musb: sunxi: Add fifo config Jagan Teki
2018-04-26 10:20 ` [U-Boot] [PATCH v6 06/34] musb: sunxi: Add OTG device clkgate and reset for H3/H5 Jagan Teki
2018-04-26 10:20 ` [U-Boot] [PATCH v6] musb: sunxi: Use BIT instead of numerical shift Jagan Teki
2018-04-26 10:20 ` Jagan Teki [this message]
2018-04-26 10:20 ` [U-Boot] [PATCH v6 07/34] sunxi: clock: Fix OHCI clock gating for H3/H5 Jagan Teki
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=20180426102020.31058-4-jagan@amarulasolutions.com \
--to=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