linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* usb_nop_xceiv_register() missing when OTG built as modules
@ 2010-03-04  0:09 Kevin Hilman
  2010-03-04  4:29 ` Gupta, Ajay Kumar
  0 siblings, 1 reply; 14+ messages in thread
From: Kevin Hilman @ 2010-03-04  0:09 UTC (permalink / raw)
  To: linux-omap

This just started happening with v2.6.33.

On OMAP3EVM, usb_nop_xceiv_register() is called in the board file,
but if USB gadget support is built as a module, this causes a link
error (below)

This is obviously broken, and this hook needs to be fixed to work when
called as a module.

To reproduce, start with omap3_defconfig and change both USB host
and gadget to be built as modules.

Kevin


  [...]
  LD      .tmp_vmlinux1
arch/arm/mach-omap2/built-in.o: In function `omap3_evm_init':
/opt/home/khilman/work.local/kernel/omap/dev/arch/arm/mach-omap2/board-omap3evm.c:686: undefined reference to `usb_nop_xceiv_register'
arch/arm/mach-omap2/built-in.o: In function `omap_4430sdp_init':
/opt/home/khilman/work.local/kernel/omap/dev/arch/arm/mach-omap2/board-4430sdp.c:143: undefined reference to `usb_nop_xceiv_register'
make[1]: *** [.tmp_vmlinux1] Error 1
make: *** [sub-make] Error 2

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: usb_nop_xceiv_register() missing when OTG built as modules
  2010-03-04  0:09 usb_nop_xceiv_register() missing when OTG built as modules Kevin Hilman
@ 2010-03-04  4:29 ` Gupta, Ajay Kumar
  2010-03-04 17:32   ` Kevin Hilman
  0 siblings, 1 reply; 14+ messages in thread
From: Gupta, Ajay Kumar @ 2010-03-04  4:29 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: linux-omap@vger.kernel.org

> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> owner@vger.kernel.org] On Behalf Of Kevin Hilman
> Sent: Thursday, March 04, 2010 5:39 AM
> To: linux-omap@vger.kernel.org
> Subject: usb_nop_xceiv_register() missing when OTG built as modules
> 
> This just started happening with v2.6.33.
> 
> On OMAP3EVM, usb_nop_xceiv_register() is called in the board file,
> but if USB gadget support is built as a module, this causes a link
> error (below)

Kevin,

usb_nop_xceiv_register() is defined at drivers/usb/otg/nop-usb-xceiv.c file
which gets compiled if CONFIG_NOP_USB_XCEIV=y.

I think you have enabled CONFIG_NOP_USB_XCEIV as module?

Regards,
Ajay

> 
> This is obviously broken, and this hook needs to be fixed to work when
> called as a module.
> 
> To reproduce, start with omap3_defconfig and change both USB host
> and gadget to be built as modules.
> 
> Kevin
> 
> 
>   [...]
>   LD      .tmp_vmlinux1
> arch/arm/mach-omap2/built-in.o: In function `omap3_evm_init':
> /opt/home/khilman/work.local/kernel/omap/dev/arch/arm/mach-omap2/board-
> omap3evm.c:686: undefined reference to `usb_nop_xceiv_register'
> arch/arm/mach-omap2/built-in.o: In function `omap_4430sdp_init':
> /opt/home/khilman/work.local/kernel/omap/dev/arch/arm/mach-omap2/board-
> 4430sdp.c:143: undefined reference to `usb_nop_xceiv_register'
> make[1]: *** [.tmp_vmlinux1] Error 1
> make: *** [sub-make] Error 2
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: usb_nop_xceiv_register() missing when OTG built as modules
  2010-03-04  4:29 ` Gupta, Ajay Kumar
