cns21xx: switch to 3.6.11
[openwrt.git] / target / linux / cns21xx / patches-3.3 / 201-cns21xx-add-usb-devices.patch
1 --- /dev/null
2 +++ b/arch/arm/mach-cns21xx/dev-usb.c
3 @@ -0,0 +1,71 @@
4 +/*
5 + *  Copyright (c) 2008 Cavium Networks
6 + *  Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
7 + *
8 + *  This file is free software; you can redistribute it and/or modify
9 + *  it under the terms of the GNU General Public License, Version 2, as
10 + *  published by the Free Software Foundation.
11 + */
12 +
13 +#include <linux/init.h>
14 +#include <linux/irq.h>
15 +#include <linux/dma-mapping.h>
16 +#include <linux/platform_device.h>
17 +
18 +#include <mach/cns21xx.h>
19 +
20 +static u64 cns21xx_usb_dmamask = DMA_BIT_MASK(32);
21 +
22 +static struct resource cns21xx_ohci_resources[] = {
23 +       [0] = {
24 +               .start  = CNS21XX_OHCI_CTRL_BASE,
25 +               .end    = CNS21XX_OHCI_CTRL_BASE + SZ_1M - 1,
26 +               .flags  = IORESOURCE_MEM,
27 +       },
28 +       [1] = {
29 +               .start  = CNS21XX_IRQ_OHCI,
30 +               .end    = CNS21XX_IRQ_OHCI,
31 +               .flags  = IORESOURCE_IRQ,
32 +       },
33 +};
34 +
35 +static struct platform_device cns21xx_ohci_device = {
36 +       .name           = "cns21xx-ohci",
37 +       .id             = -1,
38 +       .dev = {
39 +               .dma_mask               = &cns21xx_usb_dmamask,
40 +               .coherent_dma_mask      = DMA_BIT_MASK(32),
41 +       },
42 +       .resource       = cns21xx_ohci_resources,
43 +       .num_resources  = ARRAY_SIZE(cns21xx_ohci_resources),
44 +};
45 +
46 +static struct resource cns21xx_ehci_resources[] = {
47 +       [0] = {
48 +               .start  = CNS21XX_EHCI_CTRL_BASE,
49 +               .end    = CNS21XX_EHCI_CTRL_BASE + SZ_1M - 1,
50 +               .flags  = IORESOURCE_MEM,
51 +       },
52 +       [1] = {
53 +               .start  = CNS21XX_IRQ_EHCI,
54 +               .end    = CNS21XX_IRQ_EHCI,
55 +               .flags  = IORESOURCE_IRQ,
56 +       },
57 +};
58 +
59 +static struct platform_device cns21xx_ehci_device = {
60 +       .name           = "cns21xx-ehci",
61 +       .id             = -1,
62 +       .dev            = {
63 +               .dma_mask               = &cns21xx_usb_dmamask,
64 +               .coherent_dma_mask      = DMA_BIT_MASK(32),
65 +       },
66 +       .resource       = cns21xx_ehci_resources,
67 +       .num_resources  = ARRAY_SIZE(cns21xx_ehci_resources),
68 +};
69 +
70 +void __init cns21xx_register_usb(void)
71 +{
72 +       platform_device_register(&cns21xx_ehci_device);
73 +       platform_device_register(&cns21xx_ohci_device);
74 +}
75 --- a/arch/arm/mach-cns21xx/Kconfig
76 +++ b/arch/arm/mach-cns21xx/Kconfig
77 @@ -3,4 +3,7 @@ if ARCH_CNS21XX
78  menu "Cavium Networks CNS21xx based machines"
79  endmenu
80  
81 +config CNS21XX_DEV_USB
82 +       def_bool n
83 +
84  endif
85 --- a/arch/arm/mach-cns21xx/Makefile
86 +++ b/arch/arm/mach-cns21xx/Makefile
87 @@ -6,5 +6,8 @@
88  
89  obj-y          := core.o devices.o gpio.o irq.o mm.o time.o
90  
91 +# devices
92 +obj-$(CONFIG_CNS21XX_DEV_USB)          += dev-usb.o
93 +
94  # machine specific files
95  
96 --- a/arch/arm/mach-cns21xx/common.h
97 +++ b/arch/arm/mach-cns21xx/common.h
98 @@ -19,5 +19,6 @@ extern struct sys_timer cns21xx_timer;
99  
100  int cns21xx_register_uart0(void);
101  int cns21xx_register_uart1(void);
102 +int cns21xx_register_usb(void);
103  
104  #endif /* _MACH_CNS21XX_COMMON_H */