Root/target/linux/brcm47xx/patches-3.3/812-disable_wgt634u_crap.patch

1--- a/arch/mips/bcm47xx/Makefile
2+++ b/arch/mips/bcm47xx/Makefile
3@@ -4,4 +4,3 @@
4 #
5 
6 obj-y += gpio.o irq.o nvram.o prom.o serial.o setup.o time.o sprom.o bus.o
7-obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o
8--- a/arch/mips/bcm47xx/wgt634u.c
9+++ /dev/null
10@@ -1,177 +0,0 @@
11-/*
12- * This file is subject to the terms and conditions of the GNU General Public
13- * License. See the file "COPYING" in the main directory of this archive
14- * for more details.
15- *
16- * Copyright (C) 2007 Aurelien Jarno <aurelien@aurel32.net>
17- */
18-
19-#include <linux/platform_device.h>
20-#include <linux/module.h>
21-#include <linux/leds.h>
22-#include <linux/mtd/physmap.h>
23-#include <linux/ssb/ssb.h>
24-#include <linux/interrupt.h>
25-#include <linux/reboot.h>
26-#include <linux/gpio.h>
27-#include <asm/mach-bcm47xx/bcm47xx.h>
28-
29-/* GPIO definitions for the WGT634U */
30-#define WGT634U_GPIO_LED 3
31-#define WGT634U_GPIO_RESET 2
32-#define WGT634U_GPIO_TP1 7
33-#define WGT634U_GPIO_TP2 6
34-#define WGT634U_GPIO_TP3 5
35-#define WGT634U_GPIO_TP4 4
36-#define WGT634U_GPIO_TP5 1
37-
38-static struct gpio_led wgt634u_leds[] = {
39- {
40- .name = "power",
41- .gpio = WGT634U_GPIO_LED,
42- .active_low = 1,
43- .default_trigger = "heartbeat",
44- },
45-};
46-
47-static struct gpio_led_platform_data wgt634u_led_data = {
48- .num_leds = ARRAY_SIZE(wgt634u_leds),
49- .leds = wgt634u_leds,
50-};
51-
52-static struct platform_device wgt634u_gpio_leds = {
53- .name = "leds-gpio",
54- .id = -1,
55- .dev = {
56- .platform_data = &wgt634u_led_data,
57- }
58-};
59-
60-
61-/* 8MiB flash. The struct mtd_partition matches original Netgear WGT634U
62- firmware. */
63-static struct mtd_partition wgt634u_partitions[] = {
64- {
65- .name = "cfe",
66- .offset = 0,
67- .size = 0x60000, /* 384k */
68- .mask_flags = MTD_WRITEABLE /* force read-only */
69- },
70- {
71- .name = "config",
72- .offset = 0x60000,
73- .size = 0x20000 /* 128k */
74- },
75- {
76- .name = "linux",
77- .offset = 0x80000,
78- .size = 0x140000 /* 1280k */
79- },
80- {
81- .name = "jffs",
82- .offset = 0x1c0000,
83- .size = 0x620000 /* 6272k */
84- },
85- {
86- .name = "nvram",
87- .offset = 0x7e0000,
88- .size = 0x20000 /* 128k */
89- },
90-};
91-
92-static struct physmap_flash_data wgt634u_flash_data = {
93- .parts = wgt634u_partitions,
94- .nr_parts = ARRAY_SIZE(wgt634u_partitions)
95-};
96-
97-static struct resource wgt634u_flash_resource = {
98- .flags = IORESOURCE_MEM,
99-};
100-
101-static struct platform_device wgt634u_flash = {
102- .name = "physmap-flash",
103- .id = 0,
104- .dev = { .platform_data = &wgt634u_flash_data, },
105- .resource = &wgt634u_flash_resource,
106- .num_resources = 1,
107-};
108-
109-/* Platform devices */
110-static struct platform_device *wgt634u_devices[] __initdata = {
111- &wgt634u_flash,
112- &wgt634u_gpio_leds,
113-};
114-
115-static irqreturn_t gpio_interrupt(int irq, void *ignored)
116-{
117- int state;
118-
119- /* Interrupts are shared, check if the current one is
120- a GPIO interrupt. */
121- if (!ssb_chipco_irq_status(&bcm47xx_bus.ssb.chipco,
122- SSB_CHIPCO_IRQ_GPIO))
123- return IRQ_NONE;
124-
125- state = gpio_get_value(WGT634U_GPIO_RESET);
126-
127- /* Interrupt are level triggered, revert the interrupt polarity
128- to clear the interrupt. */
129- gpio_polarity(WGT634U_GPIO_RESET, state);
130-
131- if (!state) {
132- printk(KERN_INFO "Reset button pressed");
133- ctrl_alt_del();
134- }
135-
136- return IRQ_HANDLED;
137-}
138-
139-static int __init wgt634u_init(void)
140-{
141- /* There is no easy way to detect that we are running on a WGT634U
142- * machine. Use the MAC address as an heuristic. Netgear Inc. has
143- * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx.
144- */
145- u8 *et0mac;
146- int err;
147-
148- if (bcm47xx_bus_type != BCM47XX_BUS_TYPE_SSB)
149- return -ENODEV;
150-
151- et0mac = bcm47xx_bus.ssb.sprom.et0mac;
152-
153- if (et0mac[0] == 0x00 &&
154- ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) ||
155- (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) {
156- struct ssb_chipcommon *ccore = &bcm47xx_bus.ssb.chipco;
157-
158- printk(KERN_INFO "WGT634U machine detected.\n");
159-
160- err = gpio_request(WGT634U_GPIO_RESET, "reset-buton");
161- if (err) {
162- printk(KERN_INFO "Can not register gpio for reset button\n");
163- return 0;
164- }
165-
166- if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET),
167- gpio_interrupt, IRQF_SHARED,
168- "WGT634U GPIO", ccore)) {
169- gpio_direction_input(WGT634U_GPIO_RESET);
170- gpio_intmask(WGT634U_GPIO_RESET, 1);
171- ssb_chipco_irq_mask(ccore,
172- SSB_CHIPCO_IRQ_GPIO,
173- SSB_CHIPCO_IRQ_GPIO);
174- }
175-
176- wgt634u_flash_data.width = ccore->pflash.buswidth;
177- wgt634u_flash_resource.start = ccore->pflash.window;
178- wgt634u_flash_resource.end = ccore->pflash.window
179- + ccore->pflash.window_size
180- - 1;
181- return platform_add_devices(wgt634u_devices,
182- ARRAY_SIZE(wgt634u_devices));
183- } else
184- return -ENODEV;
185-}
186-
187-module_init(wgt634u_init);
188

Archive Download this file



interactive