linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm:da850: register musb device
@ 2012-03-13 15:03 Manjunathappa, Prakash
  2012-03-13 17:10 ` Sergei Shtylyov
  0 siblings, 1 reply; 5+ messages in thread
From: Manjunathappa, Prakash @ 2012-03-13 15:03 UTC (permalink / raw)
  To: linux-arm-kernel

Properly set up the OTG mode thru the CFGCHIP2 register, enable the
USB0_DRVVBUS pin, and finally register the MUSB platform device.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
---
Patche are on top below posted patches:
http://www.spinics.net/lists/linux-usb/msg59656.html

 arch/arm/mach-davinci/board-da850-evm.c |   12 ++++++++++++
 arch/arm/mach-davinci/usb.c             |    9 +++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 178d178..539e12c 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -787,6 +787,18 @@ static __init void da850_evm_usb_init(void)
 	 */
 	cfgchip2 &= ~CFGCHIP2_USB1PHYCLKMUX;
 	cfgchip2 |=  CFGCHIP2_USB2PHYCLKMUX;
+	/*
+	 * We have to override VBUS/ID signals when MUSB is configured into the
+	 * host-only mode -- ID pin will float if no cable is connected, so the
+	 * controller won't be able to drive VBUS thinking that it's a B-device.
+	 * Otherwise, we want to use the OTG mode and enable VBUS comparators.
+	 */
+	cfgchip2 &= ~CFGCHIP2_OTGMODE;
+#if CONFIG_USB_MUSB_DA8XX
+	cfgchip2 |=  CFGCHIP2_FORCE_HOST;
+#else
+	cfgchip2 |=  CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN;
+#endif
 
 	__raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
 
diff --git a/arch/arm/mach-davinci/usb.c b/arch/arm/mach-davinci/usb.c
index 25c3520..a941dc5 100644
--- a/arch/arm/mach-davinci/usb.c
+++ b/arch/arm/mach-davinci/usb.c
@@ -284,6 +284,15 @@ void __init da8xx_board_usb_init(const short pins[],
 		goto usb11_setup_fail;
 	}
 
+	/*
+	 * TPS2065 switch @ 5V supplies 1 A (sustains 1.5 A),
+	 * with the power on to power good time of 3 ms.
+	 */
+	ret = da8xx_register_usb20(1000, 3);
+	if (ret)
+		pr_warning("%s: USB 2.0 registration failed: %d\n",
+			   __func__, ret);
+
 	return;
 
 usb11_setup_fail:
-- 
1.7.1

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

* [PATCH] arm:da850: register musb device
  2012-03-13 15:03 [PATCH] arm:da850: register musb device Manjunathappa, Prakash
@ 2012-03-13 17:10 ` Sergei Shtylyov
  2012-03-14  6:16   ` Manjunathappa, Prakash
  0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2012-03-13 17:10 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/13/2012 06:03 PM, Manjunathappa, Prakash wrote:

> Properly set up the OTG mode thru the CFGCHIP2 register, enable the
> USB0_DRVVBUS pin,

    I don't see where you are enabling it.

> and finally register the MUSB platform device.
>
> Signed-off-by: Ajay Kumar Gupta<ajay.gupta@ti.com>
> Signed-off-by: Manjunathappa, Prakash<prakash.pm@ti.com>
> ---
> Patche are on top below posted patches:
> http://www.spinics.net/lists/linux-usb/msg59656.html

>   arch/arm/mach-davinci/board-da850-evm.c |   12 ++++++++++++
>   arch/arm/mach-davinci/usb.c             |    9 +++++++++
>   2 files changed, 21 insertions(+), 0 deletions(-)

> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index 178d178..539e12c 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -787,6 +787,18 @@ static __init void da850_evm_usb_init(void)
>   	 */
>   	cfgchip2&= ~CFGCHIP2_USB1PHYCLKMUX;
>   	cfgchip2 |=  CFGCHIP2_USB2PHYCLKMUX;
> +	/*
> +	 * We have to override VBUS/ID signals when MUSB is configured into the
> +	 * host-only mode -- ID pin will float if no cable is connected, so the
> +	 * controller won't be able to drive VBUS thinking that it's a B-device.
> +	 * Otherwise, we want to use the OTG mode and enable VBUS comparators.
> +	 */
> +	cfgchip2 &= ~CFGCHIP2_OTGMODE;
> +#if CONFIG_USB_MUSB_DA8XX

    This #ifdef doesn't make sense. It will make driver always work in host mode.

> +	cfgchip2 |=  CFGCHIP2_FORCE_HOST;
> +#else
> +	cfgchip2 |=  CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN;

    This is what you need to leave. The driver should always work in OTG mode now.

> +#endif
>
>   	__raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
>
> diff --git a/arch/arm/mach-davinci/usb.c b/arch/arm/mach-davinci/usb.c
> index 25c3520..a941dc5 100644
> --- a/arch/arm/mach-davinci/usb.c
> +++ b/arch/arm/mach-davinci/usb.c
> @@ -284,6 +284,15 @@ void __init da8xx_board_usb_init(const short pins[],
>   		goto usb11_setup_fail;
>   	}
>
> +	/*
> +	 * TPS2065 switch @ 5V supplies 1 A (sustains 1.5 A),
> +	 * with the power on to power good time of 3 ms.
> +	 */
> +	ret = da8xx_register_usb20(1000, 3);
> +	if (ret)
> +		pr_warning("%s: USB 2.0 registration failed: %d\n",
> +			   __func__, ret);

    Er, why this code is moved there? And how will this work on DA830 -- try to 
register MUSB twice? Place this in the board file please where it belongs.

WBR, Sergei

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

* [PATCH] arm:da850: register musb device
  2012-03-13 17:10 ` Sergei Shtylyov
