d1a4fee508cf3595803670a0e77dbceee4dece28
[openwrt.git] / target / linux / gemini / patches-3.8 / 131-arm-gemini-add-usb-platform-device.patch
1 --- a/arch/arm/mach-gemini/devices.c
2 +++ b/arch/arm/mach-gemini/devices.c
3 @@ -185,3 +185,62 @@ int __init platform_register_ethernet(st
4  
5         return platform_device_register(&ethernet_device);
6  }
7 +
8 +static u64 usb0_dmamask = DMA_BIT_MASK(32);
9 +static struct resource usb0_resources[] = {
10 +       {
11 +               .start  = 0x68000000,
12 +               .end    = 0x68000fff,
13 +               .flags  = IORESOURCE_MEM,
14 +       },
15 +       {
16 +               .start  = IRQ_USB0,
17 +               .end    = IRQ_USB0,
18 +               .flags  = IORESOURCE_IRQ,
19 +       },
20 +};
21 +
22 +static u64 usb1_dmamask = DMA_BIT_MASK(32);
23 +static struct resource usb1_resources[] = {
24 +       {
25 +               .start  = 0x69000000,
26 +               .end    = 0x69000fff,
27 +               .flags  = IORESOURCE_MEM,
28 +       },
29 +       {
30 +               .start  = IRQ_USB1,
31 +               .end    = IRQ_USB1,
32 +               .flags  = IORESOURCE_IRQ,
33 +       },
34 +};
35 +
36 +static struct platform_device usb_device[] = {
37 +       {
38 +               .name   = "ehci-fotg2xx",
39 +               .id     = 0,
40 +               .dev    = {
41 +                       .dma_mask = &usb0_dmamask,
42 +                       .coherent_dma_mask = DMA_BIT_MASK(32),
43 +               },
44 +               .num_resources  = ARRAY_SIZE(usb0_resources),
45 +               .resource       = usb0_resources,
46 +       },
47 +       {
48 +               .name   = "ehci-fotg2xx",
49 +               .id     = 1,
50 +               .dev    = {
51 +                       .dma_mask = &usb1_dmamask,
52 +                       .coherent_dma_mask = DMA_BIT_MASK(32),
53 +               },
54 +               .num_resources  = ARRAY_SIZE(usb1_resources),
55 +               .resource       = usb1_resources,
56 +       },
57 +};
58 +
59 +int __init platform_register_usb(unsigned int id)
60 +{
61 +       if (id > 1)
62 +               return -EINVAL;
63 +
64 +       return platform_device_register(&usb_device[id]);
65 +}
66 --- a/arch/arm/mach-gemini/common.h
67 +++ b/arch/arm/mach-gemini/common.h
68 @@ -28,6 +28,7 @@ extern int platform_register_pflash(unsi
69                                     unsigned int nr_parts);
70  extern int platform_register_watchdog(void);
71  extern int platform_register_ethernet(struct gemini_gmac_platform_data *pdata);
72 +extern int platform_register_usb(unsigned int id);
73  
74  extern void gemini_restart(char mode, const char *cmd);
75