switch driver updates and fixes

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@2925 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
Felix Fietkau
2006-01-11 22:57:52 +00:00
parent 474fce52d5
commit 6ebdfb8b2c
4 changed files with 134 additions and 35 deletions

View File

@@ -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,