diff options
Diffstat (limited to 'arch/arm/mach-davinci/usb.c')
-rw-r--r-- | arch/arm/mach-davinci/usb.c | 84 |
1 files changed, 75 insertions, 9 deletions
diff --git a/arch/arm/mach-davinci/usb.c b/arch/arm/mach-davinci/usb.c index 06f55931620c..31f0cbea0caa 100644 --- a/arch/arm/mach-davinci/usb.c +++ b/arch/arm/mach-davinci/usb.c | |||
@@ -1,21 +1,21 @@ | |||
1 | /* | 1 | /* |
2 | * USB | 2 | * USB |
3 | */ | 3 | */ |
4 | #include <linux/kernel.h> | ||
5 | #include <linux/module.h> | ||
6 | #include <linux/init.h> | 4 | #include <linux/init.h> |
7 | #include <linux/platform_device.h> | 5 | #include <linux/platform_device.h> |
8 | #include <linux/dma-mapping.h> | 6 | #include <linux/dma-mapping.h> |
9 | 7 | ||
10 | #include <linux/usb/musb.h> | 8 | #include <linux/usb/musb.h> |
11 | #include <linux/usb/otg.h> | ||
12 | 9 | ||
13 | #include <mach/common.h> | 10 | #include <mach/common.h> |
14 | #include <mach/hardware.h> | ||
15 | #include <mach/irqs.h> | 11 | #include <mach/irqs.h> |
16 | #include <mach/cputype.h> | 12 | #include <mach/cputype.h> |
13 | #include <mach/usb.h> | ||
17 | 14 | ||
18 | #define DAVINCI_USB_OTG_BASE 0x01C64000 | 15 | #define DAVINCI_USB_OTG_BASE 0x01c64000 |
16 | |||
17 | #define DA8XX_USB0_BASE 0x01e00000 | ||
18 | #define DA8XX_USB1_BASE 0x01e25000 | ||
19 | 19 | ||
20 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) | 20 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
21 | static struct musb_hdrc_eps_bits musb_eps[] = { | 21 | static struct musb_hdrc_eps_bits musb_eps[] = { |
@@ -85,10 +85,10 @@ static struct platform_device usb_dev = { | |||
85 | .num_resources = ARRAY_SIZE(usb_resources), | 85 | .num_resources = ARRAY_SIZE(usb_resources), |
86 | }; | 86 | }; |
87 | 87 | ||
88 | void __init setup_usb(unsigned mA, unsigned potpgt_msec) | 88 | void __init davinci_setup_usb(unsigned mA, unsigned potpgt_ms) |
89 | { | 89 | { |
90 | usb_data.power = mA / 2; | 90 | usb_data.power = mA > 510 ? 255 : mA / 2; |
91 | usb_data.potpgt = potpgt_msec / 2; | 91 | usb_data.potpgt = (potpgt_ms + 1) / 2; |
92 | 92 | ||
93 | if (cpu_is_davinci_dm646x()) { | 93 | if (cpu_is_davinci_dm646x()) { |
94 | /* Override the defaults as DM6467 uses different IRQs. */ | 94 | /* Override the defaults as DM6467 uses different IRQs. */ |
@@ -100,11 +100,77 @@ void __init setup_usb(unsigned mA, unsigned potpgt_msec) | |||
100 | platform_device_register(&usb_dev); | 100 | platform_device_register(&usb_dev); |
101 | } | 101 | } |
102 | 102 | ||
103 | #ifdef CONFIG_ARCH_DAVINCI_DA8XX | ||
104 | static struct resource da8xx_usb20_resources[] = { | ||
105 | { | ||
106 | .start = DA8XX_USB0_BASE, | ||
107 | .end = DA8XX_USB0_BASE + SZ_64K - 1, | ||
108 | .flags = IORESOURCE_MEM, | ||
109 | }, | ||
110 | { | ||
111 | .start = IRQ_DA8XX_USB_INT, | ||
112 | .flags = IORESOURCE_IRQ, | ||
113 | }, | ||
114 | }; | ||
115 | |||
116 | int __init da8xx_register_usb20(unsigned mA, unsigned potpgt) | ||
117 | { | ||
118 | usb_data.clock = "usb20"; | ||
119 | usb_data.power = mA > 510 ? 255 : mA / 2; | ||
120 | usb_data.potpgt = (potpgt + 1) / 2; | ||
121 | |||
122 | usb_dev.resource = da8xx_usb20_resources; | ||
123 | usb_dev.num_resources = ARRAY_SIZE(da8xx_usb20_resources); | ||
124 | |||
125 | return platform_device_register(&usb_dev); | ||
126 | } | ||
127 | #endif /* CONFIG_DAVINCI_DA8XX */ | ||
128 | |||
103 | #else | 129 | #else |
104 | 130 | ||
105 | void __init setup_usb(unsigned mA, unsigned potpgt_msec) | 131 | void __init davinci_setup_usb(unsigned mA, unsigned potpgt_ms) |
106 | { | 132 | { |
107 | } | 133 | } |
108 | 134 | ||
135 | #ifdef CONFIG_ARCH_DAVINCI_DA8XX | ||
136 | int __init da8xx_register_usb20(unsigned mA, unsigned potpgt) | ||
137 | { | ||
138 | return 0; | ||
139 | } | ||
140 | #endif | ||
141 | |||
109 | #endif /* CONFIG_USB_MUSB_HDRC */ | 142 | #endif /* CONFIG_USB_MUSB_HDRC */ |
110 | 143 | ||
144 | #ifdef CONFIG_ARCH_DAVINCI_DA8XX | ||
145 | static struct resource da8xx_usb11_resources[] = { | ||
146 | [0] = { | ||
147 | .start = DA8XX_USB1_BASE, | ||
148 | .end = DA8XX_USB1_BASE + SZ_4K - 1, | ||
149 | .flags = IORESOURCE_MEM, | ||
150 | }, | ||
151 | [1] = { | ||
152 | .start = IRQ_DA8XX_IRQN, | ||
153 | .end = IRQ_DA8XX_IRQN, | ||
154 | .flags = IORESOURCE_IRQ, | ||
155 | }, | ||
156 | }; | ||
157 | |||
158 | static u64 da8xx_usb11_dma_mask = DMA_BIT_MASK(32); | ||
159 | |||
160 | static struct platform_device da8xx_usb11_device = { | ||
161 | .name = "ohci", | ||
162 | .id = 0, | ||
163 | .dev = { | ||
164 | .dma_mask = &da8xx_usb11_dma_mask, | ||
165 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
166 | }, | ||
167 | .num_resources = ARRAY_SIZE(da8xx_usb11_resources), | ||
168 | .resource = da8xx_usb11_resources, | ||
169 | }; | ||
170 | |||
171 | int __init da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata) | ||
172 | { | ||
173 | da8xx_usb11_device.dev.platform_data = pdata; | ||
174 | return platform_device_register(&da8xx_usb11_device); | ||
175 | } | ||
176 | #endif /* CONFIG_DAVINCI_DA8XX */ | ||