Re: Help needed to force USB host mode on AM335x CPU

2013-11-25 Thread Felipe Balbi
Hi,

On Fri, Nov 22, 2013 at 02:28:50PM +, Mark Jackson wrote:
> We have a custom AM335x board where the USB0_ID pin has been left floating.
> 
> By default, this puts the USB controller into peripheral mode, but we need
> to force it into host mode.
> 
> This can be achieved in s/w by setting some bits in the relevant USB mode
> register (see TRM 16.5.2.35).
> 
> This mode register's offset is already defined in musb_dsps.c
> 
> static const struct dsps_musb_wrapper am33xx_driver_data = {
> ...
>   .mode   = 0xe8,
> ...
> };
> 
> I can manually set this register to the correct value in musb_host.c and
> the USB all seems to work as expected.
> 
> int musb_host_setup(struct musb *musb, int power_budget)
> {
>   int ret;
>   struct usb_hcd *hcd = musb->hcd;
> 
> /* Force HOST mode */
> unsigned long __iomem *p;
> p = ioremap(0x474010e8, 4);
> *p = 0x80;/* IDDIG = 0, IDDIG_MUX = 1 */
> 
>   MUSB_HST_MODE(musb);
> ...
> };
> 
> Ideally I'd like to add an entry in my dts file to flag for this "force mode"
> to be setup, such as:-
> 
> usb@47401000 {
>   status = "okay";
>   dr_mode = "host";
>   ti,force-host;  /* force host mode */
> };
> 
> Can anyone point me in the right direction as to where to put this extra code 
> ?
> 
> I see there's a musb_am335x.c file, but that just seems to be a wrapper.
> 
> Any help would be greatly apperciated.

I just sent two patches to linux-usb and I suppose they can help. In
fact, I remember now that I have to fix commit log on one of them. I'll
do that now.

cheers

-- 
balbi


signature.asc
Description: Digital signature


Help needed to force USB host mode on AM335x CPU

2013-11-22 Thread Mark Jackson
We have a custom AM335x board where the USB0_ID pin has been left floating.

By default, this puts the USB controller into peripheral mode, but we need
to force it into host mode.

This can be achieved in s/w by setting some bits in the relevant USB mode
register (see TRM 16.5.2.35).

This mode register's offset is already defined in musb_dsps.c

static const struct dsps_musb_wrapper am33xx_driver_data = {
...
.mode   = 0xe8,
...
};

I can manually set this register to the correct value in musb_host.c and
the USB all seems to work as expected.

int musb_host_setup(struct musb *musb, int power_budget)
{
int ret;
struct usb_hcd *hcd = musb->hcd;

/* Force HOST mode */
unsigned long __iomem *p;
p = ioremap(0x474010e8, 4);
*p = 0x80;  /* IDDIG = 0, IDDIG_MUX = 1 */

MUSB_HST_MODE(musb);
...
};

Ideally I'd like to add an entry in my dts file to flag for this "force mode"
to be setup, such as:-

usb@47401000 {
status = "okay";
dr_mode = "host";
ti,force-host;  /* force host mode */
};

Can anyone point me in the right direction as to where to put this extra code ?

I see there's a musb_am335x.c file, but that just seems to be a wrapper.

Any help would be greatly apperciated.

Regards
Mark J.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html