This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Adding USB20 (OTG) support via Linux/ARM on OMAPl138

Other Parts Discussed in Thread: DA8XX, TPS2065, OMAPL138

Example code from da-850-evm only sets up SOME fields from CFGCHIP2 for usb20, but for example it does not take the PHY out of reset. The usb device probe function is supposed to take the PHY out of reset, however the probe function doesn't run unless it recognizes a device, which it cannot do if PHY is not running and driving USB0_DRVVBUS...

I am confused about the expected order of setting up usb20 in the board file using the dedicated USB pins on the OMAP l138 (no GPIO necessary).

Sample function called on board init;

static __init int amsc_ngcc_usb_init(void)
{
u32 cfgchip2;
int ret;

/*
* Set up USB clock/mode in the CFGCHIP2 register.
* FYI: CFGCHIP2 is 0x0000ef00 initially.
*/
cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));

/* USB2.0 PHY reference clock is 24 MHz */
cfgchip2 &= ~CFGCHIP2_REFFREQ;
cfgchip2 |= CFGCHIP2_REFFREQ_24MHZ;

/*
* Select internal reference clock for USB 2.0 PHY
* and use it as a clock source for USB 1.1 PHY
* (this is the default setting anyway).
*/
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;
//#ifdef CONFIG_USB_MUSB_HOST
// cfgchip2 |= CFGCHIP2_FORCE_HOST;
//#else
cfgchip2 |= CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN;
//#endif

__raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));

/* USB_REFCLKIN is not used. */
/*
* 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_warn("%s: USB 2.0 registration failed: %d\n", __func__, ret);
}

return ret;
}

  • Hi Daniel,
    Are you using custom board or EVM ?
    What is your reference board ?
  • Hi Daniel,

    Have you run any USB starterware examples on your board ?
    If not, I would like to suggest to run USB examples on your OMAPL138 board.
    If it is a custom board, please check the clocking for USB2.0 and USB1.1.
    P.S: USB1.1 is derving the clock from USB2.0
    Please refer to the OMAPL138 TRM "spruh77a", USB clocking chapter 7.3

    Regards,
    Shankari.
  • Hello and thanks for reply.

    This is a custom board that is using OMAPl138. I have no desire to enable and/or use USB1, only USB0.

    I can see my registers in USB0 are not set correctly, but the kernel da8xx musb driver (/drivers/usb/musb/da8xx.c) i can see is supposed to do this setup. How can i configure menuconfig to enable this driver? I should only have to set very few registers in my board file as shown above and let this driver do the rest of the work, but it seems this driver and its probe function are never called...

    The name of the driver is the name of the one im trying to register also;

    from da8xx.c;

    static struct platform_driver da8xx_driver = {
    .probe = da8xx_probe,
    .remove = da8xx_remove,
    .driver = {
    .name = "musb-da8xx",
    },
    };

    My board file calls da8xx_register_usb20(unsigned mA, unsigned potpgt) in mach-davinci/usb.c, which has the usb device using the same name "musb-da8xx"

  • Also, I'm trying to build this driver into the kernel, and not make it a module. Is that possible, or is it recommended to use it as a module?
  • I have since reverted back to kernel v3.8 from v3.19 and can see the menuconfig options for this driver and glue layer. In kernel v3.19 these menuconfig options are disabled and you can see that in the kconfig, which is why i could not get them to register. I am still having trouble with the driver, but i have asked further questions under the linux forum.