1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-27 19:25:21 +02:00

make etehrent work on wrt350n, thx sn9

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18214 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
blogic 2009-10-29 21:26:36 +00:00
parent 91c099418f
commit 70916d05de
2 changed files with 28 additions and 4 deletions

View File

@ -58,6 +58,7 @@
#define ROBO_DEVICE_ID_5395 0x95 #define ROBO_DEVICE_ID_5395 0x95
#define ROBO_DEVICE_ID_5397 0x97 #define ROBO_DEVICE_ID_5397 0x97
#define ROBO_DEVICE_ID_5398 0x98 #define ROBO_DEVICE_ID_5398 0x98
#define ROBO_DEVICE_ID_53115 0x3115
/* Private et.o ioctls */ /* Private et.o ioctls */
#define SIOCGETCPHYRD (SIOCDEVPRIVATE + 9) #define SIOCGETCPHYRD (SIOCDEVPRIVATE + 9)
@ -297,6 +298,7 @@ static void robo_switch_reset(void)
(robo.devid == ROBO_DEVICE_ID_5398)) { (robo.devid == ROBO_DEVICE_ID_5398)) {
/* Trigger a software reset. */ /* Trigger a software reset. */
robo_write16(ROBO_CTRL_PAGE, 0x79, 0x83); robo_write16(ROBO_CTRL_PAGE, 0x79, 0x83);
mdelay(500);
robo_write16(ROBO_CTRL_PAGE, 0x79, 0); robo_write16(ROBO_CTRL_PAGE, 0x79, 0);
} }
} }
@ -367,7 +369,8 @@ static int robo_probe(char *devname)
if (err) if (err)
return err; return err;
printk("found!\n"); printk("found a 5%s%x!%s\n", robo.devid & 0xff00 ? "" : "3", robo.devid,
robo.is_5350 ? " It's a 5350." : "");
return 0; return 0;
} }
@ -445,6 +448,17 @@ static int handle_vlan_port_write(void *driver, char *buf, int nr)
} }
/* write config now */ /* write config now */
if (robo.devid != ROBO_DEVICE_ID_5325) {
__u8 regoff = ((robo.devid == ROBO_DEVICE_ID_5395) ||
(robo.devid == ROBO_DEVICE_ID_53115)) ? 0x20 : 0;
robo_write32(ROBO_ARLIO_PAGE, 0x63 + regoff, (c->untag << 9) | c->port);
robo_write16(ROBO_ARLIO_PAGE, 0x61 + regoff, nr);
robo_write16(ROBO_ARLIO_PAGE, 0x60 + regoff, 1 << 7);
return 0;
}
val16 = (nr) /* vlan */ | (1 << 12) /* write */ | (1 << 13) /* enable */; val16 = (nr) /* vlan */ | (1 << 12) /* write */ | (1 << 13) /* enable */;
if (robo.is_5350) { if (robo.is_5350) {
robo_write32(ROBO_VLAN_PAGE, ROBO_VLAN_WRITE_5350, robo_write32(ROBO_VLAN_PAGE, ROBO_VLAN_WRITE_5350,
@ -486,7 +500,12 @@ static int handle_enable_vlan_write(void *driver, char *buf, int nr)
robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL0, disable ? 0 : robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL0, disable ? 0 :
(1 << 7) /* 802.1Q VLAN */ | (3 << 5) /* mac check and hash */); (1 << 7) /* 802.1Q VLAN */ | (3 << 5) /* mac check and hash */);
robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL1, disable ? 0 : robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL1, disable ? 0 :
(1 << 1) | (1 << 2) | (1 << 3) /* RSV multicast */); (robo.devid == ROBO_DEVICE_ID_5325 ? (1 << 1) : 0) | /* RSV multicast */
robo_read16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL0) | (1 << 2) | (1 << 3));
if (robo.devid != ROBO_DEVICE_ID_5325)
return 0;
robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL4, disable ? 0 : robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL4, disable ? 0 :
(1 << 6) /* drop invalid VID frames */); (1 << 6) /* drop invalid VID frames */);
robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL5, disable ? 0 : robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL5, disable ? 0 :
@ -585,6 +604,10 @@ static int __init robo_init(void)
.port_handlers = NULL, .port_handlers = NULL,
.vlan_handlers = vlan, .vlan_handlers = vlan,
}; };
if (robo.devid != ROBO_DEVICE_ID_5325) {
driver.ports = 9;
driver.cpuport = 8;
}
return switch_register_driver(&driver); return switch_register_driver(&driver);
} }

View File

@ -37,8 +37,6 @@ case "$(cat /proc/diag/model)" in
"Sitecom WL-105b") ifname=eth1;; "Sitecom WL-105b") ifname=eth1;;
esac esac
failsafe_ip
check_module () { check_module () {
module="$1"; shift; params="$*" module="$1"; shift; params="$*"
@ -48,11 +46,14 @@ check_module () {
return $? return $?
} }
check_module tg3
insmod switch-core insmod switch-core
check_module switch-robo || check_module switch-adm || { check_module switch-robo || check_module switch-adm || {
check_module bcm57xx activate_gpio=0x4 && cpu_port="8u*" check_module bcm57xx activate_gpio=0x4 && cpu_port="8u*"
} || rmmod switch-core } || rmmod switch-core
failsafe_ip
[ -d /proc/switch/eth0 ] && { [ -d /proc/switch/eth0 ] && {
echo 1 > /proc/switch/eth0/reset echo 1 > /proc/switch/eth0/reset