aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/board-marzen.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>2013-06-01 17:30:15 -0400
committerSimon Horman <horms+renesas@verge.net.au>2013-06-11 03:10:40 -0400
commit2c8788bfd89bad424d3c288b5a52ce141271b862 (patch)
tree7bfaa3328c62be862903d97aabf4aae26ebc7c13 /arch/arm/mach-shmobile/board-marzen.c
parentae8b378faea7f04d4517b22f5d70d824adcbc4dc (diff)
ARM: shmobile: Marzen: move USB EHCI, OHCI, and PHY devices to R8A7779 code
USB EHCI, OHCI, and common PHY are the SoC devices but are wrongly defined and registered in the Marzen board file. Move the data and code to their proper place in setup-r8a7779.c; while at it, we have to rename r8a7779_late_devices[] to r8a7779_standard_devices[] -- this seems legitimate since they are registered from r8a7779_add_standard_devices() anyway. Note that I'm deliberately changing the USB PHY platform device's 'id' field from (previously just omitted) 0 to -1 as the device is a single of its kind. Note also that the board and SoC code have to be in one patch to keep the code bisectable... The patch has been tested on the Marzen board. Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> [horms+renesas@verge.net.au: manually applied] Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch/arm/mach-shmobile/board-marzen.c')
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c178
1 files changed, 1 insertions, 177 deletions
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index fac9e0f87897..fff353f670b8 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -37,10 +37,6 @@
37#include <linux/mmc/host.h> 37#include <linux/mmc/host.h>
38#include <linux/mmc/sh_mobile_sdhi.h> 38#include <linux/mmc/sh_mobile_sdhi.h>
39#include <linux/mfd/tmio.h> 39#include <linux/mfd/tmio.h>
40#include <linux/usb/otg.h>
41#include <linux/usb/ehci_pdriver.h>
42#include <linux/usb/ohci_pdriver.h>
43#include <linux/pm_runtime.h>
44#include <mach/hardware.h> 40#include <mach/hardware.h>
45#include <mach/r8a7779.h> 41#include <mach/r8a7779.h>
46#include <mach/common.h> 42#include <mach/common.h>
@@ -150,26 +146,6 @@ static struct platform_device hspi_device = {
150 .num_resources = ARRAY_SIZE(hspi_resources), 146 .num_resources = ARRAY_SIZE(hspi_resources),
151}; 147};
152 148
153/* USB PHY */
154static struct resource usb_phy_resources[] = {
155 [0] = {
156 .start = 0xffe70000,
157 .end = 0xffe70900 - 1,
158 .flags = IORESOURCE_MEM,
159 },
160 [1] = {
161 .start = 0xfff70000,
162 .end = 0xfff70900 - 1,
163 .flags = IORESOURCE_MEM,
164 },
165};
166
167static struct platform_device usb_phy_device = {
168 .name = "rcar_usb_phy",
169 .resource = usb_phy_resources,
170 .num_resources = ARRAY_SIZE(usb_phy_resources),
171};
172
173/* LEDS */ 149/* LEDS */
174static struct gpio_led marzen_leds[] = { 150static struct gpio_led marzen_leds[] = {
175 { 151 {
@@ -205,161 +181,9 @@ static struct platform_device *marzen_devices[] __initdata = {
205 &sdhi0_device, 181 &sdhi0_device,
206 &thermal_device, 182 &thermal_device,
207 &hspi_device, 183 &hspi_device,
208 &usb_phy_device,
209 &leds_device, 184 &leds_device,
210}; 185};
211 186
212/* USB */
213static struct usb_phy *phy;
214static int usb_power_on(struct platform_device *pdev)
215{
216 if (!phy)
217 return -EIO;
218
219 pm_runtime_enable(&pdev->dev);
220 pm_runtime_get_sync(&pdev->dev);
221
222 usb_phy_init(phy);
223
224 return 0;
225}
226
227static void usb_power_off(struct platform_device *pdev)
228{
229 if (!phy)
230 return;
231
232 usb_phy_shutdown(phy);
233
234 pm_runtime_put_sync(&pdev->dev);
235 pm_runtime_disable(&pdev->dev);
236}
237
238static struct usb_ehci_pdata ehcix_pdata = {
239 .power_on = usb_power_on,
240 .power_off = usb_power_off,
241 .power_suspend = usb_power_off,
242};
243
244static struct resource ehci0_resources[] = {
245 [0] = {
246 .start = 0xffe70000,
247 .end = 0xffe70400 - 1,
248 .flags = IORESOURCE_MEM,
249 },
250 [1] = {
251 .start = gic_iid(0x4c),
252 .flags = IORESOURCE_IRQ,
253 },
254};
255
256static struct platform_device ehci0_device = {
257 .name = "ehci-platform",
258 .id = 0,
259 .dev = {
260 .dma_mask = &ehci0_device.dev.coherent_dma_mask,
261 .coherent_dma_mask = 0xffffffff,
262 .platform_data = &ehcix_pdata,
263 },
264 .num_resources = ARRAY_SIZE(ehci0_resources),
265 .resource = ehci0_resources,
266};
267
268static struct resource ehci1_resources[] = {
269 [0] = {
270 .start = 0xfff70000,
271 .end = 0xfff70400 - 1,
272 .flags = IORESOURCE_MEM,
273 },
274 [1] = {
275 .start = gic_iid(0x4d),
276 .flags = IORESOURCE_IRQ,
277 },
278};
279
280static struct platform_device ehci1_device = {
281 .name = "ehci-platform",
282 .id = 1,
283 .dev = {
284 .dma_mask = &ehci1_device.dev.coherent_dma_mask,
285 .coherent_dma_mask = 0xffffffff,
286 .platform_data = &ehcix_pdata,
287 },
288 .num_resources = ARRAY_SIZE(ehci1_resources),
289 .resource = ehci1_resources,
290};
291
292static struct usb_ohci_pdata ohcix_pdata = {
293 .power_on = usb_power_on,
294 .power_off = usb_power_off,
295 .power_suspend = usb_power_off,
296};
297
298static struct resource ohci0_resources[] = {
299 [0] = {
300 .start = 0xffe70400,
301 .end = 0xffe70800 - 1,
302 .flags = IORESOURCE_MEM,
303 },
304 [1] = {
305 .start = gic_iid(0x4c),
306 .flags = IORESOURCE_IRQ,
307 },
308};
309
310static struct platform_device ohci0_device = {
311 .name = "ohci-platform",
312 .id = 0,
313 .dev = {
314 .dma_mask = &ohci0_device.dev.coherent_dma_mask,
315 .coherent_dma_mask = 0xffffffff,
316 .platform_data = &ohcix_pdata,
317 },
318 .num_resources = ARRAY_SIZE(ohci0_resources),
319 .resource = ohci0_resources,
320};
321
322static struct resource ohci1_resources[] = {
323 [0] = {
324 .start = 0xfff70400,
325 .end = 0xfff70800 - 1,
326 .flags = IORESOURCE_MEM,
327 },
328 [1] = {
329 .start = gic_iid(0x4d),
330 .flags = IORESOURCE_IRQ,
331 },
332};
333
334static struct platform_device ohci1_device = {
335 .name = "ohci-platform",
336 .id = 1,
337 .dev = {
338 .dma_mask = &ohci1_device.dev.coherent_dma_mask,
339 .coherent_dma_mask = 0xffffffff,
340 .platform_data = &ohcix_pdata,
341 },
342 .num_resources = ARRAY_SIZE(ohci1_resources),
343 .resource = ohci1_resources,
344};
345
346static struct platform_device *marzen_late_devices[] __initdata = {
347 &ehci0_device,
348 &ehci1_device,
349 &ohci0_device,
350 &ohci1_device,
351};
352
353void __init marzen_init_late(void)
354{
355 /* get usb phy */
356 phy = usb_get_phy(USB_PHY_TYPE_USB2);
357
358 shmobile_init_late();
359 platform_add_devices(marzen_late_devices,
360 ARRAY_SIZE(marzen_late_devices));
361}
362
363static const struct pinctrl_map marzen_pinctrl_map[] = { 187static const struct pinctrl_map marzen_pinctrl_map[] = {
364 /* HSPI0 */ 188 /* HSPI0 */
365 PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779", 189 PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779",
@@ -417,6 +241,6 @@ MACHINE_START(MARZEN, "marzen")
417 .nr_irqs = NR_IRQS_LEGACY, 241 .nr_irqs = NR_IRQS_LEGACY,
418 .init_irq = r8a7779_init_irq, 242 .init_irq = r8a7779_init_irq,
419 .init_machine = marzen_init, 243 .init_machine = marzen_init,
420 .init_late = marzen_init_late, 244 .init_late = r8a7779_init_late,
421 .init_time = r8a7779_earlytimer_init, 245 .init_time = r8a7779_earlytimer_init,
422MACHINE_END 246MACHINE_END