| .. | .. |
|---|
| 28 | 28 | #include <asm/octeon/cvmx-agl-defs.h> |
|---|
| 29 | 29 | |
|---|
| 30 | 30 | #define DRV_NAME "octeon_mgmt" |
|---|
| 31 | | -#define DRV_VERSION "2.0" |
|---|
| 32 | 31 | #define DRV_DESCRIPTION \ |
|---|
| 33 | 32 | "Cavium Networks Octeon MII (management) port Network Driver" |
|---|
| 34 | 33 | |
|---|
| .. | .. |
|---|
| 316 | 315 | netif_wake_queue(p->netdev); |
|---|
| 317 | 316 | } |
|---|
| 318 | 317 | |
|---|
| 319 | | -static void octeon_mgmt_clean_tx_tasklet(unsigned long arg) |
|---|
| 318 | +static void octeon_mgmt_clean_tx_tasklet(struct tasklet_struct *t) |
|---|
| 320 | 319 | { |
|---|
| 321 | | - struct octeon_mgmt *p = (struct octeon_mgmt *)arg; |
|---|
| 320 | + struct octeon_mgmt *p = from_tasklet(p, t, tx_clean_tasklet); |
|---|
| 322 | 321 | octeon_mgmt_clean_tx_buffers(p); |
|---|
| 323 | 322 | octeon_mgmt_enable_tx_irq(p); |
|---|
| 324 | 323 | } |
|---|
| .. | .. |
|---|
| 795 | 794 | case SIOCSHWTSTAMP: |
|---|
| 796 | 795 | return octeon_mgmt_ioctl_hwtstamp(netdev, rq, cmd); |
|---|
| 797 | 796 | default: |
|---|
| 798 | | - if (netdev->phydev) |
|---|
| 799 | | - return phy_mii_ioctl(netdev->phydev, rq, cmd); |
|---|
| 800 | | - return -EINVAL; |
|---|
| 797 | + return phy_do_ioctl(netdev, rq, cmd); |
|---|
| 801 | 798 | } |
|---|
| 802 | 799 | } |
|---|
| 803 | 800 | |
|---|
| .. | .. |
|---|
| 964 | 961 | PHY_INTERFACE_MODE_MII); |
|---|
| 965 | 962 | |
|---|
| 966 | 963 | if (!phydev) |
|---|
| 967 | | - return -ENODEV; |
|---|
| 964 | + return -EPROBE_DEFER; |
|---|
| 968 | 965 | |
|---|
| 969 | 966 | return 0; |
|---|
| 970 | 967 | } |
|---|
| .. | .. |
|---|
| 1085 | 1082 | /* Set the mode of the interface, RGMII/MII. */ |
|---|
| 1086 | 1083 | if (OCTEON_IS_MODEL(OCTEON_CN6XXX) && netdev->phydev) { |
|---|
| 1087 | 1084 | union cvmx_agl_prtx_ctl agl_prtx_ctl; |
|---|
| 1088 | | - int rgmii_mode = (netdev->phydev->supported & |
|---|
| 1089 | | - (SUPPORTED_1000baseT_Half | SUPPORTED_1000baseT_Full)) != 0; |
|---|
| 1085 | + int rgmii_mode = |
|---|
| 1086 | + (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, |
|---|
| 1087 | + netdev->phydev->supported) | |
|---|
| 1088 | + linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, |
|---|
| 1089 | + netdev->phydev->supported)) != 0; |
|---|
| 1090 | 1090 | |
|---|
| 1091 | 1091 | agl_prtx_ctl.u64 = cvmx_read_csr(p->agl_prt_ctl); |
|---|
| 1092 | 1092 | agl_prtx_ctl.s.mode = rgmii_mode ? 0 : 1; |
|---|
| .. | .. |
|---|
| 1219 | 1219 | */ |
|---|
| 1220 | 1220 | if (netdev->phydev) { |
|---|
| 1221 | 1221 | netif_carrier_off(netdev); |
|---|
| 1222 | | - phy_start_aneg(netdev->phydev); |
|---|
| 1222 | + phy_start(netdev->phydev); |
|---|
| 1223 | 1223 | } |
|---|
| 1224 | 1224 | |
|---|
| 1225 | 1225 | netif_wake_queue(netdev); |
|---|
| .. | .. |
|---|
| 1247 | 1247 | napi_disable(&p->napi); |
|---|
| 1248 | 1248 | netif_stop_queue(netdev); |
|---|
| 1249 | 1249 | |
|---|
| 1250 | | - if (netdev->phydev) |
|---|
| 1250 | + if (netdev->phydev) { |
|---|
| 1251 | + phy_stop(netdev->phydev); |
|---|
| 1251 | 1252 | phy_disconnect(netdev->phydev); |
|---|
| 1253 | + } |
|---|
| 1252 | 1254 | |
|---|
| 1253 | 1255 | netif_carrier_off(netdev); |
|---|
| 1254 | 1256 | |
|---|
| .. | .. |
|---|
| 1344 | 1346 | struct ethtool_drvinfo *info) |
|---|
| 1345 | 1347 | { |
|---|
| 1346 | 1348 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
|---|
| 1347 | | - strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
|---|
| 1348 | | - strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); |
|---|
| 1349 | | - strlcpy(info->bus_info, "N/A", sizeof(info->bus_info)); |
|---|
| 1350 | 1349 | } |
|---|
| 1351 | 1350 | |
|---|
| 1352 | 1351 | static int octeon_mgmt_nway_reset(struct net_device *dev) |
|---|
| .. | .. |
|---|
| 1492 | 1491 | |
|---|
| 1493 | 1492 | skb_queue_head_init(&p->tx_list); |
|---|
| 1494 | 1493 | skb_queue_head_init(&p->rx_list); |
|---|
| 1495 | | - tasklet_init(&p->tx_clean_tasklet, |
|---|
| 1496 | | - octeon_mgmt_clean_tx_tasklet, (unsigned long)p); |
|---|
| 1494 | + tasklet_setup(&p->tx_clean_tasklet, |
|---|
| 1495 | + octeon_mgmt_clean_tx_tasklet); |
|---|
| 1497 | 1496 | |
|---|
| 1498 | 1497 | netdev->priv_flags |= IFF_UNICAST_FLT; |
|---|
| 1499 | 1498 | |
|---|
| .. | .. |
|---|
| 1505 | 1504 | |
|---|
| 1506 | 1505 | mac = of_get_mac_address(pdev->dev.of_node); |
|---|
| 1507 | 1506 | |
|---|
| 1508 | | - if (mac) |
|---|
| 1509 | | - memcpy(netdev->dev_addr, mac, ETH_ALEN); |
|---|
| 1507 | + if (!IS_ERR(mac)) |
|---|
| 1508 | + ether_addr_copy(netdev->dev_addr, mac); |
|---|
| 1510 | 1509 | else |
|---|
| 1511 | 1510 | eth_hw_addr_random(netdev); |
|---|
| 1512 | 1511 | |
|---|
| .. | .. |
|---|
| 1521 | 1520 | if (result) |
|---|
| 1522 | 1521 | goto err; |
|---|
| 1523 | 1522 | |
|---|
| 1524 | | - dev_info(&pdev->dev, "Version " DRV_VERSION "\n"); |
|---|
| 1525 | 1523 | return 0; |
|---|
| 1526 | 1524 | |
|---|
| 1527 | 1525 | err: |
|---|
| .. | .. |
|---|
| 1558 | 1556 | .remove = octeon_mgmt_remove, |
|---|
| 1559 | 1557 | }; |
|---|
| 1560 | 1558 | |
|---|
| 1561 | | -extern void octeon_mdiobus_force_mod_depencency(void); |
|---|
| 1562 | | - |
|---|
| 1563 | 1559 | static int __init octeon_mgmt_mod_init(void) |
|---|
| 1564 | 1560 | { |
|---|
| 1565 | | - /* Force our mdiobus driver module to be loaded first. */ |
|---|
| 1566 | | - octeon_mdiobus_force_mod_depencency(); |
|---|
| 1567 | 1561 | return platform_driver_register(&octeon_mgmt_driver); |
|---|
| 1568 | 1562 | } |
|---|
| 1569 | 1563 | |
|---|
| .. | .. |
|---|
| 1575 | 1569 | module_init(octeon_mgmt_mod_init); |
|---|
| 1576 | 1570 | module_exit(octeon_mgmt_mod_exit); |
|---|
| 1577 | 1571 | |
|---|
| 1572 | +MODULE_SOFTDEP("pre: mdio-cavium"); |
|---|
| 1578 | 1573 | MODULE_DESCRIPTION(DRV_DESCRIPTION); |
|---|
| 1579 | 1574 | MODULE_AUTHOR("David Daney"); |
|---|
| 1580 | 1575 | MODULE_LICENSE("GPL"); |
|---|
| 1581 | | -MODULE_VERSION(DRV_VERSION); |
|---|