kernel: add md5sum for 3.9 final
[oweals/openwrt.git] / target / linux / brcm63xx / patches-3.7 / 401-MIPS-BCM63XX-register-ohci-device.patch
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.
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  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
16
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"
22         select HW_HAS_PCI
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
27  
28  config BCM63XX_CPU_6345
29         bool "support 6345 CPU"
30 -       select USB_OHCI_BIG_ENDIAN_DESC
31 -       select USB_OHCI_BIG_ENDIAN_MMIO
32  
33  config BCM63XX_CPU_6348
34         bool "support 6348 CPU"
35         select HW_HAS_PCI
36 +       select USB_ARCH_HAS_OHCI if USB_SUPPORT
37  
38  config BCM63XX_CPU_6358
39         bool "support 6358 CPU"
40         select HW_HAS_PCI
41 +       select USB_ARCH_HAS_OHCI if USB_SUPPORT
42  
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"
48         select HW_HAS_PCI
49 +       select USB_ARCH_HAS_OHCI if USB_SUPPORT
50  endmenu
51  
52  source "arch/mips/bcm63xx/boards/Kconfig"
53 --- a/arch/mips/bcm63xx/Makefile
54 +++ b/arch/mips/bcm63xx/Makefile
55 @@ -1,7 +1,7 @@
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 \
59 -                  dev-usb-usbd.o
60 +                  dev-usb-ohci.o dev-usb-usbd.o
61  obj-$(CONFIG_EARLY_PRINTK)     += early_printk.o
62  
63  obj-y          += boards/
64 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
65 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
66 @@ -28,6 +28,7 @@
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>
73  
74 @@ -923,6 +924,9 @@ int __init board_register_devices(void)
75         if (board.has_usbd)
76                 bcm63xx_usbd_register(&board.usbd);
77  
78 +       if (board.has_ohci0)
79 +               bcm63xx_ohci_register();
80 +
81         if (board.has_dsp)
82                 bcm63xx_dsp_register(&board.dsp);
83  
84 --- /dev/null
85 +++ b/arch/mips/bcm63xx/dev-usb-ohci.c
86 @@ -0,0 +1,50 @@
87 +/*
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
90 + * for more details.
91 + *
92 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
93 + */
94 +
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>
100 +
101 +static struct resource ohci_resources[] = {
102 +       {
103 +               .start          = -1, /* filled at runtime */
104 +               .end            = -1, /* filled at runtime */
105 +               .flags          = IORESOURCE_MEM,
106 +       },
107 +       {
108 +               .start          = -1, /* filled at runtime */
109 +               .flags          = IORESOURCE_IRQ,
110 +       },
111 +};
112 +
113 +static u64 ohci_dmamask = ~(u32)0;
114 +
115 +static struct platform_device bcm63xx_ohci_device = {
116 +       .name           = "bcm63xx_ohci",
117 +       .id             = 0,
118 +       .num_resources  = ARRAY_SIZE(ohci_resources),
119 +       .resource       = ohci_resources,
120 +       .dev            = {
121 +               .dma_mask               = &ohci_dmamask,
122 +               .coherent_dma_mask      = 0xffffffff,
123 +       },
124 +};
125 +
126 +int __init bcm63xx_ohci_register(void)
127 +{
128 +       if (!BCMCPU_IS_6348() && !BCMCPU_IS_6358() && !BCMCPU_IS_6368())
129 +               return 0;
130 +
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);
136 +}
137 --- /dev/null
138 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h
139 @@ -0,0 +1,6 @@
140 +#ifndef BCM63XX_DEV_USB_OHCI_H_
141 +#define BCM63XX_DEV_USB_OHCI_H_
142 +
143 +int bcm63xx_ohci_register(void);
144 +
145 +#endif /* BCM63XX_DEV_USB_OHCI_H_ */