Quantcast
Channel: Processors forum - Recent Threads
Viewing all articles
Browse latest Browse all 17527

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

$
0
0

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;
}


Viewing all articles
Browse latest Browse all 17527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>