@ 2012-03-14  6:16   ` Manjunathappa, Prakash
  2012-03-14 11:32     ` Sergei Shtylyov
  0 siblings, 1 reply; 5+ messages in thread
From: Manjunathappa, Prakash @ 2012-03-14  6:16 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sergei,

On Tue, Mar 13, 2012 at 22:40:41, Sergei Shtylyov wrote:
> On 03/13/2012 06:03 PM, Manjunathappa, Prakash wrote:
> 
> > Properly set up the OTG mode thru the CFGCHIP2 register, enable the
> > USB0_DRVVBUS pin,
> 
>     I don't see where you are enabling it.
> 

Yes, I will correct the message.

> > and finally register the MUSB platform device.
> >
> > Signed-off-by: Ajay Kumar Gupta<ajay.gupta@ti.com>
> > Signed-off-by: Manjunathappa, Prakash<prakash.pm@ti.com>
> > ---
> > Patche are on top below posted patches:
> > http://www.spinics.net/lists/linux-usb/msg59656.html
> 
> >   arch/arm/mach-davinci/board-da850-evm.c |   12 ++++++++++++
> >   arch/arm/mach-davinci/usb.c             |    9 +++++++++
> >   2 files changed, 21 insertions(+), 0 deletions(-)
> 
> > diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> > index 178d178..539e12c 100644
> > --- a/arch/arm/mach-davinci/board-da850-evm.c
> > +++ b/arch/arm/mach-davinci/board-da850-evm.c
> > @@ -787,6 +787,18 @@ static __init void da850_evm_usb_init(void)
> >   	 */
> >   	cfgchip2&= ~CFGCHIP2_USB1PHYCLKMUX;
> >   	cfgchip2 |=  CFGCHIP2_USB2PHYCLKMUX;
> > +	/*
> > +	 * We have to override VBUS/ID signals when MUSB is configured into the
> > +	 * host-only mode -- ID pin will float if no cable is connected, so the
> > +	 * controller won't be able to drive VBUS thinking that it's a B-device.
> > +	 * Otherwise, we want to use the OTG mode and enable VBUS comparators.
> > +	 */
> > +	cfgchip2 &= ~CFGCHIP2_OTGMODE;
> > +#if CONFIG_USB_MUSB_DA8XX
> 
>     This #ifdef doesn't make sense. It will make driver always work in host mode.
> 

