e5a682d6ccf1fae5ec664d6aa227b5424e202890
[openwrt.git] / target / linux / brcm63xx / patches-2.6.33 / 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 --- a/arch/mips/bcm63xx/Kconfig
17 +++ b/arch/mips/bcm63xx/Kconfig
18 @@ -26,6 +26,8 @@ config BCM63XX_CPU_6358
19 select USB_ARCH_HAS_OHCI
20 select USB_OHCI_BIG_ENDIAN_DESC
21 select USB_OHCI_BIG_ENDIAN_MMIO
22 + select USB_ARCH_HAS_EHCI
23 + select USB_EHCI_BIG_ENDIAN_MMIO
24 endmenu
25
26 source "arch/mips/bcm63xx/boards/Kconfig"
27 --- a/arch/mips/bcm63xx/Makefile
28 +++ b/arch/mips/bcm63xx/Makefile
29 @@ -1,6 +1,6 @@
30 obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \
31 dev-dsp.o dev-enet.o dev-pcmcia.o dev-uart.o dev-wdt.o \
32 - dev-usb-ohci.o
33 + dev-usb-ohci.o dev-usb-ehci.o
34 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
35
36 obj-y += boards/
37 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
38 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
39 @@ -25,6 +25,7 @@
40 #include <bcm63xx_dev_dsp.h>
41 #include <bcm63xx_dev_pcmcia.h>
42 #include <bcm63xx_dev_usb_ohci.h>
43 +#include <bcm63xx_dev_usb_ehci.h>
44 #include <board_bcm963xx.h>
45
46 #define PFX "board_bcm963xx: "
47 @@ -804,6 +805,9 @@ int __init board_register_devices(void)
48 !board_get_mac_address(board.enet1.mac_addr))
49 bcm63xx_enet_register(1, &board.enet1);
50
51 + if (board.has_ehci0)
52 + bcm63xx_ehci_register();
53 +
54 if (board.has_ohci0)
55 bcm63xx_ohci_register();
56
57 --- /dev/null
58 +++ b/arch/mips/bcm63xx/dev-usb-ehci.c
59 @@ -0,0 +1,49 @@
60 +/*
61 + * This file is subject to the terms and conditions of the GNU General Public
62 + * License. See the file "COPYING" in the main directory of this archive
63 + * for more details.
64 + *
65 + * Copyright (C) 2010 Maxime Bizon <mbizon@freebox.fr>
66 + */
67 +
68 +#include <linux/init.h>
69 +#include <linux/kernel.h>
70 +#include <linux/platform_device.h>
71 +#include <bcm63xx_cpu.h>
72 +#include <bcm63xx_dev_usb_ehci.h>
73 +
74 +static struct resource ehci_resources[] = {
75 + {
76 + /* start & end filled at runtime */
77 + .flags = IORESOURCE_MEM,
78 + },
79 + {
80 + /* start filled at runtime */
81 + .flags = IORESOURCE_IRQ,
82 + },
83 +};
84 +
85 +static u64 ehci_dmamask = ~(u32)0;
86 +
87 +static struct platform_device bcm63xx_ehci_device = {
88 + .name = "bcm63xx_ehci",
89 + .id = 0,
90 + .num_resources = ARRAY_SIZE(ehci_resources),
91 + .resource = ehci_resources,
92 + .dev = {
93 + .dma_mask = &ehci_dmamask,
94 + .coherent_dma_mask = 0xffffffff,
95 + },
96 +};
97 +
98 +int __init bcm63xx_ehci_register(void)
99 +{
100 + if (!BCMCPU_IS_6358())
101 + return 0;
102 +
103 + ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0);
104 + ehci_resources[0].end = ehci_resources[0].start;
105 + ehci_resources[0].end += RSET_EHCI_SIZE - 1;
106 + ehci_resources[1].start = bcm63xx_get_irq_number(IRQ_EHCI0);
107 + return platform_device_register(&bcm63xx_ehci_device);
108 +}
109 --- /dev/null
110 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h
111 @@ -0,0 +1,6 @@
112 +#ifndef BCM63XX_DEV_USB_EHCI_H_
113 +#define BCM63XX_DEV_USB_EHCI_H_
114 +
115 +int bcm63xx_ehci_register(void);
116 +
117 +#endif /* BCM63XX_DEV_USB_EHCI_H_ */
This page took 0.042873 seconds and 3 git commands to generate.