sr9700.c (2b4731b153b4621064d9e899a92f6c03199630f1) sr9700.c (2674e7ea22ba0e22a2d1603bd51e0b8f6442a267)
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

--- 306 unchanged lines hidden (view full) ---

315 .ndo_set_rx_mode = sr9700_set_multicast,
316 .ndo_set_mac_address = sr9700_set_mac_address,
317};
318
319static int sr9700_bind(struct usbnet *dev, struct usb_interface *intf)
320{
321 struct net_device *netdev;
322 struct mii_if_info *mii;
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

--- 306 unchanged lines hidden (view full) ---

315 .ndo_set_rx_mode = sr9700_set_multicast,
316 .ndo_set_mac_address = sr9700_set_mac_address,
317};
318
319static int sr9700_bind(struct usbnet *dev, struct usb_interface *intf)
320{
321 struct net_device *netdev;
322 struct mii_if_info *mii;
323 u8 addr[ETH_ALEN];
323 int ret;
324
325 ret = usbnet_get_endpoints(dev, intf);
326 if (ret)
327 goto out;
328
329 netdev = dev->net;
330

--- 14 unchanged lines hidden (view full) ---

345 sr_write_reg(dev, SR_NCR, NCR_RST);
346 udelay(20);
347
348 /* read MAC
349 * After Chip Power on, the Chip will reload the MAC from
350 * EEPROM automatically to PAR. In case there is no EEPROM externally,
351 * a default MAC address is stored in PAR for making chip work properly.
352 */
324 int ret;
325
326 ret = usbnet_get_endpoints(dev, intf);
327 if (ret)
328 goto out;
329
330 netdev = dev->net;
331

--- 14 unchanged lines hidden (view full) ---

346 sr_write_reg(dev, SR_NCR, NCR_RST);
347 udelay(20);
348
349 /* read MAC
350 * After Chip Power on, the Chip will reload the MAC from
351 * EEPROM automatically to PAR. In case there is no EEPROM externally,
352 * a default MAC address is stored in PAR for making chip work properly.
353 */
353 if (sr_read(dev, SR_PAR, ETH_ALEN, netdev->dev_addr) < 0) {
354 if (sr_read(dev, SR_PAR, ETH_ALEN, addr) < 0) {
354 netdev_err(netdev, "Error reading MAC address\n");
355 ret = -ENODEV;
356 goto out;
357 }
355 netdev_err(netdev, "Error reading MAC address\n");
356 ret = -ENODEV;
357 goto out;
358 }
359 eth_hw_addr_set(netdev, addr);
358
359 /* power up and reset phy */
360 sr_write_reg(dev, SR_PRR, PRR_PHY_RST);
361 /* at least 10ms, here 20ms for safe */
362 msleep(20);
363 sr_write_reg(dev, SR_PRR, 0);
364 /* at least 1ms, here 2ms for reading right register */
365 udelay(2 * 1000);

--- 191 unchanged lines hidden ---
360
361 /* power up and reset phy */
362 sr_write_reg(dev, SR_PRR, PRR_PHY_RST);
363 /* at least 10ms, here 20ms for safe */
364 msleep(20);
365 sr_write_reg(dev, SR_PRR, 0);
366 /* at least 1ms, here 2ms for reading right register */
367 udelay(2 * 1000);

--- 191 unchanged lines hidden ---