I will change it to support OTG.

> > +	cfgchip2 |=  CFGCHIP2_FORCE_HOST;
> > +#else
> > +	cfgchip2 |=  CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN;
> 
>     This is what you need to leave. The driver should always work in OTG mode now.
> 

Correct, I will fix this.

> > +#endif
> >
> >   	__raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
> >
> > diff --git a/arch/arm/mach-davinci/usb.c b/arch/arm/mach-davinci/usb.c
> > index 25c3520..a941dc5 100644
> > --- a/arch/arm/mach-davinci/usb.c
> > +++ b/arch/arm/mach-davinci/usb.c
> > @@ -284,6 +284,15 @@ void __init da8xx_board_usb_init(const short pins[],
> >   		goto usb11_setup_fail;
> >   	}
> >
> > +	/*
> > +	 * TPS2065 switch @ 5V supplies 1 A (sustains 1.5 A),
> > +	 * with the power on to power good time of 3 ms.
> > +	 */
> > +	ret = da8xx_register_usb20(1000, 3);
> > +	if (ret)
> > +		pr_warning("%s: USB 2.0 registration failed: %d\n",
> > +			   __func__, ret);
> 
>     Er, why this code is moved there? And how will this work on DA830 -- try to 
> register MUSB twice? Place this in the board file please where it belongs.
> 

Yes, I will revert this change.

Thanks,
Prakash

> WBR, Sergei
> 

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

* [PATCH] arm:da850: register musb device
  2012-03-14  6:16   ` Manjunathappa, Prakash
@ 2012-03-14 11:32     ` Sergei Shtylyov
  2012-03-15  9:42       ` Manjunathappa, Prakash
  0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2012-03-14 11:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 14-03-2012 10:16, Manjunathappa, Prakash wrote:

>>> Properly set up the OTG mode thru the CFGCHIP2 register, enable the
>>> USB0_DRVVBUS pin,

>>      I don't see where you are enabling it.

> Yes, I will correct the message.

>>> and finally register the MUSB platform device.

    Also, you're registering the MUSB device for DA850/OMAP-L138 EVM board, 
not the whole DA850/OMAP-L138 SoC, so that should be reflected in the subject.

>>> Signed-off-by: Ajay Kumar Gupta<ajay.gupta@ti.com>
>>> Signed-off-by: Manjunathappa, Prakash<prakash.pm@ti.com>

WBR, Sergei

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

* [PATCH] arm:da850: register musb device
  2012-03-14 11:32     ` Sergei Shtylyov
@ 2012-03-15  9:42       ` Manjunathappa, Prakash
  0 siblings, 0 replies; 5+ messages in thread
From: Manjunathappa, Prakash @ 2012-03-15  9:42 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sergei,

On Wed, Mar 14, 2012 at 17:02:19, Sergei Shtylyov wrote:
> Hello.
> 
> On 14-03-2012 10:16, Manjunathappa, Prakash wrote:
> 
> >>> Properly set up the OTG mode thru the CFGCHIP2 register, enable the
> >>> USB0_DRVVBUS pin,
> 
> >>      I don't see where you are enabling it.
> 
> > Yes, I will correct the message.
> 
> >>> and finally register the MUSB platform device.
> 
>     Also, you're registering the MUSB device for DA850/OMAP-L138 EVM board, 
> not the whole DA850/OMAP-L138 SoC, so that should be reflected in the subject.
> 

True, I will fix the subject.

Thanks,
Prakash

> >>> Signed-off-by: Ajay Kumar Gupta<ajay.gupta@ti.com>
> >>> Signed-off-by: Manjunathappa, Prakash<prakash.pm@ti.com>
> 
> WBR, Sergei
> 

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

end of thread, other threads:[~2012-03-15  9:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-13 15:03 [PATCH] arm:da850: register musb device Manjunathappa, Prakash
2012-03-13 17:10 ` Sergei Shtylyov
2012-03-14  6:16   ` Manjunathappa, Prakash
2012-03-14 11:32     ` Sergei Shtylyov
2012-03-15  9:42       ` Manjunathappa, Prakash

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).