@ 2010-03-04 17:32   ` Kevin Hilman
  2010-03-05  3:50     ` Gupta, Ajay Kumar
  2010-03-05  9:04     ` Felipe Balbi
  0 siblings, 2 replies; 14+ messages in thread
From: Kevin Hilman @ 2010-03-04 17:32 UTC (permalink / raw)
  To: Gupta, Ajay Kumar; +Cc: linux-omap@vger.kernel.org

"Gupta, Ajay Kumar" <ajay.gupta@ti.com> writes:

>> -----Original Message-----
>> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
>> owner@vger.kernel.org] On Behalf Of Kevin Hilman
>> Sent: Thursday, March 04, 2010 5:39 AM
>> To: linux-omap@vger.kernel.org
>> Subject: usb_nop_xceiv_register() missing when OTG built as modules
>> 
>> This just started happening with v2.6.33.
>> 
>> On OMAP3EVM, usb_nop_xceiv_register() is called in the board file,
>> but if USB gadget support is built as a module, this causes a link
>> error (below)
>
> Kevin,
>
> usb_nop_xceiv_register() is defined at drivers/usb/otg/nop-usb-xceiv.c file
> which gets compiled if CONFIG_NOP_USB_XCEIV=y.
>
> I think you have enabled CONFIG_NOP_USB_XCEIV as module?

Yes, I did that intentionally.  I *want* USB compiled as a module.  If
I do that, the build fails, and that's a bug that needs to be fixed.

Kevin


>
>> 
>> This is obviously broken, and this hook needs to be fixed to work when
>> called as a module.
>> 
>> To reproduce, start with omap3_defconfig and change both USB host
>> and gadget to be built as modules.
>> 
>> Kevin
>> 
>> 
>>   [...]
>>   LD      .tmp_vmlinux1
>> arch/arm/mach-omap2/built-in.o: In function `omap3_evm_init':
>> /opt/home/khilman/work.local/kernel/omap/dev/arch/arm/mach-omap2/board-
>> omap3evm.c:686: undefined reference to `usb_nop_xceiv_register'
>> arch/arm/mach-omap2/built-in.o: In function `omap_4430sdp_init':
>> /opt/home/khilman/work.local/kernel/omap/dev/arch/arm/mach-omap2/board-
>> 4430sdp.c:143: undefined reference to `usb_nop_xceiv_register'
>> make[1]: *** [.tmp_vmlinux1] Error 1
>> make: *** [sub-make] Error 2
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: usb_nop_xceiv_register() missing when OTG built as modules
  2010-03-04 17:32   ` Kevin Hilman
@ 2010-03-05  3:50     ` Gupta, Ajay Kumar
  2010-03-05  9:04     ` Felipe Balbi
  1 sibling, 0 replies; 14+ messages in thread
From: Gupta, Ajay Kumar @ 2010-03-05  3:50 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: linux-omap@vger.kernel.org

> -----Original Message-----
> From: Kevin Hilman [mailto:khilman@deeprootsystems.com]
> Sent: Thursday, March 04, 2010 11:03 PM
> To: Gupta, Ajay Kumar
> Cc: linux-omap@vger.kernel.org
> Subject: Re: usb_nop_xceiv_register() missing when OTG built as modules
> 
> "Gupta, Ajay Kumar" <ajay.gupta@ti.com> writes:
> 
> >> -----Original Message-----
> >> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> >> owner@vger.kernel.org] On Behalf Of Kevin Hilman
> >> Sent: Thursday, March 04, 2010 5:39 AM
> >> To: linux-omap@vger.kernel.org
> >> Subject: usb_nop_xceiv_register() missing when OTG built as modules
> >>
> >> This just started happening with v2.6.33.
> >>
> >> On OMAP3EVM, usb_nop_xceiv_register() is called in the board file,
> >> but if USB gadget support is built as a module, this causes a link
> >> error (below)
> >
> > Kevin,
> >
> > usb_nop_xceiv_register() is defined at drivers/usb/otg/nop-usb-xceiv.c
> file
> > which gets compiled if CONFIG_NOP_USB_XCEIV=y.
> >
> > I think you have enabled CONFIG_NOP_USB_XCEIV as module?
> 
> Yes, I did that intentionally.  I *want* USB compiled as a module.  If
> I do that, the build fails, and that's a bug that needs to be fixed.

USB can still be compiled as module without any error if we choose 
CONFIG_NOP_USB_XCEIV=y. Any reason why you want NOP transceiver also
as module ?

-Ajay
 
