Few MUSB fixes for ifdef removal
Subsystems (4)
Tony Lindgren
maintainercover Few MUSB fixes for ifdef removal
Hi all,
Here are two regression fixes for the MUSB ifdef removal.
Note that this series does not fix things for blackfin or davinci, similar fixes should be done for those.
Regards,
Tony
---
Tony Lindgren (2):
ARM: OMAP2+: Fix MUSB ifdefs for platform init code
ARM: OMAP2: Fix tusb6010 GPIO interrupt for n8x0
arch/arm/mach-omap2/board-n8x0.c | 6 ++---- arch/arm/mach-omap2/omap_phy_internal.c | 6 ------ arch/arm/mach-omap2/usb-musb.c | 6 ++---- arch/arm/mach-omap2/usb-tusb6010.c | 2 +- 4 files changed, 5 insertions(+), 15 deletions(-)
Signature · 1 line
Signature
Tony Lindgren
maintainerPATCH 1/2 ARM: OMAP2+: Fix MUSB ifdefs for platform init code
Commit 62285963 (usb: musb: drop a gigantic amount of ifdeferry) got rid of a bunch of ifdefs in the MUSB code. Looks like the platform init code is still using these dropped defines though, which in many cases results the board defaulting always to host mode.
Currently the situation is that USB_MUSB_HDRC is the main Kconfig option with additional USB_GADGET_MUSB_HDRC so only these two should be used to select between host and OTG mode.
Fix the situation for omaps. The following users should fix the platform init code in a similar way:
Dropped Kconfig option Current users
USB_MUSB_OTG blackfin, davinci, not in Kconfigs USB_MUSB_PERIPHERAL davinci, not in Kconfigs USB_MUSB_HOST davinci, not in Kconfigs USB_MUSB_HDRC_HCD blackfin, not in Kconfigs USB_MUSB_OTG blackfin, not in Kconfigs
--- arch/arm/mach-omap2/board-n8x0.c | 6 ++---- arch/arm/mach-omap2/omap_phy_internal.c | 6 ------ arch/arm/mach-omap2/usb-musb.c | 6 ++---- 3 files changed, 4 insertions(+), 14 deletions(-)
arch/arm/mach-omap2/board-n8x0.c +2 -4
@@ -86,11 +86,9 @@ static struct musb_hdrc_config musb_config = { };static struct musb_hdrc_platform_data tusb_data = { -#if defined(CONFIG_USB_MUSB_OTG) +#ifdef CONFIG_USB_GADGET_MUSB_HDRC .mode =MUSB_OTG , -#elif defined(CONFIG_USB_MUSB_PERIPHERAL) - .mode = MUSB_PERIPHERAL, -#else /* defined(CONFIG_USB_MUSB_HOST) */ +#else .mode =MUSB_HOST , #endif .set_power = tusb_set_power,
arch/arm/mach-omap2/omap_phy_internal.c +0 -6
@@ -239,21 +239,15 @@ void am35x_set_mode(u8 musb_mode) devconf2 &= ~CONF2_OTGMODE ;switch (musb_mode) { -#ifdef CONFIG_USB_MUSB_HDRC_HCD case MUSB_HOST :/* Force VBUS valid, ID = 0 */ devconf2 |=CONF2_FORCE_HOST ;break ; -#endif -#ifdef CONFIG_USB_GADGET_MUSB_HDRC case MUSB_PERIPHERAL :/* Force VBUS valid, ID = 1 */ devconf2 |=CONF2_FORCE_DEVICE ;break ; -#endif -#ifdef CONFIG_USB_MUSB_OTG case MUSB_OTG :/* Don't override the VBUS/ID comparators */ devconf2 |=CONF2_NO_OVERRIDE ;break ; -#endif default :pr_info (KERN_INFO "Unsupported mode %u\n" , musb_mode); }
arch/arm/mach-omap2/usb-musb.c +2 -4
@@ -41,12 +41,10 @@ static struct musb_hdrc_config musb_config = { };static struct musb_hdrc_platform_data musb_plat = { -#ifdef CONFIG_USB_MUSB_OTG +#ifdef CONFIG_USB_GADGET_MUSB_HDRC .mode =MUSB_OTG , -#elif defined(CONFIG_USB_MUSB_HDRC_HCD) +#else .mode =MUSB_HOST , -#elif defined(CONFIG_USB_GADGET_MUSB_HDRC) - .mode =MUSB_PERIPHERAL , #endif/* .clock is set dynamically */ .config = &musb_config,
PATCH 1/2 ARM: OMAP2+: Fix MUSB ifdefs for platform init code
Quoted 21 lines · Tony Lindgren
Commit 62285963 (usb: musb: drop a gigantic amount of ifdeferry) got rid of a bunch of ifdefs in the MUSB code. Looks like the platform init code is still using these dropped defines though, which in many cases results the board defaulting always to host mode.
Currently the situation is that
USB_MUSB_HDRCis the mainKconfigoption with additionalUSB_GADGET_MUSB_HDRCso only these two should be used to select between host and OTG mode.Fix the situation for omaps. The following users should fix the platform init code in a similar way:
Dropped
Kconfigoption Current usersUSB_MUSB_OTG blackfin, davinci, not in Kconfigs USB_MUSB_PERIPHERAL davinci, not in Kconfigs USB_MUSB_HOST davinci, not in Kconfigs USB_MUSB_HDRC_HCD blackfin, not in Kconfigs USB_MUSB_OTG blackfin, not in Kconfigs
Quoted 5 lines
Cc Mike Frysinger <[email protected]>Cc Sekhar Nori <[email protected]>Cc linux-usb at vger.kernel.orgCc Felipe Balbi <[email protected]>Signed-off-by Tony Lindgren <[email protected]>
Looks ok, though I would stick to things boards are wired to do. e.g.:
all development boards are wired for OTG (with a few exceptions), n800 is peripheral only
n810 is OTG
and so on. That way you remove all the clutter.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120622/1655eeeb/attachment.sig>
Tony Lindgren
maintainerPATCH 1/2 ARM: OMAP2+: Fix MUSB ifdefs for platform init code
Quoted 28 lines · Felipe Balbi
Quoted 21 lines · Tony Lindgren
Commit 62285963 (usb: musb: drop a gigantic amount of ifdeferry) got rid of a bunch of ifdefs in the MUSB code. Looks like the platform init code is still using these dropped defines though, which in many cases results the board defaulting always to host mode.
Currently the situation is that
USB_MUSB_HDRCis the mainKconfigoption with additionalUSB_GADGET_MUSB_HDRCso only these two should be used to select between host and OTG mode.Fix the situation for omaps. The following users should fix the platform init code in a similar way:
Dropped
Kconfigoption Current usersUSB_MUSB_OTG blackfin, davinci, not in Kconfigs USB_MUSB_PERIPHERAL davinci, not in Kconfigs USB_MUSB_HOST davinci, not in Kconfigs USB_MUSB_HDRC_HCD blackfin, not in Kconfigs USB_MUSB_OTG blackfin, not in KconfigsQuoted 5 lines
Cc Mike Frysinger <[email protected]>Cc Sekhar Nori <[email protected]>Cc linux-usb at vger.kernel.orgCc Felipe Balbi <[email protected]>Signed-off-by Tony Lindgren <[email protected]>
Quoted 7 lines
Looks ok, though I would stick to things boards are wired to do. e.g.:
all development boards are wired for OTG (with a few exceptions), n800 is peripheral only
n810 is OTGand so on. That way you remove all the clutter.
FYI, these got already merged last week as fixes because of the broken Kconfig options.
What you're suggesting sounds like a good follow-up patch to improve things, although I suggest that we remove CONFIG_USB_GADGET_MUSB_HDRC ifdef else from board-*.c files, and always set host = MUSB_OTG.
For example, both n800 and n810 are wired up the same way except for the mini-B vs mini-AB connector. The connector alone should be enough to keep n800 as peripheral unless somebody specifically wants to force it into host mode by using a non-standard cable or the debug options.
AFAIK, this same logic should apply to all the devices, or do you see issues with it?
Regards,
Tony
PATCH 1/2 ARM: OMAP2+: Fix MUSB ifdefs for platform init code
Hi,
Quoted 44 lines · Tony Lindgren
Quoted 28 lines · Felipe Balbi
Quoted 21 lines · Tony Lindgren
Commit 62285963 (usb: musb: drop a gigantic amount of ifdeferry) got rid of a bunch of ifdefs in the MUSB code. Looks like the platform init code is still using these dropped defines though, which in many cases results the board defaulting always to host mode.
Currently the situation is that
USB_MUSB_HDRCis the mainKconfigoption with additionalUSB_GADGET_MUSB_HDRCso only these two should be used to select between host and OTG mode.Fix the situation for omaps. The following users should fix the platform init code in a similar way:
Dropped
Kconfigoption Current usersUSB_MUSB_OTG blackfin, davinci, not in Kconfigs USB_MUSB_PERIPHERAL davinci, not in Kconfigs USB_MUSB_HOST davinci, not in Kconfigs USB_MUSB_HDRC_HCD blackfin, not in Kconfigs USB_MUSB_OTG blackfin, not in KconfigsQuoted 5 lines
Cc Mike Frysinger <[email protected]>Cc Sekhar Nori <[email protected]>Cc linux-usb at vger.kernel.orgCc Felipe Balbi <[email protected]>Signed-off-by Tony Lindgren <[email protected]>Quoted 7 lines
Looks ok, though I would stick to things boards are wired to do. e.g.:
all development boards are wired for OTG (with a few exceptions), n800 is peripheral only
n810 is OTGand so on. That way you remove all the clutter.
FYI, these got already merged last week as fixes because of the broken
Kconfigoptions.What you're suggesting sounds like a good follow-up patch to improve things, although I suggest that we remove
CONFIG_USB_GADGET_MUSB_HDRCifdef else from board-*.c files, and always set host =MUSB_OTG.
Quoted 7 lines
For example, both n800 and n810 are wired up the same way except for the mini-B vs mini-AB connector. The connector alone should be enough to keep n800 as peripheral unless somebody specifically wants to force it into host mode by using a non-standard cable or the debug options.
AFAIK, this same logic should apply to all the devices, or do you see issues with it?
no, that's pretty much what I tried to say ;-) If board has a mini/micro-B receptacle, then it can't be host/OTG/DRD (unless you hack the cable, or change ID pin rules on the transceiver, or you force the IP to host mode through the testmode register).
Now if board has mini/micro-AB, then it's surely supporting OTG, so we can set board_file to MUSB_OTG. That will drop all ifdeferry too.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120625/52735491/attachment-0001.sig>
Tony Lindgren
maintainerPATCH 2/2 ARM: OMAP2: Fix tusb6010 GPIO interrupt for n8x0
In reply to Tony LindgrenHere's one more gpio_to_irq conversion that we missed earlier. Tested with n800 in gadget mode using USB_ETH.
--- arch/arm/mach-omap2/usb-tusb6010.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/usb-tusb6010.c +1 -1
@@ -300,7 +300,7 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data,printk (error,3 , status);return status; } - tusb_resources[2 ].start = irq +IH_GPIO_BASE ; + tusb_resources[2 ].start =gpio_to_irq (irq);/* set up memory timings ... can speed them up later */ if (!ps_refclk) {
PATCH 2/2 ARM: OMAP2: Fix tusb6010 GPIO interrupt for n8x0
Quoted 5 lines · Tony Lindgren
Here's one more
gpio_to_irqconversion that we missed earlier. Tested with n800 in gadget mode usingUSB_ETH.Cc Felipe Balbi <[email protected]>Signed-off-by Tony Lindgren <[email protected]>
Quoted 18 lines
--- arch/arm/mach-omap2/usb-tusb6010.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/mach-omap2/usb-tusb6010.c +1
-1@@ -300,7 +300,7 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data,printk (error,3 , status);return status; } - tusb_resources[2 ].start = irq +IH_GPIO_BASE ; + tusb_resources[2 ].start =gpio_to_irq (irq);/* set up memory timings ... can speed them up later */ if (!ps_refclk) {
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120625/bd7020b7/attachment.sig>