e1000: drop lltx, remove unnecessary lock
[linux-2.6/mini2440.git] / arch / arm / mach-davinci / usb.c
blobfe182a85159cdc6e3ef8d6e549cd5760bb648fd9
1 /*
2 * USB
3 */
4 #include <linux/kernel.h>
5 #include <linux/module.h>
6 #include <linux/init.h>
7 #include <linux/platform_device.h>
8 #include <linux/dma-mapping.h>
10 #include <linux/usb/musb.h>
11 #include <linux/usb/otg.h>
13 #include <mach/common.h>
14 #include <mach/hardware.h>
16 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
17 static struct musb_hdrc_eps_bits musb_eps[] = {
18 { "ep1_tx", 8, },
19 { "ep1_rx", 8, },
20 { "ep2_tx", 8, },
21 { "ep2_rx", 8, },
22 { "ep3_tx", 5, },
23 { "ep3_rx", 5, },
24 { "ep4_tx", 5, },
25 { "ep4_rx", 5, },
28 static struct musb_hdrc_config musb_config = {
29 .multipoint = true,
30 .dyn_fifo = true,
31 .soft_con = true,
32 .dma = true,
34 .num_eps = 5,
35 .dma_channels = 8,
36 .ram_bits = 10,
37 .eps_bits = musb_eps,
40 static struct musb_hdrc_platform_data usb_data = {
41 #if defined(CONFIG_USB_MUSB_OTG)
42 /* OTG requires a Mini-AB connector */
43 .mode = MUSB_OTG,
44 #elif defined(CONFIG_USB_MUSB_PERIPHERAL)
45 .mode = MUSB_PERIPHERAL,
46 #elif defined(CONFIG_USB_MUSB_HOST)
47 .mode = MUSB_HOST,
48 #endif
49 .config = &musb_config,
52 static struct resource usb_resources[] = {
54 /* physical address */
55 .start = DAVINCI_USB_OTG_BASE,
56 .end = DAVINCI_USB_OTG_BASE + 0x5ff,
57 .flags = IORESOURCE_MEM,
60 .start = IRQ_USBINT,
61 .flags = IORESOURCE_IRQ,
65 static u64 usb_dmamask = DMA_32BIT_MASK;
67 static struct platform_device usb_dev = {
68 .name = "musb_hdrc",
69 .id = -1,
70 .dev = {
71 .platform_data = &usb_data,
72 .dma_mask = &usb_dmamask,
73 .coherent_dma_mask = DMA_32BIT_MASK,
75 .resource = usb_resources,
76 .num_resources = ARRAY_SIZE(usb_resources),
79 #ifdef CONFIG_USB_MUSB_OTG
81 static struct otg_transceiver *xceiv;
83 struct otg_transceiver *otg_get_transceiver(void)
85 if (xceiv)
86 get_device(xceiv->dev);
87 return xceiv;
89 EXPORT_SYMBOL(otg_get_transceiver);
91 int otg_set_transceiver(struct otg_transceiver *x)
93 if (xceiv && x)
94 return -EBUSY;
95 xceiv = x;
96 return 0;
98 EXPORT_SYMBOL(otg_set_transceiver);
100 #endif
102 void __init setup_usb(unsigned mA, unsigned potpgt_msec)
104 usb_data.power = mA / 2;
105 usb_data.potpgt = potpgt_msec / 2;
106 platform_device_register(&usb_dev);
109 #else
111 void __init setup_usb(unsigned mA, unsigned potpgt_msec)
115 #endif /* CONFIG_USB_MUSB_HDRC */