> 
> Kevin
> 
> 
> >
> >>
> >> This is obviously broken, and this hook needs to be fixed to work when
> >> called as a module.
> >>
> >> To reproduce, start with omap3_defconfig and change both USB host
> >> and gadget to be built as modules.
> >>
> >> Kevin
> >>
> >>
> >>   [...]
> >>   LD      .tmp_vmlinux1
> >> arch/arm/mach-omap2/built-in.o: In function `omap3_evm_init':
> >> /opt/home/khilman/work.local/kernel/omap/dev/arch/arm/mach-omap2/board-
> >> omap3evm.c:686: undefined reference to `usb_nop_xceiv_register'
> >> arch/arm/mach-omap2/built-in.o: In function `omap_4430sdp_init':
> >> /opt/home/khilman/work.local/kernel/omap/dev/arch/arm/mach-omap2/board-
> >> 4430sdp.c:143: undefined reference to `usb_nop_xceiv_register'
> >> make[1]: *** [.tmp_vmlinux1] Error 1
> >> make: *** [sub-make] Error 2
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-omap"
> in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: usb_nop_xceiv_register() missing when OTG built as modules
  2010-03-04 17:32   ` Kevin Hilman
  2010-03-05  3:50     ` Gupta, Ajay Kumar
@ 2010-03-05  9:04     ` Felipe Balbi
  2010-03-05 17:59       ` Kevin Hilman
  1 sibling, 1 reply; 14+ messages in thread
From: Felipe Balbi @ 2010-03-05  9:04 UTC (permalink / raw)
  To: ext Kevin Hilman; +Cc: Gupta, Ajay Kumar, linux-omap@vger.kernel.org

On Thu, Mar 04, 2010 at 06:32:40PM +0100, ext Kevin Hilman wrote:
>Yes, I did that intentionally.  I *want* USB compiled as a module.  If
>I do that, the build fails, and that's a bug that needs to be fixed.

it depends on where you're calling usb_nop_xceiv_register(), if you're 
calling from a file that's built-into the kernel, then it's your fault.

I suggest you keep usb as a module, but keep nop xceiv built-in.

-- 
balbi

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: usb_nop_xceiv_register() missing when OTG built as modules
  2010-03-05  9:04     ` Felipe Balbi
@ 2010-03-05 17:59       ` Kevin Hilman
  2010-03-05 19:54         ` me
  0 siblings, 1 reply; 14+ messages in thread
From: Kevin Hilman @ 2010-03-05 17:59 UTC (permalink / raw)
  To: felipe.balbi; +Cc: Gupta, Ajay Kumar, linux-omap@vger.kernel.org

Felipe Balbi <felipe.balbi@nokia.com> writes:

> On Thu, Mar 04, 2010 at 06:32:40PM +0100, ext Kevin Hilman wrote:
>>Yes, I did that intentionally.  I *want* USB compiled as a module.  If
>>I do that, the build fails, and that's a bug that needs to be fixed.
>
> it depends on where you're calling usb_nop_xceiv_register(), 

It's called from various board files (board-omap3evm.c,
board-4430sdp.c.)

> if you're calling from a file that's built-into the kernel, then
> it's your fault.

It would be my fault if I wrote those board files.  ;)

> I suggest you keep usb as a module, but keep nop xceiv built-in.

Yes, that's the workaround I'm already using, but it is not a fix.

This dependency breaks the ability to build a minimal kernel with
everything as modules (allmodconfig)

The nop xceiv needs a way for built-in code to register itself for
the cases when no xceiv is built as a module.

Kevin



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: usb_nop_xceiv_register() missing when OTG built as modules
  2010-03-05 17:59       ` Kevin Hilman
@ 2010-03-05 19:54         ` me
  2010-03-05 22:02           ` Kevin Hilman
  0 siblings, 1 reply; 14+ messages in thread
From: me @ 2010-03-05 19:54 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: felipe.balbi, Gupta, Ajay Kumar, linux-omap

On Fri, 05 Mar 2010 09:59:52 -0800, Kevin Hilman
> It would be my fault if I wrote those board files.  ;)

sure, sorry. Maybe I didn't express myself really well.

>> I suggest you keep usb as a module, but keep nop xceiv built-in.
> 
> Yes, that's the workaround I'm already using, but it is not a fix.
> 
> This dependency breaks the ability to build a minimal kernel with
> everything as modules (allmodconfig)

now this is a really good point. Haven't thought that way...

> The nop xceiv needs a way for built-in code to register itself for
> the cases when no xceiv is built as a module.

when way to do that is not to use usb_nop_xceiv_register() and
add the platform_device to the board-files. I never really liked
the whole usb_nop_xceiv_register() hackery. Almost all board-files
have a list of platform_devices which get added by platform_add_devices()
anyways, so why not using that ??

to me the usb_nop_xceiv_register() thing is just a lazy way of
defining platform_devices. Specially one that takes some 3
lines of code only.

