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>
13 #include <linux/platform_data/usb-davinci.h>
15 #define DAVINCI_USB_OTG_BASE 0x01c64000
17 #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
18 static struct musb_hdrc_config musb_config = {
25 static struct musb_hdrc_platform_data usb_data = {
26 /* OTG requires a Mini-AB connector */
29 .config = &musb_config,
32 static struct resource usb_resources[] = {
34 /* physical address */
35 .start = DAVINCI_USB_OTG_BASE,
36 .end = DAVINCI_USB_OTG_BASE + 0x5ff,
37 .flags = IORESOURCE_MEM,
41 .flags = IORESOURCE_IRQ,
45 /* placeholder for the dedicated CPPI IRQ */
46 .flags = IORESOURCE_IRQ,
51 static u64 usb_dmamask = DMA_BIT_MASK(32);
53 static struct platform_device usb_dev = {
54 .name = "musb-davinci",
57 .platform_data = &usb_data,
58 .dma_mask = &usb_dmamask,
59 .coherent_dma_mask = DMA_BIT_MASK(32),
61 .resource = usb_resources,
62 .num_resources = ARRAY_SIZE(usb_resources),
65 void __init davinci_setup_usb(unsigned mA, unsigned potpgt_ms)
67 usb_data.power = mA > 510 ? 255 : mA / 2;
68 usb_data.potpgt = (potpgt_ms + 1) / 2;
70 if (cpu_is_davinci_dm646x()) {
71 /* Override the defaults as DM6467 uses different IRQs. */
72 usb_dev.resource[1].start = IRQ_DM646X_USBINT;
73 usb_dev.resource[2].start = IRQ_DM646X_USBDMAINT;
74 } else /* other devices don't have dedicated CPPI IRQ */
75 usb_dev.num_resources = 2;
77 platform_device_register(&usb_dev);
82 void __init davinci_setup_usb(unsigned mA, unsigned potpgt_ms)
86 #endif /* CONFIG_USB_MUSB_HDRC */