X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/69ae98b46ec77c81215a3c334fd0f85df4888a4c..6c0e77acf3e17c6e76b8b68c1b54b5d4b57e541d:/package/switch/src/switch-adm.c diff --git a/package/switch/src/switch-adm.c b/package/switch/src/switch-adm.c index 8d2712001..85805f6b3 100644 --- a/package/switch/src/switch-adm.c +++ b/package/switch/src/switch-adm.c @@ -26,7 +26,7 @@ * 02110-1301, USA. */ -#include +#include #include #include #include @@ -49,11 +49,19 @@ static int force = 0; MODULE_AUTHOR("Felix Fietkau "); MODULE_LICENSE("GPL"); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52) +module_param(eecs, int, 0); +module_param(eesk, int, 0); +module_param(eedi, int, 0); +module_param(eerc, int, 0); +module_param(force, int, 0); +#else MODULE_PARM(eecs, "i"); MODULE_PARM(eesk, "i"); MODULE_PARM(eedi, "i"); MODULE_PARM(eerc, "i"); MODULE_PARM(force, "i"); +#endif /* Minimum timing constants */ #define EECK_EDGE_TIME 3 /* 3us - max(adm 2.5us, 93c 1us) */ @@ -215,7 +223,7 @@ static __u32 adm_rreg(__u8 table, __u8 addr) __u8 bits[6] = { 0xFF, 0xFF, 0xFF, 0xFF, (0x06 << 4) | ((table & 0x01) << 3 | (addr&64)>>6), - ((addr&62)<<2) + ((addr&63)<<2) }; __u8 rbits[4]; @@ -484,14 +492,23 @@ static int handle_counters(void *driver, char *buf, int nr) return len; } -static int detect_adm() +static int detect_adm(void) { int ret = 0; #if defined(BCMGPIO2) || defined(BCMGPIO) int boardflags = atoi(nvram_get("boardflags")); + int boardnum = atoi(nvram_get("boardnum")); + + if (boardnum == 44) { /* Trendware TEW-411BRP+ */ + ret = 1; + + eecs = getgpiopin("adm_eecs", 2); + eesk = getgpiopin("adm_eesk", 3); + eedi = getgpiopin("adm_eedi", 4); + eerc = getgpiopin("adm_rc", 5); - if ((boardflags & 0x80) || force) { + } else if ((boardflags & 0x80) || force) { ret = 1; eecs = getgpiopin("adm_eecs", 2); @@ -525,7 +542,7 @@ static int detect_adm() return ret; } -static int __init adm_init() +static int __init adm_init(void) { switch_config cfg[] = { {"registers", handle_registers, NULL}, @@ -561,7 +578,7 @@ static int __init adm_init() return switch_register_driver(&driver); } -static void __exit adm_exit() +static void __exit adm_exit(void) { switch_unregister_driver(DRIVER_NAME); }