-- 
balbi

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: usb_nop_xceiv_register() missing when OTG built as modules
  2010-03-05 19:54         ` me
@ 2010-03-05 22:02           ` Kevin Hilman
  2010-05-22 23:53             ` Amit Kucheria
  0 siblings, 1 reply; 14+ messages in thread
From: Kevin Hilman @ 2010-03-05 22:02 UTC (permalink / raw)
  To: me; +Cc: felipe.balbi, Gupta, Ajay Kumar, linux-omap

<me@felipebalbi.com> writes:

> On Fri, 05 Mar 2010 09:59:52 -0800, Kevin Hilman
>> It would be my fault if I wrote those board files.  ;)
>
> sure, sorry. Maybe I didn't express myself really well.
>
>>> I suggest you keep usb as a module, but keep nop xceiv built-in.
>> 
>> Yes, that's the workaround I'm already using, but it is not a fix.
>> 
>> This dependency breaks the ability to build a minimal kernel with
>> everything as modules (allmodconfig)
>
> now this is a really good point. Haven't thought that way...
>
>> The nop xceiv needs a way for built-in code to register itself for
>> the cases when no xceiv is built as a module.
>
> when way to do that is not to use usb_nop_xceiv_register() and
> add the platform_device to the board-files. I never really liked
> the whole usb_nop_xceiv_register() hackery. Almost all board-files
> have a list of platform_devices which get added by platform_add_devices()
> anyways, so why not using that ??
>
> to me the usb_nop_xceiv_register() thing is just a lazy way of
> defining platform_devices. Specially one that takes some 3
> lines of code only.

Completely agree.  I didn't take the time to look into the USB code to
see if a simple plaform device creation would fix this.

If so, any chance of a patch for OMAP3EVM and 4430SDP?

I'll be happy to test on OMAP3EVM, but don't have a 4430.

Kevin


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: usb_nop_xceiv_register() missing when OTG built as modules
  2010-03-05 22:02           ` Kevin Hilman
