Commit 87177ba6 authored by Woojung.Huh@microchip.com's avatar Woojung.Huh@microchip.com Committed by David S. Miller

lan78xx: replace devid to chipid & chiprev

Replace devid to chipid & chiprev for easy access.
Signed-off-by: default avatarWoojung Huh <woojung.huh@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 49eb9389
...@@ -278,7 +278,8 @@ struct lan78xx_net { ...@@ -278,7 +278,8 @@ struct lan78xx_net {
int link_on; int link_on;
u8 mdix_ctrl; u8 mdix_ctrl;
u32 devid; u32 chipid;
u32 chiprev;
struct mii_bus *mdiobus; struct mii_bus *mdiobus;
}; };
...@@ -471,7 +472,7 @@ static int lan78xx_read_raw_eeprom(struct lan78xx_net *dev, u32 offset, ...@@ -471,7 +472,7 @@ static int lan78xx_read_raw_eeprom(struct lan78xx_net *dev, u32 offset,
*/ */
ret = lan78xx_read_reg(dev, HW_CFG, &val); ret = lan78xx_read_reg(dev, HW_CFG, &val);
saved = val; saved = val;
if ((dev->devid & ID_REV_CHIP_ID_MASK_) == 0x78000000) { if (dev->chipid == ID_REV_CHIP_ID_7800_) {
val &= ~(HW_CFG_LED1_EN_ | HW_CFG_LED0_EN_); val &= ~(HW_CFG_LED1_EN_ | HW_CFG_LED0_EN_);
ret = lan78xx_write_reg(dev, HW_CFG, val); ret = lan78xx_write_reg(dev, HW_CFG, val);
} }
...@@ -505,7 +506,7 @@ static int lan78xx_read_raw_eeprom(struct lan78xx_net *dev, u32 offset, ...@@ -505,7 +506,7 @@ static int lan78xx_read_raw_eeprom(struct lan78xx_net *dev, u32 offset,
retval = 0; retval = 0;
exit: exit:
if ((dev->devid & ID_REV_CHIP_ID_MASK_) == 0x78000000) if (dev->chipid == ID_REV_CHIP_ID_7800_)
ret = lan78xx_write_reg(dev, HW_CFG, saved); ret = lan78xx_write_reg(dev, HW_CFG, saved);
return retval; return retval;
...@@ -539,7 +540,7 @@ static int lan78xx_write_raw_eeprom(struct lan78xx_net *dev, u32 offset, ...@@ -539,7 +540,7 @@ static int lan78xx_write_raw_eeprom(struct lan78xx_net *dev, u32 offset,
*/ */
ret = lan78xx_read_reg(dev, HW_CFG, &val); ret = lan78xx_read_reg(dev, HW_CFG, &val);
saved = val; saved = val;
if ((dev->devid & ID_REV_CHIP_ID_MASK_) == 0x78000000) { if (dev->chipid == ID_REV_CHIP_ID_7800_) {
val &= ~(HW_CFG_LED1_EN_ | HW_CFG_LED0_EN_); val &= ~(HW_CFG_LED1_EN_ | HW_CFG_LED0_EN_);
ret = lan78xx_write_reg(dev, HW_CFG, val); ret = lan78xx_write_reg(dev, HW_CFG, val);
} }
...@@ -587,7 +588,7 @@ static int lan78xx_write_raw_eeprom(struct lan78xx_net *dev, u32 offset, ...@@ -587,7 +588,7 @@ static int lan78xx_write_raw_eeprom(struct lan78xx_net *dev, u32 offset,
retval = 0; retval = 0;
exit: exit:
if ((dev->devid & ID_REV_CHIP_ID_MASK_) == 0x78000000) if (dev->chipid == ID_REV_CHIP_ID_7800_)
ret = lan78xx_write_reg(dev, HW_CFG, saved); ret = lan78xx_write_reg(dev, HW_CFG, saved);
return retval; return retval;
...@@ -1555,9 +1556,9 @@ static int lan78xx_mdio_init(struct lan78xx_net *dev) ...@@ -1555,9 +1556,9 @@ static int lan78xx_mdio_init(struct lan78xx_net *dev)
snprintf(dev->mdiobus->id, MII_BUS_ID_SIZE, "usb-%03d:%03d", snprintf(dev->mdiobus->id, MII_BUS_ID_SIZE, "usb-%03d:%03d",
dev->udev->bus->busnum, dev->udev->devnum); dev->udev->bus->busnum, dev->udev->devnum);
switch (dev->devid & ID_REV_CHIP_ID_MASK_) { switch (dev->chipid) {
case 0x78000000: case ID_REV_CHIP_ID_7800_:
case 0x78500000: case ID_REV_CHIP_ID_7850_:
/* set to internal PHY id */ /* set to internal PHY id */
dev->mdiobus->phy_mask = ~(1 << 1); dev->mdiobus->phy_mask = ~(1 << 1);
break; break;
...@@ -1918,7 +1919,8 @@ static int lan78xx_reset(struct lan78xx_net *dev) ...@@ -1918,7 +1919,8 @@ static int lan78xx_reset(struct lan78xx_net *dev)
/* save DEVID for later usage */ /* save DEVID for later usage */
ret = lan78xx_read_reg(dev, ID_REV, &buf); ret = lan78xx_read_reg(dev, ID_REV, &buf);
dev->devid = buf; dev->chipid = (buf & ID_REV_CHIP_ID_MASK_) >> 16;
dev->chiprev = buf & ID_REV_CHIP_REV_MASK_;
/* Respond to the IN token with a NAK */ /* Respond to the IN token with a NAK */
ret = lan78xx_read_reg(dev, USB_CFG0, &buf); ret = lan78xx_read_reg(dev, USB_CFG0, &buf);
......
...@@ -107,6 +107,7 @@ ...@@ -107,6 +107,7 @@
#define ID_REV_CHIP_ID_MASK_ (0xFFFF0000) #define ID_REV_CHIP_ID_MASK_ (0xFFFF0000)
#define ID_REV_CHIP_REV_MASK_ (0x0000FFFF) #define ID_REV_CHIP_REV_MASK_ (0x0000FFFF)
#define ID_REV_CHIP_ID_7800_ (0x7800) #define ID_REV_CHIP_ID_7800_ (0x7800)
#define ID_REV_CHIP_ID_7850_ (0x7850)
#define FPGA_REV (0x04) #define FPGA_REV (0x04)
#define FPGA_REV_MINOR_MASK_ (0x0000FF00) #define FPGA_REV_MINOR_MASK_ (0x0000FF00)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment