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