aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCory Maccarrone <darkstar6262@gmail.com>2009-11-22 13:10:52 -0500
committerTony Lindgren <tony@atomide.com>2009-11-22 13:24:32 -0500
commit45f780a06153544ab84fd1da3a8b28c07f61da1d (patch)
treea2821193afd713c978a828f3dc6d1a05da6ea298
parent490a56652295825e3006f8703d96da2ef6580318 (diff)
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 <dbrownell@users.sourceforge.net> Signed-off-by: Cory Maccarrone <darkstar6262@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap1/Kconfig1
-rw-r--r--arch/arm/mach-omap1/clock.c3
-rw-r--r--arch/arm/mach-omap1/clock.h10
-rw-r--r--arch/arm/plat-omap/usb.c20
-rw-r--r--drivers/usb/gadget/omap_udc.c19
5 files changed, 44 insertions, 9 deletions
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index 55ecc01ea206..323272651933 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -11,6 +11,7 @@ config ARCH_OMAP850
11 depends on ARCH_OMAP1 11 depends on ARCH_OMAP1
12 bool "OMAP850 Based System" 12 bool "OMAP850 Based System"
13 select CPU_ARM926T 13 select CPU_ARM926T
14 select ARCH_OMAP_OTG
14 15
15config ARCH_OMAP15XX 16config ARCH_OMAP15XX
16 depends on ARCH_OMAP1 17 depends on ARCH_OMAP1
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 7b146c06ca8a..42cbe203da36 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -99,7 +99,7 @@ static struct omap_clk omap_clks[] = {
99 /* CK_GEN3 clocks */ 99 /* CK_GEN3 clocks */
100 CLK(NULL, "tc_ck", &tc_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX), 100 CLK(NULL, "tc_ck", &tc_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
101 CLK(NULL, "tipb_ck", &tipb_ck, CK_1510 | CK_310), 101 CLK(NULL, "tipb_ck", &tipb_ck, CK_1510 | CK_310),
102 CLK(NULL, "l3_ocpi_ck", &l3_ocpi_ck, CK_16XX), 102 CLK(NULL, "l3_ocpi_ck", &l3_ocpi_ck, CK_16XX | CK_7XX),
103 CLK(NULL, "tc1_ck", &tc1_ck, CK_16XX), 103 CLK(NULL, "tc1_ck", &tc1_ck, CK_16XX),
104 CLK(NULL, "tc2_ck", &tc2_ck, CK_16XX), 104 CLK(NULL, "tc2_ck", &tc2_ck, CK_16XX),
105 CLK(NULL, "dma_ck", &dma_ck, CK_16XX | CK_1510 | CK_310), 105 CLK(NULL, "dma_ck", &dma_ck, CK_16XX | CK_1510 | CK_310),
@@ -120,6 +120,7 @@ static struct omap_clk omap_clks[] = {
120 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck1510, CK_1510 | CK_310), 120 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck1510, CK_1510 | CK_310),
121 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck16xx, CK_16XX), 121 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck16xx, CK_16XX),
122 CLK(NULL, "usb_dc_ck", &usb_dc_ck, CK_16XX), 122 CLK(NULL, "usb_dc_ck", &usb_dc_ck, CK_16XX),
123 CLK(NULL, "usb_dc_ck", &usb_dc_ck7xx, CK_7XX),
123 CLK(NULL, "mclk", &mclk_1510, CK_1510 | CK_310), 124 CLK(NULL, "mclk", &mclk_1510, CK_1510 | CK_310),
124 CLK(NULL, "mclk", &mclk_16xx, CK_16XX), 125 CLK(NULL, "mclk", &mclk_16xx, CK_16XX),
125 CLK(NULL, "bclk", &bclk_1510, CK_1510 | CK_310), 126 CLK(NULL, "bclk", &bclk_1510, CK_1510 | CK_310),
diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h
index fac921c00bfe..29ffa97dc7f3 100644
--- a/arch/arm/mach-omap1/clock.h
+++ b/arch/arm/mach-omap1/clock.h
@@ -574,6 +574,16 @@ static struct clk usb_dc_ck = {
574 .enable_bit = 4, 574 .enable_bit = 4,
575}; 575};
576 576
577static struct clk usb_dc_ck7xx = {
578 .name = "usb_dc_ck",
579 .ops = &clkops_generic,
580 /* Direct from ULPD, no parent */
581 .rate = 48000000,
582 .flags = RATE_FIXED,
583 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
584 .enable_bit = 8,
585};
586
577static struct clk mclk_1510 = { 587static struct clk mclk_1510 = {
578 .name = "mclk", 588 .name = "mclk",
579 .ops = &clkops_generic, 589 .ops = &clkops_generic,
diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c
index 0ea1e0beb455..51033a4503c3 100644
--- a/arch/arm/plat-omap/usb.c
+++ b/arch/arm/plat-omap/usb.c
@@ -159,11 +159,14 @@ static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device)
159 * - OTG support on this port not yet written 159 * - OTG support on this port not yet written
160 */ 160 */
161 161
162 l = omap_readl(USB_TRANSCEIVER_CTRL); 162 /* Don't do this for omap7xx -- it causes USB to not work correctly */
163 l &= ~(7 << 4); 163 if (!cpu_is_omap7xx()) {
164 if (!is_device) 164 l = omap_readl(USB_TRANSCEIVER_CTRL);
165 l |= (3 << 1); 165 l &= ~(7 << 4);
166 omap_writel(l, USB_TRANSCEIVER_CTRL); 166 if (!is_device)
167 l |= (3 << 1);
168 omap_writel(l, USB_TRANSCEIVER_CTRL);
169 }
167 170
168 return 3 << 16; 171 return 3 << 16;
169 } 172 }
@@ -603,7 +606,12 @@ omap_otg_init(struct omap_usb_config *config)
603 if (config->otg || config->register_dev) { 606 if (config->otg || config->register_dev) {
604 syscon &= ~DEV_IDLE_EN; 607 syscon &= ~DEV_IDLE_EN;
605 udc_device.dev.platform_data = config; 608 udc_device.dev.platform_data = config;
606 /* FIXME patch IRQ numbers for omap730 */ 609 /* IRQ numbers for omap7xx */
610 if(cpu_is_omap7xx()) {
611 udc_resources[1].start = INT_7XX_USB_GENI;
612 udc_resources[2].start = INT_7XX_USB_NON_ISO;
613 udc_resources[3].start = INT_7XX_USB_ISO;
614 }
607 status = platform_device_register(&udc_device); 615 status = platform_device_register(&udc_device);
608 if (status) 616 if (status)
609 pr_debug("can't register UDC device, %d\n", status); 617 pr_debug("can't register UDC device, %d\n", status);
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index b836efe9ea71..f81e4f025f23 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)
2098 || machine_is_omap_h4() 2098 || machine_is_omap_h4()
2099#endif 2099#endif
2100 || machine_is_sx1() 2100 || machine_is_sx1()
2101 || cpu_is_omap7xx() /* No known omap7xx boards with vbus sense */
2101 ); 2102 );
2102} 2103}
2103 2104
@@ -2838,6 +2839,16 @@ static int __init omap_udc_probe(struct platform_device *pdev)
2838 udelay(100); 2839 udelay(100);
2839 } 2840 }
2840 2841
2842 if (cpu_is_omap7xx()) {
2843 dc_clk = clk_get(&pdev->dev, "usb_dc_ck");
2844 hhc_clk = clk_get(&pdev->dev, "l3_ocpi_ck");
2845 BUG_ON(IS_ERR(dc_clk) || IS_ERR(hhc_clk));
2846 /* can't use omap_udc_enable_clock yet */
2847 clk_enable(dc_clk);
2848 clk_enable(hhc_clk);
2849 udelay(100);
2850 }
2851
2841 INFO("OMAP UDC rev %d.%d%s\n", 2852 INFO("OMAP UDC rev %d.%d%s\n",
2842 omap_readw(UDC_REV) >> 4, omap_readw(UDC_REV) & 0xf, 2853 omap_readw(UDC_REV) >> 4, omap_readw(UDC_REV) & 0xf,
2843 config->otg ? ", Mini-AB" : ""); 2854 config->otg ? ", Mini-AB" : "");
@@ -2970,7 +2981,7 @@ known:
2970 goto cleanup3; 2981 goto cleanup3;
2971 } 2982 }
2972#endif 2983#endif
2973 if (cpu_is_omap16xx()) { 2984 if (cpu_is_omap16xx() || cpu_is_omap7xx()) {
2974 udc->dc_clk = dc_clk; 2985 udc->dc_clk = dc_clk;
2975 udc->hhc_clk = hhc_clk; 2986 udc->hhc_clk = hhc_clk;
2976 clk_disable(hhc_clk); 2987 clk_disable(hhc_clk);
@@ -3008,7 +3019,7 @@ cleanup0:
3008 if (xceiv) 3019 if (xceiv)
3009 otg_put_transceiver(xceiv); 3020 otg_put_transceiver(xceiv);
3010 3021
3011 if (cpu_is_omap16xx() || cpu_is_omap24xx()) { 3022 if (cpu_is_omap16xx() || cpu_is_omap24xx() || cpu_is_omap7xx()) {
3012 clk_disable(hhc_clk); 3023 clk_disable(hhc_clk);
3013 clk_disable(dc_clk); 3024 clk_disable(dc_clk);
3014 clk_put(hhc_clk); 3025 clk_put(hhc_clk);
@@ -3115,6 +3126,10 @@ static struct platform_driver udc_driver = {
3115 3126
3116static int __init udc_init(void) 3127static int __init udc_init(void)
3117{ 3128{
3129 /* Disable DMA for omap7xx -- it doesn't work right. */
3130 if (cpu_is_omap7xx())
3131 use_dma = 0;
3132
3118 INFO("%s, version: " DRIVER_VERSION 3133 INFO("%s, version: " DRIVER_VERSION
3119#ifdef USE_ISO 3134#ifdef USE_ISO
3120 " (iso)" 3135 " (iso)"