diff options
author | Jagan Teki <jagan@amarulasolutions.com> | 2018-05-07 13:03:19 +0530 |
---|---|---|
committer | Jagan Teki <jagan@amarulasolutions.com> | 2018-05-28 16:40:43 +0530 |
commit | 98424b703113d6387ce004d79d98e238989d59c2 (patch) | |
tree | debc7dc116c437598d3bd274d40355375d7c93a0 /drivers/usb | |
parent | ae8b78de30e923f4797da3edcf1f64f301782c2b (diff) | |
download | u-boot-98424b703113d6387ce004d79d98e238989d59c2.tar.gz u-boot-98424b703113d6387ce004d79d98e238989d59c2.tar.xz u-boot-98424b703113d6387ce004d79d98e238989d59c2.zip |
musb: sunxi: Use simple way to fill musb_hdrc pdata
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>
Acked-by: Jun Nie <jun.nie@linaro.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/musb-new/sunxi.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c index 332ac16663..18218c68fe 100644 --- a/drivers/usb/musb-new/sunxi.c +++ b/drivers/usb/musb-new/sunxi.c @@ -307,22 +307,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; @@ -335,8 +325,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; @@ -344,7 +340,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 |