[brcm63xx] add support for 2.6.32, dropped the SPI patch for now
[openwrt.git] / target / linux / brcm63xx / patches-2.6.32 / 008-usb-ehci-support.patch
1 The bcm63xx SOC has an integrated EHCI controller, this patch adds
2 platform device registration and change board code to register
3 EHCI device when necessary.
4
5 Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
6 ---
7  arch/mips/bcm63xx/Kconfig                          |    2 +
8  arch/mips/bcm63xx/Makefile                         |    2 +-
9  arch/mips/bcm63xx/boards/board_bcm963xx.c          |    4 ++
10  arch/mips/bcm63xx/dev-usb-ehci.c                   |   49 ++++++++++++++++++++
11  .../asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h        |    6 ++
12  5 files changed, 62 insertions(+), 1 deletions(-)
13  create mode 100644 arch/mips/bcm63xx/dev-usb-ehci.c
14  create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h
15
16 diff --git a/arch/mips/bcm63xx/Kconfig b/arch/mips/bcm63xx/Kconfig
17 index 76fbbf7..4aa21e8 100644
18 --- a/arch/mips/bcm63xx/Kconfig
19 +++ b/arch/mips/bcm63xx/Kconfig
20 @@ -26,6 +26,8 @@ config BCM63XX_CPU_6358
21         select USB_ARCH_HAS_OHCI
22         select USB_OHCI_BIG_ENDIAN_DESC
23         select USB_OHCI_BIG_ENDIAN_MMIO
24 +       select USB_ARCH_HAS_EHCI
25 +       select USB_EHCI_BIG_ENDIAN_MMIO
26  endmenu
27  
28  source "arch/mips/bcm63xx/boards/Kconfig"
29 diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile
30 index be5d7ad..6e229c2 100644
31 --- a/arch/mips/bcm63xx/Makefile
32 +++ b/arch/mips/bcm63xx/Makefile
33 @@ -1,6 +1,6 @@
34  obj-y          += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \
35                    dev-dsp.o dev-enet.o dev-pcmcia.o dev-uart.o dev-wdt.o \
36 -                  dev-usb-ohci.o
37 +                  dev-usb-ohci.o dev-usb-ehci.o
38  obj-$(CONFIG_EARLY_PRINTK)     += early_printk.o
39  
40  obj-y          += boards/
41 diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
42 index e2c0c36..b0d3db3 100644
43 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
44 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
45 @@ -25,6 +25,7 @@
46  #include <bcm63xx_dev_dsp.h>
47  #include <bcm63xx_dev_pcmcia.h>
48  #include <bcm63xx_dev_usb_ohci.h>
49 +#include <bcm63xx_dev_usb_ehci.h>
50  #include <board_bcm963xx.h>
51  
52  #define PFX    "board_bcm963xx: "
53 @@ -804,6 +805,9 @@ int __init board_register_devices(void)
54             !board_get_mac_address(board.enet1.mac_addr))
55                 bcm63xx_enet_register(1, &board.enet1);
56  
57 +       if (board.has_ehci0)
58 +               bcm63xx_ehci_register();
59 +
60         if (board.has_ohci0)
61                 bcm63xx_ohci_register();
62  
63 diff --git a/arch/mips/bcm63xx/dev-usb-ehci.c b/arch/mips/bcm63xx/dev-usb-ehci.c
64 new file mode 100644
65 index 0000000..4bdd675
66 --- /dev/null
67 +++ b/arch/mips/bcm63xx/dev-usb-ehci.c
68 @@ -0,0 +1,49 @@
69 +/*
70 + * This file is subject to the terms and conditions of the GNU General Public
71 + * License.  See the file "COPYING" in the main directory of this archive
72 + * for more details.
73 + *
74 + * Copyright (C) 2010 Maxime Bizon <mbizon@freebox.fr>
75 + */
76 +
77 +#include <linux/init.h>
78 +#include <linux/kernel.h>
79 +#include <linux/platform_device.h>
80 +#include <bcm63xx_cpu.h>
81 +#include <bcm63xx_dev_usb_ehci.h>
82 +
83 +static struct resource ehci_resources[] = {
84 +       {
85 +               /* start & end filled at runtime */
86 +               .flags          = IORESOURCE_MEM,
87 +       },
88 +       {
89 +               /* start filled at runtime */
90 +               .flags          = IORESOURCE_IRQ,
91 +       },
92 +};
93 +
94 +static u64 ehci_dmamask = ~(u32)0;
95 +
96 +static struct platform_device bcm63xx_ehci_device = {
97 +       .name           = "bcm63xx_ehci",
98 +       .id             = 0,
99 +       .num_resources  = ARRAY_SIZE(ehci_resources),
100 +       .resource       = ehci_resources,
101 +       .dev            = {
102 +               .dma_mask               = &ehci_dmamask,
103 +               .coherent_dma_mask      = 0xffffffff,
104 +       },
105 +};
106 +
107 +int __init bcm63xx_ehci_register(void)
108 +{
109 +       if (!BCMCPU_IS_6358())
110 +               return 0;
111 +
112 +       ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0);
113 +       ehci_resources[0].end = ehci_resources[0].start;
114 +       ehci_resources[0].end += RSET_EHCI_SIZE - 1;
115 +       ehci_resources[1].start = bcm63xx_get_irq_number(IRQ_EHCI0);
116 +       return platform_device_register(&bcm63xx_ehci_device);
117 +}
118 diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h
119 new file mode 100644
120 index 0000000..17fb519
121 --- /dev/null
122 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h
123 @@ -0,0 +1,6 @@
124 +#ifndef BCM63XX_DEV_USB_EHCI_H_
125 +#define BCM63XX_DEV_USB_EHCI_H_
126 +
127 +int bcm63xx_ehci_register(void);
128 +
129 +#endif /* BCM63XX_DEV_USB_EHCI_H_ */
130 -- 
131 1.6.3.3
132
133