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>
15 #include <mach/irqs.h>
16 #include <mach/cputype.h>
18 #define DAVINCI_USB_OTG_BASE 0x01C64000
20 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
21 static struct musb_hdrc_eps_bits musb_eps[] = {
32 static struct musb_hdrc_config musb_config = {
44 static struct musb_hdrc_platform_data usb_data = {
45 #if defined(CONFIG_USB_MUSB_OTG)
46 /* OTG requires a Mini-AB connector */
48 #elif defined(CONFIG_USB_MUSB_PERIPHERAL)
49 .mode = MUSB_PERIPHERAL,
50 #elif defined(CONFIG_USB_MUSB_HOST)
54 .config = &musb_config,
57 static struct resource usb_resources[] = {
59 /* physical address */
60 .start = DAVINCI_USB_OTG_BASE,
61 .end = DAVINCI_USB_OTG_BASE + 0x5ff,
62 .flags = IORESOURCE_MEM,
66 .flags = IORESOURCE_IRQ,
69 /* placeholder for the dedicated CPPI IRQ */
70 .flags = IORESOURCE_IRQ,
74 static u64 usb_dmamask = DMA_BIT_MASK(32);
76 static struct platform_device usb_dev = {
80 .platform_data = &usb_data,
81 .dma_mask = &usb_dmamask,
82 .coherent_dma_mask = DMA_BIT_MASK(32),
84 .resource = usb_resources,
85 .num_resources = ARRAY_SIZE(usb_resources),
88 void __init setup_usb(unsigned mA, unsigned potpgt_msec)
90 usb_data.power = mA / 2;
91 usb_data.potpgt = potpgt_msec / 2;
93 if (cpu_is_davinci_dm646x()) {
94 /* Override the defaults as DM6467 uses different IRQs. */
95 usb_dev.resource[1].start = IRQ_DM646X_USBINT;
96 usb_dev.resource[2].start = IRQ_DM646X_USBDMAINT;
97 } else /* other devices don't have dedicated CPPI IRQ */
98 usb_dev.num_resources = 2;
100 platform_device_register(&usb_dev);
105 void __init setup_usb(unsigned mA, unsigned potpgt_msec)
109 #endif /* CONFIG_USB_MUSB_HDRC */