From: Florian Fainelli Date: Fri, 18 Aug 2006 13:10:19 +0000 (+0000) Subject: Add support for the Asus power led, closes #349 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=e725aa689e19db41fd7bf106a8823d9ebc27c7b9;p=openwrt%2Fsvn-archive%2Farchive.git Add support for the Asus power led, closes #349 SVN-Revision: 4594 --- diff --git a/openwrt/target/linux/linux-2.4/patches/brcm/005-diag_led.patch b/openwrt/target/linux/linux-2.4/patches/brcm/005-diag_led.patch index 6f85298275..197b47da53 100644 --- a/openwrt/target/linux/linux-2.4/patches/brcm/005-diag_led.patch +++ b/openwrt/target/linux/linux-2.4/patches/brcm/005-diag_led.patch @@ -1,6 +1,5 @@ -diff -urN linux.old/drivers/net/Makefile linux.dev/drivers/net/Makefile ---- linux.old/drivers/net/Makefile 2006-03-09 09:41:28.000000000 +0100 -+++ linux.dev/drivers/net/Makefile 2006-01-24 20:52:08.000000000 +0100 +--- linux-2.4.30/drivers/net/Makefile 2006-08-18 12:53:35.000000000 +0200 ++++ linux-2.4.30.new/drivers/net/Makefile 2006-08-18 12:53:49.000000000 +0200 @@ -41,6 +41,8 @@ obj-$(CONFIG_ISDN) += slhc.o endif @@ -8,29 +7,12 @@ diff -urN linux.old/drivers/net/Makefile linux.dev/drivers/net/Makefile +subdir-m += diag + subdir-$(CONFIG_HND) += hnd - subdir-$(CONFIG_ET) += et subdir-$(CONFIG_WL) += wl -diff -urN linux.old/drivers/net/diag/Makefile linux.dev/drivers/net/diag/Makefile ---- linux.old/drivers/net/diag/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/drivers/net/diag/Makefile 2006-01-24 20:52:08.000000000 +0100 -@@ -0,0 +1,13 @@ -+#$Id$ -+ -+EXTRA_CFLAGS := -I$(TOPDIR)/arch/mips/bcm947xx/include -DBCMDRIVER -+ -+O_TARGET := diag.o -+ -+MAC_OBJS := diag_led.o -+ -+export-objs := -+obj-y := $(MAC_OBJS) -+obj-m := $(O_TARGET) -+ -+include $(TOPDIR)/Rules.make -diff -urN linux.old/drivers/net/diag/diag_led.c linux.dev/drivers/net/diag/diag_led.c ---- linux.old/drivers/net/diag/diag_led.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/drivers/net/diag/diag_led.c 2006-03-13 00:58:04.000000000 +0100 -@@ -0,0 +1,309 @@ + subdir-$(CONFIG_NET_PCMCIA) += pcmcia +diff -urN linux-2.4.30/drivers/net/diag/diag_led.c linux-2.4.30.new/drivers/net/diag/diag_led.c +--- linux-2.4.30/drivers/net/diag/diag_led.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.4.30.new/drivers/net/diag/diag_led.c 2006-08-18 12:53:58.000000000 +0200 +@@ -0,0 +1,325 @@ +/* + * diag_led.c - replacement diag module + * @@ -62,6 +44,7 @@ diff -urN linux.old/drivers/net/diag/diag_led.c linux.dev/drivers/net/diag/diag_ + * 2005/03/14 asus wl-500g deluxe and buffalo v2 support added + * 2005/04/13 added licensing informations + * 2005/04/18 base reset polarity off initial readings ++ * 2006/08/18 asus power led support added + */ + +#include @@ -102,6 +85,12 @@ diff -urN linux.old/drivers/net/diag/diag_led.c linux.dev/drivers/net/diag/diag_ +static void v2_set_ses(u8 state) { + set_gpio(SES_GPIO, (ISSET(state, 0) << 2) | (ISSET(state, 1) << 3) | (ISSET(state, 2) << 5)); +} ++// asus wl-500g (+deluxe) ++#define ASUS_PWR_GPIO (1<<0) ++ ++static void asus_set_pwr(u8 state) { ++ set_gpio(ASUS_PWR_GPIO,state); ++} + +// v1.x - - - - - +#define LED_DIAG 0x13 @@ -129,20 +118,24 @@ diff -urN linux.old/drivers/net/diag/diag_led.c linux.dev/drivers/net/diag/diag_ +#define BIT_DMZ (1 << 0) +#define BIT_DIAG (1 << 2) +#define BIT_SES (BITS(3) << 3) ++#define BIT_PWR (1 << 1) + +void (*set_diag)(u8 state); +void (*set_dmz)(u8 state); +void (*set_ses)(u8 state); ++void (*set_pwr)(u8 state); + +static unsigned int diag_reverse = 1; +static unsigned int ses_reverse = 1; -+static unsigned int diag = 0; ++static unsigned int pwr_reverse = 1; ++static unsigned int diag = BIT_PWR; // default: diag off, pwr on, dmz off + +static void diag_change() +{ + set_diag(diag_reverse ? 0xFF : 0x00); // off + set_dmz(diag_reverse ? 0xFF : 0x00); // off + set_ses(ses_reverse ? 0xFF : 0x00); // off ++ set_pwr(pwr_reverse ? 0xFF : 0x00); //off + + if(diag & BIT_DIAG) + set_diag(diag_reverse ? 0x00 : 0xFF); // on @@ -150,6 +143,8 @@ diff -urN linux.old/drivers/net/diag/diag_led.c linux.dev/drivers/net/diag/diag_ + set_dmz(diag_reverse ? 0x00 : 0xFF); // on + if(diag & BIT_SES) + set_ses(((ses_reverse ? ~diag : diag) >> 3) & BITS(3)); ++ if (diag & BIT_PWR) ++ set_pwr(pwr_reverse ? 0x00 : 0xFF); // on +} + +static int proc_diag(ctl_table *table, int write, struct file *filp, @@ -247,6 +242,7 @@ diff -urN linux.old/drivers/net/diag/diag_led.c linux.dev/drivers/net/diag/diag_ + set_diag=ignore; + set_dmz=ignore; + set_ses=ignore; ++ set_pwr=ignore; + + buf=nvram_get("pmon_ver") ?: ""; + if (((board_type & 0xf00) == 0x400) && (strncmp(buf, "CFE", 3) != 0)) { @@ -261,6 +257,7 @@ diff -urN linux.old/drivers/net/diag/diag_led.c linux.dev/drivers/net/diag/diag_ + } + if (!strcmp(buf,"asusX")) { + //asus wl-500g ++ set_pwr=asus_set_pwr; + reset_gpio=(1<<6); + } + } @@ -306,6 +303,7 @@ diff -urN linux.old/drivers/net/diag/diag_led.c linux.dev/drivers/net/diag/diag_ + } + if (!strcmp(buf,"45")) { + //wl-500g deluxe ++ set_pwr=asus_set_pwr; + reset_gpio=(1<<6); + } + } @@ -340,3 +338,20 @@ diff -urN linux.old/drivers/net/diag/diag_led.c linux.dev/drivers/net/diag/diag_ + +module_init(diag_init); +module_exit(diag_exit); +diff -urN linux-2.4.30/drivers/net/diag/Makefile linux-2.4.30.new/drivers/net/diag/Makefile +--- linux-2.4.30/drivers/net/diag/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.4.30.new/drivers/net/diag/Makefile 2006-08-18 12:53:49.000000000 +0200 +@@ -0,0 +1,13 @@ ++#$Id$ ++ ++EXTRA_CFLAGS := -I$(TOPDIR)/arch/mips/bcm947xx/include -DBCMDRIVER ++ ++O_TARGET := diag.o ++ ++MAC_OBJS := diag_led.o ++ ++export-objs := ++obj-y := $(MAC_OBJS) ++obj-m := $(O_TARGET) ++ ++include $(TOPDIR)/Rules.make