projects
/
openwrt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move curl from packages to trunk, opkg depends on it
[openwrt.git]
/
package
/
switch
/
src
/
switch-adm.c
diff --git
a/package/switch/src/switch-adm.c
b/package/switch/src/switch-adm.c
index
8d27120
..
8d5de04
100644
(file)
--- a/
package/switch/src/switch-adm.c
+++ b/
package/switch/src/switch-adm.c
@@
-26,7
+26,7
@@
* 02110-1301, USA.
*/
* 02110-1301, USA.
*/
-#include <linux/
config
.h>
+#include <linux/
autoconf
.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/if.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/if.h>
@@
-49,11
+49,19
@@
static int force = 0;
MODULE_AUTHOR("Felix Fietkau <openwrt@nbd.name>");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Felix Fietkau <openwrt@nbd.name>");
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");
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) */
/* Minimum timing constants */
#define EECK_EDGE_TIME 3 /* 3us - max(adm 2.5us, 93c 1us) */
@@
-67,7
+75,7
@@
MODULE_PARM(force, "i");
#define atoi(str) simple_strtoul(((str != NULL) ? str : ""), NULL, 0)
#define atoi(str) simple_strtoul(((str != NULL) ? str : ""), NULL, 0)
-#if
defined(BCMGPIO2) || defined(BCMGPIO)
+#if
def BROADCOM
extern char *nvram_get(char *name);
/* Return gpio pin number assigned to the named pin */
extern char *nvram_get(char *name);
/* Return gpio pin number assigned to the named pin */
@@
-78,7
+86,7
@@
extern char *nvram_get(char *name);
*
* 'def_pin' is returned if there is no such variable found.
*/
*
* 'def_pin' is returned if there is no such variable found.
*/
-static unsigned int getgpiopin(char *pin_name, unsigned int def_pin)
+static unsigned int get
_
gpiopin(char *pin_name, unsigned int def_pin)
{
char name[] = "gpioXXXX";
char *val;
{
char name[] = "gpioXXXX";
char *val;
@@
-101,7
+109,7
@@
static void adm_write(int cs, char *buf, unsigned int bits)
int i, len = (bits + 7) / 8;
__u8 mask;
int i, len = (bits + 7) / 8;
__u8 mask;
- gpioout(eecs, (cs ? eecs : 0));
+ gpio
_
out(eecs, (cs ? eecs : 0));
udelay(EECK_EDGE_TIME);
/* Byte assemble from MSB to LSB */
udelay(EECK_EDGE_TIME);
/* Byte assemble from MSB to LSB */
@@
-109,25
+117,25
@@
static void adm_write(int cs, char *buf, unsigned int bits)
/* Bit bang from MSB to LSB */
for (mask = 0x80; mask && bits > 0; mask >>= 1, bits --) {
/* Clock low */
/* Bit bang from MSB to LSB */
for (mask = 0x80; mask && bits > 0; mask >>= 1, bits --) {
/* Clock low */
- gpioout(eesk, 0);
+ gpio
_
out(eesk, 0);
udelay(EECK_EDGE_TIME);
/* Output on rising edge */
udelay(EECK_EDGE_TIME);
/* Output on rising edge */
- gpioout(eedi, ((mask & buf[i]) ? eedi : 0));
+ gpio
_
out(eedi, ((mask & buf[i]) ? eedi : 0));
udelay(EEDI_SETUP_TIME);
/* Clock high */
udelay(EEDI_SETUP_TIME);
/* Clock high */
- gpioout(eesk, eesk);
+ gpio
_
out(eesk, eesk);
udelay(EECK_EDGE_TIME);
}
}
/* Clock low */
udelay(EECK_EDGE_TIME);
}
}
/* Clock low */
- gpioout(eesk, 0);
+ gpio
_
out(eesk, 0);
udelay(EECK_EDGE_TIME);
if (cs)
udelay(EECK_EDGE_TIME);
if (cs)
- gpioout(eecs, 0);
+ gpio
_
out(eecs, 0);
}
}
@@
-136,7
+144,7
@@
static void adm_read(int cs, char *buf, unsigned int bits)
int i, len = (bits + 7) / 8;
__u8 mask;
int i, len = (bits + 7) / 8;
__u8 mask;
- gpioout(eecs, (cs ? eecs : 0));
+ gpio
_
out(eecs, (cs ? eecs : 0));
udelay(EECK_EDGE_TIME);
/* Byte assemble from MSB to LSB */
udelay(EECK_EDGE_TIME);
/* Byte assemble from MSB to LSB */
@@
-148,16
+156,16
@@
static void adm_read(int cs, char *buf, unsigned int bits)
__u8 gp;
/* Clock low */
__u8 gp;
/* Clock low */
- gpioout(eesk, 0);
+ gpio
_
out(eesk, 0);
udelay(EECK_EDGE_TIME);
/* Input on rising edge */
udelay(EECK_EDGE_TIME);
/* Input on rising edge */
- gp = gpioin();
+ gp = gpio
_
in();
if (gp & eedi)
byte |= mask;
/* Clock high */
if (gp & eedi)
byte |= mask;
/* Clock high */
- gpioout(eesk, eesk);
+ gpio
_
out(eesk, eesk);
udelay(EECK_EDGE_TIME);
}
udelay(EECK_EDGE_TIME);
}
@@
-165,11
+173,11
@@
static void adm_read(int cs, char *buf, unsigned int bits)
}
/* Clock low */
}
/* Clock low */
- gpioout(eesk, 0);
+ gpio
_
out(eesk, 0);
udelay(EECK_EDGE_TIME);
if (cs)
udelay(EECK_EDGE_TIME);
if (cs)
- gpioout(eecs, 0);
+ gpio
_
out(eecs, 0);
}
}
@@
-177,10
+185,10
@@
static void adm_read(int cs, char *buf, unsigned int bits)
static void adm_enout(__u8 pins, __u8 val)
{
/* Prepare GPIO output value */
static void adm_enout(__u8 pins, __u8 val)
{
/* Prepare GPIO output value */
- gpioout(pins, val);
+ gpio
_
out(pins, val);
/* Enable GPIO outputs */
/* Enable GPIO outputs */
- gpioouten(pins, pins);
+ gpio
_
outen(pins, pins);
udelay(EECK_EDGE_TIME);
}
udelay(EECK_EDGE_TIME);
}
@@
-189,7
+197,7
@@
static void adm_enout(__u8 pins, __u8 val)
static void adm_disout(__u8 pins)
{
/* Disable GPIO outputs */
static void adm_disout(__u8 pins)
{
/* Disable GPIO outputs */
- gpioouten(pins, 0);
+ gpio
_
outen(pins, 0);
udelay(EECK_EDGE_TIME);
}
udelay(EECK_EDGE_TIME);
}
@@
-200,11
+208,11
@@
static void adm_adclk(int clocks)
int i;
for (i = 0; i < clocks; i++) {
/* Clock high */
int i;
for (i = 0; i < clocks; i++) {
/* Clock high */
- gpioout(eesk, eesk);
+ gpio
_
out(eesk, eesk);
udelay(EECK_EDGE_TIME);
/* Clock low */
udelay(EECK_EDGE_TIME);
/* Clock low */
- gpioout(eesk, 0);
+ gpio
_
out(eesk, 0);
udelay(EECK_EDGE_TIME);
}
}
udelay(EECK_EDGE_TIME);
}
}
@@
-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),
__u8 bits[6] = {
0xFF, 0xFF, 0xFF, 0xFF,
(0x06 << 4) | ((table & 0x01) << 3 | (addr&64)>>6),
- ((addr&6
2
)<<2)
+ ((addr&6
3
)<<2)
};
__u8 rbits[4];
};
__u8 rbits[4];
@@
-484,20
+492,29
@@
static int handle_counters(void *driver, char *buf, int nr)
return len;
}
return len;
}
-static int detect_adm()
+static int detect_adm(
void
)
{
int ret = 0;
{
int ret = 0;
-#if
defined(BCMGPIO2) || defined(BCMGPIO)
+#if
def BROADCOM
int boardflags = atoi(nvram_get("boardflags"));
int boardflags = atoi(nvram_get("boardflags"));
+ int boardnum = atoi(nvram_get("boardnum"));
+
+ if ((boardnum == 44) && (boardflags == 0x0388)) { /* Trendware TEW-411BRP+ */
+ ret = 1;
+
+ eecs = get_gpiopin("adm_eecs", 2);
+ eesk = get_gpiopin("adm_eesk", 3);
+ eedi = get_gpiopin("adm_eedi", 4);
+ eerc = get_gpiopin("adm_rc", 5);
- if ((boardflags & 0x80) || force) {
+
} else
if ((boardflags & 0x80) || force) {
ret = 1;
ret = 1;
- eecs = getgpiopin("adm_eecs", 2);
- eesk = getgpiopin("adm_eesk", 3);
- eedi = getgpiopin("adm_eedi", 4);
- eerc = getgpiopin("adm_rc", 0);
+ eecs = get
_
gpiopin("adm_eecs", 2);
+ eesk = get
_
gpiopin("adm_eesk", 3);
+ eedi = get
_
gpiopin("adm_eedi", 4);
+ eerc = get
_
gpiopin("adm_rc", 0);
} else if ((strcmp(nvram_get("boardtype") ?: "", "bcm94710dev") == 0) &&
(strncmp(nvram_get("boardnum") ?: "", "42", 2) == 0)) {
} else if ((strcmp(nvram_get("boardtype") ?: "", "bcm94710dev") == 0) &&
(strncmp(nvram_get("boardnum") ?: "", "42", 2) == 0)) {
@@
-525,7
+542,7
@@
static int detect_adm()
return ret;
}
return ret;
}
-static int __init adm_init()
+static int __init adm_init(
void
)
{
switch_config cfg[] = {
{"registers", handle_registers, NULL},
{
switch_config cfg[] = {
{"registers", handle_registers, NULL},
@@
-561,7
+578,7
@@
static int __init adm_init()
return switch_register_driver(&driver);
}
return switch_register_driver(&driver);
}
-static void __exit adm_exit()
+static void __exit adm_exit(
void
)
{
switch_unregister_driver(DRIVER_NAME);
}
{
switch_unregister_driver(DRIVER_NAME);
}
This page took
0.02853 seconds
and
4
git commands to generate.