@ 2010-05-22 23:53             ` Amit Kucheria
  2010-05-24  7:07               ` Gupta, Ajay Kumar
  2010-05-26  6:02               ` Felipe Balbi
  0 siblings, 2 replies; 14+ messages in thread
From: Amit Kucheria @ 2010-05-22 23:53 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: me, felipe.balbi, Gupta, Ajay Kumar, linux-omap, tony

[-- Attachment #1: Type: text/plain, Size: 1790 bytes --]

On 10 Mar 05, Kevin Hilman wrote:
> <me@felipebalbi.com> writes:
> 
> > On Fri, 05 Mar 2010 09:59:52 -0800, Kevin Hilman
> >> It would be my fault if I wrote those board files.  ;)
> >
> > sure, sorry. Maybe I didn't express myself really well.
> >
> >>> I suggest you keep usb as a module, but keep nop xceiv built-in.
> >> 
> >> Yes, that's the workaround I'm already using, but it is not a fix.
> >> 
> >> This dependency breaks the ability to build a minimal kernel with
> >> everything as modules (allmodconfig)
> >
> > now this is a really good point. Haven't thought that way...
> >
> >> The nop xceiv needs a way for built-in code to register itself for
> >> the cases when no xceiv is built as a module.
> >
> > when way to do that is not to use usb_nop_xceiv_register() and
> > add the platform_device to the board-files. I never really liked
> > the whole usb_nop_xceiv_register() hackery. Almost all board-files
> > have a list of platform_devices which get added by platform_add_devices()
> > anyways, so why not using that ??
> >
> > to me the usb_nop_xceiv_register() thing is just a lazy way of
> > defining platform_devices. Specially one that takes some 3
> > lines of code only.
> 
> Completely agree.  I didn't take the time to look into the USB code to
> see if a simple plaform device creation would fix this.
> 
> If so, any chance of a patch for OMAP3EVM and 4430SDP?
> 
> I'll be happy to test on OMAP3EVM, but don't have a 4430.
> 
> Kevin

Here is a compile-tested patch since I haven't seen this fixed in mainline
yet.  It applies to the tip of Linus' tree.

Attempting to remove usb_nop_xceiv_register() completely will require someone
with more knowledge of davinci and blackfin archs to comment on what boards
need the platform_device defined.

Cheers,
Amit


[-- Attachment #2: 0001-omap-remove-calls-to-usb_nop_xceiv_register-from-boa.patch --]
[-- Type: text/x-diff, Size: 2856 bytes --]

>From 3df714f995b0895e905090760482194233f66a1d Mon Sep 17 00:00:00 2001
Message-Id: <3df714f995b0895e905090760482194233f66a1d.1274570700.git.amit.kucheria@canonical.com>
From: Amit Kucheria <amit.kucheria@canonical.com>
Date: Sun, 23 May 2010 01:35:00 +0300
Subject: [PATCH] omap: remove calls to usb_nop_xceiv_register from board files

This will allow the OMAP USB drivers to be compiled in as modules. At the
moment, CONFIG_NOP_USB_XCEIV cannot be a module.

Signed-off-by: Amit Kucheria <amit.kucheria@canonical.com>
---
 arch/arm/mach-omap2/board-4430sdp.c  |   10 ++++++++--
 arch/arm/mach-omap2/board-omap3evm.c |   11 ++++++++---
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index e4a5d66..131f0fd 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -110,8 +110,16 @@ static struct platform_device sdp4430_lcd_device = {
 	.id		= -1,
 };
 
+static struct platform_device sdp4430_nop_usb_device = {
+	.name		= "nop_usb_xceiv",
+	.id		= -1,
+	.resource	= NULL,
+	.num_resources	= 0,
+};
+
 static struct platform_device *sdp4430_devices[] __initdata = {
 	&sdp4430_lcd_device,
+	&sdp4430_nop_usb_device,
 };
 
 static struct omap_lcd_config sdp4430_lcd_config __initdata = {
@@ -374,8 +382,6 @@ static void __init omap_4430sdp_init(void)
 	platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
 	omap_serial_init();
 	omap4_twl6030_hsmmc_init(mmc);
-	/* OMAP4 SDP uses internal transceiver so register nop transceiver */
-	usb_nop_xceiv_register();
 	/* FIXME: allow multi-omap to boot until musb is updated for omap4 */
 	if (!cpu_is_omap44xx())
 		usb_musb_init(&musb_board_data);
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 81bba19..456e218 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -620,6 +620,13 @@ struct spi_board_info omap3evm_spi_board_info[] = {
 	},
 };
 
+static struct platform_device omap3_evm_nop_usb_device = {
+	.name		= "nop_usb_xceiv",
+	.id		= -1,
+	.resource	= NULL,
+	.num_resources	= 0,
+};
+
 static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
 };
 
@@ -634,6 +641,7 @@ static void __init omap3_evm_init_irq(void)
 
 static struct platform_device *omap3_evm_devices[] __initdata = {
 	&omap3_evm_dss_device,
+	&omap3_evm_nop_usb_device,
 };
 
 static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
@@ -682,9 +690,6 @@ static void __init omap3_evm_init(void)
 
 	omap_serial_init();
 
-	/* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
-	usb_nop_xceiv_register();
-
 	if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
 		/* enable EHCI VBUS using GPIO22 */
 		omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* RE: usb_nop_xceiv_register() missing when OTG built as modules
  2010-05-22 23:53             ` Amit Kucheria
