Lines Matching refs:ndev
431 struct net_device *ndev; member
1113 static int sunxi_gmac_stop(struct net_device *ndev);
1134 struct net_device *ndev = dev_get_drvdata(dev); in sunxi_gmac_extra_tx_stats_show() local
1135 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_extra_tx_stats_show()
1154 struct net_device *ndev = dev_get_drvdata(dev); in sunxi_gmac_extra_rx_stats_show() local
1155 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_extra_rx_stats_show()
1193 struct net_device *ndev = dev_get_drvdata(dev); in sunxi_gmac_gphy_test_store() local
1197 phyreg_val = phy_read(ndev->phydev, MII_CTRL1000); in sunxi_gmac_gphy_test_store()
1207 phy_write(ndev->phydev, MII_CTRL1000, phyreg_val); in sunxi_gmac_gphy_test_store()
1208 netdev_info(ndev, "Set MII_CTRL1000(0x09) Reg: 0x%x\n", phyreg_val); in sunxi_gmac_gphy_test_store()
1210 netdev_err(ndev, "Error: Unknown value (%d)\n", value); in sunxi_gmac_gphy_test_store()
1227 struct net_device *ndev = dev_get_drvdata(dev); in sunxi_gmac_mii_read_store() local
1231 if (!netif_running(ndev)) { in sunxi_gmac_mii_read_store()
1232 netdev_err(ndev, "Error: Nic is down\n"); in sunxi_gmac_mii_read_store()
1240 phyreg_val = phy_read(ndev->phydev, phyreg); in sunxi_gmac_mii_read_store()
1241 netdev_info(ndev, "PHYREG[0x%02x] = 0x%04x\n", phyreg, phyreg_val); in sunxi_gmac_mii_read_store()
1256 struct net_device *ndev = dev_get_drvdata(dev); in sunxi_gmac_mii_write_store() local
1266 if (!netif_running(ndev)) { in sunxi_gmac_mii_write_store()
1267 netdev_err(ndev, "Error: Nic is down\n"); in sunxi_gmac_mii_write_store()
1284 phyreg_val_before = phy_read(ndev->phydev, userspace_cmd[0]); in sunxi_gmac_mii_write_store()
1285 phy_write(ndev->phydev, userspace_cmd[0], userspace_cmd[1]); in sunxi_gmac_mii_write_store()
1286 phyreg_val_after = phy_read(ndev->phydev, userspace_cmd[0]); in sunxi_gmac_mii_write_store()
1287 netdev_info(ndev, "before PHYREG[0x%02x] = 0x%04x, after PHYREG[0x%02x] = 0x%04x\n", in sunxi_gmac_mii_write_store()
1298 struct net_device *ndev = dev_get_drvdata(dev); in sunxi_gmac_loopback_show() local
1299 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_loopback_show()
1303 phyreg_val = phy_read(ndev->phydev, MII_BMCR); in sunxi_gmac_loopback_show()
1305 netdev_dbg(ndev, "Phy loopback enabled\n"); in sunxi_gmac_loopback_show()
1307 netdev_dbg(ndev, "Phy loopback disabled\n"); in sunxi_gmac_loopback_show()
1311 netdev_dbg(ndev, "Mac loopback enabled\n"); in sunxi_gmac_loopback_show()
1313 netdev_dbg(ndev, "Mac loopback disabled\n"); in sunxi_gmac_loopback_show()
1324 struct net_device *ndev = dev_get_drvdata(dev); in sunxi_gmac_loopback_store() local
1325 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_loopback_store()
1329 if (!netif_running(ndev)) { in sunxi_gmac_loopback_store()
1330 netdev_err(ndev, "Error: eth is down\n"); in sunxi_gmac_loopback_store()
1341 phyreg_val = phy_read(ndev->phydev, MII_BMCR); in sunxi_gmac_loopback_store()
1342 phy_write(ndev->phydev, MII_BMCR, phyreg_val & ~BMCR_LOOPBACK); in sunxi_gmac_loopback_store()
1345 phyreg_val = phy_read(ndev->phydev, MII_BMCR); in sunxi_gmac_loopback_store()
1346 phy_write(ndev->phydev, MII_BMCR, phyreg_val & ~BMCR_LOOPBACK); in sunxi_gmac_loopback_store()
1351 phyreg_val = phy_read(ndev->phydev, MII_BMCR); in sunxi_gmac_loopback_store()
1352 phy_write(ndev->phydev, MII_BMCR, phyreg_val | BMCR_LOOPBACK); in sunxi_gmac_loopback_store()
1355 netdev_err(ndev, "Error: Please echo right value\n"); in sunxi_gmac_loopback_store()
1365 static void sunxi_gmac_adjust_link(struct net_device *ndev) in sunxi_gmac_adjust_link() argument
1367 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_adjust_link()
1368 struct phy_device *phydev = ndev->phydev; in sunxi_gmac_adjust_link()
1414 static int sunxi_gmac_phy_release(struct net_device *ndev) in sunxi_gmac_phy_release() argument
1416 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_phy_release()
1417 struct phy_device *phydev = ndev->phydev; in sunxi_gmac_phy_release()
1435 ndev->phydev = NULL; in sunxi_gmac_phy_release()
1442 static void sunxi_gmac_rx_refill(struct net_device *ndev) in sunxi_gmac_rx_refill() argument
1444 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_rx_refill()
1456 skb = netdev_alloc_skb_ip_align(ndev, chip->buf_sz); in sunxi_gmac_rx_refill()
1480 static int sunxi_gmac_dma_desc_init(struct net_device *ndev) in sunxi_gmac_dma_desc_init() argument
1482 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_dma_desc_init()
1483 struct device *dev = &ndev->dev; in sunxi_gmac_dma_desc_init()
1488 netdev_err(ndev, "Error: Alloc rx_skb failed\n"); in sunxi_gmac_dma_desc_init()
1494 netdev_err(ndev, "Error: Alloc tx_skb failed\n"); in sunxi_gmac_dma_desc_init()
1504 netdev_err(ndev, "Error: Alloc dma_tx failed\n"); in sunxi_gmac_dma_desc_init()
1514 netdev_err(ndev, "Error: Alloc dma_rx failed\n"); in sunxi_gmac_dma_desc_init()
1600 static int sunxi_gmac_stop(struct net_device *ndev) in sunxi_gmac_stop() argument
1602 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_stop()
1604 netif_stop_queue(ndev); in sunxi_gmac_stop()
1607 netif_carrier_off(ndev); in sunxi_gmac_stop()
1609 sunxi_gmac_phy_release(ndev); in sunxi_gmac_stop()
1613 netif_tx_lock_bh(ndev); in sunxi_gmac_stop()
1617 netif_tx_unlock_bh(ndev); in sunxi_gmac_stop()
1676 static int sunxi_gmac_open(struct net_device *ndev) in sunxi_gmac_open() argument
1678 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_open()
1685 netif_carrier_off(ndev); in sunxi_gmac_open()
1691 netdev_err(ndev, "Error: Could not find ac300 %s\n", in sunxi_gmac_open()
1700 ndev->phydev = of_phy_connect(ndev, chip->phy_node, in sunxi_gmac_open()
1702 if (!ndev->phydev) { in sunxi_gmac_open()
1703 netdev_err(ndev, "Error: Could not connect to phy %s\n", in sunxi_gmac_open()
1707 netdev_info(ndev, "%s: Type(%d) PHY ID %08x at %d IRQ %s (%s)\n", in sunxi_gmac_open()
1708 ndev->name, ndev->phydev->interface, ndev->phydev->phy_id, in sunxi_gmac_open()
1709 ndev->phydev->mdio.addr, "poll", dev_name(&ndev->phydev->mdio.dev)); in sunxi_gmac_open()
1714 netdev_err(ndev, "Error: Mac reset failed, please check phy and mac clk\n"); in sunxi_gmac_open()
1718 sunxi_gmac_set_mac_addr_to_reg(chip->base, ndev->dev_addr, 0); in sunxi_gmac_open()
1730 sunxi_gmac_rx_refill(ndev); in sunxi_gmac_open()
1735 if (ndev->phydev) in sunxi_gmac_open()
1736 phy_start(ndev->phydev); in sunxi_gmac_open()
1744 netif_start_queue(ndev); in sunxi_gmac_open()
1752 phy_disconnect(ndev->phydev); in sunxi_gmac_open()
1759 struct net_device *ndev = dev_get_drvdata(dev); in sunxi_gmac_resume() local
1760 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_resume()
1762 if (!netif_running(ndev)) in sunxi_gmac_resume()
1767 netif_device_attach(ndev); in sunxi_gmac_resume()
1769 sunxi_gmac_open(ndev); in sunxi_gmac_resume()
1776 struct net_device *ndev = dev_get_drvdata(dev); in sunxi_gmac_suspend() local
1777 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_suspend()
1779 if (!ndev || !netif_running(ndev)) in sunxi_gmac_suspend()
1782 netif_device_detach(ndev); in sunxi_gmac_suspend()
1784 sunxi_gmac_stop(ndev); in sunxi_gmac_suspend()
1800 static void sunxi_gmac_chip_hwaddr(struct net_device *ndev) in sunxi_gmac_chip_hwaddr() argument
1808 u8 *addr = ndev->dev_addr; in sunxi_gmac_chip_hwaddr()
1820 netdev_err(ndev, "Error: Alloc md5 failed\n"); in sunxi_gmac_chip_hwaddr()
1832 netdev_err(ndev, "Error: Crypto_ahash_init failed\n"); in sunxi_gmac_chip_hwaddr()
1840 netdev_err(ndev, "Error: Crypto_ahash_update failed\n"); in sunxi_gmac_chip_hwaddr()
1846 netdev_err(ndev, "Error: Crypto_ahash_final failed\n"); in sunxi_gmac_chip_hwaddr()
1862 static void sunxi_gmac_check_addr(struct net_device *ndev, unsigned char *mac) in sunxi_gmac_check_addr() argument
1867 if (!is_valid_ether_addr(ndev->dev_addr)) { in sunxi_gmac_check_addr()
1869 ndev->dev_addr[i] = simple_strtoul(p, &p, 16); in sunxi_gmac_check_addr()
1871 if (!is_valid_ether_addr(ndev->dev_addr)) in sunxi_gmac_check_addr()
1872 sunxi_gmac_chip_hwaddr(ndev); in sunxi_gmac_check_addr()
1874 if (!is_valid_ether_addr(ndev->dev_addr)) { in sunxi_gmac_check_addr()
1875 random_ether_addr(ndev->dev_addr); in sunxi_gmac_check_addr()
1876 netdev_dbg(ndev, "Error: Use random mac address\n"); in sunxi_gmac_check_addr()
1883 struct net_device *ndev = chip->ndev; in sunxi_gmac_clk_enable() local
1889 netdev_err(ndev, "Error: Try to de-assert gmac rst failed\n"); in sunxi_gmac_clk_enable()
1895 netdev_err(ndev, "Error: Try to enable gmac_clk failed\n"); in sunxi_gmac_clk_enable()
1902 netdev_err(ndev, "Error: Try to enable phy25m_clk failed\n"); in sunxi_gmac_clk_enable()
1961 netif_stop_queue(chip->ndev); in sunxi_gmac_tx_err()
1972 chip->ndev->stats.tx_errors++; in sunxi_gmac_tx_err()
1973 netif_wake_queue(chip->ndev); in sunxi_gmac_tx_err()
1986 struct net_device *ndev = (struct net_device *)dev_id; in sunxi_gmac_interrupt() local
1987 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_interrupt()
1995 netdev_info(ndev, "Do nothing for bump tc\n"); in sunxi_gmac_interrupt()
1999 netdev_info(ndev, "Do nothing.....\n"); in sunxi_gmac_interrupt()
2029 chip->ndev->stats.tx_packets++; in sunxi_gmac_tx_complete()
2031 chip->ndev->stats.tx_errors++; in sunxi_gmac_tx_complete()
2050 if (unlikely(netif_queue_stopped(chip->ndev)) && in sunxi_gmac_tx_complete()
2053 netif_wake_queue(chip->ndev); in sunxi_gmac_tx_complete()
2058 static netdev_tx_t sunxi_gmac_xmit(struct sk_buff *skb, struct net_device *ndev) in sunxi_gmac_xmit() argument
2060 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_xmit()
2070 if (!netif_queue_stopped(ndev)) { in sunxi_gmac_xmit()
2071 netdev_err(ndev, "Error: Tx Ring full when queue awake\n"); in sunxi_gmac_xmit()
2072 netif_stop_queue(ndev); in sunxi_gmac_xmit()
2088 netdev_dbg(ndev, "TX packet:\n"); in sunxi_gmac_xmit()
2130 ndev->stats.tx_bytes += skb->len; in sunxi_gmac_xmit()
2139 netif_stop_queue(ndev); in sunxi_gmac_xmit()
2142 netif_wake_queue(ndev); in sunxi_gmac_xmit()
2145 netdev_dbg(ndev, "TX descripotor DMA: 0x%08llx, dirty: %d, clean: %d\n", in sunxi_gmac_xmit()
2178 netdev_dbg(chip->ndev, "Rx frame size %d, status: %d\n", in sunxi_gmac_rx()
2183 netdev_err(chip->ndev, "Skb is null\n"); in sunxi_gmac_rx()
2184 chip->ndev->stats.rx_dropped++; in sunxi_gmac_rx()
2188 netdev_dbg(chip->ndev, "RX packet:\n"); in sunxi_gmac_rx()
2194 netdev_dbg(chip->ndev, "Get error pkt\n"); in sunxi_gmac_rx()
2195 chip->ndev->stats.rx_errors++; in sunxi_gmac_rx()
2208 skb->protocol = eth_type_trans(skb, chip->ndev); in sunxi_gmac_rx()
2213 chip->ndev->stats.rx_packets++; in sunxi_gmac_rx()
2214 chip->ndev->stats.rx_bytes += frame_len; in sunxi_gmac_rx()
2218 netdev_dbg(chip->ndev, "RX descriptor DMA: 0x%08llx, dirty: %d, clean: %d\n", in sunxi_gmac_rx()
2223 sunxi_gmac_rx_refill(chip->ndev); in sunxi_gmac_rx()
2244 static int sunxi_gmac_change_mtu(struct net_device *ndev, int new_mtu) in sunxi_gmac_change_mtu() argument
2248 if (netif_running(ndev)) { in sunxi_gmac_change_mtu()
2249 netdev_err(ndev, "Error: Nic must be stopped to change its MTU\n"); in sunxi_gmac_change_mtu()
2256 netdev_err(ndev, "Error: Invalid MTU, max MTU is: %d\n", max_mtu); in sunxi_gmac_change_mtu()
2260 ndev->mtu = new_mtu; in sunxi_gmac_change_mtu()
2261 netdev_update_features(ndev); in sunxi_gmac_change_mtu()
2266 static netdev_features_t sunxi_gmac_fix_features(struct net_device *ndev, in sunxi_gmac_fix_features() argument
2272 static void sunxi_gmac_set_rx_mode(struct net_device *ndev) in sunxi_gmac_set_rx_mode() argument
2274 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_set_rx_mode()
2277 netdev_dbg(ndev, "%s: # mcasts %d, # unicast %d\n", in sunxi_gmac_set_rx_mode()
2278 __func__, netdev_mc_count(ndev), netdev_uc_count(ndev)); in sunxi_gmac_set_rx_mode()
2281 if (ndev->flags & IFF_PROMISC) { in sunxi_gmac_set_rx_mode()
2283 } else if ((netdev_mc_count(ndev) > SUNXI_GMAC_HASH_TABLE_SIZE) || in sunxi_gmac_set_rx_mode()
2284 (ndev->flags & IFF_ALLMULTI)) { in sunxi_gmac_set_rx_mode()
2287 } else if (!netdev_mc_empty(ndev)) { in sunxi_gmac_set_rx_mode()
2295 netdev_for_each_mc_addr(ha, ndev) { in sunxi_gmac_set_rx_mode()
2310 if (netdev_uc_count(ndev) > 16) { in sunxi_gmac_set_rx_mode()
2317 netdev_for_each_uc_addr(ha, ndev) { in sunxi_gmac_set_rx_mode()
2331 static void sunxi_gmac_tx_timeout(struct net_device *ndev, unsigned int txqueue) in sunxi_gmac_tx_timeout() argument
2333 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_tx_timeout()
2338 static int sunxi_gmac_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) in sunxi_gmac_ioctl() argument
2340 if (!netif_running(ndev)) in sunxi_gmac_ioctl()
2343 if (!ndev->phydev) in sunxi_gmac_ioctl()
2346 return phy_mii_ioctl(ndev->phydev, rq, cmd); in sunxi_gmac_ioctl()
2350 static int sunxi_gmac_config(struct net_device *ndev, struct ifmap *map) in sunxi_gmac_config() argument
2352 if (ndev->flags & IFF_UP) /* can't act on a running interface */ in sunxi_gmac_config()
2356 if (map->base_addr != ndev->base_addr) { in sunxi_gmac_config()
2357 netdev_err(ndev, "Error: Can't change I/O address\n"); in sunxi_gmac_config()
2362 if (map->irq != ndev->irq) { in sunxi_gmac_config()
2363 netdev_err(ndev, "Error: Can't change IRQ number %d\n", ndev->irq); in sunxi_gmac_config()
2370 static int sunxi_gmac_set_mac_address(struct net_device *ndev, void *p) in sunxi_gmac_set_mac_address() argument
2372 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_set_mac_address()
2376 netdev_err(ndev, "Error: Set error mac address\n"); in sunxi_gmac_set_mac_address()
2380 memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len); in sunxi_gmac_set_mac_address()
2381 sunxi_gmac_set_mac_addr_to_reg(chip->base, ndev->dev_addr, 0); in sunxi_gmac_set_mac_address()
2386 static int sunxi_gmac_set_features(struct net_device *ndev, netdev_features_t features) in sunxi_gmac_set_features() argument
2388 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_set_features()
2390 if (features & NETIF_F_LOOPBACK && netif_running(ndev)) in sunxi_gmac_set_features()
2428 static int sunxi_gmac_check_if_running(struct net_device *ndev) in sunxi_gmac_check_if_running() argument
2430 if (!netif_running(ndev)) in sunxi_gmac_check_if_running()
2457 static void sunxi_gmac_ethtool_getdrvinfo(struct net_device *ndev, in sunxi_gmac_ethtool_getdrvinfo() argument
2475 static void sunxi_gmac_ethtool_get_pauseparam(struct net_device *ndev, in sunxi_gmac_ethtool_get_pauseparam() argument
2478 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_ethtool_get_pauseparam()
2496 static int sunxi_gmac_ethtool_set_pauseparam(struct net_device *ndev, in sunxi_gmac_ethtool_set_pauseparam() argument
2499 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_ethtool_set_pauseparam()
2502 netdev_info(ndev, "Tx flowctrl %s\n", epause->tx_pause ? "ON" : "OFF"); in sunxi_gmac_ethtool_set_pauseparam()
2505 netdev_info(ndev, "Rx flowctrl %s\n", epause->rx_pause ? "ON" : "OFF"); in sunxi_gmac_ethtool_set_pauseparam()
2520 static void sunxi_gmac_ethtool_get_wol(struct net_device *ndev, in sunxi_gmac_ethtool_get_wol() argument
2523 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_ethtool_get_wol()
2529 netdev_err(ndev, "Error: wakeup-on-lan func is not supported yet\n"); in sunxi_gmac_ethtool_get_wol()
2542 static int sunxi_gmac_ethtool_set_wol(struct net_device *ndev, in sunxi_gmac_ethtool_set_wol() argument
2567 struct net_device *ndev = platform_get_drvdata(pdev); in sunxi_gmac_hardware_init() local
2568 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_hardware_init()
2573 netdev_err(ndev, "Error: Gmac power on failed\n"); in sunxi_gmac_hardware_init()
2580 netdev_err(ndev, "Error: Clk enable is failed\n"); in sunxi_gmac_hardware_init()
2588 netdev_err(ndev, "Error: Config ac300 pwm failed\n"); in sunxi_gmac_hardware_init()
2595 netdev_err(ndev, "Error: Enable ac300 pwm failed\n"); in sunxi_gmac_hardware_init()
2616 struct net_device *ndev = platform_get_drvdata(pdev); in sunxi_gmac_hardware_deinit() local
2617 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_hardware_deinit()
2630 struct net_device *ndev = platform_get_drvdata(pdev); in sunxi_gmac_resource_get() local
2631 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_resource_get()
2645 netdev_err(ndev, "Error: Get gmac memory failed\n"); in sunxi_gmac_resource_get()
2651 netdev_err(ndev, "Error: Gmac memory mapping failed\n"); in sunxi_gmac_resource_get()
2657 netdev_err(ndev, "Error: Get phy memory failed\n"); in sunxi_gmac_resource_get()
2663 netdev_err(ndev, "Error: Phy memory mapping failed\n"); in sunxi_gmac_resource_get()
2667 ndev->irq = platform_get_irq_byname(pdev, "gmacirq"); in sunxi_gmac_resource_get()
2668 if (ndev->irq < 0) { in sunxi_gmac_resource_get()
2669 netdev_err(ndev, "Error: Gmac irq not found\n"); in sunxi_gmac_resource_get()
2673 …ret = devm_request_irq(&pdev->dev, ndev->irq, sunxi_gmac_interrupt, IRQF_SHARED, dev_name(&pdev->d… in sunxi_gmac_resource_get()
2675 netdev_err(ndev, "Error: Could not request irq %d\n", ndev->irq); in sunxi_gmac_resource_get()
2681 netdev_err(ndev, "Error: Get gmac rst failed\n"); in sunxi_gmac_resource_get()
2687 netdev_err(ndev, "Error: Get Pin failed\n"); in sunxi_gmac_resource_get()
2693 netdev_err(ndev, "Error: Get gmac clock failed\n"); in sunxi_gmac_resource_get()
2702 netdev_err(ndev, "Error: Get gmac phy interface failed\n"); in sunxi_gmac_resource_get()
2709 netdev_warn(ndev, "Warning: Get gmac tx-delay failed, use default 0\n"); in sunxi_gmac_resource_get()
2715 netdev_warn(ndev, "Warning: Get gmac rx-delay failed, use default 0\n"); in sunxi_gmac_resource_get()
2721 netdev_err(ndev, "Error: Get gmac phy-handle failed\n"); in sunxi_gmac_resource_get()
2733 netdev_err(ndev, "Error: Get gmac ac300-phy-handle failed\n"); in sunxi_gmac_resource_get()
2739 netdev_err(ndev, "Error: Get ac300 pwm failed\n"); in sunxi_gmac_resource_get()
2745 netdev_err(ndev, "Error: Get ac300 pwm failed\n"); in sunxi_gmac_resource_get()
2752 netdev_err(ndev, "Error: Get gmac phy-clk-type failed\n"); in sunxi_gmac_resource_get()
2759 netdev_err(ndev, "Error: Get phy25m clk failed\n"); in sunxi_gmac_resource_get()
2770 netdev_dbg(ndev, "Info: Gmac_power_vol[%d] = %d\n", i, value); in sunxi_gmac_resource_get()
2777 netdev_err(ndev, "Error: gmac-power%d get error\n", i); in sunxi_gmac_resource_get()
2779 netdev_dbg(ndev, "gmac-power%d get success\n", i); in sunxi_gmac_resource_get()
2788 struct net_device *ndev = platform_get_drvdata(pdev); in sunxi_gmac_resource_put() local
2789 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_resource_put()
2827 struct net_device *ndev; in sunxi_gmac_probe() local
2835 ndev = alloc_etherdev(sizeof(*ndev)); in sunxi_gmac_probe()
2836 if (!ndev) { in sunxi_gmac_probe()
2841 SET_NETDEV_DEV(ndev, &pdev->dev); in sunxi_gmac_probe()
2843 chip = netdev_priv(ndev); in sunxi_gmac_probe()
2844 platform_set_drvdata(pdev, ndev); in sunxi_gmac_probe()
2863 ether_setup(ndev); in sunxi_gmac_probe()
2864 ndev->netdev_ops = &sunxi_gmac_netdev_ops; in sunxi_gmac_probe()
2865 netdev_set_default_ethtool_ops(ndev, &sunxi_gmac_ethtool_ops); in sunxi_gmac_probe()
2866 ndev->base_addr = (unsigned long)chip->base; in sunxi_gmac_probe()
2867 chip->ndev = ndev; in sunxi_gmac_probe()
2871 ndev->hw_features = NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | in sunxi_gmac_probe()
2873 ndev->features |= ndev->hw_features; in sunxi_gmac_probe()
2874 ndev->hw_features |= NETIF_F_LOOPBACK; in sunxi_gmac_probe()
2875 ndev->priv_flags |= IFF_UNICAST_FLT; in sunxi_gmac_probe()
2876 ndev->watchdog_timeo = msecs_to_jiffies(watchdog); in sunxi_gmac_probe()
2879 netif_napi_add(ndev, &chip->napi, sunxi_gmac_poll, SUNXI_GMAC_BUDGET); in sunxi_gmac_probe()
2884 ret = register_netdev(ndev); in sunxi_gmac_probe()
2886 dev_err(&pdev->dev, "Error: Register %s failed\n", ndev->name); in sunxi_gmac_probe()
2891 sunxi_gmac_check_addr(ndev, mac_str); in sunxi_gmac_probe()
2893 ret = sunxi_gmac_dma_desc_init(ndev); in sunxi_gmac_probe()
2906 unregister_netdev(ndev); in sunxi_gmac_probe()
2914 free_netdev(ndev); in sunxi_gmac_probe()
2921 struct net_device *ndev = platform_get_drvdata(pdev); in sunxi_gmac_remove() local
2922 struct sunxi_gmac *chip = netdev_priv(ndev); in sunxi_gmac_remove()
2926 unregister_netdev(ndev); in sunxi_gmac_remove()
2931 free_netdev(ndev); in sunxi_gmac_remove()