4 #include <linux/dma-mapping.h>
5 #include <linux/init.h>
6 #include <linux/platform_data/usb-davinci.h>
7 #include <linux/platform_device.h>
8 #include <linux/usb/musb.h>
10 #include <mach/common.h>
11 #include <mach/cputype.h>
12 #include <mach/da8xx.h>
13 #include <mach/irqs.h>
15 #define DA8XX_USB0_BASE 0x01e00000
16 #define DA8XX_USB1_BASE 0x01e25000
18 #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
20 static struct musb_hdrc_config musb_config
= {
26 static struct musb_hdrc_platform_data usb_data
= {
27 /* OTG requires a Mini-AB connector */
30 .config
= &musb_config
,
33 static struct resource da8xx_usb20_resources
[] = {
35 .start
= DA8XX_USB0_BASE
,
36 .end
= DA8XX_USB0_BASE
+ SZ_64K
- 1,
37 .flags
= IORESOURCE_MEM
,
40 .start
= IRQ_DA8XX_USB_INT
,
41 .flags
= IORESOURCE_IRQ
,
46 static u64 usb_dmamask
= DMA_BIT_MASK(32);
48 static struct platform_device usb_dev
= {
52 .platform_data
= &usb_data
,
53 .dma_mask
= &usb_dmamask
,
54 .coherent_dma_mask
= DMA_BIT_MASK(32),
56 .resource
= da8xx_usb20_resources
,
57 .num_resources
= ARRAY_SIZE(da8xx_usb20_resources
),
60 int __init
da8xx_register_usb20(unsigned int mA
, unsigned int potpgt
)
62 usb_data
.power
= mA
> 510 ? 255 : mA
/ 2;
63 usb_data
.potpgt
= (potpgt
+ 1) / 2;
65 return platform_device_register(&usb_dev
);
70 int __init
da8xx_register_usb20(unsigned int mA
, unsigned int potpgt
)
75 #endif /* CONFIG_USB_MUSB_HDRC */
77 static struct resource da8xx_usb11_resources
[] = {
79 .start
= DA8XX_USB1_BASE
,
80 .end
= DA8XX_USB1_BASE
+ SZ_4K
- 1,
81 .flags
= IORESOURCE_MEM
,
84 .start
= IRQ_DA8XX_IRQN
,
85 .end
= IRQ_DA8XX_IRQN
,
86 .flags
= IORESOURCE_IRQ
,
90 static u64 da8xx_usb11_dma_mask
= DMA_BIT_MASK(32);
92 static struct platform_device da8xx_usb11_device
= {
96 .dma_mask
= &da8xx_usb11_dma_mask
,
97 .coherent_dma_mask
= DMA_BIT_MASK(32),
99 .num_resources
= ARRAY_SIZE(da8xx_usb11_resources
),
100 .resource
= da8xx_usb11_resources
,
103 int __init
da8xx_register_usb11(struct da8xx_ohci_root_hub
*pdata
)
105 da8xx_usb11_device
.dev
.platform_data
= pdata
;
106 return platform_device_register(&da8xx_usb11_device
);