1 diff -urN linux-2.4.30.dev/drivers/net/Makefile linux-2.4.30.dev2/drivers/net/Makefile
2 --- linux-2.4.30.dev/drivers/net/Makefile 2005-08-22 01:41:45.930653216 +0200
3 +++ linux-2.4.30.dev2/drivers/net/Makefile 2005-08-22 01:58:04.162939304 +0200
5 obj-$(CONFIG_ISDN) += slhc.o
10 subdir-$(CONFIG_HND) += hnd
11 subdir-$(CONFIG_ET) += et
12 subdir-$(CONFIG_WL) += wl
13 diff -urN linux-2.4.30.dev/drivers/net/diag/Makefile linux-2.4.30.dev2/drivers/net/diag/Makefile
14 --- linux-2.4.30.dev/drivers/net/diag/Makefile 1970-01-01 01:00:00.000000000 +0100
15 +++ linux-2.4.30.dev2/drivers/net/diag/Makefile 2005-08-22 00:12:23.655170000 +0200
17 +#$Id: 005-diag_led.patch,v 1.1.2.1 2005/08/22 01:56:06 nbd Exp $
19 +EXTRA_CFLAGS := -I$(TOPDIR)/arch/mips/bcm947xx/include -DBCMDRIVER
23 +MAC_OBJS := diag_led.o
29 +include $(TOPDIR)/Rules.make
30 diff -urN linux-2.4.30.dev/drivers/net/diag/diag_led.c linux-2.4.30.dev2/drivers/net/diag/diag_led.c
31 --- linux-2.4.30.dev/drivers/net/diag/diag_led.c 1970-01-01 01:00:00.000000000 +0100
32 +++ linux-2.4.30.dev2/drivers/net/diag/diag_led.c 2005-08-22 03:37:58.112053448 +0200
35 + * diag_led.c - replacement diag module
37 + * Copyright (C) 2004 Mike Baker,
38 + * Imre Kaloz <kaloz@dune.hu>
40 + * This program is free software; you can redistribute it and/or
41 + * modify it under the terms of the GNU General Public License
42 + * as published by the Free Software Foundation; either version 2
43 + * of the License, or (at your option) any later version.
45 + * This program is distributed in the hope that it will be useful,
46 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
47 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48 + * GNU General Public License for more details.
50 + * You should have received a copy of the GNU General Public License
51 + * along with this program; if not, write to the Free Software
52 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
54 + * $Id: 005-diag_led.patch,v 1.1.2.1 2005/08/22 01:56:06 nbd Exp $
59 + * 2004/03/28 initial release
60 + * 2004/08/26 asus & buffalo support added
61 + * 2005/03/14 asus wl-500g deluxe and buffalo v2 support added
62 + * 2005/04/13 added licensing informations
63 + * 2005/04/18 base reset polarity off initial readings
66 +#include <linux/module.h>
67 +#include <linux/init.h>
68 +#include <linux/kernel.h>
69 +#include <linux/sysctl.h>
71 +#include <typedefs.h>
75 +extern char * nvram_get(const char *name);
79 +#define DIAG_GPIO (1<<1)
80 +#define DMZ_GPIO (1<<7)
82 +static void set_gpio(uint32 mask, uint32 value) {
83 + sb_gpiocontrol(sbh,mask,0);
84 + sb_gpioouten(sbh,mask,mask);
85 + sb_gpioout(sbh,mask,value);
88 +static void v2_set_diag(u8 state) {
89 + set_gpio(DIAG_GPIO,state);
91 +static void v2_set_dmz(u8 state) {
92 + set_gpio(DMZ_GPIO,state);
96 +#define LED_DIAG 0x13
99 +static void v1_set_diag(u8 state) {
101 + *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DIAG)=0xFF;
103 + *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DIAG);
106 +static void v1_set_dmz(u8 state) {
108 + *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DMZ)=0xFF;
110 + *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DMZ);
115 +static void ignore(u8 ignored) {};
118 +#define BIT_DMZ 0x01
119 +#define BIT_DIAG 0x04
121 +void (*set_diag)(u8 state);
122 +void (*set_dmz)(u8 state);
124 +static unsigned int diag = 0;
126 +static void diag_change()
128 + set_diag(0xFF); // off
129 + set_dmz(0xFF); // off
131 + if(diag & BIT_DIAG)
132 + set_diag(0x00); // on
134 + set_dmz(0x00); // on
137 +static int proc_diag(ctl_table *table, int write, struct file *filp,
138 + void *buffer, size_t *lenp)
141 + r = proc_dointvec(table, write, filp, buffer, lenp);
149 +static unsigned char reset_gpio = 0;
150 +static unsigned char reset_polarity = 0;
151 +static unsigned int reset = 0;
153 +static int proc_reset(ctl_table *table, int write, struct file *filp,
154 + void *buffer, size_t *lenp)
158 + sb_gpiocontrol(sbh,reset_gpio,reset_gpio);
159 + sb_gpioouten(sbh,reset_gpio,0);
160 + reset=!(sb_gpioin(sbh)&reset_gpio);
162 + if (reset_polarity) reset=!reset;
167 + return proc_dointvec(table, write, filp, buffer, lenp);
171 +static struct ctl_table_header *diag_sysctl_header;
173 +static ctl_table sys_diag[] = {
178 + maxlen: sizeof(diag),
180 + proc_handler: proc_diag
186 + maxlen: sizeof(reset),
188 + proc_handler: proc_reset
193 +static int __init diag_init()
197 + sbh = sb_kattach();
198 + sb_gpiosetcore(sbh);
200 + board_type = sb_boardtype(sbh);
201 + printk(KERN_INFO "diag boardtype: %08x\n",board_type);
206 + buf=nvram_get("boardrev");
207 + if (((board_type & 0xf00) == 0x400) && strcmp(buf,"0x10")) {
208 + buf=nvram_get("boardtype")?:"";
209 + if (!strcmp(buf,"bcm94710dev")) {
210 + buf=nvram_get("boardnum")?:"";
211 + if (!strcmp(buf,"42")) {
213 + set_diag=v1_set_diag;
214 + set_dmz=v1_set_dmz;
217 + if (!strcmp(buf,"asusX")) {
222 + if (!strcmp(buf,"bcm94710ap")) {
223 + buf=nvram_get("boardnum")?:"";
224 + if (!strcmp(buf,"42")) {
226 + set_dmz=v2_set_dmz;
229 + if (!strcmp(buf,"44")) {
231 + set_dmz=v2_set_dmz;
236 + buf=nvram_get("boardnum")?:"";
237 + if (!strcmp(buf,"42")) {
239 + set_diag=v2_set_diag;
240 + set_dmz=v2_set_dmz;
243 + if (!strcmp(buf,"44")) {
247 + if (!strcmp(buf,"00")) {
251 + if (!strcmp(buf,"45")) {
258 + sb_gpiocontrol(sbh,reset_gpio,reset_gpio);
259 + sb_gpioouten(sbh,reset_gpio,0);
260 + reset_polarity=!(sb_gpioin(sbh)&reset_gpio);
262 + diag_sysctl_header = register_sysctl_table(sys_diag, 0);
268 +static void __exit diag_exit()
270 + unregister_sysctl_table(diag_sysctl_header);
274 +MODULE_AUTHOR("openwrt.org");
275 +MODULE_LICENSE("GPL");
277 +module_init(diag_init);
278 +module_exit(diag_exit);