1 From 4ce192d5860760140439a3f305bc32f5e2316aa8 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 21/57] 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 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
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"
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
27 config BCM63XX_CPU_6345
28 bool "support 6345 CPU"
29 - select USB_OHCI_BIG_ENDIAN_DESC
30 - select USB_OHCI_BIG_ENDIAN_MMIO
32 config BCM63XX_CPU_6348
33 bool "support 6348 CPU"
35 + select USB_ARCH_HAS_OHCI if USB_SUPPORT
37 config BCM63XX_CPU_6358
38 bool "support 6358 CPU"
40 + select USB_ARCH_HAS_OHCI if USB_SUPPORT
42 config BCM63XX_CPU_6368
43 bool "support 6368 CPU"
45 + select USB_ARCH_HAS_OHCI if USB_SUPPORT
48 source "arch/mips/bcm63xx/boards/Kconfig"
49 --- a/arch/mips/bcm63xx/Makefile
50 +++ b/arch/mips/bcm63xx/Makefile
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-uart.o dev-wdt.o
54 + dev-dsp.o dev-enet.o dev-pcmcia.o dev-uart.o \
55 + dev-usb-ohci.o dev-wdt.o
56 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
59 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
60 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
62 #include <bcm63xx_dev_enet.h>
63 #include <bcm63xx_dev_dsp.h>
64 #include <bcm63xx_dev_pcmcia.h>
65 +#include <bcm63xx_dev_usb_ohci.h>
66 #include <board_bcm963xx.h>
68 #define PFX "board_bcm963xx: "
69 @@ -874,6 +875,9 @@ int __init board_register_devices(void)
70 !board_get_mac_address(board.enet1.mac_addr))
71 bcm63xx_enet_register(1, &board.enet1);
73 + if (board.has_ohci0)
74 + bcm63xx_ohci_register();
77 bcm63xx_dsp_register(&board.dsp);
80 +++ b/arch/mips/bcm63xx/dev-usb-ohci.c
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
87 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
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>
96 +static struct resource ohci_resources[] = {
98 + .start = -1, /* filled at runtime */
99 + .end = -1, /* filled at runtime */
100 + .flags = IORESOURCE_MEM,
103 + .start = -1, /* filled at runtime */
104 + .flags = IORESOURCE_IRQ,
108 +static u64 ohci_dmamask = ~(u32)0;
110 +static struct platform_device bcm63xx_ohci_device = {
111 + .name = "bcm63xx_ohci",
113 + .num_resources = ARRAY_SIZE(ohci_resources),
114 + .resource = ohci_resources,
116 + .dma_mask = &ohci_dmamask,
117 + .coherent_dma_mask = 0xffffffff,
121 +int __init bcm63xx_ohci_register(void)
123 + if (!BCMCPU_IS_6348() && !BCMCPU_IS_6358() && !BCMCPU_IS_6368())
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);
133 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h
135 +#ifndef BCM63XX_DEV_USB_OHCI_H_
136 +#define BCM63XX_DEV_USB_OHCI_H_
138 +int bcm63xx_ohci_register(void);
140 +#endif /* BCM63XX_DEV_USB_OHCI_H_ */