@ 2010-05-24  7:07               ` Gupta, Ajay Kumar
  2010-05-26  6:03                 ` Felipe Balbi
  2010-05-26  6:02               ` Felipe Balbi
  1 sibling, 1 reply; 14+ messages in thread
From: Gupta, Ajay Kumar @ 2010-05-24  7:07 UTC (permalink / raw)
  To: Amit Kucheria, Kevin Hilman
  Cc: me@felipebalbi.com, felipe.balbi@nokia.com,
	linux-omap@vger.kernel.org, tony@atomide.com

Hi, 
> Here is a compile-tested patch since I haven't seen this fixed in mainline
> yet.  It applies to the tip of Linus' tree.
> 
> Attempting to remove usb_nop_xceiv_register() completely will require
> someone
> with more knowledge of davinci and blackfin archs to comment on what
> boards
> need the platform_device defined.

NAK..
This is an incorrect fix as it duplicates the code snippet which
is already present in nop file.

Here is a better fix for this (patch attached below). The approach
in this patch has already been discussed and was not agreed and I was
asked to move nop registration to board files.

------------ cut here ------------------
NOP transceiver is getting registered in board files of OAMP3EVM
and OMAP4430 SDP as they use ISP150x and internal transceivers.

This registration in board file forces NOP transceiver to be
built into the kernel.

Fixing this by removing NOP tranceiver from board files to omap
platform file within musb driver.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
---
 arch/arm/mach-omap2/board-4430sdp.c  |    3 ---
 arch/arm/mach-omap2/board-omap3evm.c |    4 ----
 drivers/usb/musb/omap2430.c          |   11 ++++++++++-
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index e4a5d66..77af4c9 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -17,7 +17,6 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
-#include <linux/usb/otg.h>
 #include <linux/spi/spi.h>
 #include <linux/i2c/twl.h>
 #include <linux/regulator/machine.h>
@@ -374,8 +373,6 @@ static void __init omap_4430sdp_init(void)
 	platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
 	omap_serial_init();
 	omap4_twl6030_hsmmc_init(mmc);
-	/* OMAP4 SDP uses internal transceiver so register nop transceiver */
-	usb_nop_xceiv_register();
 	/* FIXME: allow multi-omap to boot until musb is updated for omap4 */
 	if (!cpu_is_omap44xx())
 		usb_musb_init(&musb_board_data);
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 81bba19..83d3aa5 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -27,7 +27,6 @@
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 #include <linux/i2c/twl.h>
-#include <linux/usb/otg.h>
 #include <linux/smsc911x.h>
 
 #include <linux/regulator/machine.h>
@@ -682,9 +681,6 @@ static void __init omap3_evm_init(void)
 
 	omap_serial_init();
 
-	/* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
-	usb_nop_xceiv_register();
-
 	if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
 		/* enable EHCI VBUS using GPIO22 */
 		omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP);
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index e06d65e..58acd0c 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -198,6 +198,13 @@ int __init musb_platform_init(struct musb *musb, void *board_data)
 	omap_cfg_reg(AE5_2430_USB0HS_STP);
 #endif
 
+#if defined(CONFIG_MACH_OMAP3EVM) || defined(CONFIG_MACH_OMAP_4430SDP)
+	/* OMAP3EVM used ISP150x and OMAP4 SDP uses internal transceiver
+	 * so register nop transceiver
+	 */
+	usb_nop_xceiv_register();
+#endif
+
 	/* We require some kind of external transceiver, hooked
 	 * up through ULPI.  TWL4030-family PMICs include one,
 	 * which needs a driver, drivers aren't always needed.
@@ -325,6 +332,8 @@ int musb_platform_exit(struct musb *musb)
 {
 
 	musb_platform_suspend(musb);
-
+#if defined(CONFIG_MACH_OMAP3EVM) || defined(CONFIG_MACH_OMAP_4430SDP)
+	usb_nop_xceiv_unregister();
+#endif
 	return 0;
 }
-- 
1.6.2.4
----------------------------------------

Regards,
Ajay
> 
> Cheers,
> Amit


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: usb_nop_xceiv_register() missing when OTG built as modules
  2010-05-22 23:53             ` Amit Kucheria
  2010-05-24  7:07               ` Gupta, Ajay Kumar
@ 2010-05-26  6:02               ` Felipe Balbi
  1 sibling, 0 replies; 14+ messages in thread
From: Felipe Balbi @ 2010-05-26  6:02 UTC (permalink / raw)
  To: Kevin Hilman, me, felipe.balbi, Gupta, Ajay Kumar, linux-omap,
	tony

Hi,

