musb-new: fix omap peripheral support
Subsystems (2)
v2 cover musb-new: fix omap peripheral support
DM_GADGET did not compile at all, probe was not called in non-gadget mode.
Tested on an omap4 board with ums and fastboot command.
Changes in V2:
- split up former 2/2 patch into two.
- do not break non-DM_USB_GADGET compile further
Andreas Kemnade (2):
musb-new: omap2430: no host data access in gadget mode
musb-new: omap2430: fix compiling in DM_USB_GADGET config
drivers/usb/musb-new/omap2430.c | 53 ++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 18 deletions(-)
Signature · 1 line
2.30.2
PATCH v2 1/2 musb-new: omap2430: no host data access in gadget mode
Avoid accessing structures (usb_bus_priv) only present when musb is in host mode.
--- drivers/usb/musb-new/omap2430.c | 34 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 18 deletions(-)
drivers/usb/musb-new/omap2430.c +16 -18
@@ -214,37 +214,35 @@ static int omap2430_musb_of_to_plat(struct udevice *dev)static int omap2430_musb_probe (struct udevice *dev) { -#ifdef CONFIG_USB_MUSB_HOST -struct musb_host_data *host =dev_get_priv (dev); -#else -struct musb *musbp; -#endif struct omap2430_musb_plat *plat =dev_get_plat (dev); -struct usb_bus_priv *priv =dev_get_uclass_priv (dev);struct omap_musb_board_data *otg_board_data;int ret =0 ;void *base =dev_read_addr_ptr (dev); - - priv->desc_before_addr = true; +struct musb *musbp; otg_board_data = &plat->otg_board_data; -#ifdef CONFIG_USB_MUSB_HOST - host->host =musb_init_controller (&plat->plat, - (struct device *)otg_board_data, - plat->base); -if (!host->host) { -return -EIO ; +if (CONFIG_IS_ENABLED (USB_MUSB_HOST )) { +struct musb_host_data *host =dev_get_priv (dev); +struct usb_bus_priv *priv =dev_get_uclass_priv (dev); + + priv->desc_before_addr = true; + + host->host =musb_init_controller (&plat->plat, + (struct device *)otg_board_data, + plat->base); +if (!host->host) +return -EIO ; + +return musb_lowlevel_init (host); } - ret =musb_lowlevel_init (host); -#else musbp =musb_register (&plat->plat, (struct device *)otg_board_data, plat->base);if (IS_ERR_OR_NULL (musbp))return -EINVAL ; -#endif -return ret; + +return 0 ; }static int omap2430_musb_remove (struct udevice *dev)
Signature · 1 line
2.30.2
Re: [PATCH v2 1/2] musb-new: omap2430: no host data access in gadget mode
Quoted 4 lines · Andreas Kemnade
Avoid accessing structures (
usb_bus_priv) only present when musb is in host mode.Signed-off-by Andreas Kemnade <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v2 2/2 musb-new: omap2430: fix compiling in DM_USB_GADGET config
In reply to Andreas KemnadeAdd the separate IRQ handling function and change the registration.
--- drivers/usb/musb-new/omap2430.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/usb/musb-new/omap2430.c +19 -0
@@ -46,6 +46,15 @@ static inline void omap2430_low_level_init(struct musb *musb)musb_writel (musb->mregs,OTG_FORCESTDBY , l); } +#ifdef CONFIG_DM_USB_GADGET +int dm_usb_gadget_handle_interrupts (struct udevice *dev) +{ +struct musb_host_data *host =dev_get_priv (dev); + + host->host->isr (0 , host->host); +return 0 ; +} +#endif static int omap2430_musb_init (struct musb *musb) {
@@ -235,6 +244,16 @@ static int omap2430_musb_probe(struct udevice *dev)return -EIO ;return musb_lowlevel_init (host); + }else if (CONFIG_IS_ENABLED (DM_USB_GADGET )) { +struct musb_host_data *host =dev_get_priv (dev); + + host->host =musb_init_controller (&plat->plat, + (struct device *)otg_board_data, + plat->base); +if (!host->host) +return -EIO ; + +return usb_add_gadget_udc ((struct device *)otg_board_data, &host->host->g); } musbp = musb_register(&plat->plat, (struct device *)otg_board_data,
Signature · 1 line
2.30.2
Re: [PATCH v2 2/2] musb-new: omap2430: fix compiling in DM_USB_GADGET config
Quoted 3 lines · Andreas Kemnade
Add the separate IRQ handling function and change the registration.
Signed-off-by Andreas Kemnade <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom