1 --- a/arch/mips/bcm47xx/Makefile
2 +++ b/arch/mips/bcm47xx/Makefile
7 -obj-y := cfe_env.o gpio.o irq.o nvram.o prom.o serial.o setup.o time.o wgt634u.o
8 +obj-y := cfe_env.o gpio.o irq.o nvram.o prom.o serial.o setup.o time.o
9 --- a/arch/mips/bcm47xx/wgt634u.c
13 - * This file is subject to the terms and conditions of the GNU General Public
14 - * License. See the file "COPYING" in the main directory of this archive
17 - * Copyright (C) 2007 Aurelien Jarno <aurelien@aurel32.net>
20 -#include <linux/platform_device.h>
21 -#include <linux/module.h>
22 -#include <linux/leds.h>
23 -#include <linux/mtd/physmap.h>
24 -#include <linux/ssb/ssb.h>
25 -#include <linux/interrupt.h>
26 -#include <linux/reboot.h>
27 -#include <linux/gpio.h>
28 -#include <asm/mach-bcm47xx/bcm47xx.h>
30 -/* GPIO definitions for the WGT634U */
31 -#define WGT634U_GPIO_LED 3
32 -#define WGT634U_GPIO_RESET 2
33 -#define WGT634U_GPIO_TP1 7
34 -#define WGT634U_GPIO_TP2 6
35 -#define WGT634U_GPIO_TP3 5
36 -#define WGT634U_GPIO_TP4 4
37 -#define WGT634U_GPIO_TP5 1
39 -static struct gpio_led wgt634u_leds[] = {
42 - .gpio = WGT634U_GPIO_LED,
44 - .default_trigger = "heartbeat",
48 -static struct gpio_led_platform_data wgt634u_led_data = {
49 - .num_leds = ARRAY_SIZE(wgt634u_leds),
50 - .leds = wgt634u_leds,
53 -static struct platform_device wgt634u_gpio_leds = {
54 - .name = "leds-gpio",
57 - .platform_data = &wgt634u_led_data,
62 -/* 8MiB flash. The struct mtd_partition matches original Netgear WGT634U
64 -static struct mtd_partition wgt634u_partitions[] = {
68 - .size = 0x60000, /* 384k */
69 - .mask_flags = MTD_WRITEABLE /* force read-only */
74 - .size = 0x20000 /* 128k */
79 - .size = 0x140000 /* 1280k */
84 - .size = 0x620000 /* 6272k */
89 - .size = 0x20000 /* 128k */
93 -static struct physmap_flash_data wgt634u_flash_data = {
94 - .parts = wgt634u_partitions,
95 - .nr_parts = ARRAY_SIZE(wgt634u_partitions)
98 -static struct resource wgt634u_flash_resource = {
99 - .flags = IORESOURCE_MEM,
102 -static struct platform_device wgt634u_flash = {
103 - .name = "physmap-flash",
105 - .dev = { .platform_data = &wgt634u_flash_data, },
106 - .resource = &wgt634u_flash_resource,
107 - .num_resources = 1,
110 -/* Platform devices */
111 -static struct platform_device *wgt634u_devices[] __initdata = {
113 - &wgt634u_gpio_leds,
116 -static irqreturn_t gpio_interrupt(int irq, void *ignored)
120 - /* Interrupts are shared, check if the current one is
121 - a GPIO interrupt. */
122 - if (!ssb_chipco_irq_status(&ssb_bcm47xx.chipco,
123 - SSB_CHIPCO_IRQ_GPIO))
126 - state = gpio_get_value(WGT634U_GPIO_RESET);
128 - /* Interrupt are level triggered, revert the interrupt polarity
129 - to clear the interrupt. */
130 - gpio_polarity(WGT634U_GPIO_RESET, state);
133 - printk(KERN_INFO "Reset button pressed");
137 - return IRQ_HANDLED;
140 -static int __init wgt634u_init(void)
142 - /* There is no easy way to detect that we are running on a WGT634U
143 - * machine. Use the MAC address as an heuristic. Netgear Inc. has
144 - * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx.
147 - u8 *et0mac = ssb_bcm47xx.sprom.et0mac;
149 - if (et0mac[0] == 0x00 &&
150 - ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) ||
151 - (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) {
152 - struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore;
154 - printk(KERN_INFO "WGT634U machine detected.\n");
156 - if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET),
157 - gpio_interrupt, IRQF_SHARED,
158 - "WGT634U GPIO", &ssb_bcm47xx.chipco)) {
159 - gpio_direction_input(WGT634U_GPIO_RESET);
160 - gpio_intmask(WGT634U_GPIO_RESET, 1);
161 - ssb_chipco_irq_mask(&ssb_bcm47xx.chipco,
162 - SSB_CHIPCO_IRQ_GPIO,
163 - SSB_CHIPCO_IRQ_GPIO);
166 - wgt634u_flash_data.width = mcore->flash_buswidth;
167 - wgt634u_flash_resource.start = mcore->flash_window;
168 - wgt634u_flash_resource.end = mcore->flash_window
169 - + mcore->flash_window_size
171 - return platform_add_devices(wgt634u_devices,
172 - ARRAY_SIZE(wgt634u_devices));
177 -module_init(wgt634u_init);