From 45f780a06153544ab84fd1da3a8b28c07f61da1d Mon Sep 17 00:00:00 2001 From: Cory Maccarrone Date: Sun, 22 Nov 2009 10:10:52 -0800 Subject: omap1: omap_udc: Add clocking and disable vbus sense for omap7xx The l3_ocpi_ck clock is needed on omap7xx processors for USB. Additionally, bit 8 of the SOFT_REQ_REG needs to be enabled for the usb_dc_ck on omap7xx, which is a different bit than that of the omap16xx-defined clock of the same name. I added a provision for the usb_dc_ck and l3_ocpi_ck clocks as dc_clk and hhc_clk, respectively, for omap7xx CPUs. Additionally, I added a check in machine_without_vbus_sense for all omap7xx devices, as presently I know of no omap7xx-based devices that have vbus sense, and it made more sense to me to use a cpu check here than to spell out each machine one at a time. Finally, DMA is disabled for omap7xx, as it causes problems with these chips. Cc: linux-usb@vger.kernel.org Cc: David Brownell Signed-off-by: Cory Maccarrone Signed-off-by: Tony Lindgren --- drivers/usb/gadget/omap_udc.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index b836efe9ea7..f81e4f025f2 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c @@ -2098,6 +2098,7 @@ static inline int machine_without_vbus_sense(void) || machine_is_omap_h4() #endif || machine_is_sx1() + || cpu_is_omap7xx() /* No known omap7xx boards with vbus sense */ ); } @@ -2838,6 +2839,16 @@ static int __init omap_udc_probe(struct platform_device *pdev) udelay(100); } + if (cpu_is_omap7xx()) { + dc_clk = clk_get(&pdev->dev, "usb_dc_ck"); + hhc_clk = clk_get(&pdev->dev, "l3_ocpi_ck"); + BUG_ON(IS_ERR(dc_clk) || IS_ERR(hhc_clk)); + /* can't use omap_udc_enable_clock yet */ + clk_enable(dc_clk); + clk_enable(hhc_clk); + udelay(100); + } + INFO("OMAP UDC rev %d.%d%s\n", omap_readw(UDC_REV) >> 4, omap_readw(UDC_REV) & 0xf, config->otg ? ", Mini-AB" : ""); @@ -2970,7 +2981,7 @@ known: goto cleanup3; } #endif - if (cpu_is_omap16xx()) { + if (cpu_is_omap16xx() || cpu_is_omap7xx()) { udc->dc_clk = dc_clk; udc->hhc_clk = hhc_clk; clk_disable(hhc_clk); @@ -3008,7 +3019,7 @@ cleanup0: if (xceiv) otg_put_transceiver(xceiv); - if (cpu_is_omap16xx() || cpu_is_omap24xx()) { + if (cpu_is_omap16xx() || cpu_is_omap24xx() || cpu_is_omap7xx()) { clk_disable(hhc_clk); clk_disable(dc_clk); clk_put(hhc_clk); @@ -3115,6 +3126,10 @@ static struct platform_driver udc_driver = { static int __init udc_init(void) { + /* Disable DMA for omap7xx -- it doesn't work right. */ + if (cpu_is_omap7xx()) + use_dma = 0; + INFO("%s, version: " DRIVER_VERSION #ifdef USE_ISO " (iso)" -- cgit v1.2.3