On Sun, May 23, 2010 at 01:53:10AM +0200, ext Amit Kucheria wrote:
>From 3df714f995b0895e905090760482194233f66a1d Mon Sep 17 00:00:00 2001
>Message-Id: <3df714f995b0895e905090760482194233f66a1d.1274570700.git.amit.kucheria@canonical.com>
>From: Amit Kucheria <amit.kucheria@canonical.com>
>Date: Sun, 23 May 2010 01:35:00 +0300
>Subject: [PATCH] omap: remove calls to usb_nop_xceiv_register from board files
>
>This will allow the OMAP USB drivers to be compiled in as modules. At the
>moment, CONFIG_NOP_USB_XCEIV cannot be a module.
>
>Signed-off-by: Amit Kucheria <amit.kucheria@canonical.com>
>---
> arch/arm/mach-omap2/board-4430sdp.c  |   10 ++++++++--
> arch/arm/mach-omap2/board-omap3evm.c |   11 ++++++++---
> 2 files changed, 16 insertions(+), 5 deletions(-)
>
>diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
>index e4a5d66..131f0fd 100644
>--- a/arch/arm/mach-omap2/board-4430sdp.c
>+++ b/arch/arm/mach-omap2/board-4430sdp.c
>@@ -110,8 +110,16 @@ static struct platform_device sdp4430_lcd_device = {
> 	.id		= -1,
> };
> 
>+static struct platform_device sdp4430_nop_usb_device = {
>+	.name		= "nop_usb_xceiv",
>+	.id		= -1,
>+	.resource	= NULL,
>+	.num_resources	= 0,

you don't need to zero-initialize a static variable. So you can just 
drop .resource and .num_resources altogether.

-- 
balbi

DefectiveByDesign.org

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: usb_nop_xceiv_register() missing when OTG built as modules
  2010-05-24  7:07               ` Gupta, Ajay Kumar
@ 2010-05-26  6:03                 ` Felipe Balbi
  2010-05-26  6:20                   ` Gupta, Ajay Kumar
  2010-05-26  6:53                   ` Gupta, Ajay Kumar
  0 siblings, 2 replies; 14+ messages in thread
From: Felipe Balbi @ 2010-05-26  6:03 UTC (permalink / raw)
  To: ext Gupta, Ajay Kumar
  Cc: Amit Kucheria, Kevin Hilman, me@felipebalbi.com,
	Balbi Felipe (Nokia-D/Helsinki), linux-omap@vger.kernel.org,
	tony@atomide.com

On Mon, May 24, 2010 at 09:07:37AM +0200, ext Gupta, Ajay Kumar wrote:
>Hi,
>> Here is a compile-tested patch since I haven't seen this fixed in mainline
>> yet.  It applies to the tip of Linus' tree.
>>
>> Attempting to remove usb_nop_xceiv_register() completely will require
>> someone
>> with more knowledge of davinci and blackfin archs to comment on what
>> boards
>> need the platform_device defined.
>
>NAK..
>This is an incorrect fix as it duplicates the code snippet which
>is already present in nop file.

I don't believe you understood the purpose of the original patch:

The idea is that currently, it's impossible to build a board which uses 
nop transceiver and have that be a module because when you'll have an 
undefined function being used on a board file.

Removing the call to nop_xceiv_register() and using a 
platform_device_register() is the way to go, since it's only 4 ~ 5 lines 
of code anyway.

ps: you really think that adding more and more ifdefs is better than 
Amit's patch ??

-- 
balbi

DefectiveByDesign.org

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: usb_nop_xceiv_register() missing when OTG built as modules
  2010-05-26  6:03                 ` Felipe Balbi
@ 2010-05-26  6:20                   ` Gupta, Ajay Kumar
  2010-05-26  6:53                   ` Gupta, Ajay Kumar
  1 sibling, 0 replies; 14+ messages in thread
From: Gupta, Ajay Kumar @ 2010-05-26  6:20 UTC (permalink / raw)
  To: felipe.balbi@nokia.com
  Cc: Amit Kucheria, Kevin Hilman, me@felipebalbi.com,
	linux-omap@vger.kernel.org, tony@atomide.com

Hi,
> On Mon, May 24, 2010 at 09:07:37AM +0200, ext Gupta, Ajay Kumar wrote:
> >> Attempting to remove usb_nop_xceiv_register() completely will require
> >> someone
> >> with more knowledge of davinci and blackfin archs to comment on what
> >> boards
> >> need the platform_device defined.
> >
> >NAK..
> >This is an incorrect fix as it duplicates the code snippet which
> >is already present in nop file.

> I don't believe you understood the purpose of the original patch:
I did and that's why an alternative patch.

> The idea is that currently, it's impossible to build a board which uses
> nop transceiver and have that be a module because when you'll have an
> undefined function being used on a board file.
I know.

> 
> Removing the call to nop_xceiv_register() and using a
> platform_device_register() is the way to go, since it's only 4 ~ 5 lines
> of code anyway.
4 ~5 lines would keep on repeating for all current and future boards
requiring to use NOP.

> 
> ps: you really think that adding more and more ifdefs is better than
> Amit's patch ??
Yes, when compared to the approach of repeating those 4 ~5 line in all
the board files requiring NOP.

-Ajay
> 
> --
> balbi

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: usb_nop_xceiv_register() missing when OTG built as modules
  2010-05-26  6:03                 ` Felipe Balbi
  2010-05-26  6:20                   ` Gupta, Ajay Kumar
@ 2010-05-26  6:53                   ` Gupta, Ajay Kumar
  1 sibling, 0 replies; 14+ messages in thread
From: Gupta, Ajay Kumar @ 2010-05-26  6:53 UTC (permalink / raw)
  To: felipe.balbi@nokia.com
  Cc: Amit Kucheria, Kevin Hilman, me@felipebalbi.com,
	linux-omap@vger.kernel.org, tony@atomide.com

> ps: you really think that adding more and more ifdefs is better than
> Amit's patch ??

We can avoid using #ifdefs by introducing '.neednop' flag to board_data.
Here is the patch for this which can be used on top of my earlier patch.

------------------- cut here ---------------
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 77af4c9..fb29837 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -137,6 +137,7 @@ static struct omap_musb_board_data musb_board_data = {
 	.interface_type		= MUSB_INTERFACE_UTMI,
 	.mode			= MUSB_PERIPHERAL,
 	.power			= 100,
+	.neednop		= 1,
 };
 
 static struct omap2_hsmmc_info mmc[] = {
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 83d3aa5..609f021 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -665,6 +665,7 @@ static struct omap_musb_board_data musb_board_data = {
 	.interface_type		= MUSB_INTERFACE_ULPI,
 	.mode			= MUSB_OTG,
 	.power			= 100,
+	.neednop		= 1,
 };
 
 static void __init omap3_evm_init(void)
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h
index a32d3af..b53489a 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -69,6 +69,7 @@ struct omap_musb_board_data {
 	u8	mode;
 	u16	power;
 	unsigned extvbus:1;
+	unsigned neednop:1;	/* NOP transceiver */
 };
 
 enum musb_interface    {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index e71049c..b774312 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1964,6 +1964,7 @@ bad_config:
 	musb->board_set_power = plat->set_power;
 	musb->set_clock = plat->set_clock;
 	musb->min_power = plat->min_power;
+	musb->board_data = plat->board_data;
 
 	/* Clock usage is chip-specific ... functional clock (DaVinci,
 	 * OMAP2430), or PHY ref (some TUSB6010 boards).  All this core
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index eaabf98..b72e2e5 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -392,6 +392,7 @@ struct musb {
 	int			(*board_set_power)(int state);
 
 	int			(*set_clock)(struct clk *clk, int is_active);
+	void			*board_data;
 
 	u8			min_power;	/* vbus for periph, in mA/2 */
 
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 58acd0c..8488a23 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -198,12 +198,11 @@ int __init musb_platform_init(struct musb *musb, void *board_data)
 	omap_cfg_reg(AE5_2430_USB0HS_STP);
 #endif
 
-#if defined(CONFIG_MACH_OMAP3EVM) || defined(CONFIG_MACH_OMAP_4430SDP)
 	/* OMAP3EVM used ISP150x and OMAP4 SDP uses internal transceiver
 	 * so register nop transceiver
 	 */
-	usb_nop_xceiv_register();
-#endif
+	if (data->neednop)
+		usb_nop_xceiv_register();
 
 	/* We require some kind of external transceiver, hooked
 	 * up through ULPI.  TWL4030-family PMICs include one,
@@ -330,10 +329,10 @@ static int musb_platform_resume(struct musb *musb)
 
 int musb_platform_exit(struct musb *musb)
 {
+	struct omap_musb_board_data *data = musb->board_data;
 
 	musb_platform_suspend(musb);
-#if defined(CONFIG_MACH_OMAP3EVM) || defined(CONFIG_MACH_OMAP_4430SDP)
-	usb_nop_xceiv_unregister();
-#endif
+	if (data->neednop)
+		usb_nop_xceiv_unregister();
 	return 0;
 }

--------------------------------------------
-Ajay
> 
> --
> balbi
> 
> DefectiveByDesign.org

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-05-26  6:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-04  0:09 usb_nop_xceiv_register() missing when OTG built as modules Kevin Hilman
2010-03-04  4:29 ` Gupta, Ajay Kumar
2010-03-04 17:32   ` Kevin Hilman
2010-03-05  3:50     ` Gupta, Ajay Kumar
2010-03-05  9:04     ` Felipe Balbi
2010-03-05 17:59       ` Kevin Hilman
2010-03-05 19:54         ` me
2010-03-05 22:02           ` Kevin Hilman
2010-05-22 23:53             ` Amit Kucheria
2010-05-24  7:07               ` Gupta, Ajay Kumar
2010-05-26  6:03                 ` Felipe Balbi
2010-05-26  6:20                   ` Gupta, Ajay Kumar
2010-05-26  6:53                   ` Gupta, Ajay Kumar
2010-05-26  6:02               ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).