projects
/
openwrt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[package] lua: add the 100-no_readline.patch to host build
[openwrt.git]
/
package
/
switch
/
src
/
switch-robo.c
diff --git
a/package/switch/src/switch-robo.c
b/package/switch/src/switch-robo.c
index
28d8de3
..
206359d
100644
(file)
--- a/
package/switch/src/switch-robo.c
+++ b/
package/switch/src/switch-robo.c
@@
-41,6
+41,7
@@
#define ROBO_PHY_ADDR 0x1E /* robo switch phy address */
#define ROBO_PHY_ADDR_TG3 0x01 /* Tigon3 PHY address */
#define ROBO_PHY_ADDR 0x1E /* robo switch phy address */
#define ROBO_PHY_ADDR_TG3 0x01 /* Tigon3 PHY address */
+#define ROBO_PHY_ADDR_BCM63XX 0x00 /* BCM63XX PHY address */
/* MII registers */
#define REG_MII_PAGE 0x10 /* MII Page register */
/* MII registers */
#define REG_MII_PAGE 0x10 /* MII Page register */
@@
-67,6
+68,14
@@
#define bool int
#endif
#define bool int
#endif
+/* Only available on brcm-2.4/brcm47xx */
+#ifdef BROADCOM
+extern char *nvram_get(const char *name);
+#define getvar(str) (nvram_get(str)?:"")
+#else
+#define getvar(str) ""
+#endif
+
/* Data structure for a Roboswitch device. */
struct robo_switch {
char *device; /* The device name string (ethX) */
/* Data structure for a Roboswitch device. */
struct robo_switch {
char *device; /* The device name string (ethX) */
@@
-92,7
+101,11
@@
static int do_ioctl(int cmd, void *buf)
robo.ifr.ifr_data = (caddr_t) buf;
set_fs(KERNEL_DS);
robo.ifr.ifr_data = (caddr_t) buf;
set_fs(KERNEL_DS);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+ ret = robo.dev->netdev_ops->ndo_do_ioctl(robo.dev, &robo.ifr, cmd);
+#else
ret = robo.dev->do_ioctl(robo.dev, &robo.ifr, cmd);
ret = robo.dev->do_ioctl(robo.dev, &robo.ifr, cmd);
+#endif
set_fs(old_fs);
return ret;
set_fs(old_fs);
return ret;
@@
-270,8
+283,9
@@
static int robo_switch_enable(void)
robo_write16(ROBO_CTRL_PAGE, i, 0);
}
robo_write16(ROBO_CTRL_PAGE, i, 0);
}
- /* WAN port LED */
- robo_write16(ROBO_CTRL_PAGE, 0x16, 0x1F);
+ /* WAN port LED, except for Netgear WGT634U */
+ if (strcmp(getvar("nvram_type"), "cfe") != 0)
+ robo_write16(ROBO_CTRL_PAGE, 0x16, 0x1F);
return 0;
}
return 0;
}
@@
-296,7
+310,11
@@
static int robo_probe(char *devname)
printk(KERN_INFO PFX "Probing device %s: ", devname);
strcpy(robo.ifr.ifr_name, devname);
printk(KERN_INFO PFX "Probing device %s: ", devname);
strcpy(robo.ifr.ifr_name, devname);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
if ((robo.dev = dev_get_by_name(devname)) == NULL) {
if ((robo.dev = dev_get_by_name(devname)) == NULL) {
+#else
+ if ((robo.dev = dev_get_by_name(&init_net, devname)) == NULL) {
+#endif
printk("No such device\n");
return 1;
}
printk("No such device\n");
return 1;
}
@@
-314,13
+332,14
@@
static int robo_probe(char *devname)
/* got phy address check for robo address */
struct mii_ioctl_data *mii = (struct mii_ioctl_data *) &robo.ifr.ifr_data;
if ((mii->phy_id != ROBO_PHY_ADDR) &&
/* got phy address check for robo address */
struct mii_ioctl_data *mii = (struct mii_ioctl_data *) &robo.ifr.ifr_data;
if ((mii->phy_id != ROBO_PHY_ADDR) &&
+ (mii->phy_id != ROBO_PHY_ADDR_BCM63XX) &&
(mii->phy_id != ROBO_PHY_ADDR_TG3)) {
printk("Invalid phy address (%d)\n", mii->phy_id);
return 1;
}
robo.use_et = 0;
/* The robo has a fixed PHY address that is different from the
(mii->phy_id != ROBO_PHY_ADDR_TG3)) {
printk("Invalid phy address (%d)\n", mii->phy_id);
return 1;
}
robo.use_et = 0;
/* The robo has a fixed PHY address that is different from the
- * Tigon3 PHY address. */
+ * Tigon3
and BCM63xx
PHY address. */
robo.phy_addr = ROBO_PHY_ADDR;
}
robo.phy_addr = ROBO_PHY_ADDR;
}
@@
-328,7
+347,7
@@
static int robo_probe(char *devname)
(mdio_read(robo.phy_addr, 0x3) << 16);
if (phyid == 0xffffffff || phyid == 0x55210022) {
(mdio_read(robo.phy_addr, 0x3) << 16);
if (phyid == 0xffffffff || phyid == 0x55210022) {
- printk("No Robo switch in managed mode found
\n"
);
+ printk("No Robo switch in managed mode found
, phy_id = 0x%08x\n", phyid
);
return 1;
}
return 1;
}
@@
-524,7
+543,8
@@
static int __init robo_init(void)
device = strdup("ethX");
for (device[3] = '0'; (device[3] <= '3') && notfound; device[3]++) {
device = strdup("ethX");
for (device[3] = '0'; (device[3] <= '3') && notfound; device[3]++) {
- notfound = robo_probe(device);
+ if (! switch_device_registered (device))
+ notfound = robo_probe(device);
}
device[3]--;
}
device[3]--;
This page took
0.02893 seconds
and
4
git commands to generate.