diff options
author | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2006-01-11 22:57:52 +0000 |
---|---|---|
committer | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2006-01-11 22:57:52 +0000 |
commit | 8e2a30f6f4baf326b0446f3d0d9978cd15e6a847 (patch) | |
tree | dcfddbed45ff04de3a12d4508069b904a2dcabfe /openwrt/target/linux/package/switch/src/switch-adm.c | |
parent | 15c700d66c37b30d3af59b5ec52e29603c6bcbd3 (diff) |
switch driver updates and fixes
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@2925 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'openwrt/target/linux/package/switch/src/switch-adm.c')
-rw-r--r-- | openwrt/target/linux/package/switch/src/switch-adm.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/openwrt/target/linux/package/switch/src/switch-adm.c b/openwrt/target/linux/package/switch/src/switch-adm.c index 6ad98447b..f2bc8e152 100644 --- a/openwrt/target/linux/package/switch/src/switch-adm.c +++ b/openwrt/target/linux/package/switch/src/switch-adm.c @@ -32,6 +32,7 @@ #include "gpio.h" #define DRIVER_NAME "adm6996" +#define DRIVER_VERSION "0.01" static int eecs = 2; static int eesk = 3; @@ -57,8 +58,9 @@ MODULE_PARM(force, "i"); #define adm_write16(cs, w) { __u16 val = hton16(w); adm_write(cs, (__u8 *)&val, sizeof(val)*8); } #define adm_write32(cs, i) { uint32 val = hton32(i); adm_write(cs, (__u8 *)&val, sizeof(val)*8); } +#define atoi(str) simple_strtoul(((str != NULL) ? str : ""), NULL, 0) -extern int getintvar(char **vars, char *name); +extern char *nvram_get(char *name); static void adm_write(int cs, char *buf, unsigned int bits) @@ -442,11 +444,8 @@ static int detect_adm() int ret = 0; #if defined(BCMGPIO2) || defined(BCMGPIO) -#ifdef LINUX_2_4 - int boardflags = getintvar(NULL, "boardflags"); -#else - extern int boardflags; -#endif + int boardflags = atoi(nvram_get("boardflags")); + if ((boardflags & 0x80) || force) ret = 1; else @@ -454,13 +453,6 @@ static int detect_adm() #else ret = 1; #endif - if (ret == 1) { - int i = adm_rreg(0, 0); - if ((i == 0) || (i == 0xffff)) { - printk("No ADM6996 chip detected.\n"); - ret = 0; - } - } return ret; } @@ -475,7 +467,7 @@ static int __init adm_init() {NULL, NULL, NULL} }; switch_config port[] = { - {"enabled", handle_port_enable_read, handle_port_enable_write}, + {"enable", handle_port_enable_read, handle_port_enable_write}, {"media", handle_port_media_read, handle_port_media_write}, {NULL, NULL, NULL} }; @@ -485,6 +477,7 @@ static int __init adm_init() }; switch_driver driver = { name: DRIVER_NAME, + version: DRIVER_VERSION, interface: "eth0", ports: 6, cpuport: 5, |