diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2008-05-31 20:18:13 -0400 |
---|---|---|
committer | Lennert Buytenhek <buytenh@wantstofly.org> | 2008-06-12 02:40:30 -0400 |
commit | e53714933c66668ecb7eb9a48d79725e5a077a93 (patch) | |
tree | 8a6d1a117d1e230c7224a2f1c35b5ff6db6abc4e /drivers/net | |
parent | cc9754b3334ea371c25041b03b2fdc08404f38b4 (diff) |
mv643xx_eth: use 'mv643xx_eth_' prefix consistently
A bunch of places in the mv643xx_eth driver use the 'mv643xx_'
prefix. Since the mv643xx is a chip that includes more than just
ethernet, this patch makes all those places use either no prefix
(for some internal-use-only functions), or the full 'mv643xx_eth_'
prefix.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Acked-by: Dale Farnsworth <dale@farnsworth.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/mv643xx_eth.c | 411 |
1 files changed, 206 insertions, 205 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 624f80775506..80482cac173d 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -54,20 +54,20 @@ | |||
54 | #include <asm/types.h> | 54 | #include <asm/types.h> |
55 | #include <asm/system.h> | 55 | #include <asm/system.h> |
56 | 56 | ||
57 | static char mv643xx_driver_name[] = "mv643xx_eth"; | 57 | static char mv643xx_eth_driver_name[] = "mv643xx_eth"; |
58 | static char mv643xx_driver_version[] = "1.0"; | 58 | static char mv643xx_eth_driver_version[] = "1.0"; |
59 | 59 | ||
60 | #define MV643XX_CHECKSUM_OFFLOAD_TX | 60 | #define MV643XX_ETH_CHECKSUM_OFFLOAD_TX |
61 | #define MV643XX_NAPI | 61 | #define MV643XX_ETH_NAPI |
62 | #define MV643XX_TX_FAST_REFILL | 62 | #define MV643XX_ETH_TX_FAST_REFILL |
63 | #undef MV643XX_COAL | 63 | #undef MV643XX_ETH_COAL |
64 | 64 | ||
65 | #define MV643XX_TX_COAL 100 | 65 | #define MV643XX_ETH_TX_COAL 100 |
66 | #ifdef MV643XX_COAL | 66 | #ifdef MV643XX_ETH_COAL |
67 | #define MV643XX_RX_COAL 100 | 67 | #define MV643XX_ETH_RX_COAL 100 |
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | #ifdef MV643XX_CHECKSUM_OFFLOAD_TX | 70 | #ifdef MV643XX_ETH_CHECKSUM_OFFLOAD_TX |
71 | #define MAX_DESCS_PER_SKB (MAX_SKB_FRAGS + 1) | 71 | #define MAX_DESCS_PER_SKB (MAX_SKB_FRAGS + 1) |
72 | #else | 72 | #else |
73 | #define MAX_DESCS_PER_SKB 1 | 73 | #define MAX_DESCS_PER_SKB 1 |
@@ -263,7 +263,7 @@ struct pkt_info { | |||
263 | 263 | ||
264 | 264 | ||
265 | /* global *******************************************************************/ | 265 | /* global *******************************************************************/ |
266 | struct mv643xx_shared_private { | 266 | struct mv643xx_eth_shared_private { |
267 | void __iomem *base; | 267 | void __iomem *base; |
268 | 268 | ||
269 | /* used to protect SMI_REG, which is shared across ports */ | 269 | /* used to protect SMI_REG, which is shared across ports */ |
@@ -276,7 +276,7 @@ struct mv643xx_shared_private { | |||
276 | 276 | ||
277 | 277 | ||
278 | /* per-port *****************************************************************/ | 278 | /* per-port *****************************************************************/ |
279 | struct mv643xx_mib_counters { | 279 | struct mib_counters { |
280 | u64 good_octets_received; | 280 | u64 good_octets_received; |
281 | u32 bad_octets_received; | 281 | u32 bad_octets_received; |
282 | u32 internal_mac_transmit_err; | 282 | u32 internal_mac_transmit_err; |
@@ -309,11 +309,11 @@ struct mv643xx_mib_counters { | |||
309 | u32 late_collision; | 309 | u32 late_collision; |
310 | }; | 310 | }; |
311 | 311 | ||
312 | struct mv643xx_private { | 312 | struct mv643xx_eth_private { |
313 | struct mv643xx_shared_private *shared; | 313 | struct mv643xx_eth_shared_private *shared; |
314 | int port_num; /* User Ethernet port number */ | 314 | int port_num; /* User Ethernet port number */ |
315 | 315 | ||
316 | struct mv643xx_shared_private *shared_smi; | 316 | struct mv643xx_eth_shared_private *shared_smi; |
317 | 317 | ||
318 | u32 rx_sram_addr; /* Base address of rx sram area */ | 318 | u32 rx_sram_addr; /* Base address of rx sram area */ |
319 | u32 rx_sram_size; /* Size of rx sram area */ | 319 | u32 rx_sram_size; /* Size of rx sram area */ |
@@ -330,7 +330,7 @@ struct mv643xx_private { | |||
330 | /* Next available and first returning Tx resource */ | 330 | /* Next available and first returning Tx resource */ |
331 | int tx_curr_desc_q, tx_used_desc_q; | 331 | int tx_curr_desc_q, tx_used_desc_q; |
332 | 332 | ||
333 | #ifdef MV643XX_TX_FAST_REFILL | 333 | #ifdef MV643XX_ETH_TX_FAST_REFILL |
334 | u32 tx_clean_threshold; | 334 | u32 tx_clean_threshold; |
335 | #endif | 335 | #endif |
336 | 336 | ||
@@ -349,7 +349,7 @@ struct mv643xx_private { | |||
349 | struct net_device *dev; | 349 | struct net_device *dev; |
350 | struct napi_struct napi; | 350 | struct napi_struct napi; |
351 | struct net_device_stats stats; | 351 | struct net_device_stats stats; |
352 | struct mv643xx_mib_counters mib_counters; | 352 | struct mib_counters mib_counters; |
353 | spinlock_t lock; | 353 | spinlock_t lock; |
354 | /* Size of Tx Ring per queue */ | 354 | /* Size of Tx Ring per queue */ |
355 | int tx_ring_size; | 355 | int tx_ring_size; |
@@ -373,25 +373,25 @@ struct mv643xx_private { | |||
373 | 373 | ||
374 | 374 | ||
375 | /* port register accessors **************************************************/ | 375 | /* port register accessors **************************************************/ |
376 | static inline u32 rdl(struct mv643xx_private *mp, int offset) | 376 | static inline u32 rdl(struct mv643xx_eth_private *mp, int offset) |
377 | { | 377 | { |
378 | return readl(mp->shared->base + offset); | 378 | return readl(mp->shared->base + offset); |
379 | } | 379 | } |
380 | 380 | ||
381 | static inline void wrl(struct mv643xx_private *mp, int offset, u32 data) | 381 | static inline void wrl(struct mv643xx_eth_private *mp, int offset, u32 data) |
382 | { | 382 | { |
383 | writel(data, mp->shared->base + offset); | 383 | writel(data, mp->shared->base + offset); |
384 | } | 384 | } |
385 | 385 | ||
386 | 386 | ||
387 | /* rxq/txq helper functions *************************************************/ | 387 | /* rxq/txq helper functions *************************************************/ |
388 | static void mv643xx_eth_port_enable_rx(struct mv643xx_private *mp, | 388 | static void mv643xx_eth_port_enable_rx(struct mv643xx_eth_private *mp, |
389 | unsigned int queues) | 389 | unsigned int queues) |
390 | { | 390 | { |
391 | wrl(mp, RXQ_COMMAND(mp->port_num), queues); | 391 | wrl(mp, RXQ_COMMAND(mp->port_num), queues); |
392 | } | 392 | } |
393 | 393 | ||
394 | static unsigned int mv643xx_eth_port_disable_rx(struct mv643xx_private *mp) | 394 | static unsigned int mv643xx_eth_port_disable_rx(struct mv643xx_eth_private *mp) |
395 | { | 395 | { |
396 | unsigned int port_num = mp->port_num; | 396 | unsigned int port_num = mp->port_num; |
397 | u32 queues; | 397 | u32 queues; |
@@ -411,13 +411,13 @@ static unsigned int mv643xx_eth_port_disable_rx(struct mv643xx_private *mp) | |||
411 | return queues; | 411 | return queues; |
412 | } | 412 | } |
413 | 413 | ||
414 | static void mv643xx_eth_port_enable_tx(struct mv643xx_private *mp, | 414 | static void mv643xx_eth_port_enable_tx(struct mv643xx_eth_private *mp, |
415 | unsigned int queues) | 415 | unsigned int queues) |
416 | { | 416 | { |
417 | wrl(mp, TXQ_COMMAND(mp->port_num), queues); | 417 | wrl(mp, TXQ_COMMAND(mp->port_num), queues); |
418 | } | 418 | } |
419 | 419 | ||
420 | static unsigned int mv643xx_eth_port_disable_tx(struct mv643xx_private *mp) | 420 | static unsigned int mv643xx_eth_port_disable_tx(struct mv643xx_eth_private *mp) |
421 | { | 421 | { |
422 | unsigned int port_num = mp->port_num; | 422 | unsigned int port_num = mp->port_num; |
423 | u32 queues; | 423 | u32 queues; |
@@ -455,7 +455,7 @@ static void mv643xx_eth_free_completed_tx_descs(struct net_device *dev); | |||
455 | * no available Rx resources, the function resets the resource error flag. | 455 | * no available Rx resources, the function resets the resource error flag. |
456 | * | 456 | * |
457 | * INPUT: | 457 | * INPUT: |
458 | * struct mv643xx_private *mp Ethernet Port Control srtuct. | 458 | * struct mv643xx_eth_private *mp Ethernet Port Control srtuct. |
459 | * struct pkt_info *p_pkt_info Information on returned buffer. | 459 | * struct pkt_info *p_pkt_info Information on returned buffer. |
460 | * | 460 | * |
461 | * OUTPUT: | 461 | * OUTPUT: |
@@ -465,7 +465,7 @@ static void mv643xx_eth_free_completed_tx_descs(struct net_device *dev); | |||
465 | * ETH_ERROR in case the routine can not access Rx desc ring. | 465 | * ETH_ERROR in case the routine can not access Rx desc ring. |
466 | * ETH_OK otherwise. | 466 | * ETH_OK otherwise. |
467 | */ | 467 | */ |
468 | static FUNC_RET_STATUS rx_return_buff(struct mv643xx_private *mp, | 468 | static FUNC_RET_STATUS rx_return_buff(struct mv643xx_eth_private *mp, |
469 | struct pkt_info *p_pkt_info) | 469 | struct pkt_info *p_pkt_info) |
470 | { | 470 | { |
471 | int used_rx_desc; /* Where to return Rx resource */ | 471 | int used_rx_desc; /* Where to return Rx resource */ |
@@ -510,7 +510,7 @@ static FUNC_RET_STATUS rx_return_buff(struct mv643xx_private *mp, | |||
510 | */ | 510 | */ |
511 | static void mv643xx_eth_rx_refill_descs(struct net_device *dev) | 511 | static void mv643xx_eth_rx_refill_descs(struct net_device *dev) |
512 | { | 512 | { |
513 | struct mv643xx_private *mp = netdev_priv(dev); | 513 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
514 | struct pkt_info pkt_info; | 514 | struct pkt_info pkt_info; |
515 | struct sk_buff *skb; | 515 | struct sk_buff *skb; |
516 | int unaligned; | 516 | int unaligned; |
@@ -572,7 +572,7 @@ static inline void mv643xx_eth_rx_refill_descs_timer_wrapper(unsigned long data) | |||
572 | * is set. | 572 | * is set. |
573 | * | 573 | * |
574 | * INPUT: | 574 | * INPUT: |
575 | * struct mv643xx_private *mp Ethernet Port Control srtuct. | 575 | * struct mv643xx_eth_private *mp Ethernet Port Control srtuct. |
576 | * struct pkt_info *p_pkt_info User packet buffer. | 576 | * struct pkt_info *p_pkt_info User packet buffer. |
577 | * | 577 | * |
578 | * OUTPUT: | 578 | * OUTPUT: |
@@ -584,7 +584,7 @@ static inline void mv643xx_eth_rx_refill_descs_timer_wrapper(unsigned long data) | |||
584 | * ETH_END_OF_JOB if there is no received data. | 584 | * ETH_END_OF_JOB if there is no received data. |
585 | * ETH_OK otherwise. | 585 | * ETH_OK otherwise. |
586 | */ | 586 | */ |
587 | static FUNC_RET_STATUS port_receive(struct mv643xx_private *mp, | 587 | static FUNC_RET_STATUS port_receive(struct mv643xx_eth_private *mp, |
588 | struct pkt_info *p_pkt_info) | 588 | struct pkt_info *p_pkt_info) |
589 | { | 589 | { |
590 | int rx_next_curr_desc, rx_curr_desc, rx_used_desc; | 590 | int rx_next_curr_desc, rx_curr_desc, rx_used_desc; |
@@ -652,7 +652,7 @@ static FUNC_RET_STATUS port_receive(struct mv643xx_private *mp, | |||
652 | */ | 652 | */ |
653 | static int mv643xx_eth_receive_queue(struct net_device *dev, int budget) | 653 | static int mv643xx_eth_receive_queue(struct net_device *dev, int budget) |
654 | { | 654 | { |
655 | struct mv643xx_private *mp = netdev_priv(dev); | 655 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
656 | struct net_device_stats *stats = &dev->stats; | 656 | struct net_device_stats *stats = &dev->stats; |
657 | unsigned int received_packets = 0; | 657 | unsigned int received_packets = 0; |
658 | struct sk_buff *skb; | 658 | struct sk_buff *skb; |
@@ -705,7 +705,7 @@ static int mv643xx_eth_receive_queue(struct net_device *dev, int budget) | |||
705 | (pkt_info.cmd_sts & 0x0007fff8) >> 3); | 705 | (pkt_info.cmd_sts & 0x0007fff8) >> 3); |
706 | } | 706 | } |
707 | skb->protocol = eth_type_trans(skb, dev); | 707 | skb->protocol = eth_type_trans(skb, dev); |
708 | #ifdef MV643XX_NAPI | 708 | #ifdef MV643XX_ETH_NAPI |
709 | netif_receive_skb(skb); | 709 | netif_receive_skb(skb); |
710 | #else | 710 | #else |
711 | netif_rx(skb); | 711 | netif_rx(skb); |
@@ -718,20 +718,20 @@ static int mv643xx_eth_receive_queue(struct net_device *dev, int budget) | |||
718 | return received_packets; | 718 | return received_packets; |
719 | } | 719 | } |
720 | 720 | ||
721 | #ifdef MV643XX_NAPI | 721 | #ifdef MV643XX_ETH_NAPI |
722 | /* | 722 | /* |
723 | * mv643xx_poll | 723 | * mv643xx_eth_poll |
724 | * | 724 | * |
725 | * This function is used in case of NAPI | 725 | * This function is used in case of NAPI |
726 | */ | 726 | */ |
727 | static int mv643xx_poll(struct napi_struct *napi, int budget) | 727 | static int mv643xx_eth_poll(struct napi_struct *napi, int budget) |
728 | { | 728 | { |
729 | struct mv643xx_private *mp = container_of(napi, struct mv643xx_private, napi); | 729 | struct mv643xx_eth_private *mp = container_of(napi, struct mv643xx_eth_private, napi); |
730 | struct net_device *dev = mp->dev; | 730 | struct net_device *dev = mp->dev; |
731 | unsigned int port_num = mp->port_num; | 731 | unsigned int port_num = mp->port_num; |
732 | int work_done; | 732 | int work_done; |
733 | 733 | ||
734 | #ifdef MV643XX_TX_FAST_REFILL | 734 | #ifdef MV643XX_ETH_TX_FAST_REFILL |
735 | if (++mp->tx_clean_threshold > 5) { | 735 | if (++mp->tx_clean_threshold > 5) { |
736 | mv643xx_eth_free_completed_tx_descs(dev); | 736 | mv643xx_eth_free_completed_tx_descs(dev); |
737 | mp->tx_clean_threshold = 0; | 737 | mp->tx_clean_threshold = 0; |
@@ -779,7 +779,7 @@ static inline unsigned int has_tiny_unaligned_frags(struct sk_buff *skb) | |||
779 | /** | 779 | /** |
780 | * alloc_tx_desc_index - return the index of the next available tx desc | 780 | * alloc_tx_desc_index - return the index of the next available tx desc |
781 | */ | 781 | */ |
782 | static int alloc_tx_desc_index(struct mv643xx_private *mp) | 782 | static int alloc_tx_desc_index(struct mv643xx_eth_private *mp) |
783 | { | 783 | { |
784 | int tx_desc_curr; | 784 | int tx_desc_curr; |
785 | 785 | ||
@@ -799,7 +799,7 @@ static int alloc_tx_desc_index(struct mv643xx_private *mp) | |||
799 | * Ensure the data for each fragment to be transmitted is mapped properly, | 799 | * Ensure the data for each fragment to be transmitted is mapped properly, |
800 | * then fill in descriptors in the tx hw queue. | 800 | * then fill in descriptors in the tx hw queue. |
801 | */ | 801 | */ |
802 | static void tx_fill_frag_descs(struct mv643xx_private *mp, | 802 | static void tx_fill_frag_descs(struct mv643xx_eth_private *mp, |
803 | struct sk_buff *skb) | 803 | struct sk_buff *skb) |
804 | { | 804 | { |
805 | int frag; | 805 | int frag; |
@@ -843,7 +843,7 @@ static inline __be16 sum16_as_be(__sum16 sum) | |||
843 | * Ensure the data for an skb to be transmitted is mapped properly, | 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. | 844 | * then fill in descriptors in the tx hw queue and start the hardware. |
845 | */ | 845 | */ |
846 | static void tx_submit_descs_for_skb(struct mv643xx_private *mp, | 846 | static void tx_submit_descs_for_skb(struct mv643xx_eth_private *mp, |
847 | struct sk_buff *skb) | 847 | struct sk_buff *skb) |
848 | { | 848 | { |
849 | int tx_index; | 849 | int tx_index; |
@@ -912,7 +912,7 @@ static void tx_submit_descs_for_skb(struct mv643xx_private *mp, | |||
912 | */ | 912 | */ |
913 | static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) | 913 | static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) |
914 | { | 914 | { |
915 | struct mv643xx_private *mp = netdev_priv(dev); | 915 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
916 | struct net_device_stats *stats = &dev->stats; | 916 | struct net_device_stats *stats = &dev->stats; |
917 | unsigned long flags; | 917 | unsigned long flags; |
918 | 918 | ||
@@ -949,7 +949,7 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
949 | 949 | ||
950 | 950 | ||
951 | /* mii management interface *************************************************/ | 951 | /* mii management interface *************************************************/ |
952 | static int phy_addr_get(struct mv643xx_private *mp); | 952 | static int phy_addr_get(struct mv643xx_eth_private *mp); |
953 | 953 | ||
954 | /* | 954 | /* |
955 | * read_smi_reg - Read PHY registers | 955 | * read_smi_reg - Read PHY registers |
@@ -959,7 +959,7 @@ static int phy_addr_get(struct mv643xx_private *mp); | |||
959 | * order to perform PHY register read. | 959 | * order to perform PHY register read. |
960 | * | 960 | * |
961 | * INPUT: | 961 | * INPUT: |
962 | * struct mv643xx_private *mp Ethernet Port. | 962 | * struct mv643xx_eth_private *mp Ethernet Port. |
963 | * unsigned int phy_reg PHY register address offset. | 963 | * unsigned int phy_reg PHY register address offset. |
964 | * unsigned int *value Register value buffer. | 964 | * unsigned int *value Register value buffer. |
965 | * | 965 | * |
@@ -971,7 +971,7 @@ static int phy_addr_get(struct mv643xx_private *mp); | |||
971 | * true otherwise. | 971 | * true otherwise. |
972 | * | 972 | * |
973 | */ | 973 | */ |
974 | static void read_smi_reg(struct mv643xx_private *mp, | 974 | static void read_smi_reg(struct mv643xx_eth_private *mp, |
975 | unsigned int phy_reg, unsigned int *value) | 975 | unsigned int phy_reg, unsigned int *value) |
976 | { | 976 | { |
977 | void __iomem *smi_reg = mp->shared_smi->base + SMI_REG; | 977 | void __iomem *smi_reg = mp->shared_smi->base + SMI_REG; |
@@ -1015,7 +1015,7 @@ out: | |||
1015 | * order to perform writes to PHY registers. | 1015 | * order to perform writes to PHY registers. |
1016 | * | 1016 | * |
1017 | * INPUT: | 1017 | * INPUT: |
1018 | * struct mv643xx_private *mp Ethernet Port. | 1018 | * struct mv643xx_eth_private *mp Ethernet Port. |
1019 | * unsigned int phy_reg PHY register address offset. | 1019 | * unsigned int phy_reg PHY register address offset. |
1020 | * unsigned int value Register value. | 1020 | * unsigned int value Register value. |
1021 | * | 1021 | * |
@@ -1027,7 +1027,7 @@ out: | |||
1027 | * true otherwise. | 1027 | * true otherwise. |
1028 | * | 1028 | * |
1029 | */ | 1029 | */ |
1030 | static void write_smi_reg(struct mv643xx_private *mp, | 1030 | static void write_smi_reg(struct mv643xx_eth_private *mp, |
1031 | unsigned int phy_reg, unsigned int value) | 1031 | unsigned int phy_reg, unsigned int value) |
1032 | { | 1032 | { |
1033 | void __iomem *smi_reg = mp->shared_smi->base + SMI_REG; | 1033 | void __iomem *smi_reg = mp->shared_smi->base + SMI_REG; |
@@ -1063,7 +1063,7 @@ out: | |||
1063 | * A read from the MIB counter will reset the counter. | 1063 | * A read from the MIB counter will reset the counter. |
1064 | * | 1064 | * |
1065 | * INPUT: | 1065 | * INPUT: |
1066 | * struct mv643xx_private *mp Ethernet Port. | 1066 | * struct mv643xx_eth_private *mp Ethernet Port. |
1067 | * | 1067 | * |
1068 | * OUTPUT: | 1068 | * OUTPUT: |
1069 | * After reading all MIB counters, the counters resets. | 1069 | * After reading all MIB counters, the counters resets. |
@@ -1072,7 +1072,7 @@ out: | |||
1072 | * MIB counter value. | 1072 | * MIB counter value. |
1073 | * | 1073 | * |
1074 | */ | 1074 | */ |
1075 | static void clear_mib_counters(struct mv643xx_private *mp) | 1075 | static void clear_mib_counters(struct mv643xx_eth_private *mp) |
1076 | { | 1076 | { |
1077 | unsigned int port_num = mp->port_num; | 1077 | unsigned int port_num = mp->port_num; |
1078 | int i; | 1078 | int i; |
@@ -1082,14 +1082,14 @@ static void clear_mib_counters(struct mv643xx_private *mp) | |||
1082 | rdl(mp, MIB_COUNTERS(port_num) + i); | 1082 | rdl(mp, MIB_COUNTERS(port_num) + i); |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | static inline u32 read_mib(struct mv643xx_private *mp, int offset) | 1085 | static inline u32 read_mib(struct mv643xx_eth_private *mp, int offset) |
1086 | { | 1086 | { |
1087 | return rdl(mp, MIB_COUNTERS(mp->port_num) + offset); | 1087 | return rdl(mp, MIB_COUNTERS(mp->port_num) + offset); |
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | static void update_mib_counters(struct mv643xx_private *mp) | 1090 | static void update_mib_counters(struct mv643xx_eth_private *mp) |
1091 | { | 1091 | { |
1092 | struct mv643xx_mib_counters *p = &mp->mib_counters; | 1092 | struct mib_counters *p = &mp->mib_counters; |
1093 | 1093 | ||
1094 | p->good_octets_received += read_mib(mp, 0x00); | 1094 | p->good_octets_received += read_mib(mp, 0x00); |
1095 | p->good_octets_received += (u64)read_mib(mp, 0x04) << 32; | 1095 | p->good_octets_received += (u64)read_mib(mp, 0x04) << 32; |
@@ -1127,61 +1127,61 @@ static void update_mib_counters(struct mv643xx_private *mp) | |||
1127 | 1127 | ||
1128 | 1128 | ||
1129 | /* ethtool ******************************************************************/ | 1129 | /* ethtool ******************************************************************/ |
1130 | struct mv643xx_stats { | 1130 | struct mv643xx_eth_stats { |
1131 | char stat_string[ETH_GSTRING_LEN]; | 1131 | char stat_string[ETH_GSTRING_LEN]; |
1132 | int sizeof_stat; | 1132 | int sizeof_stat; |
1133 | int stat_offset; | 1133 | int stat_offset; |
1134 | }; | 1134 | }; |
1135 | 1135 | ||
1136 | #define MV643XX_STAT(m) FIELD_SIZEOF(struct mv643xx_private, m), \ | 1136 | #define MV643XX_ETH_STAT(m) FIELD_SIZEOF(struct mv643xx_eth_private, m), \ |
1137 | offsetof(struct mv643xx_private, m) | 1137 | offsetof(struct mv643xx_eth_private, m) |
1138 | 1138 | ||
1139 | static const struct mv643xx_stats mv643xx_gstrings_stats[] = { | 1139 | static const struct mv643xx_eth_stats mv643xx_eth_gstrings_stats[] = { |
1140 | { "rx_packets", MV643XX_STAT(stats.rx_packets) }, | 1140 | { "rx_packets", MV643XX_ETH_STAT(stats.rx_packets) }, |
1141 | { "tx_packets", MV643XX_STAT(stats.tx_packets) }, | 1141 | { "tx_packets", MV643XX_ETH_STAT(stats.tx_packets) }, |
1142 | { "rx_bytes", MV643XX_STAT(stats.rx_bytes) }, | 1142 | { "rx_bytes", MV643XX_ETH_STAT(stats.rx_bytes) }, |
1143 | { "tx_bytes", MV643XX_STAT(stats.tx_bytes) }, | 1143 | { "tx_bytes", MV643XX_ETH_STAT(stats.tx_bytes) }, |
1144 | { "rx_errors", MV643XX_STAT(stats.rx_errors) }, | 1144 | { "rx_errors", MV643XX_ETH_STAT(stats.rx_errors) }, |
1145 | { "tx_errors", MV643XX_STAT(stats.tx_errors) }, | 1145 | { "tx_errors", MV643XX_ETH_STAT(stats.tx_errors) }, |
1146 | { "rx_dropped", MV643XX_STAT(stats.rx_dropped) }, | 1146 | { "rx_dropped", MV643XX_ETH_STAT(stats.rx_dropped) }, |
1147 | { "tx_dropped", MV643XX_STAT(stats.tx_dropped) }, | 1147 | { "tx_dropped", MV643XX_ETH_STAT(stats.tx_dropped) }, |
1148 | { "good_octets_received", MV643XX_STAT(mib_counters.good_octets_received) }, | 1148 | { "good_octets_received", MV643XX_ETH_STAT(mib_counters.good_octets_received) }, |
1149 | { "bad_octets_received", MV643XX_STAT(mib_counters.bad_octets_received) }, | 1149 | { "bad_octets_received", MV643XX_ETH_STAT(mib_counters.bad_octets_received) }, |
1150 | { "internal_mac_transmit_err", MV643XX_STAT(mib_counters.internal_mac_transmit_err) }, | 1150 | { "internal_mac_transmit_err", MV643XX_ETH_STAT(mib_counters.internal_mac_transmit_err) }, |
1151 | { "good_frames_received", MV643XX_STAT(mib_counters.good_frames_received) }, | 1151 | { "good_frames_received", MV643XX_ETH_STAT(mib_counters.good_frames_received) }, |
1152 | { "bad_frames_received", MV643XX_STAT(mib_counters.bad_frames_received) }, | 1152 | { "bad_frames_received", MV643XX_ETH_STAT(mib_counters.bad_frames_received) }, |
1153 | { "broadcast_frames_received", MV643XX_STAT(mib_counters.broadcast_frames_received) }, | 1153 | { "broadcast_frames_received", MV643XX_ETH_STAT(mib_counters.broadcast_frames_received) }, |
1154 | { "multicast_frames_received", MV643XX_STAT(mib_counters.multicast_frames_received) }, | 1154 | { "multicast_frames_received", MV643XX_ETH_STAT(mib_counters.multicast_frames_received) }, |
1155 | { "frames_64_octets", MV643XX_STAT(mib_counters.frames_64_octets) }, | 1155 | { "frames_64_octets", MV643XX_ETH_STAT(mib_counters.frames_64_octets) }, |
1156 | { "frames_65_to_127_octets", MV643XX_STAT(mib_counters.frames_65_to_127_octets) }, | 1156 | { "frames_65_to_127_octets", MV643XX_ETH_STAT(mib_counters.frames_65_to_127_octets) }, |
1157 | { "frames_128_to_255_octets", MV643XX_STAT(mib_counters.frames_128_to_255_octets) }, | 1157 | { "frames_128_to_255_octets", MV643XX_ETH_STAT(mib_counters.frames_128_to_255_octets) }, |
1158 | { "frames_256_to_511_octets", MV643XX_STAT(mib_counters.frames_256_to_511_octets) }, | 1158 | { "frames_256_to_511_octets", MV643XX_ETH_STAT(mib_counters.frames_256_to_511_octets) }, |
1159 | { "frames_512_to_1023_octets", MV643XX_STAT(mib_counters.frames_512_to_1023_octets) }, | 1159 | { "frames_512_to_1023_octets", MV643XX_ETH_STAT(mib_counters.frames_512_to_1023_octets) }, |
1160 | { "frames_1024_to_max_octets", MV643XX_STAT(mib_counters.frames_1024_to_max_octets) }, | 1160 | { "frames_1024_to_max_octets", MV643XX_ETH_STAT(mib_counters.frames_1024_to_max_octets) }, |
1161 | { "good_octets_sent", MV643XX_STAT(mib_counters.good_octets_sent) }, | 1161 | { "good_octets_sent", MV643XX_ETH_STAT(mib_counters.good_octets_sent) }, |
1162 | { "good_frames_sent", MV643XX_STAT(mib_counters.good_frames_sent) }, | 1162 | { "good_frames_sent", MV643XX_ETH_STAT(mib_counters.good_frames_sent) }, |
1163 | { "excessive_collision", MV643XX_STAT(mib_counters.excessive_collision) }, | 1163 | { "excessive_collision", MV643XX_ETH_STAT(mib_counters.excessive_collision) }, |
1164 | { "multicast_frames_sent", MV643XX_STAT(mib_counters.multicast_frames_sent) }, | 1164 | { "multicast_frames_sent", MV643XX_ETH_STAT(mib_counters.multicast_frames_sent) }, |
1165 | { "broadcast_frames_sent", MV643XX_STAT(mib_counters.broadcast_frames_sent) }, | 1165 | { "broadcast_frames_sent", MV643XX_ETH_STAT(mib_counters.broadcast_frames_sent) }, |
1166 | { "unrec_mac_control_received", MV643XX_STAT(mib_counters.unrec_mac_control_received) }, | 1166 | { "unrec_mac_control_received", MV643XX_ETH_STAT(mib_counters.unrec_mac_control_received) }, |
1167 | { "fc_sent", MV643XX_STAT(mib_counters.fc_sent) }, | 1167 | { "fc_sent", MV643XX_ETH_STAT(mib_counters.fc_sent) }, |
1168 | { "good_fc_received", MV643XX_STAT(mib_counters.good_fc_received) }, | 1168 | { "good_fc_received", MV643XX_ETH_STAT(mib_counters.good_fc_received) }, |
1169 | { "bad_fc_received", MV643XX_STAT(mib_counters.bad_fc_received) }, | 1169 | { "bad_fc_received", MV643XX_ETH_STAT(mib_counters.bad_fc_received) }, |
1170 | { "undersize_received", MV643XX_STAT(mib_counters.undersize_received) }, | 1170 | { "undersize_received", MV643XX_ETH_STAT(mib_counters.undersize_received) }, |
1171 | { "fragments_received", MV643XX_STAT(mib_counters.fragments_received) }, | 1171 | { "fragments_received", MV643XX_ETH_STAT(mib_counters.fragments_received) }, |
1172 | { "oversize_received", MV643XX_STAT(mib_counters.oversize_received) }, | 1172 | { "oversize_received", MV643XX_ETH_STAT(mib_counters.oversize_received) }, |
1173 | { "jabber_received", MV643XX_STAT(mib_counters.jabber_received) }, | 1173 | { "jabber_received", MV643XX_ETH_STAT(mib_counters.jabber_received) }, |
1174 | { "mac_receive_error", MV643XX_STAT(mib_counters.mac_receive_error) }, | 1174 | { "mac_receive_error", MV643XX_ETH_STAT(mib_counters.mac_receive_error) }, |
1175 | { "bad_crc_event", MV643XX_STAT(mib_counters.bad_crc_event) }, | 1175 | { "bad_crc_event", MV643XX_ETH_STAT(mib_counters.bad_crc_event) }, |
1176 | { "collision", MV643XX_STAT(mib_counters.collision) }, | 1176 | { "collision", MV643XX_ETH_STAT(mib_counters.collision) }, |
1177 | { "late_collision", MV643XX_STAT(mib_counters.late_collision) }, | 1177 | { "late_collision", MV643XX_ETH_STAT(mib_counters.late_collision) }, |
1178 | }; | 1178 | }; |
1179 | 1179 | ||
1180 | #define MV643XX_STATS_LEN ARRAY_SIZE(mv643xx_gstrings_stats) | 1180 | #define MV643XX_ETH_STATS_LEN ARRAY_SIZE(mv643xx_eth_gstrings_stats) |
1181 | 1181 | ||
1182 | static int mv643xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 1182 | static int mv643xx_eth_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
1183 | { | 1183 | { |
1184 | struct mv643xx_private *mp = netdev_priv(dev); | 1184 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
1185 | int err; | 1185 | int err; |
1186 | 1186 | ||
1187 | spin_lock_irq(&mp->lock); | 1187 | spin_lock_irq(&mp->lock); |
@@ -1195,9 +1195,9 @@ static int mv643xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1195 | return err; | 1195 | return err; |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | static int mv643xx_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 1198 | static int mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
1199 | { | 1199 | { |
1200 | struct mv643xx_private *mp = netdev_priv(dev); | 1200 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
1201 | int err; | 1201 | int err; |
1202 | 1202 | ||
1203 | spin_lock_irq(&mp->lock); | 1203 | spin_lock_irq(&mp->lock); |
@@ -1207,80 +1207,80 @@ static int mv643xx_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1207 | return err; | 1207 | return err; |
1208 | } | 1208 | } |
1209 | 1209 | ||
1210 | static void mv643xx_get_drvinfo(struct net_device *netdev, | 1210 | static void mv643xx_eth_get_drvinfo(struct net_device *netdev, |
1211 | struct ethtool_drvinfo *drvinfo) | 1211 | struct ethtool_drvinfo *drvinfo) |
1212 | { | 1212 | { |
1213 | strncpy(drvinfo->driver, mv643xx_driver_name, 32); | 1213 | strncpy(drvinfo->driver, mv643xx_eth_driver_name, 32); |
1214 | strncpy(drvinfo->version, mv643xx_driver_version, 32); | 1214 | strncpy(drvinfo->version, mv643xx_eth_driver_version, 32); |
1215 | strncpy(drvinfo->fw_version, "N/A", 32); | 1215 | strncpy(drvinfo->fw_version, "N/A", 32); |
1216 | strncpy(drvinfo->bus_info, "mv643xx", 32); | 1216 | strncpy(drvinfo->bus_info, "mv643xx", 32); |
1217 | drvinfo->n_stats = MV643XX_STATS_LEN; | 1217 | drvinfo->n_stats = MV643XX_ETH_STATS_LEN; |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | static int mv643xx_eth_nway_restart(struct net_device *dev) | 1220 | static int mv643xx_eth_nway_restart(struct net_device *dev) |
1221 | { | 1221 | { |
1222 | struct mv643xx_private *mp = netdev_priv(dev); | 1222 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
1223 | 1223 | ||
1224 | return mii_nway_restart(&mp->mii); | 1224 | return mii_nway_restart(&mp->mii); |
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | static u32 mv643xx_eth_get_link(struct net_device *dev) | 1227 | static u32 mv643xx_eth_get_link(struct net_device *dev) |
1228 | { | 1228 | { |
1229 | struct mv643xx_private *mp = netdev_priv(dev); | 1229 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
1230 | 1230 | ||
1231 | return mii_link_ok(&mp->mii); | 1231 | return mii_link_ok(&mp->mii); |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | static void mv643xx_get_strings(struct net_device *netdev, uint32_t stringset, | 1234 | static void mv643xx_eth_get_strings(struct net_device *netdev, uint32_t stringset, |
1235 | uint8_t *data) | 1235 | uint8_t *data) |
1236 | { | 1236 | { |
1237 | int i; | 1237 | int i; |
1238 | 1238 | ||
1239 | switch(stringset) { | 1239 | switch(stringset) { |
1240 | case ETH_SS_STATS: | 1240 | case ETH_SS_STATS: |
1241 | for (i=0; i < MV643XX_STATS_LEN; i++) { | 1241 | for (i=0; i < MV643XX_ETH_STATS_LEN; i++) { |
1242 | memcpy(data + i * ETH_GSTRING_LEN, | 1242 | memcpy(data + i * ETH_GSTRING_LEN, |
1243 | mv643xx_gstrings_stats[i].stat_string, | 1243 | mv643xx_eth_gstrings_stats[i].stat_string, |
1244 | ETH_GSTRING_LEN); | 1244 | ETH_GSTRING_LEN); |
1245 | } | 1245 | } |
1246 | break; | 1246 | break; |
1247 | } | 1247 | } |
1248 | } | 1248 | } |
1249 | 1249 | ||
1250 | static void mv643xx_get_ethtool_stats(struct net_device *netdev, | 1250 | static void mv643xx_eth_get_ethtool_stats(struct net_device *netdev, |
1251 | struct ethtool_stats *stats, uint64_t *data) | 1251 | struct ethtool_stats *stats, uint64_t *data) |
1252 | { | 1252 | { |
1253 | struct mv643xx_private *mp = netdev->priv; | 1253 | struct mv643xx_eth_private *mp = netdev->priv; |
1254 | int i; | 1254 | int i; |
1255 | 1255 | ||
1256 | update_mib_counters(mp); | 1256 | update_mib_counters(mp); |
1257 | 1257 | ||
1258 | for (i = 0; i < MV643XX_STATS_LEN; i++) { | 1258 | for (i = 0; i < MV643XX_ETH_STATS_LEN; i++) { |
1259 | char *p = (char *)mp+mv643xx_gstrings_stats[i].stat_offset; | 1259 | char *p = (char *)mp+mv643xx_eth_gstrings_stats[i].stat_offset; |
1260 | data[i] = (mv643xx_gstrings_stats[i].sizeof_stat == | 1260 | data[i] = (mv643xx_eth_gstrings_stats[i].sizeof_stat == |
1261 | sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; | 1261 | sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; |
1262 | } | 1262 | } |
1263 | } | 1263 | } |
1264 | 1264 | ||
1265 | static int mv643xx_get_sset_count(struct net_device *netdev, int sset) | 1265 | static int mv643xx_eth_get_sset_count(struct net_device *netdev, int sset) |
1266 | { | 1266 | { |
1267 | switch (sset) { | 1267 | switch (sset) { |
1268 | case ETH_SS_STATS: | 1268 | case ETH_SS_STATS: |
1269 | return MV643XX_STATS_LEN; | 1269 | return MV643XX_ETH_STATS_LEN; |
1270 | default: | 1270 | default: |
1271 | return -EOPNOTSUPP; | 1271 | return -EOPNOTSUPP; |
1272 | } | 1272 | } |
1273 | } | 1273 | } |
1274 | 1274 | ||
1275 | static const struct ethtool_ops mv643xx_ethtool_ops = { | 1275 | static const struct ethtool_ops mv643xx_eth_ethtool_ops = { |
1276 | .get_settings = mv643xx_get_settings, | 1276 | .get_settings = mv643xx_eth_get_settings, |
1277 | .set_settings = mv643xx_set_settings, | 1277 | .set_settings = mv643xx_eth_set_settings, |
1278 | .get_drvinfo = mv643xx_get_drvinfo, | 1278 | .get_drvinfo = mv643xx_eth_get_drvinfo, |
1279 | .get_link = mv643xx_eth_get_link, | 1279 | .get_link = mv643xx_eth_get_link, |
1280 | .set_sg = ethtool_op_set_sg, | 1280 | .set_sg = ethtool_op_set_sg, |
1281 | .get_sset_count = mv643xx_get_sset_count, | 1281 | .get_sset_count = mv643xx_eth_get_sset_count, |
1282 | .get_ethtool_stats = mv643xx_get_ethtool_stats, | 1282 | .get_ethtool_stats = mv643xx_eth_get_ethtool_stats, |
1283 | .get_strings = mv643xx_get_strings, | 1283 | .get_strings = mv643xx_eth_get_strings, |
1284 | .nway_reset = mv643xx_eth_nway_restart, | 1284 | .nway_reset = mv643xx_eth_nway_restart, |
1285 | }; | 1285 | }; |
1286 | 1286 | ||
@@ -1289,7 +1289,7 @@ static const struct ethtool_ops mv643xx_ethtool_ops = { | |||
1289 | /* | 1289 | /* |
1290 | * uc_addr_get - Read the MAC address from the port's hw registers | 1290 | * uc_addr_get - Read the MAC address from the port's hw registers |
1291 | */ | 1291 | */ |
1292 | static void uc_addr_get(struct mv643xx_private *mp, unsigned char *p_addr) | 1292 | static void uc_addr_get(struct mv643xx_eth_private *mp, unsigned char *p_addr) |
1293 | { | 1293 | { |
1294 | unsigned int port_num = mp->port_num; | 1294 | unsigned int port_num = mp->port_num; |
1295 | unsigned int mac_h; | 1295 | unsigned int mac_h; |
@@ -1314,7 +1314,7 @@ static void uc_addr_get(struct mv643xx_private *mp, unsigned char *p_addr) | |||
1314 | * Other Multicast) and set each entry to 0. | 1314 | * Other Multicast) and set each entry to 0. |
1315 | * | 1315 | * |
1316 | * INPUT: | 1316 | * INPUT: |
1317 | * struct mv643xx_private *mp Ethernet Port. | 1317 | * struct mv643xx_eth_private *mp Ethernet Port. |
1318 | * | 1318 | * |
1319 | * OUTPUT: | 1319 | * OUTPUT: |
1320 | * Multicast and Unicast packets are rejected. | 1320 | * Multicast and Unicast packets are rejected. |
@@ -1322,7 +1322,7 @@ static void uc_addr_get(struct mv643xx_private *mp, unsigned char *p_addr) | |||
1322 | * RETURN: | 1322 | * RETURN: |
1323 | * None. | 1323 | * None. |
1324 | */ | 1324 | */ |
1325 | static void init_mac_tables(struct mv643xx_private *mp) | 1325 | static void init_mac_tables(struct mv643xx_eth_private *mp) |
1326 | { | 1326 | { |
1327 | unsigned int port_num = mp->port_num; | 1327 | unsigned int port_num = mp->port_num; |
1328 | int table_index; | 1328 | int table_index; |
@@ -1348,7 +1348,7 @@ static void init_mac_tables(struct mv643xx_private *mp) | |||
1348 | * 3-1 Queue (ETH_Q0=0) | 1348 | * 3-1 Queue (ETH_Q0=0) |
1349 | * 7-4 Reserved = 0; | 1349 | * 7-4 Reserved = 0; |
1350 | */ | 1350 | */ |
1351 | static void set_filter_table_entry(struct mv643xx_private *mp, | 1351 | static void set_filter_table_entry(struct mv643xx_eth_private *mp, |
1352 | int table, unsigned char entry) | 1352 | int table, unsigned char entry) |
1353 | { | 1353 | { |
1354 | unsigned int table_reg; | 1354 | unsigned int table_reg; |
@@ -1367,7 +1367,7 @@ static void set_filter_table_entry(struct mv643xx_private *mp, | |||
1367 | /* | 1367 | /* |
1368 | * uc_addr_set - Write a MAC address into the port's hw registers | 1368 | * uc_addr_set - Write a MAC address into the port's hw registers |
1369 | */ | 1369 | */ |
1370 | static void uc_addr_set(struct mv643xx_private *mp, unsigned char *p_addr) | 1370 | static void uc_addr_set(struct mv643xx_eth_private *mp, unsigned char *p_addr) |
1371 | { | 1371 | { |
1372 | unsigned int port_num = mp->port_num; | 1372 | unsigned int port_num = mp->port_num; |
1373 | unsigned int mac_h; | 1373 | unsigned int mac_h; |
@@ -1396,7 +1396,7 @@ static void uc_addr_set(struct mv643xx_private *mp, unsigned char *p_addr) | |||
1396 | */ | 1396 | */ |
1397 | static void mv643xx_eth_update_mac_address(struct net_device *dev) | 1397 | static void mv643xx_eth_update_mac_address(struct net_device *dev) |
1398 | { | 1398 | { |
1399 | struct mv643xx_private *mp = netdev_priv(dev); | 1399 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
1400 | 1400 | ||
1401 | init_mac_tables(mp); | 1401 | init_mac_tables(mp); |
1402 | uc_addr_set(mp, dev->dev_addr); | 1402 | uc_addr_set(mp, dev->dev_addr); |
@@ -1438,7 +1438,7 @@ static int mv643xx_eth_set_mac_address(struct net_device *dev, void *addr) | |||
1438 | * In either case, set_filter_table_entry() is then called | 1438 | * In either case, set_filter_table_entry() is then called |
1439 | * to set to set the actual table entry. | 1439 | * to set to set the actual table entry. |
1440 | */ | 1440 | */ |
1441 | static void mc_addr(struct mv643xx_private *mp, unsigned char *p_addr) | 1441 | static void mc_addr(struct mv643xx_eth_private *mp, unsigned char *p_addr) |
1442 | { | 1442 | { |
1443 | unsigned int port_num = mp->port_num; | 1443 | unsigned int port_num = mp->port_num; |
1444 | unsigned int mac_h; | 1444 | unsigned int mac_h; |
@@ -1537,7 +1537,7 @@ static void set_multicast_list(struct net_device *dev) | |||
1537 | struct dev_mc_list *mc_list; | 1537 | struct dev_mc_list *mc_list; |
1538 | int i; | 1538 | int i; |
1539 | int table_index; | 1539 | int table_index; |
1540 | struct mv643xx_private *mp = netdev_priv(dev); | 1540 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
1541 | unsigned int port_num = mp->port_num; | 1541 | unsigned int port_num = mp->port_num; |
1542 | 1542 | ||
1543 | /* If the device is in promiscuous mode or in all multicast mode, | 1543 | /* If the device is in promiscuous mode or in all multicast mode, |
@@ -1598,7 +1598,7 @@ static void set_multicast_list(struct net_device *dev) | |||
1598 | */ | 1598 | */ |
1599 | static void mv643xx_eth_set_rx_mode(struct net_device *dev) | 1599 | static void mv643xx_eth_set_rx_mode(struct net_device *dev) |
1600 | { | 1600 | { |
1601 | struct mv643xx_private *mp = netdev_priv(dev); | 1601 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
1602 | u32 config_reg; | 1602 | u32 config_reg; |
1603 | 1603 | ||
1604 | config_reg = rdl(mp, PORT_CONFIG(mp->port_num)); | 1604 | config_reg = rdl(mp, PORT_CONFIG(mp->port_num)); |
@@ -1626,7 +1626,7 @@ static void mv643xx_eth_set_rx_mode(struct net_device *dev) | |||
1626 | * with physical addresses. | 1626 | * with physical addresses. |
1627 | * | 1627 | * |
1628 | * INPUT: | 1628 | * INPUT: |
1629 | * struct mv643xx_private *mp Ethernet Port Control srtuct. | 1629 | * struct mv643xx_eth_private *mp Ethernet Port Control srtuct. |
1630 | * | 1630 | * |
1631 | * OUTPUT: | 1631 | * OUTPUT: |
1632 | * The routine updates the Ethernet port control struct with information | 1632 | * The routine updates the Ethernet port control struct with information |
@@ -1635,7 +1635,7 @@ static void mv643xx_eth_set_rx_mode(struct net_device *dev) | |||
1635 | * RETURN: | 1635 | * RETURN: |
1636 | * None. | 1636 | * None. |
1637 | */ | 1637 | */ |
1638 | static void ether_init_rx_desc_ring(struct mv643xx_private *mp) | 1638 | static void ether_init_rx_desc_ring(struct mv643xx_eth_private *mp) |
1639 | { | 1639 | { |
1640 | volatile struct rx_desc *p_rx_desc; | 1640 | volatile struct rx_desc *p_rx_desc; |
1641 | int rx_desc_num = mp->rx_ring_size; | 1641 | int rx_desc_num = mp->rx_ring_size; |
@@ -1657,7 +1657,7 @@ static void ether_init_rx_desc_ring(struct mv643xx_private *mp) | |||
1657 | 1657 | ||
1658 | static void mv643xx_eth_free_rx_rings(struct net_device *dev) | 1658 | static void mv643xx_eth_free_rx_rings(struct net_device *dev) |
1659 | { | 1659 | { |
1660 | struct mv643xx_private *mp = netdev_priv(dev); | 1660 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
1661 | int curr; | 1661 | int curr; |
1662 | 1662 | ||
1663 | /* Stop RX Queues */ | 1663 | /* Stop RX Queues */ |
@@ -1697,7 +1697,7 @@ static void mv643xx_eth_free_rx_rings(struct net_device *dev) | |||
1697 | * with physical addresses. | 1697 | * with physical addresses. |
1698 | * | 1698 | * |
1699 | * INPUT: | 1699 | * INPUT: |
1700 | * struct mv643xx_private *mp Ethernet Port Control srtuct. | 1700 | * struct mv643xx_eth_private *mp Ethernet Port Control srtuct. |
1701 | * | 1701 | * |
1702 | * OUTPUT: | 1702 | * OUTPUT: |
1703 | * The routine updates the Ethernet port control struct with information | 1703 | * The routine updates the Ethernet port control struct with information |
@@ -1706,7 +1706,7 @@ static void mv643xx_eth_free_rx_rings(struct net_device *dev) | |||
1706 | * RETURN: | 1706 | * RETURN: |
1707 | * None. | 1707 | * None. |
1708 | */ | 1708 | */ |
1709 | static void ether_init_tx_desc_ring(struct mv643xx_private *mp) | 1709 | static void ether_init_tx_desc_ring(struct mv643xx_eth_private *mp) |
1710 | { | 1710 | { |
1711 | int tx_desc_num = mp->tx_ring_size; | 1711 | int tx_desc_num = mp->tx_ring_size; |
1712 | struct tx_desc *p_tx_desc; | 1712 | struct tx_desc *p_tx_desc; |
@@ -1732,7 +1732,7 @@ static void ether_init_tx_desc_ring(struct mv643xx_private *mp) | |||
1732 | */ | 1732 | */ |
1733 | static int mv643xx_eth_free_tx_descs(struct net_device *dev, int force) | 1733 | static int mv643xx_eth_free_tx_descs(struct net_device *dev, int force) |
1734 | { | 1734 | { |
1735 | struct mv643xx_private *mp = netdev_priv(dev); | 1735 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
1736 | struct tx_desc *desc; | 1736 | struct tx_desc *desc; |
1737 | u32 cmd_sts; | 1737 | u32 cmd_sts; |
1738 | struct sk_buff *skb; | 1738 | struct sk_buff *skb; |
@@ -1792,7 +1792,7 @@ static int mv643xx_eth_free_tx_descs(struct net_device *dev, int force) | |||
1792 | 1792 | ||
1793 | static void mv643xx_eth_free_completed_tx_descs(struct net_device *dev) | 1793 | static void mv643xx_eth_free_completed_tx_descs(struct net_device *dev) |
1794 | { | 1794 | { |
1795 | struct mv643xx_private *mp = netdev_priv(dev); | 1795 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
1796 | 1796 | ||
1797 | if (mv643xx_eth_free_tx_descs(dev, 0) && | 1797 | if (mv643xx_eth_free_tx_descs(dev, 0) && |
1798 | mp->tx_ring_size - mp->tx_desc_count >= MAX_DESCS_PER_SKB) | 1798 | mp->tx_ring_size - mp->tx_desc_count >= MAX_DESCS_PER_SKB) |
@@ -1806,7 +1806,7 @@ static void mv643xx_eth_free_all_tx_descs(struct net_device *dev) | |||
1806 | 1806 | ||
1807 | static void mv643xx_eth_free_tx_rings(struct net_device *dev) | 1807 | static void mv643xx_eth_free_tx_rings(struct net_device *dev) |
1808 | { | 1808 | { |
1809 | struct mv643xx_private *mp = netdev_priv(dev); | 1809 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
1810 | 1810 | ||
1811 | /* Stop Tx Queues */ | 1811 | /* Stop Tx Queues */ |
1812 | mv643xx_eth_port_disable_tx(mp); | 1812 | mv643xx_eth_port_disable_tx(mp); |
@@ -1826,13 +1826,13 @@ static void mv643xx_eth_free_tx_rings(struct net_device *dev) | |||
1826 | 1826 | ||
1827 | 1827 | ||
1828 | /* netdev ops and related ***************************************************/ | 1828 | /* netdev ops and related ***************************************************/ |
1829 | static void port_reset(struct mv643xx_private *mp); | 1829 | static void port_reset(struct mv643xx_eth_private *mp); |
1830 | 1830 | ||
1831 | /* Set the mv643xx port configuration register for the speed/duplex mode. */ | 1831 | /* Set the mv643xx port configuration register for the speed/duplex mode. */ |
1832 | static void mv643xx_eth_update_pscr(struct net_device *dev, | 1832 | static void mv643xx_eth_update_pscr(struct net_device *dev, |
1833 | struct ethtool_cmd *ecmd) | 1833 | struct ethtool_cmd *ecmd) |
1834 | { | 1834 | { |
1835 | struct mv643xx_private *mp = netdev_priv(dev); | 1835 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
1836 | int port_num = mp->port_num; | 1836 | int port_num = mp->port_num; |
1837 | u32 o_pscr, n_pscr; | 1837 | u32 o_pscr, n_pscr; |
1838 | unsigned int queues; | 1838 | unsigned int queues; |
@@ -1888,7 +1888,7 @@ static void mv643xx_eth_update_pscr(struct net_device *dev, | |||
1888 | static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id) | 1888 | static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id) |
1889 | { | 1889 | { |
1890 | struct net_device *dev = (struct net_device *)dev_id; | 1890 | struct net_device *dev = (struct net_device *)dev_id; |
1891 | struct mv643xx_private *mp = netdev_priv(dev); | 1891 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
1892 | u32 int_cause, int_cause_ext = 0; | 1892 | u32 int_cause, int_cause_ext = 0; |
1893 | unsigned int port_num = mp->port_num; | 1893 | unsigned int port_num = mp->port_num; |
1894 | 1894 | ||
@@ -1920,7 +1920,7 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id) | |||
1920 | } | 1920 | } |
1921 | } | 1921 | } |
1922 | 1922 | ||
1923 | #ifdef MV643XX_NAPI | 1923 | #ifdef MV643XX_ETH_NAPI |
1924 | if (int_cause & INT_RX) { | 1924 | if (int_cause & INT_RX) { |
1925 | /* schedule the NAPI poll routine to maintain port */ | 1925 | /* schedule the NAPI poll routine to maintain port */ |
1926 | wrl(mp, INT_MASK(port_num), 0x00000000); | 1926 | wrl(mp, INT_MASK(port_num), 0x00000000); |
@@ -1954,7 +1954,7 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id) | |||
1954 | * This routine utilizes the SMI interface to reset the ethernet port PHY. | 1954 | * This routine utilizes the SMI interface to reset the ethernet port PHY. |
1955 | * | 1955 | * |
1956 | * INPUT: | 1956 | * INPUT: |
1957 | * struct mv643xx_private *mp Ethernet Port. | 1957 | * struct mv643xx_eth_private *mp Ethernet Port. |
1958 | * | 1958 | * |
1959 | * OUTPUT: | 1959 | * OUTPUT: |
1960 | * The PHY is reset. | 1960 | * The PHY is reset. |
@@ -1963,7 +1963,7 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id) | |||
1963 | * None. | 1963 | * None. |
1964 | * | 1964 | * |
1965 | */ | 1965 | */ |
1966 | static void phy_reset(struct mv643xx_private *mp) | 1966 | static void phy_reset(struct mv643xx_eth_private *mp) |
1967 | { | 1967 | { |
1968 | unsigned int phy_reg_data; | 1968 | unsigned int phy_reg_data; |
1969 | 1969 | ||
@@ -2008,7 +2008,7 @@ static void phy_reset(struct mv643xx_private *mp) | |||
2008 | */ | 2008 | */ |
2009 | static void port_start(struct net_device *dev) | 2009 | static void port_start(struct net_device *dev) |
2010 | { | 2010 | { |
2011 | struct mv643xx_private *mp = netdev_priv(dev); | 2011 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
2012 | unsigned int port_num = mp->port_num; | 2012 | unsigned int port_num = mp->port_num; |
2013 | int tx_curr_desc, rx_curr_desc; | 2013 | int tx_curr_desc, rx_curr_desc; |
2014 | u32 pscr; | 2014 | u32 pscr; |
@@ -2064,12 +2064,12 @@ static void port_start(struct net_device *dev) | |||
2064 | wrl(mp, TX_BW_MTU(port_num), 0); | 2064 | wrl(mp, TX_BW_MTU(port_num), 0); |
2065 | 2065 | ||
2066 | /* save phy settings across reset */ | 2066 | /* save phy settings across reset */ |
2067 | mv643xx_get_settings(dev, ðtool_cmd); | 2067 | mv643xx_eth_get_settings(dev, ðtool_cmd); |
2068 | phy_reset(mp); | 2068 | phy_reset(mp); |
2069 | mv643xx_set_settings(dev, ðtool_cmd); | 2069 | mv643xx_eth_set_settings(dev, ðtool_cmd); |
2070 | } | 2070 | } |
2071 | 2071 | ||
2072 | #ifdef MV643XX_COAL | 2072 | #ifdef MV643XX_ETH_COAL |
2073 | 2073 | ||
2074 | /* | 2074 | /* |
2075 | * set_rx_coal - Sets coalescing interrupt mechanism on RX path | 2075 | * set_rx_coal - Sets coalescing interrupt mechanism on RX path |
@@ -2083,7 +2083,7 @@ static void port_start(struct net_device *dev) | |||
2083 | * , and the required delay of the interrupt in usec. | 2083 | * , and the required delay of the interrupt in usec. |
2084 | * | 2084 | * |
2085 | * INPUT: | 2085 | * INPUT: |
2086 | * struct mv643xx_private *mp Ethernet port | 2086 | * struct mv643xx_eth_private *mp Ethernet port |
2087 | * unsigned int delay Delay in usec | 2087 | * unsigned int delay Delay in usec |
2088 | * | 2088 | * |
2089 | * OUTPUT: | 2089 | * OUTPUT: |
@@ -2093,7 +2093,7 @@ static void port_start(struct net_device *dev) | |||
2093 | * The interrupt coalescing value set in the gigE port. | 2093 | * The interrupt coalescing value set in the gigE port. |
2094 | * | 2094 | * |
2095 | */ | 2095 | */ |
2096 | static unsigned int set_rx_coal(struct mv643xx_private *mp, | 2096 | static unsigned int set_rx_coal(struct mv643xx_eth_private *mp, |
2097 | unsigned int delay) | 2097 | unsigned int delay) |
2098 | { | 2098 | { |
2099 | unsigned int port_num = mp->port_num; | 2099 | unsigned int port_num = mp->port_num; |
@@ -2121,7 +2121,7 @@ static unsigned int set_rx_coal(struct mv643xx_private *mp, | |||
2121 | * MV-643xx chip and the required delay in the interrupt in uSec | 2121 | * MV-643xx chip and the required delay in the interrupt in uSec |
2122 | * | 2122 | * |
2123 | * INPUT: | 2123 | * INPUT: |
2124 | * struct mv643xx_private *mp Ethernet port | 2124 | * struct mv643xx_eth_private *mp Ethernet port |
2125 | * unsigned int delay Delay in uSeconds | 2125 | * unsigned int delay Delay in uSeconds |
2126 | * | 2126 | * |
2127 | * OUTPUT: | 2127 | * OUTPUT: |
@@ -2131,7 +2131,7 @@ static unsigned int set_rx_coal(struct mv643xx_private *mp, | |||
2131 | * The interrupt coalescing value set in the gigE port. | 2131 | * The interrupt coalescing value set in the gigE port. |
2132 | * | 2132 | * |
2133 | */ | 2133 | */ |
2134 | static unsigned int set_tx_coal(struct mv643xx_private *mp, | 2134 | static unsigned int set_tx_coal(struct mv643xx_eth_private *mp, |
2135 | unsigned int delay) | 2135 | unsigned int delay) |
2136 | { | 2136 | { |
2137 | unsigned int coal = ((mp->shared->t_clk / 1000000) * delay) / 64; | 2137 | unsigned int coal = ((mp->shared->t_clk / 1000000) * delay) / 64; |
@@ -2158,7 +2158,7 @@ static unsigned int set_tx_coal(struct mv643xx_private *mp, | |||
2158 | * struct. | 2158 | * struct. |
2159 | * | 2159 | * |
2160 | * INPUT: | 2160 | * INPUT: |
2161 | * struct mv643xx_private *mp Ethernet port control struct | 2161 | * struct mv643xx_eth_private *mp Ethernet port control struct |
2162 | * | 2162 | * |
2163 | * OUTPUT: | 2163 | * OUTPUT: |
2164 | * See description. | 2164 | * See description. |
@@ -2166,7 +2166,7 @@ static unsigned int set_tx_coal(struct mv643xx_private *mp, | |||
2166 | * RETURN: | 2166 | * RETURN: |
2167 | * None. | 2167 | * None. |
2168 | */ | 2168 | */ |
2169 | static void port_init(struct mv643xx_private *mp) | 2169 | static void port_init(struct mv643xx_eth_private *mp) |
2170 | { | 2170 | { |
2171 | mp->rx_resource_err = 0; | 2171 | mp->rx_resource_err = 0; |
2172 | 2172 | ||
@@ -2190,7 +2190,7 @@ static void port_init(struct mv643xx_private *mp) | |||
2190 | 2190 | ||
2191 | static int mv643xx_eth_open(struct net_device *dev) | 2191 | static int mv643xx_eth_open(struct net_device *dev) |
2192 | { | 2192 | { |
2193 | struct mv643xx_private *mp = netdev_priv(dev); | 2193 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
2194 | unsigned int port_num = mp->port_num; | 2194 | unsigned int port_num = mp->port_num; |
2195 | unsigned int size; | 2195 | unsigned int size; |
2196 | int err; | 2196 | int err; |
@@ -2288,7 +2288,7 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
2288 | 2288 | ||
2289 | mv643xx_eth_rx_refill_descs(dev); /* Fill RX ring with skb's */ | 2289 | mv643xx_eth_rx_refill_descs(dev); /* Fill RX ring with skb's */ |
2290 | 2290 | ||
2291 | #ifdef MV643XX_NAPI | 2291 | #ifdef MV643XX_ETH_NAPI |
2292 | napi_enable(&mp->napi); | 2292 | napi_enable(&mp->napi); |
2293 | #endif | 2293 | #endif |
2294 | 2294 | ||
@@ -2296,11 +2296,11 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
2296 | 2296 | ||
2297 | /* Interrupt Coalescing */ | 2297 | /* Interrupt Coalescing */ |
2298 | 2298 | ||
2299 | #ifdef MV643XX_COAL | 2299 | #ifdef MV643XX_ETH_COAL |
2300 | mp->rx_int_coal = set_rx_coal(mp, MV643XX_RX_COAL); | 2300 | mp->rx_int_coal = set_rx_coal(mp, MV643XX_ETH_RX_COAL); |
2301 | #endif | 2301 | #endif |
2302 | 2302 | ||
2303 | mp->tx_int_coal = set_tx_coal(mp, MV643XX_TX_COAL); | 2303 | mp->tx_int_coal = set_tx_coal(mp, MV643XX_ETH_TX_COAL); |
2304 | 2304 | ||
2305 | /* Unmask phy and link status changes interrupts */ | 2305 | /* Unmask phy and link status changes interrupts */ |
2306 | wrl(mp, INT_MASK_EXT(port_num), INT_EXT_LINK | INT_EXT_PHY | INT_EXT_TX); | 2306 | wrl(mp, INT_MASK_EXT(port_num), INT_EXT_LINK | INT_EXT_PHY | INT_EXT_TX); |
@@ -2329,7 +2329,7 @@ out_free_irq: | |||
2329 | * idle state after this command is performed and the port is disabled. | 2329 | * idle state after this command is performed and the port is disabled. |
2330 | * | 2330 | * |
2331 | * INPUT: | 2331 | * INPUT: |
2332 | * struct mv643xx_private *mp Ethernet Port. | 2332 | * struct mv643xx_eth_private *mp Ethernet Port. |
2333 | * | 2333 | * |
2334 | * OUTPUT: | 2334 | * OUTPUT: |
2335 | * Channel activity is halted. | 2335 | * Channel activity is halted. |
@@ -2338,7 +2338,7 @@ out_free_irq: | |||
2338 | * None. | 2338 | * None. |
2339 | * | 2339 | * |
2340 | */ | 2340 | */ |
2341 | static void port_reset(struct mv643xx_private *mp) | 2341 | static void port_reset(struct mv643xx_eth_private *mp) |
2342 | { | 2342 | { |
2343 | unsigned int port_num = mp->port_num; | 2343 | unsigned int port_num = mp->port_num; |
2344 | unsigned int reg_data; | 2344 | unsigned int reg_data; |
@@ -2369,7 +2369,7 @@ static void port_reset(struct mv643xx_private *mp) | |||
2369 | 2369 | ||
2370 | static int mv643xx_eth_stop(struct net_device *dev) | 2370 | static int mv643xx_eth_stop(struct net_device *dev) |
2371 | { | 2371 | { |
2372 | struct mv643xx_private *mp = netdev_priv(dev); | 2372 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
2373 | unsigned int port_num = mp->port_num; | 2373 | unsigned int port_num = mp->port_num; |
2374 | 2374 | ||
2375 | /* Mask all interrupts on ethernet port */ | 2375 | /* Mask all interrupts on ethernet port */ |
@@ -2377,7 +2377,7 @@ static int mv643xx_eth_stop(struct net_device *dev) | |||
2377 | /* wait for previous write to complete */ | 2377 | /* wait for previous write to complete */ |
2378 | rdl(mp, INT_MASK(port_num)); | 2378 | rdl(mp, INT_MASK(port_num)); |
2379 | 2379 | ||
2380 | #ifdef MV643XX_NAPI | 2380 | #ifdef MV643XX_ETH_NAPI |
2381 | napi_disable(&mp->napi); | 2381 | napi_disable(&mp->napi); |
2382 | #endif | 2382 | #endif |
2383 | netif_carrier_off(dev); | 2383 | netif_carrier_off(dev); |
@@ -2395,7 +2395,7 @@ static int mv643xx_eth_stop(struct net_device *dev) | |||
2395 | 2395 | ||
2396 | static int mv643xx_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 2396 | static int mv643xx_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
2397 | { | 2397 | { |
2398 | struct mv643xx_private *mp = netdev_priv(dev); | 2398 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
2399 | 2399 | ||
2400 | return generic_mii_ioctl(&mp->mii, if_mii(ifr), cmd, NULL); | 2400 | return generic_mii_ioctl(&mp->mii, if_mii(ifr), cmd, NULL); |
2401 | } | 2401 | } |
@@ -2438,7 +2438,7 @@ static int mv643xx_eth_change_mtu(struct net_device *dev, int new_mtu) | |||
2438 | */ | 2438 | */ |
2439 | static void mv643xx_eth_tx_timeout_task(struct work_struct *ugly) | 2439 | static void mv643xx_eth_tx_timeout_task(struct work_struct *ugly) |
2440 | { | 2440 | { |
2441 | struct mv643xx_private *mp = container_of(ugly, struct mv643xx_private, | 2441 | struct mv643xx_eth_private *mp = container_of(ugly, struct mv643xx_eth_private, |
2442 | tx_timeout_task); | 2442 | tx_timeout_task); |
2443 | struct net_device *dev = mp->dev; | 2443 | struct net_device *dev = mp->dev; |
2444 | 2444 | ||
@@ -2464,7 +2464,7 @@ static void mv643xx_eth_tx_timeout_task(struct work_struct *ugly) | |||
2464 | */ | 2464 | */ |
2465 | static void mv643xx_eth_tx_timeout(struct net_device *dev) | 2465 | static void mv643xx_eth_tx_timeout(struct net_device *dev) |
2466 | { | 2466 | { |
2467 | struct mv643xx_private *mp = netdev_priv(dev); | 2467 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
2468 | 2468 | ||
2469 | printk(KERN_INFO "%s: TX timeout ", dev->name); | 2469 | printk(KERN_INFO "%s: TX timeout ", dev->name); |
2470 | 2470 | ||
@@ -2473,9 +2473,9 @@ static void mv643xx_eth_tx_timeout(struct net_device *dev) | |||
2473 | } | 2473 | } |
2474 | 2474 | ||
2475 | #ifdef CONFIG_NET_POLL_CONTROLLER | 2475 | #ifdef CONFIG_NET_POLL_CONTROLLER |
2476 | static void mv643xx_netpoll(struct net_device *netdev) | 2476 | static void mv643xx_eth_netpoll(struct net_device *netdev) |
2477 | { | 2477 | { |
2478 | struct mv643xx_private *mp = netdev_priv(netdev); | 2478 | struct mv643xx_eth_private *mp = netdev_priv(netdev); |
2479 | int port_num = mp->port_num; | 2479 | int port_num = mp->port_num; |
2480 | 2480 | ||
2481 | wrl(mp, INT_MASK(port_num), 0x00000000); | 2481 | wrl(mp, INT_MASK(port_num), 0x00000000); |
@@ -2491,25 +2491,26 @@ static void mv643xx_netpoll(struct net_device *netdev) | |||
2491 | /* | 2491 | /* |
2492 | * Wrappers for MII support library. | 2492 | * Wrappers for MII support library. |
2493 | */ | 2493 | */ |
2494 | static int mv643xx_mdio_read(struct net_device *dev, int phy_id, int location) | 2494 | static int mv643xx_eth_mdio_read(struct net_device *dev, int phy_id, int location) |
2495 | { | 2495 | { |
2496 | struct mv643xx_private *mp = netdev_priv(dev); | 2496 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
2497 | int val; | 2497 | int val; |
2498 | 2498 | ||
2499 | read_smi_reg(mp, location, &val); | 2499 | read_smi_reg(mp, location, &val); |
2500 | return val; | 2500 | return val; |
2501 | } | 2501 | } |
2502 | 2502 | ||
2503 | static void mv643xx_mdio_write(struct net_device *dev, int phy_id, int location, int val) | 2503 | static void mv643xx_eth_mdio_write(struct net_device *dev, int phy_id, int location, int val) |
2504 | { | 2504 | { |
2505 | struct mv643xx_private *mp = netdev_priv(dev); | 2505 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
2506 | write_smi_reg(mp, location, val); | 2506 | write_smi_reg(mp, location, val); |
2507 | } | 2507 | } |
2508 | 2508 | ||
2509 | 2509 | ||
2510 | /* platform glue ************************************************************/ | 2510 | /* platform glue ************************************************************/ |
2511 | static void mv643xx_eth_conf_mbus_windows(struct mv643xx_shared_private *msp, | 2511 | static void |
2512 | struct mbus_dram_target_info *dram) | 2512 | mv643xx_eth_conf_mbus_windows(struct mv643xx_eth_shared_private *msp, |
2513 | struct mbus_dram_target_info *dram) | ||
2513 | { | 2514 | { |
2514 | void __iomem *base = msp->base; | 2515 | void __iomem *base = msp->base; |
2515 | u32 win_enable; | 2516 | u32 win_enable; |
@@ -2544,13 +2545,13 @@ static void mv643xx_eth_conf_mbus_windows(struct mv643xx_shared_private *msp, | |||
2544 | 2545 | ||
2545 | static int mv643xx_eth_shared_probe(struct platform_device *pdev) | 2546 | static int mv643xx_eth_shared_probe(struct platform_device *pdev) |
2546 | { | 2547 | { |
2547 | static int mv643xx_version_printed = 0; | 2548 | static int mv643xx_eth_version_printed = 0; |
2548 | struct mv643xx_eth_shared_platform_data *pd = pdev->dev.platform_data; | 2549 | struct mv643xx_eth_shared_platform_data *pd = pdev->dev.platform_data; |
2549 | struct mv643xx_shared_private *msp; | 2550 | struct mv643xx_eth_shared_private *msp; |
2550 | struct resource *res; | 2551 | struct resource *res; |
2551 | int ret; | 2552 | int ret; |
2552 | 2553 | ||
2553 | if (!mv643xx_version_printed++) | 2554 | if (!mv643xx_eth_version_printed++) |
2554 | printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n"); | 2555 | printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n"); |
2555 | 2556 | ||
2556 | ret = -EINVAL; | 2557 | ret = -EINVAL; |
@@ -2589,7 +2590,7 @@ out: | |||
2589 | 2590 | ||
2590 | static int mv643xx_eth_shared_remove(struct platform_device *pdev) | 2591 | static int mv643xx_eth_shared_remove(struct platform_device *pdev) |
2591 | { | 2592 | { |
2592 | struct mv643xx_shared_private *msp = platform_get_drvdata(pdev); | 2593 | struct mv643xx_eth_shared_private *msp = platform_get_drvdata(pdev); |
2593 | 2594 | ||
2594 | iounmap(msp->base); | 2595 | iounmap(msp->base); |
2595 | kfree(msp); | 2596 | kfree(msp); |
@@ -2613,7 +2614,7 @@ static struct platform_driver mv643xx_eth_shared_driver = { | |||
2613 | * This routine sets the given ethernet port PHY address. | 2614 | * This routine sets the given ethernet port PHY address. |
2614 | * | 2615 | * |
2615 | * INPUT: | 2616 | * INPUT: |
2616 | * struct mv643xx_private *mp Ethernet Port. | 2617 | * struct mv643xx_eth_private *mp Ethernet Port. |
2617 | * int phy_addr PHY address. | 2618 | * int phy_addr PHY address. |
2618 | * | 2619 | * |
2619 | * OUTPUT: | 2620 | * OUTPUT: |
@@ -2623,7 +2624,7 @@ static struct platform_driver mv643xx_eth_shared_driver = { | |||
2623 | * None. | 2624 | * None. |
2624 | * | 2625 | * |
2625 | */ | 2626 | */ |
2626 | static void phy_addr_set(struct mv643xx_private *mp, int phy_addr) | 2627 | static void phy_addr_set(struct mv643xx_eth_private *mp, int phy_addr) |
2627 | { | 2628 | { |
2628 | u32 reg_data; | 2629 | u32 reg_data; |
2629 | int addr_shift = 5 * mp->port_num; | 2630 | int addr_shift = 5 * mp->port_num; |
@@ -2641,7 +2642,7 @@ static void phy_addr_set(struct mv643xx_private *mp, int phy_addr) | |||
2641 | * This routine returns the given ethernet port PHY address. | 2642 | * This routine returns the given ethernet port PHY address. |
2642 | * | 2643 | * |
2643 | * INPUT: | 2644 | * INPUT: |
2644 | * struct mv643xx_private *mp Ethernet Port. | 2645 | * struct mv643xx_eth_private *mp Ethernet Port. |
2645 | * | 2646 | * |
2646 | * OUTPUT: | 2647 | * OUTPUT: |
2647 | * None. | 2648 | * None. |
@@ -2650,7 +2651,7 @@ static void phy_addr_set(struct mv643xx_private *mp, int phy_addr) | |||
2650 | * PHY address. | 2651 | * PHY address. |
2651 | * | 2652 | * |
2652 | */ | 2653 | */ |
2653 | static int phy_addr_get(struct mv643xx_private *mp) | 2654 | static int phy_addr_get(struct mv643xx_eth_private *mp) |
2654 | { | 2655 | { |
2655 | unsigned int reg_data; | 2656 | unsigned int reg_data; |
2656 | 2657 | ||
@@ -2667,7 +2668,7 @@ static int phy_addr_get(struct mv643xx_private *mp) | |||
2667 | * the specified port. | 2668 | * the specified port. |
2668 | * | 2669 | * |
2669 | * INPUT: | 2670 | * INPUT: |
2670 | * struct mv643xx_private *mp Ethernet Port. | 2671 | * struct mv643xx_eth_private *mp Ethernet Port. |
2671 | * | 2672 | * |
2672 | * OUTPUT: | 2673 | * OUTPUT: |
2673 | * None | 2674 | * None |
@@ -2677,7 +2678,7 @@ static int phy_addr_get(struct mv643xx_private *mp) | |||
2677 | * -ENODEV on failure | 2678 | * -ENODEV on failure |
2678 | * | 2679 | * |
2679 | */ | 2680 | */ |
2680 | static int phy_detect(struct mv643xx_private *mp) | 2681 | static int phy_detect(struct mv643xx_eth_private *mp) |
2681 | { | 2682 | { |
2682 | unsigned int phy_reg_data0; | 2683 | unsigned int phy_reg_data0; |
2683 | int auto_neg; | 2684 | int auto_neg; |
@@ -2700,7 +2701,7 @@ static void mv643xx_init_ethtool_cmd(struct net_device *dev, int phy_address, | |||
2700 | int speed, int duplex, | 2701 | int speed, int duplex, |
2701 | struct ethtool_cmd *cmd) | 2702 | struct ethtool_cmd *cmd) |
2702 | { | 2703 | { |
2703 | struct mv643xx_private *mp = netdev_priv(dev); | 2704 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
2704 | 2705 | ||
2705 | memset(cmd, 0, sizeof(*cmd)); | 2706 | memset(cmd, 0, sizeof(*cmd)); |
2706 | 2707 | ||
@@ -2740,7 +2741,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
2740 | { | 2741 | { |
2741 | struct mv643xx_eth_platform_data *pd; | 2742 | struct mv643xx_eth_platform_data *pd; |
2742 | int port_num; | 2743 | int port_num; |
2743 | struct mv643xx_private *mp; | 2744 | struct mv643xx_eth_private *mp; |
2744 | struct net_device *dev; | 2745 | struct net_device *dev; |
2745 | u8 *p; | 2746 | u8 *p; |
2746 | struct resource *res; | 2747 | struct resource *res; |
@@ -2761,7 +2762,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
2761 | return -ENODEV; | 2762 | return -ENODEV; |
2762 | } | 2763 | } |
2763 | 2764 | ||
2764 | dev = alloc_etherdev(sizeof(struct mv643xx_private)); | 2765 | dev = alloc_etherdev(sizeof(struct mv643xx_eth_private)); |
2765 | if (!dev) | 2766 | if (!dev) |
2766 | return -ENOMEM; | 2767 | return -ENOMEM; |
2767 | 2768 | ||
@@ -2769,8 +2770,8 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
2769 | 2770 | ||
2770 | mp = netdev_priv(dev); | 2771 | mp = netdev_priv(dev); |
2771 | mp->dev = dev; | 2772 | mp->dev = dev; |
2772 | #ifdef MV643XX_NAPI | 2773 | #ifdef MV643XX_ETH_NAPI |
2773 | netif_napi_add(dev, &mp->napi, mv643xx_poll, 64); | 2774 | netif_napi_add(dev, &mp->napi, mv643xx_eth_poll, 64); |
2774 | #endif | 2775 | #endif |
2775 | 2776 | ||
2776 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 2777 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
@@ -2787,16 +2788,16 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
2787 | dev->tx_timeout = mv643xx_eth_tx_timeout; | 2788 | dev->tx_timeout = mv643xx_eth_tx_timeout; |
2788 | 2789 | ||
2789 | #ifdef CONFIG_NET_POLL_CONTROLLER | 2790 | #ifdef CONFIG_NET_POLL_CONTROLLER |
2790 | dev->poll_controller = mv643xx_netpoll; | 2791 | dev->poll_controller = mv643xx_eth_netpoll; |
2791 | #endif | 2792 | #endif |
2792 | 2793 | ||
2793 | dev->watchdog_timeo = 2 * HZ; | 2794 | dev->watchdog_timeo = 2 * HZ; |
2794 | dev->base_addr = 0; | 2795 | dev->base_addr = 0; |
2795 | dev->change_mtu = mv643xx_eth_change_mtu; | 2796 | dev->change_mtu = mv643xx_eth_change_mtu; |
2796 | dev->do_ioctl = mv643xx_eth_do_ioctl; | 2797 | dev->do_ioctl = mv643xx_eth_do_ioctl; |
2797 | SET_ETHTOOL_OPS(dev, &mv643xx_ethtool_ops); | 2798 | SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops); |
2798 | 2799 | ||
2799 | #ifdef MV643XX_CHECKSUM_OFFLOAD_TX | 2800 | #ifdef MV643XX_ETH_CHECKSUM_OFFLOAD_TX |
2800 | #ifdef MAX_SKB_FRAGS | 2801 | #ifdef MAX_SKB_FRAGS |
2801 | /* | 2802 | /* |
2802 | * Zero copy can only work if we use Discovery II memory. Else, we will | 2803 | * Zero copy can only work if we use Discovery II memory. Else, we will |
@@ -2853,8 +2854,8 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
2853 | 2854 | ||
2854 | /* Hook up MII support for ethtool */ | 2855 | /* Hook up MII support for ethtool */ |
2855 | mp->mii.dev = dev; | 2856 | mp->mii.dev = dev; |
2856 | mp->mii.mdio_read = mv643xx_mdio_read; | 2857 | mp->mii.mdio_read = mv643xx_eth_mdio_read; |
2857 | mp->mii.mdio_write = mv643xx_mdio_write; | 2858 | mp->mii.mdio_write = mv643xx_eth_mdio_write; |
2858 | mp->mii.phy_id = phy_addr_get(mp); | 2859 | mp->mii.phy_id = phy_addr_get(mp); |
2859 | mp->mii.phy_id_mask = 0x3f; | 2860 | mp->mii.phy_id_mask = 0x3f; |
2860 | mp->mii.reg_num_mask = 0x1f; | 2861 | mp->mii.reg_num_mask = 0x1f; |
@@ -2870,7 +2871,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
2870 | mp->mii.supports_gmii = mii_check_gmii_support(&mp->mii); | 2871 | mp->mii.supports_gmii = mii_check_gmii_support(&mp->mii); |
2871 | mv643xx_init_ethtool_cmd(dev, mp->mii.phy_id, speed, duplex, &cmd); | 2872 | mv643xx_init_ethtool_cmd(dev, mp->mii.phy_id, speed, duplex, &cmd); |
2872 | mv643xx_eth_update_pscr(dev, &cmd); | 2873 | mv643xx_eth_update_pscr(dev, &cmd); |
2873 | mv643xx_set_settings(dev, &cmd); | 2874 | mv643xx_eth_set_settings(dev, &cmd); |
2874 | 2875 | ||
2875 | SET_NETDEV_DEV(dev, &pdev->dev); | 2876 | SET_NETDEV_DEV(dev, &pdev->dev); |
2876 | err = register_netdev(dev); | 2877 | err = register_netdev(dev); |
@@ -2889,16 +2890,16 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
2889 | printk(KERN_NOTICE "%s: TX TCP/IP Checksumming Supported\n", | 2890 | printk(KERN_NOTICE "%s: TX TCP/IP Checksumming Supported\n", |
2890 | dev->name); | 2891 | dev->name); |
2891 | 2892 | ||
2892 | #ifdef MV643XX_CHECKSUM_OFFLOAD_TX | 2893 | #ifdef MV643XX_ETH_CHECKSUM_OFFLOAD_TX |
2893 | printk(KERN_NOTICE "%s: RX TCP/UDP Checksum Offload ON \n", dev->name); | 2894 | printk(KERN_NOTICE "%s: RX TCP/UDP Checksum Offload ON \n", dev->name); |
2894 | #endif | 2895 | #endif |
2895 | 2896 | ||
2896 | #ifdef MV643XX_COAL | 2897 | #ifdef MV643XX_ETH_COAL |
2897 | printk(KERN_NOTICE "%s: TX and RX Interrupt Coalescing ON \n", | 2898 | printk(KERN_NOTICE "%s: TX and RX Interrupt Coalescing ON \n", |
2898 | dev->name); | 2899 | dev->name); |
2899 | #endif | 2900 | #endif |
2900 | 2901 | ||
2901 | #ifdef MV643XX_NAPI | 2902 | #ifdef MV643XX_ETH_NAPI |
2902 | printk(KERN_NOTICE "%s: RX NAPI Enabled \n", dev->name); | 2903 | printk(KERN_NOTICE "%s: RX NAPI Enabled \n", dev->name); |
2903 | #endif | 2904 | #endif |
2904 | 2905 | ||
@@ -2928,7 +2929,7 @@ static int mv643xx_eth_remove(struct platform_device *pdev) | |||
2928 | static void mv643xx_eth_shutdown(struct platform_device *pdev) | 2929 | static void mv643xx_eth_shutdown(struct platform_device *pdev) |
2929 | { | 2930 | { |
2930 | struct net_device *dev = platform_get_drvdata(pdev); | 2931 | struct net_device *dev = platform_get_drvdata(pdev); |
2931 | struct mv643xx_private *mp = netdev_priv(dev); | 2932 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
2932 | unsigned int port_num = mp->port_num; | 2933 | unsigned int port_num = mp->port_num; |
2933 | 2934 | ||
2934 | /* Mask all interrupts on ethernet port */ | 2935 | /* Mask all interrupts on ethernet port */ |
@@ -2949,7 +2950,7 @@ static struct platform_driver mv643xx_eth_driver = { | |||
2949 | }; | 2950 | }; |
2950 | 2951 | ||
2951 | /* | 2952 | /* |
2952 | * mv643xx_init_module | 2953 | * mv643xx_eth_init_module |
2953 | * | 2954 | * |
2954 | * Registers the network drivers into the Linux kernel | 2955 | * Registers the network drivers into the Linux kernel |
2955 | * | 2956 | * |
@@ -2957,7 +2958,7 @@ static struct platform_driver mv643xx_eth_driver = { | |||
2957 | * | 2958 | * |
2958 | * Output : N/A | 2959 | * Output : N/A |
2959 | */ | 2960 | */ |
2960 | static int __init mv643xx_init_module(void) | 2961 | static int __init mv643xx_eth_init_module(void) |
2961 | { | 2962 | { |
2962 | int rc; | 2963 | int rc; |
2963 | 2964 | ||
@@ -2971,7 +2972,7 @@ static int __init mv643xx_init_module(void) | |||
2971 | } | 2972 | } |
2972 | 2973 | ||
2973 | /* | 2974 | /* |
2974 | * mv643xx_cleanup_module | 2975 | * mv643xx_eth_cleanup_module |
2975 | * | 2976 | * |
2976 | * Registers the network drivers into the Linux kernel | 2977 | * Registers the network drivers into the Linux kernel |
2977 | * | 2978 | * |
@@ -2979,14 +2980,14 @@ static int __init mv643xx_init_module(void) | |||
2979 | * | 2980 | * |
2980 | * Output : N/A | 2981 | * Output : N/A |
2981 | */ | 2982 | */ |
2982 | static void __exit mv643xx_cleanup_module(void) | 2983 | static void __exit mv643xx_eth_cleanup_module(void) |
2983 | { | 2984 | { |
2984 | platform_driver_unregister(&mv643xx_eth_driver); | 2985 | platform_driver_unregister(&mv643xx_eth_driver); |
2985 | platform_driver_unregister(&mv643xx_eth_shared_driver); | 2986 | platform_driver_unregister(&mv643xx_eth_shared_driver); |
2986 | } | 2987 | } |
2987 | 2988 | ||
2988 | module_init(mv643xx_init_module); | 2989 | module_init(mv643xx_eth_init_module); |
2989 | module_exit(mv643xx_cleanup_module); | 2990 | module_exit(mv643xx_eth_cleanup_module); |
2990 | 2991 | ||
2991 | MODULE_LICENSE("GPL"); | 2992 | MODULE_LICENSE("GPL"); |
2992 | MODULE_AUTHOR( "Rabeeh Khoury, Assaf Hoffman, Matthew Dharm, Manish Lachwani" | 2993 | MODULE_AUTHOR( "Rabeeh Khoury, Assaf Hoffman, Matthew Dharm, Manish Lachwani" |