aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mv643xx_eth.c
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2008-06-01 06:27:57 -0400
committerLennert Buytenhek <buytenh@wantstofly.org>2008-06-12 02:40:30 -0400
commit5dc4d174e2fc0a30ae8fbeb0de81d7cef21f8885 (patch)
tree7be01ff6a332c2d662d4b5cf0b39b454d52c5abd /drivers/net/mv643xx_eth.c
parente53714933c66668ecb7eb9a48d79725e5a077a93 (diff)
mv643xx_eth: kill superfluous comments
Half of the functions in the mv643xx_eth driver are prefixed by useless and baroque comment blocks on _what_ those functions do (which is obvious from the code itself) rather than why, and there's no point in keeping those comments around. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
Diffstat (limited to 'drivers/net/mv643xx_eth.c')
-rw-r--r--drivers/net/mv643xx_eth.c552
1 files changed, 0 insertions, 552 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 80482cac173d..63e0d0fff951 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -445,26 +445,6 @@ static unsigned int mv643xx_eth_port_disable_tx(struct mv643xx_eth_private *mp)
445/* rx ***********************************************************************/ 445/* rx ***********************************************************************/
446static void mv643xx_eth_free_completed_tx_descs(struct net_device *dev); 446static void mv643xx_eth_free_completed_tx_descs(struct net_device *dev);
447 447
448/*
449 * rx_return_buff - Returns a Rx buffer back to the Rx ring.
450 *
451 * DESCRIPTION:
452 * This routine returns a Rx buffer back to the Rx ring. It retrieves the
453 * next 'used' descriptor and attached the returned buffer to it.
454 * In case the Rx ring was in "resource error" condition, where there are
455 * no available Rx resources, the function resets the resource error flag.
456 *
457 * INPUT:
458 * struct mv643xx_eth_private *mp Ethernet Port Control srtuct.
459 * struct pkt_info *p_pkt_info Information on returned buffer.
460 *
461 * OUTPUT:
462 * New available Rx resource in Rx descriptor ring.
463 *
464 * RETURN:
465 * ETH_ERROR in case the routine can not access Rx desc ring.
466 * ETH_OK otherwise.
467 */
468static FUNC_RET_STATUS rx_return_buff(struct mv643xx_eth_private *mp, 448static FUNC_RET_STATUS rx_return_buff(struct mv643xx_eth_private *mp,
469 struct pkt_info *p_pkt_info) 449 struct pkt_info *p_pkt_info)
470{ 450{
@@ -500,14 +480,6 @@ static FUNC_RET_STATUS rx_return_buff(struct mv643xx_eth_private *mp,
500 return ETH_OK; 480 return ETH_OK;
501} 481}
502 482
503/*
504 * mv643xx_eth_rx_refill_descs
505 *
506 * Fills / refills RX queue on a certain gigabit ethernet port
507 *
508 * Input : pointer to ethernet interface network device structure
509 * Output : N/A
510 */
511static void mv643xx_eth_rx_refill_descs(struct net_device *dev) 483static void mv643xx_eth_rx_refill_descs(struct net_device *dev)
512{ 484{
513 struct mv643xx_eth_private *mp = netdev_priv(dev); 485 struct mv643xx_eth_private *mp = netdev_priv(dev);
@@ -546,44 +518,11 @@ static void mv643xx_eth_rx_refill_descs(struct net_device *dev)
546 } 518 }
547} 519}
548 520
549/*
550 * mv643xx_eth_rx_refill_descs_timer_wrapper
551 *
552 * Timer routine to wake up RX queue filling task. This function is
553 * used only in case the RX queue is empty, and all alloc_skb has
554 * failed (due to out of memory event).
555 *
556 * Input : pointer to ethernet interface network device structure
557 * Output : N/A
558 */
559static inline void mv643xx_eth_rx_refill_descs_timer_wrapper(unsigned long data) 521static inline void mv643xx_eth_rx_refill_descs_timer_wrapper(unsigned long data)
560{ 522{
561 mv643xx_eth_rx_refill_descs((struct net_device *)data); 523 mv643xx_eth_rx_refill_descs((struct net_device *)data);
562} 524}
563 525
564/*
565 * port_receive - Get received information from Rx ring.
566 *
567 * DESCRIPTION:
568 * This routine returns the received data to the caller. There is no
569 * data copying during routine operation. All information is returned
570 * using pointer to packet information struct passed from the caller.
571 * If the routine exhausts Rx ring resources then the resource error flag
572 * is set.
573 *
574 * INPUT:
575 * struct mv643xx_eth_private *mp Ethernet Port Control srtuct.
576 * struct pkt_info *p_pkt_info User packet buffer.
577 *
578 * OUTPUT:
579 * Rx ring current and used indexes are updated.
580 *
581 * RETURN:
582 * ETH_ERROR in case the routine can not access Rx desc ring.
583 * ETH_QUEUE_FULL if Rx ring resources are exhausted.
584 * ETH_END_OF_JOB if there is no received data.
585 * ETH_OK otherwise.
586 */
587static FUNC_RET_STATUS port_receive(struct mv643xx_eth_private *mp, 526static FUNC_RET_STATUS port_receive(struct mv643xx_eth_private *mp,
588 struct pkt_info *p_pkt_info) 527 struct pkt_info *p_pkt_info)
589{ 528{
@@ -639,17 +578,6 @@ static FUNC_RET_STATUS port_receive(struct mv643xx_eth_private *mp,
639 return ETH_OK; 578 return ETH_OK;
640} 579}
641 580
642/*
643 * mv643xx_eth_receive
644 *
645 * This function is forward packets that are received from the port's
646 * queues toward kernel core or FastRoute them to another interface.
647 *
648 * Input : dev - a pointer to the required interface
649 * max - maximum number to receive (0 means unlimted)
650 *
651 * Output : number of served packets
652 */
653static int mv643xx_eth_receive_queue(struct net_device *dev, int budget) 581static int mv643xx_eth_receive_queue(struct net_device *dev, int budget)
654{ 582{
655 struct mv643xx_eth_private *mp = netdev_priv(dev); 583 struct mv643xx_eth_private *mp = netdev_priv(dev);
@@ -719,11 +647,6 @@ static int mv643xx_eth_receive_queue(struct net_device *dev, int budget)
719} 647}
720 648
721#ifdef MV643XX_ETH_NAPI 649#ifdef MV643XX_ETH_NAPI
722/*
723 * mv643xx_eth_poll
724 *
725 * This function is used in case of NAPI
726 */
727static int mv643xx_eth_poll(struct napi_struct *napi, int budget) 650static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
728{ 651{
729 struct mv643xx_eth_private *mp = container_of(napi, struct mv643xx_eth_private, napi); 652 struct mv643xx_eth_private *mp = container_of(napi, struct mv643xx_eth_private, napi);
@@ -756,13 +679,6 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
756 679
757 680
758/* tx ***********************************************************************/ 681/* tx ***********************************************************************/
759/**
760 * has_tiny_unaligned_frags - check if skb has any small, unaligned fragments
761 *
762 * Hardware can't handle unaligned fragments smaller than 9 bytes.
763 * This helper function detects that case.
764 */
765
766static inline unsigned int has_tiny_unaligned_frags(struct sk_buff *skb) 682static inline unsigned int has_tiny_unaligned_frags(struct sk_buff *skb)
767{ 683{
768 unsigned int frag; 684 unsigned int frag;
@@ -776,9 +692,6 @@ static inline unsigned int has_tiny_unaligned_frags(struct sk_buff *skb)
776 return 0; 692 return 0;
777} 693}
778 694
779/**
780 * alloc_tx_desc_index - return the index of the next available tx desc
781 */
782static int alloc_tx_desc_index(struct mv643xx_eth_private *mp) 695static int alloc_tx_desc_index(struct mv643xx_eth_private *mp)
783{ 696{
784 int tx_desc_curr; 697 int tx_desc_curr;
@@ -793,12 +706,6 @@ static int alloc_tx_desc_index(struct mv643xx_eth_private *mp)
793 return tx_desc_curr; 706 return tx_desc_curr;
794} 707}
795 708
796/**
797 * tx_fill_frag_descs - fill tx hw descriptors for an skb's fragments.
798 *
799 * Ensure the data for each fragment to be transmitted is mapped properly,
800 * then fill in descriptors in the tx hw queue.
801 */
802static void tx_fill_frag_descs(struct mv643xx_eth_private *mp, 709static void tx_fill_frag_descs(struct mv643xx_eth_private *mp,
803 struct sk_buff *skb) 710 struct sk_buff *skb)
804{ 711{
@@ -837,12 +744,6 @@ static inline __be16 sum16_as_be(__sum16 sum)
837 return (__force __be16)sum; 744 return (__force __be16)sum;
838} 745}
839 746
840/**
841 * tx_submit_descs_for_skb - submit data from an skb to the tx hw
842 *
843 * Ensure the data for an skb to be transmitted is mapped properly,
844 * then fill in descriptors in the tx hw queue and start the hardware.
845 */
846static void tx_submit_descs_for_skb(struct mv643xx_eth_private *mp, 747static void tx_submit_descs_for_skb(struct mv643xx_eth_private *mp,
847 struct sk_buff *skb) 748 struct sk_buff *skb)
848{ 749{
@@ -906,10 +807,6 @@ static void tx_submit_descs_for_skb(struct mv643xx_eth_private *mp,
906 mp->tx_desc_count += nr_frags + 1; 807 mp->tx_desc_count += nr_frags + 1;
907} 808}
908 809
909/**
910 * mv643xx_eth_start_xmit - queue an skb to the hardware for transmission
911 *
912 */
913static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) 810static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev)
914{ 811{
915 struct mv643xx_eth_private *mp = netdev_priv(dev); 812 struct mv643xx_eth_private *mp = netdev_priv(dev);
@@ -951,26 +848,6 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev)
951/* mii management interface *************************************************/ 848/* mii management interface *************************************************/
952static int phy_addr_get(struct mv643xx_eth_private *mp); 849static int phy_addr_get(struct mv643xx_eth_private *mp);
953 850
954/*
955 * read_smi_reg - Read PHY registers
956 *
957 * DESCRIPTION:
958 * This routine utilize the SMI interface to interact with the PHY in
959 * order to perform PHY register read.
960 *
961 * INPUT:
962 * struct mv643xx_eth_private *mp Ethernet Port.
963 * unsigned int phy_reg PHY register address offset.
964 * unsigned int *value Register value buffer.
965 *
966 * OUTPUT:
967 * Write the value of a specified PHY register into given buffer.
968 *
969 * RETURN:
970 * false if the PHY is busy or read data is not in valid state.
971 * true otherwise.
972 *
973 */
974static void read_smi_reg(struct mv643xx_eth_private *mp, 851static void read_smi_reg(struct mv643xx_eth_private *mp,
975 unsigned int phy_reg, unsigned int *value) 852 unsigned int phy_reg, unsigned int *value)
976{ 853{
@@ -1007,26 +884,6 @@ out:
1007 spin_unlock_irqrestore(&mp->shared_smi->phy_lock, flags); 884 spin_unlock_irqrestore(&mp->shared_smi->phy_lock, flags);
1008} 885}
1009 886
1010/*
1011 * write_smi_reg - Write to PHY registers
1012 *
1013 * DESCRIPTION:
1014 * This routine utilize the SMI interface to interact with the PHY in
1015 * order to perform writes to PHY registers.
1016 *
1017 * INPUT:
1018 * struct mv643xx_eth_private *mp Ethernet Port.
1019 * unsigned int phy_reg PHY register address offset.
1020 * unsigned int value Register value.
1021 *
1022 * OUTPUT:
1023 * Write the given value to the specified PHY register.
1024 *
1025 * RETURN:
1026 * false if the PHY is busy.
1027 * true otherwise.
1028 *
1029 */
1030static void write_smi_reg(struct mv643xx_eth_private *mp, 887static void write_smi_reg(struct mv643xx_eth_private *mp,
1031 unsigned int phy_reg, unsigned int value) 888 unsigned int phy_reg, unsigned int value)
1032{ 889{
@@ -1055,23 +912,6 @@ out:
1055 912
1056 913
1057/* mib counters *************************************************************/ 914/* mib counters *************************************************************/
1058/*
1059 * clear_mib_counters - Clear all MIB counters
1060 *
1061 * DESCRIPTION:
1062 * This function clears all MIB counters of a specific ethernet port.
1063 * A read from the MIB counter will reset the counter.
1064 *
1065 * INPUT:
1066 * struct mv643xx_eth_private *mp Ethernet Port.
1067 *
1068 * OUTPUT:
1069 * After reading all MIB counters, the counters resets.
1070 *
1071 * RETURN:
1072 * MIB counter value.
1073 *
1074 */
1075static void clear_mib_counters(struct mv643xx_eth_private *mp) 915static void clear_mib_counters(struct mv643xx_eth_private *mp)
1076{ 916{
1077 unsigned int port_num = mp->port_num; 917 unsigned int port_num = mp->port_num;
@@ -1286,9 +1126,6 @@ static const struct ethtool_ops mv643xx_eth_ethtool_ops = {
1286 1126
1287 1127
1288/* address handling *********************************************************/ 1128/* address handling *********************************************************/
1289/*
1290 * uc_addr_get - Read the MAC address from the port's hw registers
1291 */
1292static void uc_addr_get(struct mv643xx_eth_private *mp, unsigned char *p_addr) 1129static void uc_addr_get(struct mv643xx_eth_private *mp, unsigned char *p_addr)
1293{ 1130{
1294 unsigned int port_num = mp->port_num; 1131 unsigned int port_num = mp->port_num;
@@ -1306,22 +1143,6 @@ static void uc_addr_get(struct mv643xx_eth_private *mp, unsigned char *p_addr)
1306 p_addr[5] = mac_l & 0xff; 1143 p_addr[5] = mac_l & 0xff;
1307} 1144}
1308 1145
1309/*
1310 * init_mac_tables - Clear all entrance in the UC, SMC and OMC tables
1311 *
1312 * DESCRIPTION:
1313 * Go through all the DA filter tables (Unicast, Special Multicast &
1314 * Other Multicast) and set each entry to 0.
1315 *
1316 * INPUT:
1317 * struct mv643xx_eth_private *mp Ethernet Port.
1318 *
1319 * OUTPUT:
1320 * Multicast and Unicast packets are rejected.
1321 *
1322 * RETURN:
1323 * None.
1324 */
1325static void init_mac_tables(struct mv643xx_eth_private *mp) 1146static void init_mac_tables(struct mv643xx_eth_private *mp)
1326{ 1147{
1327 unsigned int port_num = mp->port_num; 1148 unsigned int port_num = mp->port_num;
@@ -1339,15 +1160,6 @@ static void init_mac_tables(struct mv643xx_eth_private *mp)
1339 } 1160 }
1340} 1161}
1341 1162
1342/*
1343 * The entries in each table are indexed by a hash of a packet's MAC
1344 * address. One bit in each entry determines whether the packet is
1345 * accepted. There are 4 entries (each 8 bits wide) in each register
1346 * of the table. The bits in each entry are defined as follows:
1347 * 0 Accept=1, Drop=0
1348 * 3-1 Queue (ETH_Q0=0)
1349 * 7-4 Reserved = 0;
1350 */
1351static void set_filter_table_entry(struct mv643xx_eth_private *mp, 1163static void set_filter_table_entry(struct mv643xx_eth_private *mp,
1352 int table, unsigned char entry) 1164 int table, unsigned char entry)
1353{ 1165{
@@ -1364,9 +1176,6 @@ static void set_filter_table_entry(struct mv643xx_eth_private *mp,
1364 wrl(mp, table + tbl_offset, table_reg); 1176 wrl(mp, table + tbl_offset, table_reg);
1365} 1177}
1366 1178
1367/*
1368 * uc_addr_set - Write a MAC address into the port's hw registers
1369 */
1370static void uc_addr_set(struct mv643xx_eth_private *mp, unsigned char *p_addr) 1179static void uc_addr_set(struct mv643xx_eth_private *mp, unsigned char *p_addr)
1371{ 1180{
1372 unsigned int port_num = mp->port_num; 1181 unsigned int port_num = mp->port_num;
@@ -1386,14 +1195,6 @@ static void uc_addr_set(struct mv643xx_eth_private *mp, unsigned char *p_addr)
1386 set_filter_table_entry(mp, table, p_addr[5] & 0x0f); 1195 set_filter_table_entry(mp, table, p_addr[5] & 0x0f);
1387} 1196}
1388 1197
1389/*
1390 * mv643xx_eth_update_mac_address
1391 *
1392 * Update the MAC address of the port in the address table
1393 *
1394 * Input : pointer to ethernet interface network device structure
1395 * Output : N/A
1396 */
1397static void mv643xx_eth_update_mac_address(struct net_device *dev) 1198static void mv643xx_eth_update_mac_address(struct net_device *dev)
1398{ 1199{
1399 struct mv643xx_eth_private *mp = netdev_priv(dev); 1200 struct mv643xx_eth_private *mp = netdev_priv(dev);
@@ -1402,17 +1203,6 @@ static void mv643xx_eth_update_mac_address(struct net_device *dev)
1402 uc_addr_set(mp, dev->dev_addr); 1203 uc_addr_set(mp, dev->dev_addr);
1403} 1204}
1404 1205
1405/*
1406 * mv643xx_eth_set_mac_address
1407 *
1408 * Change the interface's mac address.
1409 * No special hardware thing should be done because interface is always
1410 * put in promiscuous mode.
1411 *
1412 * Input : pointer to ethernet interface network device structure and
1413 * a pointer to the designated entry to be added to the cache.
1414 * Output : zero upon success, negative upon failure
1415 */
1416static int mv643xx_eth_set_mac_address(struct net_device *dev, void *addr) 1206static int mv643xx_eth_set_mac_address(struct net_device *dev, void *addr)
1417{ 1207{
1418 int i; 1208 int i;
@@ -1424,20 +1214,6 @@ static int mv643xx_eth_set_mac_address(struct net_device *dev, void *addr)
1424 return 0; 1214 return 0;
1425} 1215}
1426 1216
1427/*
1428 * mc_addr - Multicast address settings.
1429 *
1430 * The MV device supports multicast using two tables:
1431 * 1) Special Multicast Table for MAC addresses of the form
1432 * 0x01-00-5E-00-00-XX (where XX is between 0x00 and 0x_FF).
1433 * The MAC DA[7:0] bits are used as a pointer to the Special Multicast
1434 * Table entries in the DA-Filter table.
1435 * 2) Other Multicast Table for multicast of another type. A CRC-8bit
1436 * is used as an index to the Other Multicast Table entries in the
1437 * DA-Filter table. This function calculates the CRC-8bit value.
1438 * In either case, set_filter_table_entry() is then called
1439 * to set to set the actual table entry.
1440 */
1441static void mc_addr(struct mv643xx_eth_private *mp, unsigned char *p_addr) 1217static void mc_addr(struct mv643xx_eth_private *mp, unsigned char *p_addr)
1442{ 1218{
1443 unsigned int port_num = mp->port_num; 1219 unsigned int port_num = mp->port_num;
@@ -1528,9 +1304,6 @@ static void mc_addr(struct mv643xx_eth_private *mp, unsigned char *p_addr)
1528 set_filter_table_entry(mp, table, crc_result); 1304 set_filter_table_entry(mp, table, crc_result);
1529} 1305}
1530 1306
1531/*
1532 * Set the entire multicast list based on dev->mc_list.
1533 */
1534static void set_multicast_list(struct net_device *dev) 1307static void set_multicast_list(struct net_device *dev)
1535{ 1308{
1536 1309
@@ -1588,14 +1361,6 @@ static void set_multicast_list(struct net_device *dev)
1588 mc_addr(mp, mc_list->dmi_addr); 1361 mc_addr(mp, mc_list->dmi_addr);
1589} 1362}
1590 1363
1591/*
1592 * mv643xx_eth_set_rx_mode
1593 *
1594 * Change from promiscuos to regular rx mode
1595 *
1596 * Input : pointer to ethernet interface network device structure
1597 * Output : N/A
1598 */
1599static void mv643xx_eth_set_rx_mode(struct net_device *dev) 1364static void mv643xx_eth_set_rx_mode(struct net_device *dev)
1600{ 1365{
1601 struct mv643xx_eth_private *mp = netdev_priv(dev); 1366 struct mv643xx_eth_private *mp = netdev_priv(dev);
@@ -1613,28 +1378,6 @@ static void mv643xx_eth_set_rx_mode(struct net_device *dev)
1613 1378
1614 1379
1615/* rx/tx queue initialisation ***********************************************/ 1380/* rx/tx queue initialisation ***********************************************/
1616/*
1617 * ether_init_rx_desc_ring - Curve a Rx chain desc list and buffer in memory.
1618 *
1619 * DESCRIPTION:
1620 * This function prepares a Rx chained list of descriptors and packet
1621 * buffers in a form of a ring. The routine must be called after port
1622 * initialization routine and before port start routine.
1623 * The Ethernet SDMA engine uses CPU bus addresses to access the various
1624 * devices in the system (i.e. DRAM). This function uses the ethernet
1625 * struct 'virtual to physical' routine (set by the user) to set the ring
1626 * with physical addresses.
1627 *
1628 * INPUT:
1629 * struct mv643xx_eth_private *mp Ethernet Port Control srtuct.
1630 *
1631 * OUTPUT:
1632 * The routine updates the Ethernet port control struct with information
1633 * regarding the Rx descriptors and buffers.
1634 *
1635 * RETURN:
1636 * None.
1637 */
1638static void ether_init_rx_desc_ring(struct mv643xx_eth_private *mp) 1381static void ether_init_rx_desc_ring(struct mv643xx_eth_private *mp)
1639{ 1382{
1640 volatile struct rx_desc *p_rx_desc; 1383 volatile struct rx_desc *p_rx_desc;
@@ -1684,28 +1427,6 @@ static void mv643xx_eth_free_rx_rings(struct net_device *dev)
1684 mp->p_rx_desc_area, mp->rx_desc_dma); 1427 mp->p_rx_desc_area, mp->rx_desc_dma);
1685} 1428}
1686 1429
1687/*
1688 * ether_init_tx_desc_ring - Curve a Tx chain desc list and buffer in memory.
1689 *
1690 * DESCRIPTION:
1691 * This function prepares a Tx chained list of descriptors and packet
1692 * buffers in a form of a ring. The routine must be called after port
1693 * initialization routine and before port start routine.
1694 * The Ethernet SDMA engine uses CPU bus addresses to access the various
1695 * devices in the system (i.e. DRAM). This function uses the ethernet
1696 * struct 'virtual to physical' routine (set by the user) to set the ring
1697 * with physical addresses.
1698 *
1699 * INPUT:
1700 * struct mv643xx_eth_private *mp Ethernet Port Control srtuct.
1701 *
1702 * OUTPUT:
1703 * The routine updates the Ethernet port control struct with information
1704 * regarding the Tx descriptors and buffers.
1705 *
1706 * RETURN:
1707 * None.
1708 */
1709static void ether_init_tx_desc_ring(struct mv643xx_eth_private *mp) 1430static void ether_init_tx_desc_ring(struct mv643xx_eth_private *mp)
1710{ 1431{
1711 int tx_desc_num = mp->tx_ring_size; 1432 int tx_desc_num = mp->tx_ring_size;
@@ -1725,11 +1446,6 @@ static void ether_init_tx_desc_ring(struct mv643xx_eth_private *mp)
1725 mp->tx_desc_area_size = tx_desc_num * sizeof(struct tx_desc); 1446 mp->tx_desc_area_size = tx_desc_num * sizeof(struct tx_desc);
1726} 1447}
1727 1448
1728/**
1729 * mv643xx_eth_free_tx_descs - Free the tx desc data for completed descriptors
1730 *
1731 * If force is non-zero, frees uncompleted descriptors as well
1732 */
1733static int mv643xx_eth_free_tx_descs(struct net_device *dev, int force) 1449static int mv643xx_eth_free_tx_descs(struct net_device *dev, int force)
1734{ 1450{
1735 struct mv643xx_eth_private *mp = netdev_priv(dev); 1451 struct mv643xx_eth_private *mp = netdev_priv(dev);
@@ -1828,7 +1544,6 @@ static void mv643xx_eth_free_tx_rings(struct net_device *dev)
1828/* netdev ops and related ***************************************************/ 1544/* netdev ops and related ***************************************************/
1829static void port_reset(struct mv643xx_eth_private *mp); 1545static void port_reset(struct mv643xx_eth_private *mp);
1830 1546
1831/* Set the mv643xx port configuration register for the speed/duplex mode. */
1832static void mv643xx_eth_update_pscr(struct net_device *dev, 1547static void mv643xx_eth_update_pscr(struct net_device *dev,
1833 struct ethtool_cmd *ecmd) 1548 struct ethtool_cmd *ecmd)
1834{ 1549{
@@ -1874,17 +1589,6 @@ static void mv643xx_eth_update_pscr(struct net_device *dev,
1874 } 1589 }
1875} 1590}
1876 1591
1877/*
1878 * mv643xx_eth_int_handler
1879 *
1880 * Main interrupt handler for the gigbit ethernet ports
1881 *
1882 * Input : irq - irq number (not used)
1883 * dev_id - a pointer to the required interface's data structure
1884 * regs - not used
1885 * Output : N/A
1886 */
1887
1888static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id) 1592static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id)
1889{ 1593{
1890 struct net_device *dev = (struct net_device *)dev_id; 1594 struct net_device *dev = (struct net_device *)dev_id;
@@ -1947,22 +1651,6 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id)
1947 return IRQ_HANDLED; 1651 return IRQ_HANDLED;
1948} 1652}
1949 1653
1950/*
1951 * phy_reset - Reset Ethernet port PHY.
1952 *
1953 * DESCRIPTION:
1954 * This routine utilizes the SMI interface to reset the ethernet port PHY.
1955 *
1956 * INPUT:
1957 * struct mv643xx_eth_private *mp Ethernet Port.
1958 *
1959 * OUTPUT:
1960 * The PHY is reset.
1961 *
1962 * RETURN:
1963 * None.
1964 *
1965 */
1966static void phy_reset(struct mv643xx_eth_private *mp) 1654static void phy_reset(struct mv643xx_eth_private *mp)
1967{ 1655{
1968 unsigned int phy_reg_data; 1656 unsigned int phy_reg_data;
@@ -1979,33 +1667,6 @@ static void phy_reset(struct mv643xx_eth_private *mp)
1979 } while (phy_reg_data & 0x8000); 1667 } while (phy_reg_data & 0x8000);
1980} 1668}
1981 1669
1982/*
1983 * port_start - Start the Ethernet port activity.
1984 *
1985 * DESCRIPTION:
1986 * This routine prepares the Ethernet port for Rx and Tx activity:
1987 * 1. Initialize Tx and Rx Current Descriptor Pointer for each queue that
1988 * has been initialized a descriptor's ring (using
1989 * ether_init_tx_desc_ring for Tx and ether_init_rx_desc_ring for Rx)
1990 * 2. Initialize and enable the Ethernet configuration port by writing to
1991 * the port's configuration and command registers.
1992 * 3. Initialize and enable the SDMA by writing to the SDMA's
1993 * configuration and command registers. After completing these steps,
1994 * the ethernet port SDMA can starts to perform Rx and Tx activities.
1995 *
1996 * Note: Each Rx and Tx queue descriptor's list must be initialized prior
1997 * to calling this function (use ether_init_tx_desc_ring for Tx queues
1998 * and ether_init_rx_desc_ring for Rx queues).
1999 *
2000 * INPUT:
2001 * dev - a pointer to the required interface
2002 *
2003 * OUTPUT:
2004 * Ethernet port is ready to receive and transmit.
2005 *
2006 * RETURN:
2007 * None.
2008 */
2009static void port_start(struct net_device *dev) 1670static void port_start(struct net_device *dev)
2010{ 1671{
2011 struct mv643xx_eth_private *mp = netdev_priv(dev); 1672 struct mv643xx_eth_private *mp = netdev_priv(dev);
@@ -2070,29 +1731,6 @@ static void port_start(struct net_device *dev)
2070} 1731}
2071 1732
2072#ifdef MV643XX_ETH_COAL 1733#ifdef MV643XX_ETH_COAL
2073
2074/*
2075 * set_rx_coal - Sets coalescing interrupt mechanism on RX path
2076 *
2077 * DESCRIPTION:
2078 * This routine sets the RX coalescing interrupt mechanism parameter.
2079 * This parameter is a timeout counter, that counts in 64 t_clk
2080 * chunks ; that when timeout event occurs a maskable interrupt
2081 * occurs.
2082 * The parameter is calculated using the tClk of the MV-643xx chip
2083 * , and the required delay of the interrupt in usec.
2084 *
2085 * INPUT:
2086 * struct mv643xx_eth_private *mp Ethernet port
2087 * unsigned int delay Delay in usec
2088 *
2089 * OUTPUT:
2090 * Interrupt coalescing mechanism value is set in MV-643xx chip.
2091 *
2092 * RETURN:
2093 * The interrupt coalescing value set in the gigE port.
2094 *
2095 */
2096static unsigned int set_rx_coal(struct mv643xx_eth_private *mp, 1734static unsigned int set_rx_coal(struct mv643xx_eth_private *mp,
2097 unsigned int delay) 1735 unsigned int delay)
2098{ 1736{
@@ -2109,28 +1747,6 @@ static unsigned int set_rx_coal(struct mv643xx_eth_private *mp,
2109} 1747}
2110#endif 1748#endif
2111 1749
2112/*
2113 * set_tx_coal - Sets coalescing interrupt mechanism on TX path
2114 *
2115 * DESCRIPTION:
2116 * This routine sets the TX coalescing interrupt mechanism parameter.
2117 * This parameter is a timeout counter, that counts in 64 t_clk
2118 * chunks ; that when timeout event occurs a maskable interrupt
2119 * occurs.
2120 * The parameter is calculated using the t_cLK frequency of the
2121 * MV-643xx chip and the required delay in the interrupt in uSec
2122 *
2123 * INPUT:
2124 * struct mv643xx_eth_private *mp Ethernet port
2125 * unsigned int delay Delay in uSeconds
2126 *
2127 * OUTPUT:
2128 * Interrupt coalescing mechanism value is set in MV-643xx chip.
2129 *
2130 * RETURN:
2131 * The interrupt coalescing value set in the gigE port.
2132 *
2133 */
2134static unsigned int set_tx_coal(struct mv643xx_eth_private *mp, 1750static unsigned int set_tx_coal(struct mv643xx_eth_private *mp,
2135 unsigned int delay) 1751 unsigned int delay)
2136{ 1752{
@@ -2142,30 +1758,6 @@ static unsigned int set_tx_coal(struct mv643xx_eth_private *mp,
2142 return coal; 1758 return coal;
2143} 1759}
2144 1760
2145/*
2146 * port_init - Initialize the Ethernet port driver
2147 *
2148 * DESCRIPTION:
2149 * This function prepares the ethernet port to start its activity:
2150 * 1) Completes the ethernet port driver struct initialization toward port
2151 * start routine.
2152 * 2) Resets the device to a quiescent state in case of warm reboot.
2153 * 3) Enable SDMA access to all four DRAM banks as well as internal SRAM.
2154 * 4) Clean MAC tables. The reset status of those tables is unknown.
2155 * 5) Set PHY address.
2156 * Note: Call this routine prior to port_start routine and after
2157 * setting user values in the user fields of Ethernet port control
2158 * struct.
2159 *
2160 * INPUT:
2161 * struct mv643xx_eth_private *mp Ethernet port control struct
2162 *
2163 * OUTPUT:
2164 * See description.
2165 *
2166 * RETURN:
2167 * None.
2168 */
2169static void port_init(struct mv643xx_eth_private *mp) 1761static void port_init(struct mv643xx_eth_private *mp)
2170{ 1762{
2171 mp->rx_resource_err = 0; 1763 mp->rx_resource_err = 0;
@@ -2175,19 +1767,6 @@ static void port_init(struct mv643xx_eth_private *mp)
2175 init_mac_tables(mp); 1767 init_mac_tables(mp);
2176} 1768}
2177 1769
2178/*
2179 * mv643xx_eth_open
2180 *
2181 * This function is called when openning the network device. The function
2182 * should initialize all the hardware, initialize cyclic Rx/Tx
2183 * descriptors chain and buffers and allocate an IRQ to the network
2184 * device.
2185 *
2186 * Input : a pointer to the network device structure
2187 *
2188 * Output : zero of success , nonzero if fails.
2189 */
2190
2191static int mv643xx_eth_open(struct net_device *dev) 1770static int mv643xx_eth_open(struct net_device *dev)
2192{ 1771{
2193 struct mv643xx_eth_private *mp = netdev_priv(dev); 1772 struct mv643xx_eth_private *mp = netdev_priv(dev);
@@ -2320,24 +1899,6 @@ out_free_irq:
2320 return err; 1899 return err;
2321} 1900}
2322 1901
2323/*
2324 * port_reset - Reset Ethernet port
2325 *
2326 * DESCRIPTION:
2327 * This routine resets the chip by aborting any SDMA engine activity and
2328 * clearing the MIB counters. The Receiver and the Transmit unit are in
2329 * idle state after this command is performed and the port is disabled.
2330 *
2331 * INPUT:
2332 * struct mv643xx_eth_private *mp Ethernet Port.
2333 *
2334 * OUTPUT:
2335 * Channel activity is halted.
2336 *
2337 * RETURN:
2338 * None.
2339 *
2340 */
2341static void port_reset(struct mv643xx_eth_private *mp) 1902static void port_reset(struct mv643xx_eth_private *mp)
2342{ 1903{
2343 unsigned int port_num = mp->port_num; 1904 unsigned int port_num = mp->port_num;
@@ -2357,16 +1918,6 @@ static void port_reset(struct mv643xx_eth_private *mp)
2357 wrl(mp, PORT_SERIAL_CONTROL(port_num), reg_data); 1918 wrl(mp, PORT_SERIAL_CONTROL(port_num), reg_data);
2358} 1919}
2359 1920
2360/*
2361 * mv643xx_eth_stop
2362 *
2363 * This function is used when closing the network device.
2364 * It updates the hardware,
2365 * release all memory that holds buffers and descriptors and release the IRQ.
2366 * Input : a pointer to the device structure
2367 * Output : zero if success , nonzero if fails
2368 */
2369
2370static int mv643xx_eth_stop(struct net_device *dev) 1921static int mv643xx_eth_stop(struct net_device *dev)
2371{ 1922{
2372 struct mv643xx_eth_private *mp = netdev_priv(dev); 1923 struct mv643xx_eth_private *mp = netdev_priv(dev);
@@ -2400,13 +1951,6 @@ static int mv643xx_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr, int c
2400 return generic_mii_ioctl(&mp->mii, if_mii(ifr), cmd, NULL); 1951 return generic_mii_ioctl(&mp->mii, if_mii(ifr), cmd, NULL);
2401} 1952}
2402 1953
2403/*
2404 * Changes MTU (maximum transfer unit) of the gigabit ethenret port
2405 *
2406 * Input : pointer to ethernet interface network device structure
2407 * new mtu size
2408 * Output : 0 upon success, -EINVAL upon failure
2409 */
2410static int mv643xx_eth_change_mtu(struct net_device *dev, int new_mtu) 1954static int mv643xx_eth_change_mtu(struct net_device *dev, int new_mtu)
2411{ 1955{
2412 if ((new_mtu > 9500) || (new_mtu < 64)) 1956 if ((new_mtu > 9500) || (new_mtu < 64))
@@ -2431,11 +1975,6 @@ static int mv643xx_eth_change_mtu(struct net_device *dev, int new_mtu)
2431 return 0; 1975 return 0;
2432} 1976}
2433 1977
2434/*
2435 * mv643xx_eth_tx_timeout_task
2436 *
2437 * Actual routine to reset the adapter when a timeout on Tx has occurred
2438 */
2439static void mv643xx_eth_tx_timeout_task(struct work_struct *ugly) 1978static void mv643xx_eth_tx_timeout_task(struct work_struct *ugly)
2440{ 1979{
2441 struct mv643xx_eth_private *mp = container_of(ugly, struct mv643xx_eth_private, 1980 struct mv643xx_eth_private *mp = container_of(ugly, struct mv643xx_eth_private,
@@ -2454,14 +1993,6 @@ static void mv643xx_eth_tx_timeout_task(struct work_struct *ugly)
2454 netif_wake_queue(dev); 1993 netif_wake_queue(dev);
2455} 1994}
2456 1995
2457/*
2458 * mv643xx_eth_tx_timeout
2459 *
2460 * Called upon a timeout on transmitting a packet
2461 *
2462 * Input : pointer to ethernet interface network device structure.
2463 * Output : N/A
2464 */
2465static void mv643xx_eth_tx_timeout(struct net_device *dev) 1996static void mv643xx_eth_tx_timeout(struct net_device *dev)
2466{ 1997{
2467 struct mv643xx_eth_private *mp = netdev_priv(dev); 1998 struct mv643xx_eth_private *mp = netdev_priv(dev);
@@ -2488,9 +2019,6 @@ static void mv643xx_eth_netpoll(struct net_device *netdev)
2488} 2019}
2489#endif 2020#endif
2490 2021
2491/*
2492 * Wrappers for MII support library.
2493 */
2494static int mv643xx_eth_mdio_read(struct net_device *dev, int phy_id, int location) 2022static int mv643xx_eth_mdio_read(struct net_device *dev, int phy_id, int location)
2495{ 2023{
2496 struct mv643xx_eth_private *mp = netdev_priv(dev); 2024 struct mv643xx_eth_private *mp = netdev_priv(dev);
@@ -2607,23 +2135,6 @@ static struct platform_driver mv643xx_eth_shared_driver = {
2607 }, 2135 },
2608}; 2136};
2609 2137
2610/*
2611 * phy_addr_set - Set the ethernet port PHY address.
2612 *
2613 * DESCRIPTION:
2614 * This routine sets the given ethernet port PHY address.
2615 *
2616 * INPUT:
2617 * struct mv643xx_eth_private *mp Ethernet Port.
2618 * int phy_addr PHY address.
2619 *
2620 * OUTPUT:
2621 * None.
2622 *
2623 * RETURN:
2624 * None.
2625 *
2626 */
2627static void phy_addr_set(struct mv643xx_eth_private *mp, int phy_addr) 2138static void phy_addr_set(struct mv643xx_eth_private *mp, int phy_addr)
2628{ 2139{
2629 u32 reg_data; 2140 u32 reg_data;
@@ -2635,22 +2146,6 @@ static void phy_addr_set(struct mv643xx_eth_private *mp, int phy_addr)
2635 wrl(mp, PHY_ADDR, reg_data); 2146 wrl(mp, PHY_ADDR, reg_data);
2636} 2147}
2637 2148
2638/*
2639 * phy_addr_get - Get the ethernet port PHY address.
2640 *
2641 * DESCRIPTION:
2642 * This routine returns the given ethernet port PHY address.
2643 *
2644 * INPUT:
2645 * struct mv643xx_eth_private *mp Ethernet Port.
2646 *
2647 * OUTPUT:
2648 * None.
2649 *
2650 * RETURN:
2651 * PHY address.
2652 *
2653 */
2654static int phy_addr_get(struct mv643xx_eth_private *mp) 2149static int phy_addr_get(struct mv643xx_eth_private *mp)
2655{ 2150{
2656 unsigned int reg_data; 2151 unsigned int reg_data;
@@ -2660,24 +2155,6 @@ static int phy_addr_get(struct mv643xx_eth_private *mp)
2660 return ((reg_data >> (5 * mp->port_num)) & 0x1f); 2155 return ((reg_data >> (5 * mp->port_num)) & 0x1f);
2661} 2156}
2662 2157
2663/*
2664 * phy_detect - Detect whether a phy is present
2665 *
2666 * DESCRIPTION:
2667 * This function tests whether there is a PHY present on
2668 * the specified port.
2669 *
2670 * INPUT:
2671 * struct mv643xx_eth_private *mp Ethernet Port.
2672 *
2673 * OUTPUT:
2674 * None
2675 *
2676 * RETURN:
2677 * 0 on success
2678 * -ENODEV on failure
2679 *
2680 */
2681static int phy_detect(struct mv643xx_eth_private *mp) 2158static int phy_detect(struct mv643xx_eth_private *mp)
2682{ 2159{
2683 unsigned int phy_reg_data0; 2160 unsigned int phy_reg_data0;
@@ -2726,17 +2203,6 @@ static void mv643xx_init_ethtool_cmd(struct net_device *dev, int phy_address,
2726 } 2203 }
2727} 2204}
2728 2205
2729/*/
2730 * mv643xx_eth_probe
2731 *
2732 * First function called after registering the network device.
2733 * It's purpose is to initialize the device as an ethernet device,
2734 * fill the ethernet device structure with pointers * to functions,
2735 * and set the MAC address of the interface
2736 *
2737 * Input : struct device *
2738 * Output : -ENOMEM if failed , 0 if success
2739 */
2740static int mv643xx_eth_probe(struct platform_device *pdev) 2206static int mv643xx_eth_probe(struct platform_device *pdev)
2741{ 2207{
2742 struct mv643xx_eth_platform_data *pd; 2208 struct mv643xx_eth_platform_data *pd;
@@ -2949,15 +2415,6 @@ static struct platform_driver mv643xx_eth_driver = {
2949 }, 2415 },
2950}; 2416};
2951 2417
2952/*
2953 * mv643xx_eth_init_module
2954 *
2955 * Registers the network drivers into the Linux kernel
2956 *
2957 * Input : N/A
2958 *
2959 * Output : N/A
2960 */
2961static int __init mv643xx_eth_init_module(void) 2418static int __init mv643xx_eth_init_module(void)
2962{ 2419{
2963 int rc; 2420 int rc;
@@ -2971,15 +2428,6 @@ static int __init mv643xx_eth_init_module(void)
2971 return rc; 2428 return rc;
2972} 2429}
2973 2430
2974/*
2975 * mv643xx_eth_cleanup_module
2976 *
2977 * Registers the network drivers into the Linux kernel
2978 *
2979 * Input : N/A
2980 *
2981 * Output : N/A
2982 */
2983static void __exit mv643xx_eth_cleanup_module(void) 2431static void __exit mv643xx_eth_cleanup_module(void)
2984{ 2432{
2985 platform_driver_unregister(&mv643xx_eth_driver); 2433 platform_driver_unregister(&mv643xx_eth_driver);