bcm63xx: replace SPI driver with latest upstream version
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / patches-3.3 / 401-MIPS-BCM63XX-register-ohci-device.patch
1 From ab96f20ca1c3c8e7e5acd82d1e50823a5d572675 Mon Sep 17 00:00:00 2001
2 From: Maxime Bizon <mbizon@freebox.fr>
3 Date: Tue, 24 May 2011 21:47:41 +0200
4 Subject: [PATCH 24/63] MIPS: BCM63XX: register ohci device.
5
6 ---
7 arch/mips/bcm63xx/Kconfig | 9 ++--
8 arch/mips/bcm63xx/Makefile | 2 +-
9 arch/mips/bcm63xx/boards/board_bcm963xx.c | 4 ++
10 arch/mips/bcm63xx/dev-usb-ohci.c | 50 ++++++++++++++++++++
11 .../asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h | 6 ++
12 5 files changed, 65 insertions(+), 6 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 @@ -4,26 +4,25 @@ menu "CPU support"
19 config BCM63XX_CPU_6338
20 bool "support 6338 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 + select USB_ARCH_HAS_OHCI if USB_SUPPORT
26
27 config BCM63XX_CPU_6345
28 bool "support 6345 CPU"
29 - select USB_OHCI_BIG_ENDIAN_DESC
30 - select USB_OHCI_BIG_ENDIAN_MMIO
31
32 config BCM63XX_CPU_6348
33 bool "support 6348 CPU"
34 select HW_HAS_PCI
35 + select USB_ARCH_HAS_OHCI if USB_SUPPORT
36
37 config BCM63XX_CPU_6358
38 bool "support 6358 CPU"
39 select HW_HAS_PCI
40 + select USB_ARCH_HAS_OHCI if USB_SUPPORT
41
42 config BCM63XX_CPU_6368
43 bool "support 6368 CPU"
44 select HW_HAS_PCI
45 + select USB_ARCH_HAS_OHCI if USB_SUPPORT
46 endmenu
47
48 source "arch/mips/bcm63xx/boards/Kconfig"
49 --- a/arch/mips/bcm63xx/Makefile
50 +++ b/arch/mips/bcm63xx/Makefile
51 @@ -1,6 +1,6 @@
52 obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \
53 dev-dsp.o dev-enet.o dev-pcmcia.o dev-spi.o dev-uart.o \
54 - dev-wdt.o
55 + dev-usb-ohci.o dev-wdt.o
56 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
57
58 obj-y += boards/
59 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
60 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
61 @@ -28,6 +28,7 @@
62 #include <bcm63xx_dev_dsp.h>
63 #include <bcm63xx_dev_pcmcia.h>
64 #include <bcm63xx_dev_spi.h>
65 +#include <bcm63xx_dev_usb_ohci.h>
66 #include <board_bcm963xx.h>
67 #include <bcm_tag.h>
68
69 @@ -941,6 +942,9 @@ int __init board_register_devices(void)
70 !board_get_mac_address(board.enet1.mac_addr))
71 bcm63xx_enet_register(1, &board.enet1);
72
73 + if (board.has_ohci0)
74 + bcm63xx_ohci_register();
75 +
76 if (board.has_dsp)
77 bcm63xx_dsp_register(&board.dsp);
78
79 --- /dev/null
80 +++ b/arch/mips/bcm63xx/dev-usb-ohci.c
81 @@ -0,0 +1,50 @@
82 +/*
83 + * This file is subject to the terms and conditions of the GNU General Public
84 + * License. See the file "COPYING" in the main directory of this archive
85 + * for more details.
86 + *
87 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
88 + */
89 +
90 +#include <linux/init.h>
91 +#include <linux/kernel.h>
92 +#include <linux/platform_device.h>
93 +#include <bcm63xx_cpu.h>
94 +#include <bcm63xx_dev_usb_ohci.h>
95 +
96 +static struct resource ohci_resources[] = {
97 + {
98 + .start = -1, /* filled at runtime */
99 + .end = -1, /* filled at runtime */
100 + .flags = IORESOURCE_MEM,
101 + },
102 + {
103 + .start = -1, /* filled at runtime */
104 + .flags = IORESOURCE_IRQ,
105 + },
106 +};
107 +
108 +static u64 ohci_dmamask = ~(u32)0;
109 +
110 +static struct platform_device bcm63xx_ohci_device = {
111 + .name = "bcm63xx_ohci",
112 + .id = 0,
113 + .num_resources = ARRAY_SIZE(ohci_resources),
114 + .resource = ohci_resources,
115 + .dev = {
116 + .dma_mask = &ohci_dmamask,
117 + .coherent_dma_mask = 0xffffffff,
118 + },
119 +};
120 +
121 +int __init bcm63xx_ohci_register(void)
122 +{
123 + if (!BCMCPU_IS_6348() && !BCMCPU_IS_6358() && !BCMCPU_IS_6368())
124 + return 0;
125 +
126 + ohci_resources[0].start = bcm63xx_regset_address(RSET_OHCI0);
127 + ohci_resources[0].end = ohci_resources[0].start;
128 + ohci_resources[0].end += RSET_OHCI_SIZE - 1;
129 + ohci_resources[1].start = bcm63xx_get_irq_number(IRQ_OHCI0);
130 + return platform_device_register(&bcm63xx_ohci_device);
131 +}
132 --- /dev/null
133 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h
134 @@ -0,0 +1,6 @@
135 +#ifndef BCM63XX_DEV_USB_OHCI_H_
136 +#define BCM63XX_DEV_USB_OHCI_H_
137 +
138 +int bcm63xx_ohci_register(void);
139 +
140 +#endif /* BCM63XX_DEV_USB_OHCI_H_ */