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