summaryrefslogtreecommitdiff
path: root/target/linux/package/switch/src/switch-adm.c
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/package/switch/src/switch-adm.c')
-rw-r--r--target/linux/package/switch/src/switch-adm.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/target/linux/package/switch/src/switch-adm.c b/target/linux/package/switch/src/switch-adm.c
index 6ad98447b3..f2bc8e152e 100644
--- a/target/linux/package/switch/src/switch-adm.c
+++ b/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,