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