1 From f8a61c6788da0b03e9a100256e6d1526a5519ce9 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 31/72] MIPS: BCM63XX: register ohci device.
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 arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 3 +-
13 6 files changed, 67 insertions(+), 7 deletions(-)
14 create mode 100644 arch/mips/bcm63xx/dev-usb-ohci.c
15 create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h
17 --- a/arch/mips/bcm63xx/Kconfig
18 +++ b/arch/mips/bcm63xx/Kconfig
19 @@ -8,22 +8,20 @@ config BCM63XX_CPU_6328
20 config BCM63XX_CPU_6338
21 bool "support 6338 CPU"
23 - select USB_ARCH_HAS_OHCI
24 - select USB_OHCI_BIG_ENDIAN_DESC
25 - select USB_OHCI_BIG_ENDIAN_MMIO
26 + select USB_ARCH_HAS_OHCI if USB_SUPPORT
28 config BCM63XX_CPU_6345
29 bool "support 6345 CPU"
30 - select USB_OHCI_BIG_ENDIAN_DESC
31 - select USB_OHCI_BIG_ENDIAN_MMIO
33 config BCM63XX_CPU_6348
34 bool "support 6348 CPU"
36 + select USB_ARCH_HAS_OHCI if USB_SUPPORT
38 config BCM63XX_CPU_6358
39 bool "support 6358 CPU"
41 + select USB_ARCH_HAS_OHCI if USB_SUPPORT
43 config BCM63XX_CPU_6362
44 bool "support 6362 CPU"
45 @@ -32,6 +30,7 @@ config BCM63XX_CPU_6362
46 config BCM63XX_CPU_6368
47 bool "support 6368 CPU"
49 + select USB_ARCH_HAS_OHCI if USB_SUPPORT
52 source "arch/mips/bcm63xx/boards/Kconfig"
53 --- a/arch/mips/bcm63xx/Makefile
54 +++ b/arch/mips/bcm63xx/Makefile
56 obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \
57 setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \
58 dev-pcmcia.o dev-rng.o dev-spi.o dev-uart.o dev-wdt.o \
60 + dev-usb-ohci.o dev-usb-usbd.o
61 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
64 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
65 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
67 #include <bcm63xx_dev_flash.h>
68 #include <bcm63xx_dev_pcmcia.h>
69 #include <bcm63xx_dev_spi.h>
70 +#include <bcm63xx_dev_usb_ohci.h>
71 #include <bcm63xx_dev_usb_usbd.h>
72 #include <board_bcm963xx.h>
74 @@ -923,6 +924,9 @@ int __init board_register_devices(void)
76 bcm63xx_usbd_register(&board.usbd);
78 + if (board.has_ohci0)
79 + bcm63xx_ohci_register();
82 bcm63xx_dsp_register(&board.dsp);
85 +++ b/arch/mips/bcm63xx/dev-usb-ohci.c
88 + * This file is subject to the terms and conditions of the GNU General Public
89 + * License. See the file "COPYING" in the main directory of this archive
92 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
95 +#include <linux/init.h>
96 +#include <linux/kernel.h>
97 +#include <linux/platform_device.h>
98 +#include <bcm63xx_cpu.h>
99 +#include <bcm63xx_dev_usb_ohci.h>
101 +static struct resource ohci_resources[] = {
103 + .start = -1, /* filled at runtime */
104 + .end = -1, /* filled at runtime */
105 + .flags = IORESOURCE_MEM,
108 + .start = -1, /* filled at runtime */
109 + .flags = IORESOURCE_IRQ,
113 +static u64 ohci_dmamask = ~(u32)0;
115 +static struct platform_device bcm63xx_ohci_device = {
116 + .name = "bcm63xx_ohci",
118 + .num_resources = ARRAY_SIZE(ohci_resources),
119 + .resource = ohci_resources,
121 + .dma_mask = &ohci_dmamask,
122 + .coherent_dma_mask = 0xffffffff,
126 +int __init bcm63xx_ohci_register(void)
128 + if (!BCMCPU_IS_6348() && !BCMCPU_IS_6358() && !BCMCPU_IS_6368())
131 + ohci_resources[0].start = bcm63xx_regset_address(RSET_OHCI0);
132 + ohci_resources[0].end = ohci_resources[0].start;
133 + ohci_resources[0].end += RSET_OHCI_SIZE - 1;
134 + ohci_resources[1].start = bcm63xx_get_irq_number(IRQ_OHCI0);
135 + return platform_device_register(&bcm63xx_ohci_device);
138 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h
140 +#ifndef BCM63XX_DEV_USB_OHCI_H_
141 +#define BCM63XX_DEV_USB_OHCI_H_
143 +int bcm63xx_ohci_register(void);
145 +#endif /* BCM63XX_DEV_USB_OHCI_H_ */