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-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to