Skip to contentSkip to conversation

arm: omap3beagle: init musb default role by Kconfig

PATCH In review Bob Liu 2 participants 6 messages Feb 15, 2011 – Feb 16, 2011

Subsystems (5)
lore
Share & tools
lore

Bob Liu

author
#0 lore raw

PATCH 1/1 arm: omap3beagle: init musb default role by Kconfig

Currently musb is initialized to OTG mode by default in musb_board_data, it's better to init it depending on Kconfig.

---
 arch/arm/mach-omap2/board-omap3beagle.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/board-omap3beagle.c +7 -1
index 14f4224..fb82773 100644
@@ -554,7 +554,13 @@ static struct omap_board_mux board_mux[] __initdata = {
 
 static struct omap_musb_board_data musb_board_data = {
 	.interface_type		= MUSB_INTERFACE_ULPI,
-	.mode			= MUSB_OTG,
+#if defined(CONFIG_USB_MUSB_OTG)
+	.mode		= MUSB_OTG,
+#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
+	.mode		= MUSB_HOST,
+#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
+	.mode		= MUSB_PERIPHERAL,
+#endif
 	.power			= 100,
 };
 
Signature · 1 line
1.6.3.3
#1 lore raw

Hi,

Quoted 2 lines · Bob Liu

Currently musb is initialized to OTG mode by default in musb_board_data, it's better to init it depending on Kconfig.

what's the problem in always keeping OTG ? that board is wired for OTG anyway.

Signature · 1 line
balbi
author
#2 lore raw
Quoted 9 lines · Felipe Balbi

Hi,

Quoted 2 lines · Bob Liu

Currently musb is initialized to OTG mode by default in musb_board_data, it's better to init it depending on Kconfig.

what's the problem in always keeping OTG ? that board is wired for OTG anyway.

Yeah, but it's better if user can make their choices by themselves. Or mask the other choices in Kconfig if keeping OTG. Currently user can select HOST-only mode in Kconfig, but will receive compiler error.
In my opinion, this should be consist.

Another problem is if keeping in OTG mode, my board can't recognize usb device. HOST-only mode works fine, I am still debugging on it.
But I think it's not related with current topic.

Thanks

Signature · 2 lines
Regards,
--Bob
#3 lore raw
Quoted 11 lines · Bob Liu
Quoted 9 lines · Felipe Balbi

Hi,

Quoted 2 lines · Bob Liu

Currently musb is initialized to OTG mode by default in musb_board_data, it's better to init it depending on Kconfig.

what's the problem in always keeping OTG ? that board is wired for OTG anyway.

Quoted 5 lines

Yeah, but it's better if user can make their choices by themselves. Or mask the other choices in Kconfig if keeping OTG. Currently user can select HOST-only mode in Kconfig, but will receive compiler error.
In my opinion, this should be consist.

compile error ?? Would you share that ? All I see is a dev_err() when Kconfig doesn't match board-file.

Quoted 3 lines

Another problem is if keeping in OTG mode, my board can't recognize usb device. HOST-only mode works fine, I am still debugging on it.
But I think it's not related with current topic.

I can be related. Try this:

drivers/usb/musb/musb_core.c +0 -25
index 54a8bd1..bc29655 100644
@@ -1949,31 +1949,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
                goto fail0;
        }
 
-       switch (plat->mode) {
-       case MUSB_HOST:
-#ifdef CONFIG_USB_MUSB_HDRC_HCD
-               break;
-#else
-               goto bad_config;
-#endif
-       case MUSB_PERIPHERAL:
-#ifdef CONFIG_USB_GADGET_MUSB_HDRC
-               break;
-#else
-               goto bad_config;
-#endif
-       case MUSB_OTG:
-#ifdef CONFIG_USB_MUSB_OTG
-               break;
-#else
-bad_config:
-#endif
-       default:
-               dev_err(dev, "incompatible Kconfig role setting\n");
-               status = -EINVAL;
-               goto fail0;
-       }
-
        /* allocate */
        musb = allocate_instance(dev, plat->config, ctrl);
        if (!musb) {
Signature · 1 line
balbi
author
#4 lore raw
Quoted 18 lines · Felipe Balbi
Quoted 11 lines · Bob Liu
Quoted 9 lines · Felipe Balbi

Hi,

Quoted 2 lines · Bob Liu

Currently musb is initialized to OTG mode by default in musb_board_data, it's better to init it depending on Kconfig.

what's the problem in always keeping OTG ? that board is wired for OTG anyway.

Quoted 5 lines

Yeah, but it's better if user can make their choices by themselves. Or mask the other choices in Kconfig if keeping OTG. Currently user can select HOST-only mode in Kconfig, but will receive compiler error.
In my opinion, this should be consist.

Quoted 8 lines

compile error ?? Would you share that ? All I see is a dev_err() when Kconfig doesn't match board-file.

Quoted 3 lines

Another problem is if keeping in OTG mode, my board can't recognize usb device. HOST-only mode works fine, I am still debugging on it.
But I think it's not related with current topic.

I can be related. Try this:

Yeah, it works. Thanks, sorry for the noise
.
BTW: Is the below patch which about musb_core.c will be merged into mainline ?

Quoted 38 lines
drivers/usb/musb/musb_core.c +0 -25
index 54a8bd1..bc29655 100644
@@ -1949,31 +1949,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
                goto fail0;
        }
 
-       switch (plat->mode) {
-       case MUSB_HOST:
-#ifdef CONFIG_USB_MUSB_HDRC_HCD
-               break;
-#else
-               goto bad_config;
-#endif
-       case MUSB_PERIPHERAL:
-#ifdef CONFIG_USB_GADGET_MUSB_HDRC
-               break;
-#else
-               goto bad_config;
-#endif
-       case MUSB_OTG:
-#ifdef CONFIG_USB_MUSB_OTG
-               break;
-#else
-bad_config:
-#endif
-       default:
-               dev_err(dev, "incompatible Kconfig role setting\n");
-               status = -EINVAL;
-               goto fail0;
-       }
-
        /* allocate */
        musb = allocate_instance(dev, plat->config, ctrl);
        if (!musb) {
Signature · 6 lines
Regards,
--Bob
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

Hi,

Quoted 5 lines · Bob Liu
Quoted 1 line

I can be related. Try this:

Yeah, it works. Thanks, sorry for the noise
.
BTW: Is the below patch which about musb_core.c will be merged into mainline ?

I thinking on doing that, yes.

Signature · 1 line
balbi