brcm47xx: use upstream patch removing WGT634U code
[openwrt.git] / target / linux / brcm47xx / patches-3.10 / 127-MIPS-BCM47XX-Drop-WGT634U-hacks.patch
1 From 68e30f30875d4e4608cebec27ca8bd07be0d0f64 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Thu, 2 Jan 2014 13:53:15 +0100
4 Subject: [PATCH] MIPS: BCM47XX: Drop WGT634U hacks
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 This old wgt634u.c was trying to implement a bit ugly support for
10 Netgear WGT634U. It provided info about LED, flash mapping & layout and
11 was trying to handle reset button.
12
13 This is not needed anymore as we have replacement for all this stuff.
14
15 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
16 Signed-off-by: John Crispin <blogic@openwrt.org>
17 Patchwork: http://patchwork.linux-mips.org/patch/6302/
18 ---
19  arch/mips/bcm47xx/Makefile  |   1 -
20  arch/mips/bcm47xx/wgt634u.c | 174 --------------------------------------------
21  2 files changed, 175 deletions(-)
22  delete mode 100644 arch/mips/bcm47xx/wgt634u.c
23
24 --- a/arch/mips/bcm47xx/Makefile
25 +++ b/arch/mips/bcm47xx/Makefile
26 @@ -5,4 +5,3 @@
27  
28  obj-y                          += irq.o nvram.o prom.o serial.o setup.o time.o sprom.o
29  obj-y                          += board.o buttons.o leds.o
30 -obj-$(CONFIG_BCM47XX_SSB)      += wgt634u.o
31 --- a/arch/mips/bcm47xx/wgt634u.c
32 +++ /dev/null
33 @@ -1,174 +0,0 @@
34 -/*
35 - * This file is subject to the terms and conditions of the GNU General Public
36 - * License.  See the file "COPYING" in the main directory of this archive
37 - * for more details.
38 - *
39 - * Copyright (C) 2007 Aurelien Jarno <aurelien@aurel32.net>
40 - */
41 -
42 -#include <linux/platform_device.h>
43 -#include <linux/module.h>
44 -#include <linux/leds.h>
45 -#include <linux/mtd/physmap.h>
46 -#include <linux/ssb/ssb.h>
47 -#include <linux/ssb/ssb_embedded.h>
48 -#include <linux/interrupt.h>
49 -#include <linux/reboot.h>
50 -#include <linux/gpio.h>
51 -#include <asm/mach-bcm47xx/bcm47xx.h>
52 -
53 -/* GPIO definitions for the WGT634U */
54 -#define WGT634U_GPIO_LED       3
55 -#define WGT634U_GPIO_RESET     2
56 -#define WGT634U_GPIO_TP1       7
57 -#define WGT634U_GPIO_TP2       6
58 -#define WGT634U_GPIO_TP3       5
59 -#define WGT634U_GPIO_TP4       4
60 -#define WGT634U_GPIO_TP5       1
61 -
62 -static struct gpio_led wgt634u_leds[] = {
63 -       {
64 -               .name = "power",
65 -               .gpio = WGT634U_GPIO_LED,
66 -               .active_low = 1,
67 -               .default_trigger = "heartbeat",
68 -       },
69 -};
70 -
71 -static struct gpio_led_platform_data wgt634u_led_data = {
72 -       .num_leds =     ARRAY_SIZE(wgt634u_leds),
73 -       .leds =         wgt634u_leds,
74 -};
75 -
76 -static struct platform_device wgt634u_gpio_leds = {
77 -       .name =         "leds-gpio",
78 -       .id =           -1,
79 -       .dev = {
80 -               .platform_data = &wgt634u_led_data,
81 -       }
82 -};
83 -
84 -
85 -/* 8MiB flash. The struct mtd_partition matches original Netgear WGT634U
86 -   firmware. */
87 -static struct mtd_partition wgt634u_partitions[] = {
88 -       {
89 -               .name       = "cfe",
90 -               .offset     = 0,
91 -               .size       = 0x60000,          /* 384k */
92 -               .mask_flags = MTD_WRITEABLE     /* force read-only */
93 -       },
94 -       {
95 -               .name   = "config",
96 -               .offset = 0x60000,
97 -               .size   = 0x20000               /* 128k */
98 -       },
99 -       {
100 -               .name   = "linux",
101 -               .offset = 0x80000,
102 -               .size   = 0x140000              /* 1280k */
103 -       },
104 -       {
105 -               .name   = "jffs",
106 -               .offset = 0x1c0000,
107 -               .size   = 0x620000              /* 6272k */
108 -       },
109 -       {
110 -               .name   = "nvram",
111 -               .offset = 0x7e0000,
112 -               .size   = 0x20000               /* 128k */
113 -       },
114 -};
115 -
116 -static struct physmap_flash_data wgt634u_flash_data = {
117 -       .parts    = wgt634u_partitions,
118 -       .nr_parts = ARRAY_SIZE(wgt634u_partitions)
119 -};
120 -
121 -static struct resource wgt634u_flash_resource = {
122 -       .flags = IORESOURCE_MEM,
123 -};
124 -
125 -static struct platform_device wgt634u_flash = {
126 -       .name          = "physmap-flash",
127 -       .id            = 0,
128 -       .dev           = { .platform_data = &wgt634u_flash_data, },
129 -       .resource      = &wgt634u_flash_resource,
130 -       .num_resources = 1,
131 -};
132 -
133 -/* Platform devices */
134 -static struct platform_device *wgt634u_devices[] __initdata = {
135 -       &wgt634u_flash,
136 -       &wgt634u_gpio_leds,
137 -};
138 -
139 -static irqreturn_t gpio_interrupt(int irq, void *ignored)
140 -{
141 -       int state;
142 -
143 -       /* Interrupts are shared, check if the current one is
144 -          a GPIO interrupt. */
145 -       if (!ssb_chipco_irq_status(&bcm47xx_bus.ssb.chipco,
146 -                                  SSB_CHIPCO_IRQ_GPIO))
147 -               return IRQ_NONE;
148 -
149 -       state = gpio_get_value(WGT634U_GPIO_RESET);
150 -
151 -       /* Interrupt are level triggered, revert the interrupt polarity
152 -          to clear the interrupt. */
153 -       ssb_gpio_polarity(&bcm47xx_bus.ssb, 1 << WGT634U_GPIO_RESET,
154 -                         state ? 1 << WGT634U_GPIO_RESET : 0);
155 -
156 -       if (!state) {
157 -               printk(KERN_INFO "Reset button pressed");
158 -               ctrl_alt_del();
159 -       }
160 -
161 -       return IRQ_HANDLED;
162 -}
163 -
164 -static int __init wgt634u_init(void)
165 -{
166 -       /* There is no easy way to detect that we are running on a WGT634U
167 -        * machine. Use the MAC address as an heuristic. Netgear Inc. has
168 -        * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx.
169 -        */
170 -       u8 *et0mac;
171 -
172 -       if (bcm47xx_bus_type != BCM47XX_BUS_TYPE_SSB)
173 -               return -ENODEV;
174 -
175 -       et0mac = bcm47xx_bus.ssb.sprom.et0mac;
176 -
177 -       if (et0mac[0] == 0x00 &&
178 -           ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) ||
179 -            (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) {
180 -               struct ssb_mipscore *mcore = &bcm47xx_bus.ssb.mipscore;
181 -
182 -               printk(KERN_INFO "WGT634U machine detected.\n");
183 -
184 -               if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET),
185 -                                gpio_interrupt, IRQF_SHARED,
186 -                                "WGT634U GPIO", &bcm47xx_bus.ssb.chipco)) {
187 -                       gpio_direction_input(WGT634U_GPIO_RESET);
188 -                       ssb_gpio_intmask(&bcm47xx_bus.ssb,
189 -                                        1 << WGT634U_GPIO_RESET,
190 -                                        1 << WGT634U_GPIO_RESET);
191 -                       ssb_chipco_irq_mask(&bcm47xx_bus.ssb.chipco,
192 -                                           SSB_CHIPCO_IRQ_GPIO,
193 -                                           SSB_CHIPCO_IRQ_GPIO);
194 -               }
195 -
196 -               wgt634u_flash_data.width = mcore->pflash.buswidth;
197 -               wgt634u_flash_resource.start = mcore->pflash.window;
198 -               wgt634u_flash_resource.end = mcore->pflash.window
199 -                                          + mcore->pflash.window_size
200 -                                          - 1;
201 -               return platform_add_devices(wgt634u_devices,
202 -                                           ARRAY_SIZE(wgt634u_devices));
203 -       } else
204 -               return -ENODEV;
205 -}
206 -
207 -module_init(wgt634u_init);