sr9700.c (b181f7029bd71238ac2754ce7052dffd69432085) | sr9700.c (f2b5be33a3b54564e6a1d8d290f7536f1aceeef5) |
---|---|
1/* 2 * CoreChip-sz SR9700 one chip USB 1.1 Ethernet Devices 3 * 4 * Author : Liu Junliang <liujunliang_ljl@163.com> 5 * 6 * Based on dm9601.c 7 * 8 * This file is licensed under the terms of the GNU General Public License --- 165 unchanged lines hidden (view full) --- 174 return ret; 175} 176 177static int sr_mdio_read(struct net_device *netdev, int phy_id, int loc) 178{ 179 struct usbnet *dev = netdev_priv(netdev); 180 __le16 res; 181 int rc = 0; | 1/* 2 * CoreChip-sz SR9700 one chip USB 1.1 Ethernet Devices 3 * 4 * Author : Liu Junliang <liujunliang_ljl@163.com> 5 * 6 * Based on dm9601.c 7 * 8 * This file is licensed under the terms of the GNU General Public License --- 165 unchanged lines hidden (view full) --- 174 return ret; 175} 176 177static int sr_mdio_read(struct net_device *netdev, int phy_id, int loc) 178{ 179 struct usbnet *dev = netdev_priv(netdev); 180 __le16 res; 181 int rc = 0; |
182 int err; |
|
182 183 if (phy_id) { 184 netdev_dbg(netdev, "Only internal phy supported\n"); 185 return 0; 186 } 187 188 /* Access NSR_LINKST bit for link status instead of MII_BMSR */ 189 if (loc == MII_BMSR) { 190 u8 value; 191 | 183 184 if (phy_id) { 185 netdev_dbg(netdev, "Only internal phy supported\n"); 186 return 0; 187 } 188 189 /* Access NSR_LINKST bit for link status instead of MII_BMSR */ 190 if (loc == MII_BMSR) { 191 u8 value; 192 |
192 sr_read_reg(dev, SR_NSR, &value); | 193 err = sr_read_reg(dev, SR_NSR, &value); 194 if (err < 0) 195 return err; 196 |
193 if (value & NSR_LINKST) 194 rc = 1; 195 } | 197 if (value & NSR_LINKST) 198 rc = 1; 199 } |
196 sr_share_read_word(dev, 1, loc, &res); | 200 err = sr_share_read_word(dev, 1, loc, &res); 201 if (err < 0) 202 return err; 203 |
197 if (rc == 1) 198 res = le16_to_cpu(res) | BMSR_LSTATUS; 199 else 200 res = le16_to_cpu(res) & ~BMSR_LSTATUS; 201 202 netdev_dbg(netdev, "sr_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x\n", 203 phy_id, loc, res); 204 --- 350 unchanged lines hidden --- | 204 if (rc == 1) 205 res = le16_to_cpu(res) | BMSR_LSTATUS; 206 else 207 res = le16_to_cpu(res) & ~BMSR_LSTATUS; 208 209 netdev_dbg(netdev, "sr_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x\n", 210 phy_id, loc, res); 211 --- 350 unchanged lines hidden --- |