diff options
Diffstat (limited to 'drivers/net/ethernet/marvell/pxa168_eth.c')
-rw-r--r-- | drivers/net/ethernet/marvell/pxa168_eth.c | 126 |
1 files changed, 0 insertions, 126 deletions
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c index ca60fa24d2ed..bee4c369f0fe 100644 --- a/drivers/net/ethernet/marvell/pxa168_eth.c +++ b/drivers/net/ethernet/marvell/pxa168_eth.c | |||
@@ -177,7 +177,6 @@ | |||
177 | #define LINK_UP (1 << 3) | 177 | #define LINK_UP (1 << 3) |
178 | 178 | ||
179 | /* Bit definitions for work to be done */ | 179 | /* Bit definitions for work to be done */ |
180 | #define WORK_LINK (1 << 0) | ||
181 | #define WORK_TX_DONE (1 << 1) | 180 | #define WORK_TX_DONE (1 << 1) |
182 | 181 | ||
183 | /* | 182 | /* |
@@ -284,7 +283,6 @@ static void eth_port_reset(struct net_device *dev); | |||
284 | static void eth_port_start(struct net_device *dev); | 283 | static void eth_port_start(struct net_device *dev); |
285 | static int pxa168_eth_open(struct net_device *dev); | 284 | static int pxa168_eth_open(struct net_device *dev); |
286 | static int pxa168_eth_stop(struct net_device *dev); | 285 | static int pxa168_eth_stop(struct net_device *dev); |
287 | static int ethernet_phy_setup(struct net_device *dev); | ||
288 | 286 | ||
289 | static inline u32 rdl(struct pxa168_eth_private *pep, int offset) | 287 | static inline u32 rdl(struct pxa168_eth_private *pep, int offset) |
290 | { | 288 | { |
@@ -316,26 +314,6 @@ static void abort_dma(struct pxa168_eth_private *pep) | |||
316 | netdev_err(pep->dev, "%s : DMA Stuck\n", __func__); | 314 | netdev_err(pep->dev, "%s : DMA Stuck\n", __func__); |
317 | } | 315 | } |
318 | 316 | ||
319 | static int ethernet_phy_get(struct pxa168_eth_private *pep) | ||
320 | { | ||
321 | unsigned int reg_data; | ||
322 | |||
323 | reg_data = rdl(pep, PHY_ADDRESS); | ||
324 | |||
325 | return (reg_data >> (5 * pep->port_num)) & 0x1f; | ||
326 | } | ||
327 | |||
328 | static void ethernet_phy_set_addr(struct pxa168_eth_private *pep, int phy_addr) | ||
329 | { | ||
330 | u32 reg_data; | ||
331 | int addr_shift = 5 * pep->port_num; | ||
332 | |||
333 | reg_data = rdl(pep, PHY_ADDRESS); | ||
334 | reg_data &= ~(0x1f << addr_shift); | ||
335 | reg_data |= (phy_addr & 0x1f) << addr_shift; | ||
336 | wrl(pep, PHY_ADDRESS, reg_data); | ||
337 | } | ||
338 | |||
339 | static void rxq_refill(struct net_device *dev) | 317 | static void rxq_refill(struct net_device *dev) |
340 | { | 318 | { |
341 | struct pxa168_eth_private *pep = netdev_priv(dev); | 319 | struct pxa168_eth_private *pep = netdev_priv(dev); |
@@ -890,43 +868,9 @@ static int pxa168_eth_collect_events(struct pxa168_eth_private *pep, | |||
890 | } | 868 | } |
891 | if (icr & ICR_RXBUF) | 869 | if (icr & ICR_RXBUF) |
892 | ret = 1; | 870 | ret = 1; |
893 | if (icr & ICR_MII_CH) { | ||
894 | pep->work_todo |= WORK_LINK; | ||
895 | ret = 1; | ||
896 | } | ||
897 | return ret; | 871 | return ret; |
898 | } | 872 | } |
899 | 873 | ||
900 | static void handle_link_event(struct pxa168_eth_private *pep) | ||
901 | { | ||
902 | struct net_device *dev = pep->dev; | ||
903 | u32 port_status; | ||
904 | int speed; | ||
905 | int duplex; | ||
906 | int fc; | ||
907 | |||
908 | port_status = rdl(pep, PORT_STATUS); | ||
909 | if (!(port_status & LINK_UP)) { | ||
910 | if (netif_carrier_ok(dev)) { | ||
911 | netdev_info(dev, "link down\n"); | ||
912 | netif_carrier_off(dev); | ||
913 | txq_reclaim(dev, 1); | ||
914 | } | ||
915 | return; | ||
916 | } | ||
917 | if (port_status & PORT_SPEED_100) | ||
918 | speed = 100; | ||
919 | else | ||
920 | speed = 10; | ||
921 | |||
922 | duplex = (port_status & FULL_DUPLEX) ? 1 : 0; | ||
923 | fc = (port_status & FLOW_CONTROL_DISABLED) ? 0 : 1; | ||
924 | netdev_info(dev, "link up, %d Mb/s, %s duplex, flow control %sabled\n", | ||
925 | speed, duplex ? "full" : "half", fc ? "en" : "dis"); | ||
926 | if (!netif_carrier_ok(dev)) | ||
927 | netif_carrier_on(dev); | ||
928 | } | ||
929 | |||
930 | static irqreturn_t pxa168_eth_int_handler(int irq, void *dev_id) | 874 | static irqreturn_t pxa168_eth_int_handler(int irq, void *dev_id) |
931 | { | 875 | { |
932 | struct net_device *dev = (struct net_device *)dev_id; | 876 | struct net_device *dev = (struct net_device *)dev_id; |
@@ -1307,10 +1251,6 @@ static int pxa168_rx_poll(struct napi_struct *napi, int budget) | |||
1307 | struct net_device *dev = pep->dev; | 1251 | struct net_device *dev = pep->dev; |
1308 | int work_done = 0; | 1252 | int work_done = 0; |
1309 | 1253 | ||
1310 | if (unlikely(pep->work_todo & WORK_LINK)) { | ||
1311 | pep->work_todo &= ~(WORK_LINK); | ||
1312 | handle_link_event(pep); | ||
1313 | } | ||
1314 | /* | 1254 | /* |
1315 | * We call txq_reclaim every time since in NAPI interupts are disabled | 1255 | * We call txq_reclaim every time since in NAPI interupts are disabled |
1316 | * and due to this we miss the TX_DONE interrupt,which is not updated in | 1256 | * and due to this we miss the TX_DONE interrupt,which is not updated in |
@@ -1433,72 +1373,6 @@ static int pxa168_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr, | |||
1433 | return -EOPNOTSUPP; | 1373 | return -EOPNOTSUPP; |
1434 | } | 1374 | } |
1435 | 1375 | ||
1436 | static struct phy_device *phy_scan(struct pxa168_eth_private *pep, int phy_addr) | ||
1437 | { | ||
1438 | struct mii_bus *bus = pep->smi_bus; | ||
1439 | struct phy_device *phydev; | ||
1440 | int start; | ||
1441 | int num; | ||
1442 | int i; | ||
1443 | |||
1444 | if (phy_addr == PXA168_ETH_PHY_ADDR_DEFAULT) { | ||
1445 | /* Scan entire range */ | ||
1446 | start = ethernet_phy_get(pep); | ||
1447 | num = 32; | ||
1448 | } else { | ||
1449 | /* Use phy addr specific to platform */ | ||
1450 | start = phy_addr & 0x1f; | ||
1451 | num = 1; | ||
1452 | } | ||
1453 | phydev = NULL; | ||
1454 | for (i = 0; i < num; i++) { | ||
1455 | int addr = (start + i) & 0x1f; | ||
1456 | if (bus->phy_map[addr] == NULL) | ||
1457 | mdiobus_scan(bus, addr); | ||
1458 | |||
1459 | if (phydev == NULL) { | ||
1460 | phydev = bus->phy_map[addr]; | ||
1461 | if (phydev != NULL) | ||
1462 | ethernet_phy_set_addr(pep, addr); | ||
1463 | } | ||
1464 | } | ||
1465 | |||
1466 | return phydev; | ||
1467 | } | ||
1468 | |||
1469 | static void phy_init(struct pxa168_eth_private *pep) | ||
1470 | { | ||
1471 | struct phy_device *phy = pep->phy; | ||
1472 | |||
1473 | phy_attach(pep->dev, dev_name(&phy->dev), pep->phy_intf); | ||
1474 | |||
1475 | phy->speed = pep->phy_speed; | ||
1476 | phy->duplex = pep->phy_duplex; | ||
1477 | phy->autoneg = AUTONEG_ENABLE; | ||
1478 | phy->supported &= PHY_BASIC_FEATURES; | ||
1479 | phy->advertising = phy->supported | ADVERTISED_Autoneg; | ||
1480 | |||
1481 | if (pep->phy_speed != 0) { | ||
1482 | phy->autoneg = AUTONEG_DISABLE; | ||
1483 | phy->advertising = 0; | ||
1484 | } | ||
1485 | |||
1486 | phy_start_aneg(phy); | ||
1487 | } | ||
1488 | |||
1489 | static int ethernet_phy_setup(struct net_device *dev) | ||
1490 | { | ||
1491 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
1492 | |||
1493 | pep->phy = phy_scan(pep, pep->phy_addr & 0x1f); | ||
1494 | if (pep->phy != NULL) | ||
1495 | phy_init(pep); | ||
1496 | |||
1497 | update_hash_table_mac_address(pep, NULL, dev->dev_addr); | ||
1498 | |||
1499 | return 0; | ||
1500 | } | ||
1501 | |||
1502 | static int pxa168_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 1376 | static int pxa168_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
1503 | { | 1377 | { |
1504 | struct pxa168_eth_private *pep = netdev_priv(dev); | 1378 | struct pxa168_eth_private *pep = netdev_priv(dev); |