aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgb/ixgb_hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ixgb/ixgb_hw.c')
-rw-r--r--drivers/net/ixgb/ixgb_hw.c144
1 files changed, 72 insertions, 72 deletions
diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
index 8a04bbd258a6..04d2003e24e1 100644
--- a/drivers/net/ixgb/ixgb_hw.c
+++ b/drivers/net/ixgb/ixgb_hw.c
@@ -35,9 +35,9 @@
35 35
36/* Local function prototypes */ 36/* Local function prototypes */
37 37
38static uint32_t ixgb_hash_mc_addr(struct ixgb_hw *hw, uint8_t * mc_addr); 38static u32 ixgb_hash_mc_addr(struct ixgb_hw *hw, u8 * mc_addr);
39 39
40static void ixgb_mta_set(struct ixgb_hw *hw, uint32_t hash_value); 40static void ixgb_mta_set(struct ixgb_hw *hw, u32 hash_value);
41 41
42static void ixgb_get_bus_info(struct ixgb_hw *hw); 42static void ixgb_get_bus_info(struct ixgb_hw *hw);
43 43
@@ -55,18 +55,18 @@ static void ixgb_clear_vfta(struct ixgb_hw *hw);
55 55
56static void ixgb_init_rx_addrs(struct ixgb_hw *hw); 56static void ixgb_init_rx_addrs(struct ixgb_hw *hw);
57 57
58static uint16_t ixgb_read_phy_reg(struct ixgb_hw *hw, 58static u16 ixgb_read_phy_reg(struct ixgb_hw *hw,
59 uint32_t reg_address, 59 u32 reg_address,
60 uint32_t phy_address, 60 u32 phy_address,
61 uint32_t device_type); 61 u32 device_type);
62 62
63static bool ixgb_setup_fc(struct ixgb_hw *hw); 63static bool ixgb_setup_fc(struct ixgb_hw *hw);
64 64
65static bool mac_addr_valid(uint8_t *mac_addr); 65static bool mac_addr_valid(u8 *mac_addr);
66 66
67static uint32_t ixgb_mac_reset(struct ixgb_hw *hw) 67static u32 ixgb_mac_reset(struct ixgb_hw *hw)
68{ 68{
69 uint32_t ctrl_reg; 69 u32 ctrl_reg;
70 70
71 ctrl_reg = IXGB_CTRL0_RST | 71 ctrl_reg = IXGB_CTRL0_RST |
72 IXGB_CTRL0_SDP3_DIR | /* All pins are Output=1 */ 72 IXGB_CTRL0_SDP3_DIR | /* All pins are Output=1 */
@@ -117,8 +117,8 @@ static uint32_t ixgb_mac_reset(struct ixgb_hw *hw)
117bool 117bool
118ixgb_adapter_stop(struct ixgb_hw *hw) 118ixgb_adapter_stop(struct ixgb_hw *hw)
119{ 119{
120 uint32_t ctrl_reg; 120 u32 ctrl_reg;
121 uint32_t icr_reg; 121 u32 icr_reg;
122 122
123 DEBUGFUNC("ixgb_adapter_stop"); 123 DEBUGFUNC("ixgb_adapter_stop");
124 124
@@ -179,8 +179,8 @@ ixgb_adapter_stop(struct ixgb_hw *hw)
179static ixgb_xpak_vendor 179static ixgb_xpak_vendor
180ixgb_identify_xpak_vendor(struct ixgb_hw *hw) 180ixgb_identify_xpak_vendor(struct ixgb_hw *hw)
181{ 181{
182 uint32_t i; 182 u32 i;
183 uint16_t vendor_name[5]; 183 u16 vendor_name[5];
184 ixgb_xpak_vendor xpak_vendor; 184 ixgb_xpak_vendor xpak_vendor;
185 185
186 DEBUGFUNC("ixgb_identify_xpak_vendor"); 186 DEBUGFUNC("ixgb_identify_xpak_vendor");
@@ -292,8 +292,8 @@ ixgb_identify_phy(struct ixgb_hw *hw)
292bool 292bool
293ixgb_init_hw(struct ixgb_hw *hw) 293ixgb_init_hw(struct ixgb_hw *hw)
294{ 294{
295 uint32_t i; 295 u32 i;
296 uint32_t ctrl_reg; 296 u32 ctrl_reg;
297 bool status; 297 bool status;
298 298
299 DEBUGFUNC("ixgb_init_hw"); 299 DEBUGFUNC("ixgb_init_hw");
@@ -377,7 +377,7 @@ ixgb_init_hw(struct ixgb_hw *hw)
377static void 377static void
378ixgb_init_rx_addrs(struct ixgb_hw *hw) 378ixgb_init_rx_addrs(struct ixgb_hw *hw)
379{ 379{
380 uint32_t i; 380 u32 i;
381 381
382 DEBUGFUNC("ixgb_init_rx_addrs"); 382 DEBUGFUNC("ixgb_init_rx_addrs");
383 383
@@ -437,13 +437,13 @@ ixgb_init_rx_addrs(struct ixgb_hw *hw)
437 *****************************************************************************/ 437 *****************************************************************************/
438void 438void
439ixgb_mc_addr_list_update(struct ixgb_hw *hw, 439ixgb_mc_addr_list_update(struct ixgb_hw *hw,
440 uint8_t *mc_addr_list, 440 u8 *mc_addr_list,
441 uint32_t mc_addr_count, 441 u32 mc_addr_count,
442 uint32_t pad) 442 u32 pad)
443{ 443{
444 uint32_t hash_value; 444 u32 hash_value;
445 uint32_t i; 445 u32 i;
446 uint32_t rar_used_count = 1; /* RAR[0] is used for our MAC address */ 446 u32 rar_used_count = 1; /* RAR[0] is used for our MAC address */
447 447
448 DEBUGFUNC("ixgb_mc_addr_list_update"); 448 DEBUGFUNC("ixgb_mc_addr_list_update");
449 449
@@ -515,11 +515,11 @@ ixgb_mc_addr_list_update(struct ixgb_hw *hw,
515 * Returns: 515 * Returns:
516 * The hash value 516 * The hash value
517 *****************************************************************************/ 517 *****************************************************************************/
518static uint32_t 518static u32
519ixgb_hash_mc_addr(struct ixgb_hw *hw, 519ixgb_hash_mc_addr(struct ixgb_hw *hw,
520 uint8_t *mc_addr) 520 u8 *mc_addr)
521{ 521{
522 uint32_t hash_value = 0; 522 u32 hash_value = 0;
523 523
524 DEBUGFUNC("ixgb_hash_mc_addr"); 524 DEBUGFUNC("ixgb_hash_mc_addr");
525 525
@@ -533,18 +533,18 @@ ixgb_hash_mc_addr(struct ixgb_hw *hw,
533 case 0: 533 case 0:
534 /* [47:36] i.e. 0x563 for above example address */ 534 /* [47:36] i.e. 0x563 for above example address */
535 hash_value = 535 hash_value =
536 ((mc_addr[4] >> 4) | (((uint16_t) mc_addr[5]) << 4)); 536 ((mc_addr[4] >> 4) | (((u16) mc_addr[5]) << 4));
537 break; 537 break;
538 case 1: /* [46:35] i.e. 0xAC6 for above example address */ 538 case 1: /* [46:35] i.e. 0xAC6 for above example address */
539 hash_value = 539 hash_value =
540 ((mc_addr[4] >> 3) | (((uint16_t) mc_addr[5]) << 5)); 540 ((mc_addr[4] >> 3) | (((u16) mc_addr[5]) << 5));
541 break; 541 break;
542 case 2: /* [45:34] i.e. 0x5D8 for above example address */ 542 case 2: /* [45:34] i.e. 0x5D8 for above example address */
543 hash_value = 543 hash_value =
544 ((mc_addr[4] >> 2) | (((uint16_t) mc_addr[5]) << 6)); 544 ((mc_addr[4] >> 2) | (((u16) mc_addr[5]) << 6));
545 break; 545 break;
546 case 3: /* [43:32] i.e. 0x634 for above example address */ 546 case 3: /* [43:32] i.e. 0x634 for above example address */
547 hash_value = ((mc_addr[4]) | (((uint16_t) mc_addr[5]) << 8)); 547 hash_value = ((mc_addr[4]) | (((u16) mc_addr[5]) << 8));
548 break; 548 break;
549 default: 549 default:
550 /* Invalid mc_filter_type, what should we do? */ 550 /* Invalid mc_filter_type, what should we do? */
@@ -565,10 +565,10 @@ ixgb_hash_mc_addr(struct ixgb_hw *hw,
565 *****************************************************************************/ 565 *****************************************************************************/
566static void 566static void
567ixgb_mta_set(struct ixgb_hw *hw, 567ixgb_mta_set(struct ixgb_hw *hw,
568 uint32_t hash_value) 568 u32 hash_value)
569{ 569{
570 uint32_t hash_bit, hash_reg; 570 u32 hash_bit, hash_reg;
571 uint32_t mta_reg; 571 u32 mta_reg;
572 572
573 /* The MTA is a register array of 128 32-bit registers. 573 /* The MTA is a register array of 128 32-bit registers.
574 * It is treated like an array of 4096 bits. We want to set 574 * It is treated like an array of 4096 bits. We want to set
@@ -599,23 +599,23 @@ ixgb_mta_set(struct ixgb_hw *hw,
599 *****************************************************************************/ 599 *****************************************************************************/
600void 600void
601ixgb_rar_set(struct ixgb_hw *hw, 601ixgb_rar_set(struct ixgb_hw *hw,
602 uint8_t *addr, 602 u8 *addr,
603 uint32_t index) 603 u32 index)
604{ 604{
605 uint32_t rar_low, rar_high; 605 u32 rar_low, rar_high;
606 606
607 DEBUGFUNC("ixgb_rar_set"); 607 DEBUGFUNC("ixgb_rar_set");
608 608
609 /* HW expects these in little endian so we reverse the byte order 609 /* HW expects these in little endian so we reverse the byte order
610 * from network order (big endian) to little endian 610 * from network order (big endian) to little endian
611 */ 611 */
612 rar_low = ((uint32_t) addr[0] | 612 rar_low = ((u32) addr[0] |
613 ((uint32_t)addr[1] << 8) | 613 ((u32)addr[1] << 8) |
614 ((uint32_t)addr[2] << 16) | 614 ((u32)addr[2] << 16) |
615 ((uint32_t)addr[3] << 24)); 615 ((u32)addr[3] << 24));
616 616
617 rar_high = ((uint32_t) addr[4] | 617 rar_high = ((u32) addr[4] |
618 ((uint32_t)addr[5] << 8) | 618 ((u32)addr[5] << 8) |
619 IXGB_RAH_AV); 619 IXGB_RAH_AV);
620 620
621 IXGB_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low); 621 IXGB_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low);
@@ -632,8 +632,8 @@ ixgb_rar_set(struct ixgb_hw *hw,
632 *****************************************************************************/ 632 *****************************************************************************/
633void 633void
634ixgb_write_vfta(struct ixgb_hw *hw, 634ixgb_write_vfta(struct ixgb_hw *hw,
635 uint32_t offset, 635 u32 offset,
636 uint32_t value) 636 u32 value)
637{ 637{
638 IXGB_WRITE_REG_ARRAY(hw, VFTA, offset, value); 638 IXGB_WRITE_REG_ARRAY(hw, VFTA, offset, value);
639 return; 639 return;
@@ -647,7 +647,7 @@ ixgb_write_vfta(struct ixgb_hw *hw,
647static void 647static void
648ixgb_clear_vfta(struct ixgb_hw *hw) 648ixgb_clear_vfta(struct ixgb_hw *hw)
649{ 649{
650 uint32_t offset; 650 u32 offset;
651 651
652 for(offset = 0; offset < IXGB_VLAN_FILTER_TBL_SIZE; offset++) 652 for(offset = 0; offset < IXGB_VLAN_FILTER_TBL_SIZE; offset++)
653 IXGB_WRITE_REG_ARRAY(hw, VFTA, offset, 0); 653 IXGB_WRITE_REG_ARRAY(hw, VFTA, offset, 0);
@@ -663,8 +663,8 @@ ixgb_clear_vfta(struct ixgb_hw *hw)
663static bool 663static bool
664ixgb_setup_fc(struct ixgb_hw *hw) 664ixgb_setup_fc(struct ixgb_hw *hw)
665{ 665{
666 uint32_t ctrl_reg; 666 u32 ctrl_reg;
667 uint32_t pap_reg = 0; /* by default, assume no pause time */ 667 u32 pap_reg = 0; /* by default, assume no pause time */
668 bool status = true; 668 bool status = true;
669 669
670 DEBUGFUNC("ixgb_setup_fc"); 670 DEBUGFUNC("ixgb_setup_fc");
@@ -762,15 +762,15 @@ ixgb_setup_fc(struct ixgb_hw *hw)
762 * This requires that first an address cycle command is sent, followed by a 762 * This requires that first an address cycle command is sent, followed by a
763 * read command. 763 * read command.
764 *****************************************************************************/ 764 *****************************************************************************/
765static uint16_t 765static u16
766ixgb_read_phy_reg(struct ixgb_hw *hw, 766ixgb_read_phy_reg(struct ixgb_hw *hw,
767 uint32_t reg_address, 767 u32 reg_address,
768 uint32_t phy_address, 768 u32 phy_address,
769 uint32_t device_type) 769 u32 device_type)
770{ 770{
771 uint32_t i; 771 u32 i;
772 uint32_t data; 772 u32 data;
773 uint32_t command = 0; 773 u32 command = 0;
774 774
775 ASSERT(reg_address <= IXGB_MAX_PHY_REG_ADDRESS); 775 ASSERT(reg_address <= IXGB_MAX_PHY_REG_ADDRESS);
776 ASSERT(phy_address <= IXGB_MAX_PHY_ADDRESS); 776 ASSERT(phy_address <= IXGB_MAX_PHY_ADDRESS);
@@ -835,7 +835,7 @@ ixgb_read_phy_reg(struct ixgb_hw *hw,
835 */ 835 */
836 data = IXGB_READ_REG(hw, MSRWD); 836 data = IXGB_READ_REG(hw, MSRWD);
837 data >>= IXGB_MSRWD_READ_DATA_SHIFT; 837 data >>= IXGB_MSRWD_READ_DATA_SHIFT;
838 return((uint16_t) data); 838 return((u16) data);
839} 839}
840 840
841/****************************************************************************** 841/******************************************************************************
@@ -857,20 +857,20 @@ ixgb_read_phy_reg(struct ixgb_hw *hw,
857 *****************************************************************************/ 857 *****************************************************************************/
858static void 858static void
859ixgb_write_phy_reg(struct ixgb_hw *hw, 859ixgb_write_phy_reg(struct ixgb_hw *hw,
860 uint32_t reg_address, 860 u32 reg_address,
861 uint32_t phy_address, 861 u32 phy_address,
862 uint32_t device_type, 862 u32 device_type,
863 uint16_t data) 863 u16 data)
864{ 864{
865 uint32_t i; 865 u32 i;
866 uint32_t command = 0; 866 u32 command = 0;
867 867
868 ASSERT(reg_address <= IXGB_MAX_PHY_REG_ADDRESS); 868 ASSERT(reg_address <= IXGB_MAX_PHY_REG_ADDRESS);
869 ASSERT(phy_address <= IXGB_MAX_PHY_ADDRESS); 869 ASSERT(phy_address <= IXGB_MAX_PHY_ADDRESS);
870 ASSERT(device_type <= IXGB_MAX_PHY_DEV_TYPE); 870 ASSERT(device_type <= IXGB_MAX_PHY_DEV_TYPE);
871 871
872 /* Put the data in the MDIO Read/Write Data register */ 872 /* Put the data in the MDIO Read/Write Data register */
873 IXGB_WRITE_REG(hw, MSRWD, (uint32_t)data); 873 IXGB_WRITE_REG(hw, MSRWD, (u32)data);
874 874
875 /* Setup and write the address cycle command */ 875 /* Setup and write the address cycle command */
876 command = ((reg_address << IXGB_MSCA_NP_ADDR_SHIFT) | 876 command = ((reg_address << IXGB_MSCA_NP_ADDR_SHIFT) |
@@ -939,8 +939,8 @@ ixgb_write_phy_reg(struct ixgb_hw *hw,
939void 939void
940ixgb_check_for_link(struct ixgb_hw *hw) 940ixgb_check_for_link(struct ixgb_hw *hw)
941{ 941{
942 uint32_t status_reg; 942 u32 status_reg;
943 uint32_t xpcss_reg; 943 u32 xpcss_reg;
944 944
945 DEBUGFUNC("ixgb_check_for_link"); 945 DEBUGFUNC("ixgb_check_for_link");
946 946
@@ -975,7 +975,7 @@ ixgb_check_for_link(struct ixgb_hw *hw)
975 *****************************************************************************/ 975 *****************************************************************************/
976bool ixgb_check_for_bad_link(struct ixgb_hw *hw) 976bool ixgb_check_for_bad_link(struct ixgb_hw *hw)
977{ 977{
978 uint32_t newLFC, newRFC; 978 u32 newLFC, newRFC;
979 bool bad_link_returncode = false; 979 bool bad_link_returncode = false;
980 980
981 if (hw->phy_type == ixgb_phy_type_txn17401) { 981 if (hw->phy_type == ixgb_phy_type_txn17401) {
@@ -1002,7 +1002,7 @@ bool ixgb_check_for_bad_link(struct ixgb_hw *hw)
1002static void 1002static void
1003ixgb_clear_hw_cntrs(struct ixgb_hw *hw) 1003ixgb_clear_hw_cntrs(struct ixgb_hw *hw)
1004{ 1004{
1005 volatile uint32_t temp_reg; 1005 volatile u32 temp_reg;
1006 1006
1007 DEBUGFUNC("ixgb_clear_hw_cntrs"); 1007 DEBUGFUNC("ixgb_clear_hw_cntrs");
1008 1008
@@ -1083,7 +1083,7 @@ ixgb_clear_hw_cntrs(struct ixgb_hw *hw)
1083void 1083void
1084ixgb_led_on(struct ixgb_hw *hw) 1084ixgb_led_on(struct ixgb_hw *hw)
1085{ 1085{
1086 uint32_t ctrl0_reg = IXGB_READ_REG(hw, CTRL0); 1086 u32 ctrl0_reg = IXGB_READ_REG(hw, CTRL0);
1087 1087
1088 /* To turn on the LED, clear software-definable pin 0 (SDP0). */ 1088 /* To turn on the LED, clear software-definable pin 0 (SDP0). */
1089 ctrl0_reg &= ~IXGB_CTRL0_SDP0; 1089 ctrl0_reg &= ~IXGB_CTRL0_SDP0;
@@ -1099,7 +1099,7 @@ ixgb_led_on(struct ixgb_hw *hw)
1099void 1099void
1100ixgb_led_off(struct ixgb_hw *hw) 1100ixgb_led_off(struct ixgb_hw *hw)
1101{ 1101{
1102 uint32_t ctrl0_reg = IXGB_READ_REG(hw, CTRL0); 1102 u32 ctrl0_reg = IXGB_READ_REG(hw, CTRL0);
1103 1103
1104 /* To turn off the LED, set software-definable pin 0 (SDP0). */ 1104 /* To turn off the LED, set software-definable pin 0 (SDP0). */
1105 ctrl0_reg |= IXGB_CTRL0_SDP0; 1105 ctrl0_reg |= IXGB_CTRL0_SDP0;
@@ -1115,7 +1115,7 @@ ixgb_led_off(struct ixgb_hw *hw)
1115static void 1115static void
1116ixgb_get_bus_info(struct ixgb_hw *hw) 1116ixgb_get_bus_info(struct ixgb_hw *hw)
1117{ 1117{
1118 uint32_t status_reg; 1118 u32 status_reg;
1119 1119
1120 status_reg = IXGB_READ_REG(hw, STATUS); 1120 status_reg = IXGB_READ_REG(hw, STATUS);
1121 1121
@@ -1155,7 +1155,7 @@ ixgb_get_bus_info(struct ixgb_hw *hw)
1155 * 1155 *
1156 *****************************************************************************/ 1156 *****************************************************************************/
1157static bool 1157static bool
1158mac_addr_valid(uint8_t *mac_addr) 1158mac_addr_valid(u8 *mac_addr)
1159{ 1159{
1160 bool is_valid = true; 1160 bool is_valid = true;
1161 DEBUGFUNC("mac_addr_valid"); 1161 DEBUGFUNC("mac_addr_valid");
@@ -1193,8 +1193,8 @@ static bool
1193ixgb_link_reset(struct ixgb_hw *hw) 1193ixgb_link_reset(struct ixgb_hw *hw)
1194{ 1194{
1195 bool link_status = false; 1195 bool link_status = false;
1196 uint8_t wait_retries = MAX_RESET_ITERATIONS; 1196 u8 wait_retries = MAX_RESET_ITERATIONS;
1197 uint8_t lrst_retries = MAX_RESET_ITERATIONS; 1197 u8 lrst_retries = MAX_RESET_ITERATIONS;
1198 1198
1199 do { 1199 do {
1200 /* Reset the link */ 1200 /* Reset the link */
@@ -1224,7 +1224,7 @@ static void
1224ixgb_optics_reset(struct ixgb_hw *hw) 1224ixgb_optics_reset(struct ixgb_hw *hw)
1225{ 1225{
1226 if (hw->phy_type == ixgb_phy_type_txn17401) { 1226 if (hw->phy_type == ixgb_phy_type_txn17401) {
1227 uint16_t mdio_reg; 1227 u16 mdio_reg;
1228 1228
1229 ixgb_write_phy_reg(hw, 1229 ixgb_write_phy_reg(hw,
1230 MDIO_PMA_PMD_CR1, 1230 MDIO_PMA_PMD_CR1,