* [PATCH] USB device support on OMAP2
@ 2006-08-24 12:23 박경민
0 siblings, 0 replies; 3+ messages in thread
From: 박경민 @ 2006-08-24 12:23 UTC (permalink / raw)
To: linux-omap-open-source
[-- Attachment #1: Type: text/plain, Size: 18326 bytes --]
[PATCH] USB device support on OMAP2
Enable USB device on OMAP2 platform. Only usb0 is used for device without DMA.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
--
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/arch/arm/mach-omap2/Kconfig linux-omap-2.6/arch/arm/mach-omap2/Kconfig
--- linux-omap-2.6-base/arch/arm/mach-omap2/Kconfig 2006-08-24 17:53:15.171875000 +0900
+++ linux-omap-2.6/arch/arm/mach-omap2/Kconfig 2006-08-24 20:10:05.953125000 +0900
@@ -25,3 +25,4 @@ config MACH_OMAP_H4
config MACH_OMAP_APOLLON
bool "OMAP 2420 Apollon board"
depends on ARCH_OMAP2 && ARCH_OMAP24XX
+ select ARCH_OMAP_OTG
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/arch/arm/mach-omap2/board-apollon.c linux-omap-2.6/arch/arm/mach-omap2/board-apollon.c
--- linux-omap-2.6-base/arch/arm/mach-omap2/board-apollon.c 2006-08-24 17:53:15.187500000 +0900
+++ linux-omap-2.6/arch/arm/mach-omap2/board-apollon.c 2006-08-24 20:54:09.906250000 +0900
@@ -234,6 +234,13 @@ static struct omap_mmc_config apollon_mm
},
};
+static struct omap_usb_config apollon_usb_config __initdata = {
+ .register_dev = 1,
+ .hmc_mode = 0x14, /* 0:dev 1:host1 2: disable */
+
+ .pins[0] = 6,
+};
+
static struct omap_lcd_config apollon_lcd_config __initdata = {
.ctrl_name = "internal",
};
@@ -241,6 +248,7 @@ static struct omap_lcd_config apollon_lc
static struct omap_board_config_kernel apollon_config[] = {
{ OMAP_TAG_UART, &apollon_uart_config },
{ OMAP_TAG_MMC, &apollon_mmc_config },
+ { OMAP_TAG_USB, &apollon_usb_config },
{ OMAP_TAG_LCD, &apollon_lcd_config },
};
@@ -292,28 +300,35 @@ static void __init apollon_sw_init(void)
omap_request_gpio(SW_DOWN_GPIO58);
omap_set_gpio_direction(SW_DOWN_GPIO58, 1);
- set_irq_type(OMAP_GPIO_IRQ(SW_ENTER_GPIO16), IRQT_RISING);
if (request_irq(OMAP_GPIO_IRQ(SW_ENTER_GPIO16), &apollon_sw_interrupt,
IRQF_SHARED, "enter sw",
&apollon_sw_interrupt))
return;
- set_irq_type(OMAP_GPIO_IRQ(SW_UP_GPIO17), IRQT_RISING);
if (request_irq(OMAP_GPIO_IRQ(SW_UP_GPIO17), &apollon_sw_interrupt,
IRQF_SHARED, "up sw",
&apollon_sw_interrupt))
return;
- set_irq_type(OMAP_GPIO_IRQ(SW_DOWN_GPIO58), IRQT_RISING);
if (request_irq(OMAP_GPIO_IRQ(SW_DOWN_GPIO58), &apollon_sw_interrupt,
IRQF_SHARED, "down sw",
&apollon_sw_interrupt))
return;
}
+static void __init apollon_usb_init(void)
+{
+ /* USB device */
+ /* DEVICE_SUSPEND */
+ omap_cfg_reg(P21_242X_GPIO12);
+ omap_set_gpio_direction(12, 0);
+ omap_set_gpio_dataout(12, 0);
+}
+
static void __init omap_apollon_init(void)
{
apollon_led_init();
apollon_sw_init();
apollon_flash_init();
+ apollon_usb_init();
/* REVISIT: where's the correct place */
omap_cfg_reg(W19_24XX_SYS_NIRQ);
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/arch/arm/mach-omap2/mux.c linux-omap-2.6/arch/arm/mach-omap2/mux.c
--- linux-omap-2.6-base/arch/arm/mach-omap2/mux.c 2006-08-24 17:53:15.203125000 +0900
+++ linux-omap-2.6/arch/arm/mach-omap2/mux.c 2006-08-24 19:45:20.265625000 +0900
@@ -66,6 +66,7 @@ MUX_CFG_24XX("V15_24XX_MCBSP2_DX", 0x127
/* 24xx GPIO */
MUX_CFG_24XX("M21_242X_GPIO11", 0x0c9, 3, 1, 1, 1)
+MUX_CFG_24XX("P21_242X_GPIO12", 0x0ca, 3, 0, 0, 1)
MUX_CFG_24XX("AA10_242X_GPIO13", 0x0e5, 3, 0, 0, 1)
MUX_CFG_24XX("AA6_242X_GPIO14", 0x0e6, 3, 0, 0, 1)
MUX_CFG_24XX("AA4_242X_GPIO15", 0x0e7, 3, 0, 0, 1)
@@ -118,6 +119,15 @@ MUX_CFG_24XX("E18_24XX_MMC_DAT_DIR3", 0x
MUX_CFG_24XX("G18_24XX_MMC_CMD_DIR", 0x0fd, 0, 0, 0, 1)
MUX_CFG_24XX("H15_24XX_MMC_CLKI", 0x0fe, 0, 0, 0, 1)
+/* USB */
+MUX_CFG_24XX("J20_24XX_USB0_PUEN", 0x11d, 0, 0, 0, 1)
+MUX_CFG_24XX("J19_24XX_USB0_VP", 0x11e, 0, 0, 0, 1)
+MUX_CFG_24XX("K20_24XX_USB0_VM", 0x11f, 0, 0, 0, 1)
+MUX_CFG_24XX("J18_24XX_USB0_RCV", 0x120, 0, 0, 0, 1)
+MUX_CFG_24XX("K19_24XX_USB0_TXEN", 0x121, 0, 0, 0, 1)
+MUX_CFG_24XX("J14_24XX_USB0_SE0", 0x122, 0, 0, 0, 1)
+MUX_CFG_24XX("K18_24XX_USB0_DAT", 0x113, 0, 0, 0, 1)
+
/* Keypad GPIO*/
MUX_CFG_24XX("T19_24XX_KBR0", 0x106, 3, 1, 1, 1)
MUX_CFG_24XX("R19_24XX_KBR1", 0x107, 3, 1, 1, 1)
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/arch/arm/plat-omap/usb.c linux-omap-2.6/arch/arm/plat-omap/usb.c
--- linux-omap-2.6-base/arch/arm/plat-omap/usb.c 2006-08-24 17:50:36.218750000 +0900
+++ linux-omap-2.6/arch/arm/plat-omap/usb.c 2006-08-24 20:48:30.687500000 +0900
@@ -37,6 +37,25 @@
#include <asm/arch/usb.h>
#include <asm/arch/board.h>
+#ifdef CONFIG_ARCH_OMAP1
+
+#define INT_USB_IRQ_GEN IH2_BASE + 20
+#define INT_USB_IRQ_NISO IH2_BASE + 30
+#define INT_USB_IRQ_ISO IH2_BASE + 29
+#define INT_USB_IRQ_HGEN INT_USB_HHC_1
+#define INT_USB_IRQ_OTG IH2_BASE + 8
+
+#else
+
+#define INT_USB_IRQ_GEN INT_24XX_USB_IRQ_GEN
+#define INT_USB_IRQ_NISO INT_24XX_USB_IRQ_NISO
+#define INT_USB_IRQ_ISO INT_24XX_USB_IRQ_ISO
+#define INT_USB_IRQ_HGEN INT_24XX_USB_IRQ_HGEN
+#define INT_USB_IRQ_OTG INT_24XX_USB_IRQ_OTG
+
+#endif
+
+
/* These routines should handle the standard chip-specific modes
* for usb0/1/2 ports, covering basic mux and transceiver setup.
* Call omap_usb_init() once, from INIT_MACHINE().
@@ -97,15 +116,19 @@ static u32 __init omap_usb0_init(unsigne
u32 syscon1 = 0;
if (nwires == 0) {
- if (!cpu_is_omap15xx()) {
+ if (cpu_class_is_omap1() && !cpu_is_omap15xx()) {
/* pulldown D+/D- */
USB_TRANSCEIVER_CTRL_REG &= ~(3 << 1);
}
return 0;
}
- if (is_device)
- omap_cfg_reg(W4_USB_PUEN);
+ if (is_device) {
+ if (cpu_is_omap24xx())
+ omap_cfg_reg(J20_24XX_USB0_PUEN);
+ else
+ omap_cfg_reg(W4_USB_PUEN);
+ }
/* internal transceiver */
if (nwires == 2) {
@@ -136,29 +159,51 @@ static u32 __init omap_usb0_init(unsigne
return 0;
}
- omap_cfg_reg(V6_USB0_TXD);
- omap_cfg_reg(W9_USB0_TXEN);
- omap_cfg_reg(W5_USB0_SE0);
+ if (cpu_is_omap24xx()) {
+ omap_cfg_reg(K18_24XX_USB0_DAT);
+ omap_cfg_reg(K19_24XX_USB0_TXEN);
+ omap_cfg_reg(J14_24XX_USB0_SE0);
+ } else {
+ omap_cfg_reg(V6_USB0_TXD);
+ omap_cfg_reg(W9_USB0_TXEN);
+ omap_cfg_reg(W5_USB0_SE0);
+ }
/* NOTE: SPEED and SUSP aren't configured here */
- if (nwires != 3)
- omap_cfg_reg(Y5_USB0_RCV);
- if (nwires != 6)
+ if (nwires != 3) {
+ if (cpu_is_omap24xx())
+ omap_cfg_reg(J18_24XX_USB0_RCV);
+ else
+ omap_cfg_reg(Y5_USB0_RCV);
+ }
+ if (cpu_is_omap24xx())
+ CONTROL_DEVCONF_REG &= ~USBT0WRMODEI(BIDIR_TTL);
+ else if (nwires != 6)
USB_TRANSCEIVER_CTRL_REG &= ~CONF_USB2_UNI_R;
switch (nwires) {
case 3:
syscon1 = 2;
+ if (cpu_is_omap24xx())
+ CONTROL_DEVCONF_REG |= USBT0WRMODEI(BIDIR);
break;
case 4:
syscon1 = 1;
+ if (cpu_is_omap24xx())
+ CONTROL_DEVCONF_REG |= USBT0WRMODEI(BIDIR);
break;
case 6:
syscon1 = 3;
- omap_cfg_reg(AA9_USB0_VP);
- omap_cfg_reg(R9_USB0_VM);
- USB_TRANSCEIVER_CTRL_REG |= CONF_USB2_UNI_R;
+ if (cpu_is_omap24xx()) {
+ omap_cfg_reg(J19_24XX_USB0_VP);
+ omap_cfg_reg(K20_24XX_USB0_VM);
+ CONTROL_DEVCONF_REG |= USBT0WRMODEI(UNIDIR);
+ } else {
+ omap_cfg_reg(AA9_USB0_VP);
+ omap_cfg_reg(R9_USB0_VM);
+ USB_TRANSCEIVER_CTRL_REG |= CONF_USB2_UNI_R;
+ }
break;
default:
printk(KERN_ERR "illegal usb%d %d-wire transceiver\n",
@@ -171,6 +216,9 @@ static u32 __init omap_usb1_init(unsigne
{
u32 syscon1 = 0;
+ if (cpu_is_omap24xx())
+ return 0;
+
if (nwires != 6 && !cpu_is_omap15xx())
USB_TRANSCEIVER_CTRL_REG &= ~CONF_USB1_UNI_R;
if (nwires == 0)
@@ -221,6 +269,9 @@ static u32 __init omap_usb2_init(unsigne
{
u32 syscon1 = 0;
+ if (cpu_is_omap24xx())
+ return 0;
+
/* NOTE erratum: must leave USB2_UNI_R set if usb0 in use */
if (alt_pingroup || nwires == 0)
return 0;
@@ -294,13 +345,13 @@ static struct resource udc_resources[] =
.end = UDC_BASE + 0xff,
.flags = IORESOURCE_MEM,
}, { /* general IRQ */
- .start = IH2_BASE + 20,
+ .start = INT_USB_IRQ_GEN,
.flags = IORESOURCE_IRQ,
}, { /* PIO IRQ */
- .start = IH2_BASE + 30,
+ .start = INT_USB_IRQ_NISO,
.flags = IORESOURCE_IRQ,
}, { /* SOF IRQ */
- .start = IH2_BASE + 29,
+ .start = INT_USB_IRQ_ISO,
.flags = IORESOURCE_IRQ,
},
};
@@ -333,7 +384,7 @@ static struct resource ohci_resources[]
.flags = IORESOURCE_MEM,
},
{
- .start = INT_USB_HHC_1,
+ .start = INT_USB_IRQ_HGEN,
.flags = IORESOURCE_IRQ,
},
};
@@ -361,7 +412,7 @@ static struct resource otg_resources[] =
.end = OTG_BASE + 0xff,
.flags = IORESOURCE_MEM,
}, {
- .start = IH2_BASE + 8,
+ .start = INT_USB_IRQ_OTG,
.flags = IORESOURCE_IRQ,
},
};
@@ -426,12 +477,13 @@ omap_otg_init(struct omap_usb_config *co
if (config->otg)
syscon |= OTG_EN;
#endif
- pr_debug("USB_TRANSCEIVER_CTRL_REG = %03x\n", USB_TRANSCEIVER_CTRL_REG);
+ if (cpu_class_is_omap1())
+ pr_debug("USB_TRANSCEIVER_CTRL_REG = %03x\n", USB_TRANSCEIVER_CTRL_REG);
pr_debug("OTG_SYSCON_2_REG = %08x\n", syscon);
OTG_SYSCON_2_REG = syscon;
printk("USB: hmc %d", config->hmc_mode);
- if (alt_pingroup)
+ if (!alt_pingroup)
printk(", usb2 alt %d wires", config->pins[2]);
else if (config->pins[0])
printk(", usb0 %d wires%s", config->pins[0],
@@ -444,10 +496,12 @@ omap_otg_init(struct omap_usb_config *co
printk(", Mini-AB on usb%d", config->otg - 1);
printk("\n");
- /* leave USB clocks/controllers off until needed */
- ULPD_SOFT_REQ_REG &= ~SOFT_USB_CLK_REQ;
- ULPD_CLOCK_CTRL_REG &= ~USB_MCLK_EN;
- ULPD_CLOCK_CTRL_REG |= DIS_USB_PVCI_CLK;
+ if (cpu_class_is_omap1()) {
+ /* leave USB clocks/controllers off until needed */
+ ULPD_SOFT_REQ_REG &= ~SOFT_USB_CLK_REQ;
+ ULPD_CLOCK_CTRL_REG &= ~USB_MCLK_EN;
+ ULPD_CLOCK_CTRL_REG |= DIS_USB_PVCI_CLK;
+ }
syscon = OTG_SYSCON_1_REG;
syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN;
@@ -585,7 +639,7 @@ omap_usb_init(void)
}
platform_data = *config;
- if (cpu_is_omap730() || cpu_is_omap16xx())
+ if (cpu_is_omap730() || cpu_is_omap16xx() || cpu_is_omap24xx())
omap_otg_init(&platform_data);
else if (cpu_is_omap15xx())
omap_1510_usb_init(&platform_data);
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/drivers/usb/gadget/Kconfig linux-omap-2.6/drivers/usb/gadget/Kconfig
--- linux-omap-2.6-base/drivers/usb/gadget/Kconfig 2006-08-24 17:53:15.984375000 +0900
+++ linux-omap-2.6/drivers/usb/gadget/Kconfig 2006-08-24 19:58:06.593750000 +0900
@@ -157,7 +157,7 @@ config USB_LH7A40X
config USB_GADGET_OMAP
boolean "OMAP USB Device Controller"
- depends on ARCH_OMAP1
+ depends on ARCH_OMAP
select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3
help
Many Texas Instruments OMAP processors have flexible full
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/drivers/usb/gadget/omap_udc.c linux-omap-2.6/drivers/usb/gadget/omap_udc.c
--- linux-omap-2.6-base/drivers/usb/gadget/omap_udc.c 2006-08-24 17:53:16.000000000 +0900
+++ linux-omap-2.6/drivers/usb/gadget/omap_udc.c 2006-08-24 20:06:42.703125000 +0900
@@ -61,6 +61,11 @@
/* bulk DMA seems to be behaving for both IN and OUT */
#define USE_DMA
+/* FIXME: Now OMAP2 has some problem in DMA mode */
+#ifdef CONFIG_ARCH_OMAP2
+#undef USB_DMA
+#endif
+
/* ISO too */
#define USE_ISO
@@ -2069,6 +2074,13 @@ omap_udc_iso_irq(int irq, void *_dev, st
/*-------------------------------------------------------------------------*/
+static inline int machine_needs_vbus_session(void)
+{
+ return (machine_is_omap_innovator()
+ || machine_is_omap_osk()
+ || machine_is_omap_apollon()
+ );
+}
int usb_gadget_register_driver (struct usb_gadget_driver *driver)
{
@@ -2145,7 +2157,7 @@ int usb_gadget_register_driver (struct u
/* boards that don't have VBUS sensing can't autogate 48MHz;
* can't enter deep sleep while a gadget driver is active.
*/
- if (machine_is_omap_innovator() || machine_is_omap_osk())
+ if (machine_needs_vbus_session())
omap_vbus_session(&udc->gadget, 1);
done:
@@ -2168,7 +2180,7 @@ int usb_gadget_unregister_driver (struct
if (udc->dc_clk != NULL)
omap_udc_enable_clock(1);
- if (machine_is_omap_innovator() || machine_is_omap_osk())
+ if (machine_needs_vbus_session())
omap_vbus_session(&udc->gadget, 0);
if (udc->transceiver)
@@ -2277,11 +2289,18 @@ static int proc_otg_show(struct seq_file
{
u32 tmp;
u32 trans;
+ char *ctrl_name;
tmp = OTG_REV_REG;
- trans = USB_TRANSCEIVER_CTRL_REG;
- seq_printf(s, "\nOTG rev %d.%d, transceiver_ctrl %05x\n",
- tmp >> 4, tmp & 0xf, trans);
+ if (cpu_is_omap24xx()) {
+ ctrl_name = "control_devconf";
+ trans = CONTROL_DEVCONF_REG;
+ } else {
+ ctrl_name = "tranceiver_ctrl";
+ trans = USB_TRANSCEIVER_CTRL_REG;
+ }
+ seq_printf(s, "\nOTG rev %d.%d, %s %05x\n",
+ tmp >> 4, tmp & 0xf, ctrl_name, trans);
tmp = OTG_SYSCON_1_REG;
seq_printf(s, "otg_syscon1 %08x usb2 %s, usb1 %s, usb0 %s,"
FOURBITS "\n", tmp,
@@ -2365,10 +2384,12 @@ static int proc_udc_show(struct seq_file
udc->driver ? udc->driver->driver.name : "(none)",
HMC,
udc->transceiver ? udc->transceiver->label : "(none)");
- seq_printf(s, "ULPD control %04x req %04x status %04x\n",
- __REG16(ULPD_CLOCK_CTRL),
- __REG16(ULPD_SOFT_REQ),
- __REG16(ULPD_STATUS_REQ));
+ if (cpu_class_is_omap1()) {
+ seq_printf(s, "ULPD control %04x req %04x status %04x\n",
+ __REG16(ULPD_CLOCK_CTRL),
+ __REG16(ULPD_SOFT_REQ),
+ __REG16(ULPD_STATUS_REQ));
+ }
/* OTG controller registers */
if (!cpu_is_omap15xx())
@@ -2779,6 +2800,16 @@ static int __init omap_udc_probe(struct
udelay(100);
}
+ if (cpu_is_omap24xx()) {
+ dc_clk = clk_get(&pdev->dev, "usb_fck");
+ hhc_clk = clk_get(&pdev->dev, "usb_l4_ick");
+ 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",
UDC_REV_REG >> 4, UDC_REV_REG & 0xf,
config->otg ? ", Mini-AB" : "");
@@ -2908,6 +2939,16 @@ bad_on_1710:
clk_disable(dc_clk);
}
+ if (cpu_is_omap24xx()) {
+ udc->dc_clk = dc_clk;
+ udc->hhc_clk = hhc_clk;
+ /* FIXME OMAP2 don't release hhc & dc clock */
+#if 0
+ clk_disable(hhc_clk);
+ clk_disable(dc_clk);
+#endif
+ }
+
create_proc_file();
device_add(&udc->gadget.dev);
return 0;
@@ -2928,7 +2969,7 @@ cleanup0:
if (xceiv)
put_device(xceiv->dev);
- if (cpu_is_omap16xx()) {
+ if (cpu_is_omap16xx() || cpu_is_omap24xx()) {
clk_disable(hhc_clk);
clk_disable(dc_clk);
clk_put(hhc_clk);
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/include/asm-arm/arch-omap/irqs.h linux-omap-2.6/include/asm-arm/arch-omap/irqs.h
--- linux-omap-2.6-base/include/asm-arm/arch-omap/irqs.h 2006-08-24 17:53:16.187500000 +0900
+++ linux-omap-2.6/include/asm-arm/arch-omap/irqs.h 2006-08-24 20:08:01.468750000 +0900
@@ -262,6 +262,12 @@
#define INT_24XX_UART1_IRQ 72
#define INT_24XX_UART2_IRQ 73
#define INT_24XX_UART3_IRQ 74
+#define INT_24XX_USB_IRQ_GEN 75
+#define INT_24XX_USB_IRQ_NISO 76
+#define INT_24XX_USB_IRQ_ISO 77
+#define INT_24XX_USB_IRQ_HGEN 78
+#define INT_24XX_USB_IRQ_HSOF 79
+#define INT_24XX_USB_IRQ_OTG 80
#define INT_24XX_MMC_IRQ 83
/* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/include/asm-arm/arch-omap/mux.h linux-omap-2.6/include/asm-arm/arch-omap/mux.h
--- linux-omap-2.6-base/include/asm-arm/arch-omap/mux.h 2006-08-24 17:53:16.203125000 +0900
+++ linux-omap-2.6/include/asm-arm/arch-omap/mux.h 2006-08-24 20:09:27.781250000 +0900
@@ -435,6 +435,7 @@ enum omap24xx_index {
/* 24xx GPIO */
M21_242X_GPIO11,
+ P21_242X_GPIO12,
AA10_242X_GPIO13,
AA6_242X_GPIO14,
AA4_242X_GPIO15,
@@ -486,6 +487,15 @@ enum omap24xx_index {
G18_24XX_MMC_CMD_DIR,
H15_24XX_MMC_CLKI,
+ /* USB */
+ J20_24XX_USB0_PUEN,
+ J19_24XX_USB0_VP,
+ K20_24XX_USB0_VM,
+ J18_24XX_USB0_RCV,
+ K19_24XX_USB0_TXEN,
+ J14_24XX_USB0_SE0,
+ K18_24XX_USB0_DAT,
+
/* Keypad GPIO*/
T19_24XX_KBR0,
R19_24XX_KBR1,
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/include/asm-arm/arch-omap/usb.h linux-omap-2.6/include/asm-arm/arch-omap/usb.h
--- linux-omap-2.6-base/include/asm-arm/arch-omap/usb.h 2006-06-18 10:49:35.000000000 +0900
+++ linux-omap-2.6/include/asm-arm/arch-omap/usb.h 2006-08-24 20:17:16.218750000 +0900
@@ -7,9 +7,27 @@
/*-------------------------------------------------------------------------*/
-#define OTG_BASE 0xfffb0400
-#define UDC_BASE 0xfffb4000
-#define OMAP_OHCI_BASE 0xfffba000
+#define OMAP1_OTG_BASE 0xfffb0400
+#define OMAP1_UDC_BASE 0xfffb4000
+#define OMAP1_OHCI_BASE 0xfffba000
+
+#define OMAP2_OHCI_BASE 0x4805e000
+#define OMAP2_UDC_BASE 0x4805e200
+#define OMAP2_OTG_BASE 0x4805e300
+
+#ifdef CONFIG_ARCH_OMAP1
+
+#define OTG_BASE OMAP1_OTG_BASE
+#define UDC_BASE OMAP1_UDC_BASE
+#define OMAP_OHCI_BASE OMAP1_OHCI_BASE
+
+#else
+
+#define OTG_BASE OMAP2_OTG_BASE
+#define UDC_BASE OMAP2_UDC_BASE
+#define OMAP_OHCI_BASE OMAP2_OHCI_BASE
+
+#endif
/*-------------------------------------------------------------------------*/
@@ -103,6 +121,7 @@
/*-------------------------------------------------------------------------*/
+/* OMAP1 */
#define USB_TRANSCEIVER_CTRL_REG __REG32(0xfffe1000 + 0x0064)
# define CONF_USB2_UNI_R (1 << 8)
# define CONF_USB1_UNI_R (1 << 7)
@@ -111,7 +130,15 @@
# define CONF_USB_PWRDN_DM_R (1 << 2)
# define CONF_USB_PWRDN_DP_R (1 << 1)
-
-
+/* OMAP2 */
+#define CONTROL_DEVCONF_REG __REG32(0x48000000 + 0x0274)
+# define UNIDIR 0x0
+# define UNIDIR_TTL 0x1
+# define BIDIR 0x2
+# define BIDIR_TTL 0x3
+# define USBT0WRMODEI(x) ((x) << 22)
+# define USBT1WRMODEI(x) ((x) << 20)
+# define USBT2WRMODEI(x) ((x) << 18)
+# define USB0PUENACTLOI (1 << 16)
#endif /* __ASM_ARCH_OMAP_USB_H */
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] USB device support on OMAP2
@ 2006-08-24 12:54 박경민
2006-10-17 21:15 ` David Brownell
0 siblings, 1 reply; 3+ messages in thread
From: 박경민 @ 2006-08-24 12:54 UTC (permalink / raw)
To: linux-omap-open-source@linux.omap.com
[-- Attachment #1: Type: text/plain, Size: 19059 bytes --]
Hi,
Sorry there's missing one.
Please ignore the previous patch.
There's not sovled problems, USB DMA and Clocks on OMAP2420.
First, DMA. In previos TI developer mail, USB DMA can't work well.
I already tried to ues DMA with TI code, but failed. So I just use Non-DMA mode on OMAP2.
It also don't work in kernel 2.4
Second, Clocks, The current implementation is always turn on USB clocks.
When I turn off the USB clock after probing, then USB don't work since there's no clocks.
Is there some places to enable the clocks to work?
Of course, there's no problem in kernel 2.4. It's working well.
Are there any suggestions or hints?
Thank you,
Kyungmin Park
[PATCH] USB device support on OMAP2
Enable USB device on OMAP2 platform. Only usb0 is used for device without DMA.
There are remainging issues, DMA and clocks.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
--
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/arch/arm/mach-omap2/Kconfig linux-omap-2.6/arch/arm/mach-omap2/Kconfig
--- linux-omap-2.6-base/arch/arm/mach-omap2/Kconfig 2006-08-24 17:53:15.171875000 +0900
+++ linux-omap-2.6/arch/arm/mach-omap2/Kconfig 2006-08-24 20:10:05.953125000 +0900
@@ -25,3 +25,4 @@ config MACH_OMAP_H4
config MACH_OMAP_APOLLON
bool "OMAP 2420 Apollon board"
depends on ARCH_OMAP2 && ARCH_OMAP24XX
+ select ARCH_OMAP_OTG
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/arch/arm/mach-omap2/board-apollon.c linux-omap-2.6/arch/arm/mach-omap2/board-apollon.c
--- linux-omap-2.6-base/arch/arm/mach-omap2/board-apollon.c 2006-08-24 17:53:15.187500000 +0900
+++ linux-omap-2.6/arch/arm/mach-omap2/board-apollon.c 2006-08-24 20:54:09.906250000 +0900
@@ -234,6 +234,13 @@ static struct omap_mmc_config apollon_mm
},
};
+static struct omap_usb_config apollon_usb_config __initdata = {
+ .register_dev = 1,
+ .hmc_mode = 0x14, /* 0:dev 1:host1 2: disable */
+
+ .pins[0] = 6,
+};
+
static struct omap_lcd_config apollon_lcd_config __initdata = {
.ctrl_name = "internal",
};
@@ -241,6 +248,7 @@ static struct omap_lcd_config apollon_lc
static struct omap_board_config_kernel apollon_config[] = {
{ OMAP_TAG_UART, &apollon_uart_config },
{ OMAP_TAG_MMC, &apollon_mmc_config },
+ { OMAP_TAG_USB, &apollon_usb_config },
{ OMAP_TAG_LCD, &apollon_lcd_config },
};
@@ -292,28 +300,35 @@ static void __init apollon_sw_init(void)
omap_request_gpio(SW_DOWN_GPIO58);
omap_set_gpio_direction(SW_DOWN_GPIO58, 1);
- set_irq_type(OMAP_GPIO_IRQ(SW_ENTER_GPIO16), IRQT_RISING);
if (request_irq(OMAP_GPIO_IRQ(SW_ENTER_GPIO16), &apollon_sw_interrupt,
IRQF_SHARED, "enter sw",
&apollon_sw_interrupt))
return;
- set_irq_type(OMAP_GPIO_IRQ(SW_UP_GPIO17), IRQT_RISING);
if (request_irq(OMAP_GPIO_IRQ(SW_UP_GPIO17), &apollon_sw_interrupt,
IRQF_SHARED, "up sw",
&apollon_sw_interrupt))
return;
- set_irq_type(OMAP_GPIO_IRQ(SW_DOWN_GPIO58), IRQT_RISING);
if (request_irq(OMAP_GPIO_IRQ(SW_DOWN_GPIO58), &apollon_sw_interrupt,
IRQF_SHARED, "down sw",
&apollon_sw_interrupt))
return;
}
+static void __init apollon_usb_init(void)
+{
+ /* USB device */
+ /* DEVICE_SUSPEND */
+ omap_cfg_reg(P21_242X_GPIO12);
+ omap_set_gpio_direction(12, 0);
+ omap_set_gpio_dataout(12, 0);
+}
+
static void __init omap_apollon_init(void)
{
apollon_led_init();
apollon_sw_init();
apollon_flash_init();
+ apollon_usb_init();
/* REVISIT: where's the correct place */
omap_cfg_reg(W19_24XX_SYS_NIRQ);
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/arch/arm/mach-omap2/mux.c linux-omap-2.6/arch/arm/mach-omap2/mux.c
--- linux-omap-2.6-base/arch/arm/mach-omap2/mux.c 2006-08-24 17:53:15.203125000 +0900
+++ linux-omap-2.6/arch/arm/mach-omap2/mux.c 2006-08-24 19:45:20.265625000 +0900
@@ -66,6 +66,7 @@ MUX_CFG_24XX("V15_24XX_MCBSP2_DX", 0x127
/* 24xx GPIO */
MUX_CFG_24XX("M21_242X_GPIO11", 0x0c9, 3, 1, 1, 1)
+MUX_CFG_24XX("P21_242X_GPIO12", 0x0ca, 3, 0, 0, 1)
MUX_CFG_24XX("AA10_242X_GPIO13", 0x0e5, 3, 0, 0, 1)
MUX_CFG_24XX("AA6_242X_GPIO14", 0x0e6, 3, 0, 0, 1)
MUX_CFG_24XX("AA4_242X_GPIO15", 0x0e7, 3, 0, 0, 1)
@@ -118,6 +119,15 @@ MUX_CFG_24XX("E18_24XX_MMC_DAT_DIR3", 0x
MUX_CFG_24XX("G18_24XX_MMC_CMD_DIR", 0x0fd, 0, 0, 0, 1)
MUX_CFG_24XX("H15_24XX_MMC_CLKI", 0x0fe, 0, 0, 0, 1)
+/* USB */
+MUX_CFG_24XX("J20_24XX_USB0_PUEN", 0x11d, 0, 0, 0, 1)
+MUX_CFG_24XX("J19_24XX_USB0_VP", 0x11e, 0, 0, 0, 1)
+MUX_CFG_24XX("K20_24XX_USB0_VM", 0x11f, 0, 0, 0, 1)
+MUX_CFG_24XX("J18_24XX_USB0_RCV", 0x120, 0, 0, 0, 1)
+MUX_CFG_24XX("K19_24XX_USB0_TXEN", 0x121, 0, 0, 0, 1)
+MUX_CFG_24XX("J14_24XX_USB0_SE0", 0x122, 0, 0, 0, 1)
+MUX_CFG_24XX("K18_24XX_USB0_DAT", 0x123, 0, 0, 0, 1)
+
/* Keypad GPIO*/
MUX_CFG_24XX("T19_24XX_KBR0", 0x106, 3, 1, 1, 1)
MUX_CFG_24XX("R19_24XX_KBR1", 0x107, 3, 1, 1, 1)
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/arch/arm/plat-omap/usb.c linux-omap-2.6/arch/arm/plat-omap/usb.c
--- linux-omap-2.6-base/arch/arm/plat-omap/usb.c 2006-08-24 17:50:36.218750000 +0900
+++ linux-omap-2.6/arch/arm/plat-omap/usb.c 2006-08-24 20:48:30.687500000 +0900
@@ -37,6 +37,25 @@
#include <asm/arch/usb.h>
#include <asm/arch/board.h>
+#ifdef CONFIG_ARCH_OMAP1
+
+#define INT_USB_IRQ_GEN IH2_BASE + 20
+#define INT_USB_IRQ_NISO IH2_BASE + 30
+#define INT_USB_IRQ_ISO IH2_BASE + 29
+#define INT_USB_IRQ_HGEN INT_USB_HHC_1
+#define INT_USB_IRQ_OTG IH2_BASE + 8
+
+#else
+
+#define INT_USB_IRQ_GEN INT_24XX_USB_IRQ_GEN
+#define INT_USB_IRQ_NISO INT_24XX_USB_IRQ_NISO
+#define INT_USB_IRQ_ISO INT_24XX_USB_IRQ_ISO
+#define INT_USB_IRQ_HGEN INT_24XX_USB_IRQ_HGEN
+#define INT_USB_IRQ_OTG INT_24XX_USB_IRQ_OTG
+
+#endif
+
+
/* These routines should handle the standard chip-specific modes
* for usb0/1/2 ports, covering basic mux and transceiver setup.
* Call omap_usb_init() once, from INIT_MACHINE().
@@ -97,15 +116,19 @@ static u32 __init omap_usb0_init(unsigne
u32 syscon1 = 0;
if (nwires == 0) {
- if (!cpu_is_omap15xx()) {
+ if (cpu_class_is_omap1() && !cpu_is_omap15xx()) {
/* pulldown D+/D- */
USB_TRANSCEIVER_CTRL_REG &= ~(3 << 1);
}
return 0;
}
- if (is_device)
- omap_cfg_reg(W4_USB_PUEN);
+ if (is_device) {
+ if (cpu_is_omap24xx())
+ omap_cfg_reg(J20_24XX_USB0_PUEN);
+ else
+ omap_cfg_reg(W4_USB_PUEN);
+ }
/* internal transceiver */
if (nwires == 2) {
@@ -136,29 +159,51 @@ static u32 __init omap_usb0_init(unsigne
return 0;
}
- omap_cfg_reg(V6_USB0_TXD);
- omap_cfg_reg(W9_USB0_TXEN);
- omap_cfg_reg(W5_USB0_SE0);
+ if (cpu_is_omap24xx()) {
+ omap_cfg_reg(K18_24XX_USB0_DAT);
+ omap_cfg_reg(K19_24XX_USB0_TXEN);
+ omap_cfg_reg(J14_24XX_USB0_SE0);
+ } else {
+ omap_cfg_reg(V6_USB0_TXD);
+ omap_cfg_reg(W9_USB0_TXEN);
+ omap_cfg_reg(W5_USB0_SE0);
+ }
/* NOTE: SPEED and SUSP aren't configured here */
- if (nwires != 3)
- omap_cfg_reg(Y5_USB0_RCV);
- if (nwires != 6)
+ if (nwires != 3) {
+ if (cpu_is_omap24xx())
+ omap_cfg_reg(J18_24XX_USB0_RCV);
+ else
+ omap_cfg_reg(Y5_USB0_RCV);
+ }
+ if (cpu_is_omap24xx())
+ CONTROL_DEVCONF_REG &= ~USBT0WRMODEI(BIDIR_TTL);
+ else if (nwires != 6)
USB_TRANSCEIVER_CTRL_REG &= ~CONF_USB2_UNI_R;
switch (nwires) {
case 3:
syscon1 = 2;
+ if (cpu_is_omap24xx())
+ CONTROL_DEVCONF_REG |= USBT0WRMODEI(BIDIR);
break;
case 4:
syscon1 = 1;
+ if (cpu_is_omap24xx())
+ CONTROL_DEVCONF_REG |= USBT0WRMODEI(BIDIR);
break;
case 6:
syscon1 = 3;
- omap_cfg_reg(AA9_USB0_VP);
- omap_cfg_reg(R9_USB0_VM);
- USB_TRANSCEIVER_CTRL_REG |= CONF_USB2_UNI_R;
+ if (cpu_is_omap24xx()) {
+ omap_cfg_reg(J19_24XX_USB0_VP);
+ omap_cfg_reg(K20_24XX_USB0_VM);
+ CONTROL_DEVCONF_REG |= USBT0WRMODEI(UNIDIR);
+ } else {
+ omap_cfg_reg(AA9_USB0_VP);
+ omap_cfg_reg(R9_USB0_VM);
+ USB_TRANSCEIVER_CTRL_REG |= CONF_USB2_UNI_R;
+ }
break;
default:
printk(KERN_ERR "illegal usb%d %d-wire transceiver\n",
@@ -171,6 +216,9 @@ static u32 __init omap_usb1_init(unsigne
{
u32 syscon1 = 0;
+ if (cpu_is_omap24xx())
+ return 0;
+
if (nwires != 6 && !cpu_is_omap15xx())
USB_TRANSCEIVER_CTRL_REG &= ~CONF_USB1_UNI_R;
if (nwires == 0)
@@ -221,6 +269,9 @@ static u32 __init omap_usb2_init(unsigne
{
u32 syscon1 = 0;
+ if (cpu_is_omap24xx())
+ return 0;
+
/* NOTE erratum: must leave USB2_UNI_R set if usb0 in use */
if (alt_pingroup || nwires == 0)
return 0;
@@ -294,13 +345,13 @@ static struct resource udc_resources[] =
.end = UDC_BASE + 0xff,
.flags = IORESOURCE_MEM,
}, { /* general IRQ */
- .start = IH2_BASE + 20,
+ .start = INT_USB_IRQ_GEN,
.flags = IORESOURCE_IRQ,
}, { /* PIO IRQ */
- .start = IH2_BASE + 30,
+ .start = INT_USB_IRQ_NISO,
.flags = IORESOURCE_IRQ,
}, { /* SOF IRQ */
- .start = IH2_BASE + 29,
+ .start = INT_USB_IRQ_ISO,
.flags = IORESOURCE_IRQ,
},
};
@@ -333,7 +384,7 @@ static struct resource ohci_resources[]
.flags = IORESOURCE_MEM,
},
{
- .start = INT_USB_HHC_1,
+ .start = INT_USB_IRQ_HGEN,
.flags = IORESOURCE_IRQ,
},
};
@@ -361,7 +412,7 @@ static struct resource otg_resources[] =
.end = OTG_BASE + 0xff,
.flags = IORESOURCE_MEM,
}, {
- .start = IH2_BASE + 8,
+ .start = INT_USB_IRQ_OTG,
.flags = IORESOURCE_IRQ,
},
};
@@ -426,12 +477,13 @@ omap_otg_init(struct omap_usb_config *co
if (config->otg)
syscon |= OTG_EN;
#endif
- pr_debug("USB_TRANSCEIVER_CTRL_REG = %03x\n", USB_TRANSCEIVER_CTRL_REG);
+ if (cpu_class_is_omap1())
+ pr_debug("USB_TRANSCEIVER_CTRL_REG = %03x\n", USB_TRANSCEIVER_CTRL_REG);
pr_debug("OTG_SYSCON_2_REG = %08x\n", syscon);
OTG_SYSCON_2_REG = syscon;
printk("USB: hmc %d", config->hmc_mode);
- if (alt_pingroup)
+ if (!alt_pingroup)
printk(", usb2 alt %d wires", config->pins[2]);
else if (config->pins[0])
printk(", usb0 %d wires%s", config->pins[0],
@@ -444,10 +496,12 @@ omap_otg_init(struct omap_usb_config *co
printk(", Mini-AB on usb%d", config->otg - 1);
printk("\n");
- /* leave USB clocks/controllers off until needed */
- ULPD_SOFT_REQ_REG &= ~SOFT_USB_CLK_REQ;
- ULPD_CLOCK_CTRL_REG &= ~USB_MCLK_EN;
- ULPD_CLOCK_CTRL_REG |= DIS_USB_PVCI_CLK;
+ if (cpu_class_is_omap1()) {
+ /* leave USB clocks/controllers off until needed */
+ ULPD_SOFT_REQ_REG &= ~SOFT_USB_CLK_REQ;
+ ULPD_CLOCK_CTRL_REG &= ~USB_MCLK_EN;
+ ULPD_CLOCK_CTRL_REG |= DIS_USB_PVCI_CLK;
+ }
syscon = OTG_SYSCON_1_REG;
syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN;
@@ -585,7 +639,7 @@ omap_usb_init(void)
}
platform_data = *config;
- if (cpu_is_omap730() || cpu_is_omap16xx())
+ if (cpu_is_omap730() || cpu_is_omap16xx() || cpu_is_omap24xx())
omap_otg_init(&platform_data);
else if (cpu_is_omap15xx())
omap_1510_usb_init(&platform_data);
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/drivers/usb/gadget/Kconfig linux-omap-2.6/drivers/usb/gadget/Kconfig
--- linux-omap-2.6-base/drivers/usb/gadget/Kconfig 2006-08-24 17:53:15.984375000 +0900
+++ linux-omap-2.6/drivers/usb/gadget/Kconfig 2006-08-24 19:58:06.593750000 +0900
@@ -157,7 +157,7 @@ config USB_LH7A40X
config USB_GADGET_OMAP
boolean "OMAP USB Device Controller"
- depends on ARCH_OMAP1
+ depends on ARCH_OMAP
select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3
help
Many Texas Instruments OMAP processors have flexible full
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/drivers/usb/gadget/omap_udc.c linux-omap-2.6/drivers/usb/gadget/omap_udc.c
--- linux-omap-2.6-base/drivers/usb/gadget/omap_udc.c 2006-08-24 17:53:16.000000000 +0900
+++ linux-omap-2.6/drivers/usb/gadget/omap_udc.c 2006-08-24 20:06:42.703125000 +0900
@@ -61,6 +61,11 @@
/* bulk DMA seems to be behaving for both IN and OUT */
#define USE_DMA
+/* FIXME: Now OMAP2 has some problem in DMA mode */
+#ifdef CONFIG_ARCH_OMAP2
+#undef USB_DMA
+#endif
+
/* ISO too */
#define USE_ISO
@@ -2069,6 +2074,13 @@ omap_udc_iso_irq(int irq, void *_dev, st
/*-------------------------------------------------------------------------*/
+static inline int machine_needs_vbus_session(void)
+{
+ return (machine_is_omap_innovator()
+ || machine_is_omap_osk()
+ || machine_is_omap_apollon()
+ );
+}
int usb_gadget_register_driver (struct usb_gadget_driver *driver)
{
@@ -2145,7 +2157,7 @@ int usb_gadget_register_driver (struct u
/* boards that don't have VBUS sensing can't autogate 48MHz;
* can't enter deep sleep while a gadget driver is active.
*/
- if (machine_is_omap_innovator() || machine_is_omap_osk())
+ if (machine_needs_vbus_session())
omap_vbus_session(&udc->gadget, 1);
done:
@@ -2168,7 +2180,7 @@ int usb_gadget_unregister_driver (struct
if (udc->dc_clk != NULL)
omap_udc_enable_clock(1);
- if (machine_is_omap_innovator() || machine_is_omap_osk())
+ if (machine_needs_vbus_session())
omap_vbus_session(&udc->gadget, 0);
if (udc->transceiver)
@@ -2277,11 +2289,18 @@ static int proc_otg_show(struct seq_file
{
u32 tmp;
u32 trans;
+ char *ctrl_name;
tmp = OTG_REV_REG;
- trans = USB_TRANSCEIVER_CTRL_REG;
- seq_printf(s, "\nOTG rev %d.%d, transceiver_ctrl %05x\n",
- tmp >> 4, tmp & 0xf, trans);
+ if (cpu_is_omap24xx()) {
+ ctrl_name = "control_devconf";
+ trans = CONTROL_DEVCONF_REG;
+ } else {
+ ctrl_name = "tranceiver_ctrl";
+ trans = USB_TRANSCEIVER_CTRL_REG;
+ }
+ seq_printf(s, "\nOTG rev %d.%d, %s %05x\n",
+ tmp >> 4, tmp & 0xf, ctrl_name, trans);
tmp = OTG_SYSCON_1_REG;
seq_printf(s, "otg_syscon1 %08x usb2 %s, usb1 %s, usb0 %s,"
FOURBITS "\n", tmp,
@@ -2365,10 +2384,12 @@ static int proc_udc_show(struct seq_file
udc->driver ? udc->driver->driver.name : "(none)",
HMC,
udc->transceiver ? udc->transceiver->label : "(none)");
- seq_printf(s, "ULPD control %04x req %04x status %04x\n",
- __REG16(ULPD_CLOCK_CTRL),
- __REG16(ULPD_SOFT_REQ),
- __REG16(ULPD_STATUS_REQ));
+ if (cpu_class_is_omap1()) {
+ seq_printf(s, "ULPD control %04x req %04x status %04x\n",
+ __REG16(ULPD_CLOCK_CTRL),
+ __REG16(ULPD_SOFT_REQ),
+ __REG16(ULPD_STATUS_REQ));
+ }
/* OTG controller registers */
if (!cpu_is_omap15xx())
@@ -2779,6 +2800,16 @@ static int __init omap_udc_probe(struct
udelay(100);
}
+ if (cpu_is_omap24xx()) {
+ dc_clk = clk_get(&pdev->dev, "usb_fck");
+ hhc_clk = clk_get(&pdev->dev, "usb_l4_ick");
+ 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",
UDC_REV_REG >> 4, UDC_REV_REG & 0xf,
config->otg ? ", Mini-AB" : "");
@@ -2908,6 +2939,16 @@ bad_on_1710:
clk_disable(dc_clk);
}
+ if (cpu_is_omap24xx()) {
+ udc->dc_clk = dc_clk;
+ udc->hhc_clk = hhc_clk;
+ /* FIXME OMAP2 don't release hhc & dc clock */
+#if 0
+ clk_disable(hhc_clk);
+ clk_disable(dc_clk);
+#endif
+ }
+
create_proc_file();
device_add(&udc->gadget.dev);
return 0;
@@ -2928,7 +2969,7 @@ cleanup0:
if (xceiv)
put_device(xceiv->dev);
- if (cpu_is_omap16xx()) {
+ if (cpu_is_omap16xx() || cpu_is_omap24xx()) {
clk_disable(hhc_clk);
clk_disable(dc_clk);
clk_put(hhc_clk);
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/include/asm-arm/arch-omap/irqs.h linux-omap-2.6/include/asm-arm/arch-omap/irqs.h
--- linux-omap-2.6-base/include/asm-arm/arch-omap/irqs.h 2006-08-24 17:53:16.187500000 +0900
+++ linux-omap-2.6/include/asm-arm/arch-omap/irqs.h 2006-08-24 20:08:01.468750000 +0900
@@ -262,6 +262,12 @@
#define INT_24XX_UART1_IRQ 72
#define INT_24XX_UART2_IRQ 73
#define INT_24XX_UART3_IRQ 74
+#define INT_24XX_USB_IRQ_GEN 75
+#define INT_24XX_USB_IRQ_NISO 76
+#define INT_24XX_USB_IRQ_ISO 77
+#define INT_24XX_USB_IRQ_HGEN 78
+#define INT_24XX_USB_IRQ_HSOF 79
+#define INT_24XX_USB_IRQ_OTG 80
#define INT_24XX_MMC_IRQ 83
/* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/include/asm-arm/arch-omap/mux.h linux-omap-2.6/include/asm-arm/arch-omap/mux.h
--- linux-omap-2.6-base/include/asm-arm/arch-omap/mux.h 2006-08-24 17:53:16.203125000 +0900
+++ linux-omap-2.6/include/asm-arm/arch-omap/mux.h 2006-08-24 20:09:27.781250000 +0900
@@ -435,6 +435,7 @@ enum omap24xx_index {
/* 24xx GPIO */
M21_242X_GPIO11,
+ P21_242X_GPIO12,
AA10_242X_GPIO13,
AA6_242X_GPIO14,
AA4_242X_GPIO15,
@@ -486,6 +487,15 @@ enum omap24xx_index {
G18_24XX_MMC_CMD_DIR,
H15_24XX_MMC_CLKI,
+ /* USB */
+ J20_24XX_USB0_PUEN,
+ J19_24XX_USB0_VP,
+ K20_24XX_USB0_VM,
+ J18_24XX_USB0_RCV,
+ K19_24XX_USB0_TXEN,
+ J14_24XX_USB0_SE0,
+ K18_24XX_USB0_DAT,
+
/* Keypad GPIO*/
T19_24XX_KBR0,
R19_24XX_KBR1,
diff -upr --exclude '.*' --exclude '*.o' linux-omap-2.6-base/include/asm-arm/arch-omap/usb.h linux-omap-2.6/include/asm-arm/arch-omap/usb.h
--- linux-omap-2.6-base/include/asm-arm/arch-omap/usb.h 2006-06-18 10:49:35.000000000 +0900
+++ linux-omap-2.6/include/asm-arm/arch-omap/usb.h 2006-08-24 20:17:16.218750000 +0900
@@ -7,9 +7,27 @@
/*-------------------------------------------------------------------------*/
-#define OTG_BASE 0xfffb0400
-#define UDC_BASE 0xfffb4000
-#define OMAP_OHCI_BASE 0xfffba000
+#define OMAP1_OTG_BASE 0xfffb0400
+#define OMAP1_UDC_BASE 0xfffb4000
+#define OMAP1_OHCI_BASE 0xfffba000
+
+#define OMAP2_OHCI_BASE 0x4805e000
+#define OMAP2_UDC_BASE 0x4805e200
+#define OMAP2_OTG_BASE 0x4805e300
+
+#ifdef CONFIG_ARCH_OMAP1
+
+#define OTG_BASE OMAP1_OTG_BASE
+#define UDC_BASE OMAP1_UDC_BASE
+#define OMAP_OHCI_BASE OMAP1_OHCI_BASE
+
+#else
+
+#define OTG_BASE OMAP2_OTG_BASE
+#define UDC_BASE OMAP2_UDC_BASE
+#define OMAP_OHCI_BASE OMAP2_OHCI_BASE
+
+#endif
/*-------------------------------------------------------------------------*/
@@ -103,6 +121,7 @@
/*-------------------------------------------------------------------------*/
+/* OMAP1 */
#define USB_TRANSCEIVER_CTRL_REG __REG32(0xfffe1000 + 0x0064)
# define CONF_USB2_UNI_R (1 << 8)
# define CONF_USB1_UNI_R (1 << 7)
@@ -111,7 +130,15 @@
# define CONF_USB_PWRDN_DM_R (1 << 2)
# define CONF_USB_PWRDN_DP_R (1 << 1)
-
-
+/* OMAP2 */
+#define CONTROL_DEVCONF_REG __REG32(0x48000000 + 0x0274)
+# define UNIDIR 0x0
+# define UNIDIR_TTL 0x1
+# define BIDIR 0x2
+# define BIDIR_TTL 0x3
+# define USBT0WRMODEI(x) ((x) << 22)
+# define USBT1WRMODEI(x) ((x) << 20)
+# define USBT2WRMODEI(x) ((x) << 18)
+# define USB0PUENACTLOI (1 << 16)
#endif /* __ASM_ARCH_OMAP_USB_H */
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] USB device support on OMAP2
2006-08-24 12:54 박경민
@ 2006-10-17 21:15 ` David Brownell
0 siblings, 0 replies; 3+ messages in thread
From: David Brownell @ 2006-10-17 21:15 UTC (permalink / raw)
To: linux-omap-open-source, kyungmin.park
On Thursday 24 August 2006 5:54 am, 박경민 wrote:
> [PATCH] USB device support on OMAP2
>
> Enable USB device on OMAP2 platform. Only usb0 is used for device without DMA.
> There are remainging issues, DMA and clocks.
>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
I've been looking at this. What I'll do is split it apart into
smaller chunks and forward them, along with H4 support. Mostly
it looks OK, except for only including support for the the usb0
port insteaf of also usb1 and usb2 hooks.
- Dave
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-10-17 21:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-24 12:23 [PATCH] USB device support on OMAP2 박경민
-- strict thread matches above, loose matches on Subject: below --
2006-08-24 12:54 박경민
2006-10-17 21:15 ` David Brownell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox