4 #include <linux/init.h>
5 #include <linux/platform_device.h>
6 #include <linux/dma-mapping.h>
8 #include <linux/usb/musb.h>
10 #include <mach/common.h>
11 #include <mach/irqs.h>
12 #include <mach/cputype.h>
15 #define DAVINCI_USB_OTG_BASE 0x01c64000
16 #define DA8XX_USB1_BASE 0x01e25000
18 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
19 static struct musb_hdrc_eps_bits musb_eps[] = {
30 static struct musb_hdrc_config musb_config = {
42 static struct musb_hdrc_platform_data usb_data = {
43 #if defined(CONFIG_USB_MUSB_OTG)
44 /* OTG requires a Mini-AB connector */
46 #elif defined(CONFIG_USB_MUSB_PERIPHERAL)
47 .mode = MUSB_PERIPHERAL,
48 #elif defined(CONFIG_USB_MUSB_HOST)
52 .config = &musb_config,
55 static struct resource usb_resources[] = {
57 /* physical address */
58 .start = DAVINCI_USB_OTG_BASE,
59 .end = DAVINCI_USB_OTG_BASE + 0x5ff,
60 .flags = IORESOURCE_MEM,
64 .flags = IORESOURCE_IRQ,
67 /* placeholder for the dedicated CPPI IRQ */
68 .flags = IORESOURCE_IRQ,
72 static u64 usb_dmamask = DMA_BIT_MASK(32);
74 static struct platform_device usb_dev = {
78 .platform_data = &usb_data,
79 .dma_mask = &usb_dmamask,
80 .coherent_dma_mask = DMA_BIT_MASK(32),
82 .resource = usb_resources,
83 .num_resources = ARRAY_SIZE(usb_resources),
86 void __init setup_usb(unsigned mA, unsigned potpgt_msec)
88 usb_data.power = mA / 2;
89 usb_data.potpgt = potpgt_msec / 2;
91 if (cpu_is_davinci_dm646x()) {
92 /* Override the defaults as DM6467 uses different IRQs. */
93 usb_dev.resource[1].start = IRQ_DM646X_USBINT;
94 usb_dev.resource[2].start = IRQ_DM646X_USBDMAINT;
95 } else /* other devices don't have dedicated CPPI IRQ */
96 usb_dev.num_resources = 2;
98 platform_device_register(&usb_dev);
103 void __init setup_usb(unsigned mA, unsigned potpgt_msec)
107 #endif /* CONFIG_USB_MUSB_HDRC */
109 #ifdef CONFIG_ARCH_DAVINCI_DA8XX
110 static struct resource da8xx_usb11_resources[] = {
112 .start = DA8XX_USB1_BASE,
113 .end = DA8XX_USB1_BASE + SZ_4K - 1,
114 .flags = IORESOURCE_MEM,
117 .start = IRQ_DA8XX_IRQN,
118 .end = IRQ_DA8XX_IRQN,
119 .flags = IORESOURCE_IRQ,
123 static u64 da8xx_usb11_dma_mask = DMA_BIT_MASK(32);
125 static struct platform_device da8xx_usb11_device = {
129 .dma_mask = &da8xx_usb11_dma_mask,
130 .coherent_dma_mask = DMA_BIT_MASK(32),
132 .num_resources = ARRAY_SIZE(da8xx_usb11_resources),
133 .resource = da8xx_usb11_resources,
136 int __init da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata)
138 da8xx_usb11_device.dev.platform_data = pdata;
139 return platform_device_register(&da8xx_usb11_device);
141 #endif /* CONFIG_DAVINCI_DA8XX */