switch: improve error messages
This is in part based on a patch send by Nathan Hintz <nlhintz@hotmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34991 3c298f89-4303-0410-b956-a3cf2f4a3e73master
parent
739d7e10d7
commit
477d74b42b
|
@ -103,8 +103,7 @@ static u16 mdio_read(__u16 phy_id, __u8 reg)
|
||||||
|
|
||||||
err = do_ioctl(SIOCGMIIREG);
|
err = do_ioctl(SIOCGMIIREG);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
printk(KERN_ERR PFX
|
printk(KERN_ERR PFX "failed to read mdio reg %i with err %i.\n", reg, err);
|
||||||
"[%s:%d] SIOCGMIIREG failed! err: %i\n", __FILE__, __LINE__, err);
|
|
||||||
|
|
||||||
return 0xffff;
|
return 0xffff;
|
||||||
}
|
}
|
||||||
|
@ -123,8 +122,7 @@ static void mdio_write(__u16 phy_id, __u8 reg, __u16 val)
|
||||||
|
|
||||||
err = do_ioctl(SIOCSMIIREG);
|
err = do_ioctl(SIOCSMIIREG);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
printk(KERN_ERR PFX
|
printk(KERN_ERR PFX "failed to write mdio reg: %i with err %i.\n", reg, err);
|
||||||
"[%s:%d] SIOCSMIIREG failed! err: %i\n", __FILE__, __LINE__, err);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,7 +145,7 @@ static int robo_reg(__u8 page, __u8 reg, __u8 op)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_ERR PFX "[%s:%d] timeout in robo_reg!\n", __FILE__, __LINE__);
|
printk(KERN_ERR PFX "timeout in robo_reg on page %i and reg %i with op %i.\n", page, reg, op);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -224,7 +222,7 @@ static int robo_switch_enable(void)
|
||||||
robo_write16(ROBO_CTRL_PAGE, ROBO_SWITCH_MODE, val);
|
robo_write16(ROBO_CTRL_PAGE, ROBO_SWITCH_MODE, val);
|
||||||
val = robo_read16(ROBO_CTRL_PAGE, ROBO_SWITCH_MODE);
|
val = robo_read16(ROBO_CTRL_PAGE, ROBO_SWITCH_MODE);
|
||||||
if (!(val & (1 << 1))) {
|
if (!(val & (1 << 1))) {
|
||||||
printk("Failed to enable switch\n");
|
printk(KERN_ERR PFX "Failed to enable switch\n");
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,15 +260,15 @@ static int robo_probe(char *devname)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int err = 1;
|
int err = 1;
|
||||||
|
|
||||||
printk(KERN_INFO PFX "Probing device %s: ", devname);
|
printk(KERN_INFO PFX "Probing device '%s'\n", devname);
|
||||||
strcpy(robo.ifr.ifr_name, devname);
|
strcpy(robo.ifr.ifr_name, devname);
|
||||||
|
|
||||||
if ((robo.dev = dev_get_by_name(&init_net, devname)) == NULL) {
|
if ((robo.dev = dev_get_by_name(&init_net, devname)) == NULL) {
|
||||||
printk("No such device\n");
|
printk(KERN_ERR PFX "No such device\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (!robo.dev->netdev_ops || !robo.dev->netdev_ops->ndo_do_ioctl) {
|
if (!robo.dev->netdev_ops || !robo.dev->netdev_ops->ndo_do_ioctl) {
|
||||||
printk("ndo_do_ioctl not implemented in ethernet driver\n");
|
printk(KERN_ERR PFX "ndo_do_ioctl not implemented in ethernet driver\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,8 +278,9 @@ static int robo_probe(char *devname)
|
||||||
robo.port[5] = 8;
|
robo.port[5] = 8;
|
||||||
|
|
||||||
/* try access using MII ioctls - get phy address */
|
/* try access using MII ioctls - get phy address */
|
||||||
if (do_ioctl(SIOCGMIIPHY) < 0) {
|
err = do_ioctl(SIOCGMIIPHY);
|
||||||
printk("error while accessing MII phy registers with ioctls\n");
|
if (err < 0) {
|
||||||
|
printk(KERN_ERR PFX "error (%i) while accessing MII phy registers with ioctls\n", err);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +289,7 @@ static int robo_probe(char *devname)
|
||||||
if ((mii->phy_id != ROBO_PHY_ADDR) &&
|
if ((mii->phy_id != ROBO_PHY_ADDR) &&
|
||||||
(mii->phy_id != ROBO_PHY_ADDR_BCM63XX) &&
|
(mii->phy_id != ROBO_PHY_ADDR_BCM63XX) &&
|
||||||
(mii->phy_id != ROBO_PHY_ADDR_TG3)) {
|
(mii->phy_id != ROBO_PHY_ADDR_TG3)) {
|
||||||
printk("Invalid phy address (%d)\n", mii->phy_id);
|
printk(KERN_ERR PFX "Invalid phy address (%d)\n", mii->phy_id);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +297,7 @@ static int robo_probe(char *devname)
|
||||||
(mdio_read(ROBO_PHY_ADDR, 0x3) << 16);
|
(mdio_read(ROBO_PHY_ADDR, 0x3) << 16);
|
||||||
|
|
||||||
if (phyid == 0xffffffff || phyid == 0x55210022) {
|
if (phyid == 0xffffffff || phyid == 0x55210022) {
|
||||||
printk("No Robo switch in managed mode found, phy_id = 0x%08x\n", phyid);
|
printk(KERN_ERR PFX "No Robo switch in managed mode found, phy_id = 0x%08x\n", phyid);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,8 +318,8 @@ static int robo_probe(char *devname)
|
||||||
goto done;
|
goto done;
|
||||||
err = 0;
|
err = 0;
|
||||||
|
|
||||||
printk("found a 5%s%x!%s\n", robo.devid & 0xff00 ? "" : "3", robo.devid,
|
printk(KERN_INFO PFX "found a 5%s%x!%s at %s\n", robo.devid & 0xff00 ? "" : "3", robo.devid,
|
||||||
robo.is_5350 ? " It's a 5350." : "");
|
robo.is_5350 ? " It's a 5350." : "", devname);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
Loading…
Reference in New Issue