aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2010-02-16 18:16:45 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-16 18:16:45 -0500
commit496c185c9495629ef1c65387cb2594578393cfe0 (patch)
tree4bf3e64ffd535328d9b5f05740d411298982cc37 /drivers/net
parentd5aa407f59f5b83d2c50ec88f5bf56d40f1f8978 (diff)
atl1c: Add support for Atheros AR8152 and AR8152
AR8151 is a Gigabit Ethernet device. AR8152 devices are Fast Ethernet devices, there are two revisions, a 1.0 and a 2.0 revision. This has been tested against these devices: Driver Model-name vendor:device Type atl1c AR8131 1969:1063 Gigabit Ethernet atl1c AR8132 1969:1062 Fast Ethernet atl1c AR8151(v1.0) 1969:1073 Gigabit Ethernet atl1c AR8152(v1.1) 1969:2060 Fast Ethernet This device has no hardware available yet so it goes untested, but it should work: atl1c AR8152(v2.0) 1969:2062 Fast Ethernet Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/atl1c/atl1c.h11
-rw-r--r--drivers/net/atl1c/atl1c_ethtool.c2
-rw-r--r--drivers/net/atl1c/atl1c_hw.c83
-rw-r--r--drivers/net/atl1c/atl1c_hw.h5
-rw-r--r--drivers/net/atl1c/atl1c_main.c115
5 files changed, 191 insertions, 25 deletions
diff --git a/drivers/net/atl1c/atl1c.h b/drivers/net/atl1c/atl1c.h
index efe5435bc3d3..84ae905bf732 100644
--- a/drivers/net/atl1c/atl1c.h
+++ b/drivers/net/atl1c/atl1c.h
@@ -313,6 +313,9 @@ enum atl1c_rss_type {
313enum atl1c_nic_type { 313enum atl1c_nic_type {
314 athr_l1c = 0, 314 athr_l1c = 0,
315 athr_l2c = 1, 315 athr_l2c = 1,
316 athr_l2c_b,
317 athr_l2c_b2,
318 athr_l1d,
316}; 319};
317 320
318enum atl1c_trans_queue { 321enum atl1c_trans_queue {
@@ -426,8 +429,12 @@ struct atl1c_hw {
426#define ATL1C_ASPM_L1_SUPPORT 0x0100 429#define ATL1C_ASPM_L1_SUPPORT 0x0100
427#define ATL1C_ASPM_CTRL_MON 0x0200 430#define ATL1C_ASPM_CTRL_MON 0x0200
428#define ATL1C_HIB_DISABLE 0x0400 431#define ATL1C_HIB_DISABLE 0x0400
429#define ATL1C_LINK_CAP_1000M 0x0800 432#define ATL1C_APS_MODE_ENABLE 0x0800
430#define ATL1C_FPGA_VERSION 0x8000 433#define ATL1C_LINK_EXT_SYNC 0x1000
434#define ATL1C_CLK_GATING_EN 0x2000
435#define ATL1C_FPGA_VERSION 0x8000
436 u16 link_cap_flags;
437#define ATL1C_LINK_CAP_1000M 0x0001
431 u16 cmb_tpd; 438 u16 cmb_tpd;
432 u16 cmb_rrd; 439 u16 cmb_rrd;
433 u16 cmb_rx_timer; /* 2us resolution */ 440 u16 cmb_rx_timer; /* 2us resolution */
diff --git a/drivers/net/atl1c/atl1c_ethtool.c b/drivers/net/atl1c/atl1c_ethtool.c
index 9b1e0eaebb5c..61a0f2ff11e9 100644
--- a/drivers/net/atl1c/atl1c_ethtool.c
+++ b/drivers/net/atl1c/atl1c_ethtool.c
@@ -37,7 +37,7 @@ static int atl1c_get_settings(struct net_device *netdev,
37 SUPPORTED_100baseT_Full | 37 SUPPORTED_100baseT_Full |
38 SUPPORTED_Autoneg | 38 SUPPORTED_Autoneg |
39 SUPPORTED_TP); 39 SUPPORTED_TP);
40 if (hw->ctrl_flags & ATL1C_LINK_CAP_1000M) 40 if (hw->link_cap_flags & ATL1C_LINK_CAP_1000M)
41 ecmd->supported |= SUPPORTED_1000baseT_Full; 41 ecmd->supported |= SUPPORTED_1000baseT_Full;
42 42
43 ecmd->advertising = ADVERTISED_TP; 43 ecmd->advertising = ADVERTISED_TP;
diff --git a/drivers/net/atl1c/atl1c_hw.c b/drivers/net/atl1c/atl1c_hw.c
index 3e69b940b8f7..f1389d664a21 100644
--- a/drivers/net/atl1c/atl1c_hw.c
+++ b/drivers/net/atl1c/atl1c_hw.c
@@ -70,17 +70,39 @@ static int atl1c_get_permanent_address(struct atl1c_hw *hw)
70 u32 otp_ctrl_data; 70 u32 otp_ctrl_data;
71 u32 twsi_ctrl_data; 71 u32 twsi_ctrl_data;
72 u8 eth_addr[ETH_ALEN]; 72 u8 eth_addr[ETH_ALEN];
73 u16 phy_data;
74 bool raise_vol = false;
73 75
74 /* init */ 76 /* init */
75 addr[0] = addr[1] = 0; 77 addr[0] = addr[1] = 0;
76 AT_READ_REG(hw, REG_OTP_CTRL, &otp_ctrl_data); 78 AT_READ_REG(hw, REG_OTP_CTRL, &otp_ctrl_data);
77 if (atl1c_check_eeprom_exist(hw)) { 79 if (atl1c_check_eeprom_exist(hw)) {
78 /* Enable OTP CLK */ 80 if (hw->nic_type == athr_l1c || hw->nic_type == athr_l2c_b) {
79 if (!(otp_ctrl_data & OTP_CTRL_CLK_EN)) { 81 /* Enable OTP CLK */
80 otp_ctrl_data |= OTP_CTRL_CLK_EN; 82 if (!(otp_ctrl_data & OTP_CTRL_CLK_EN)) {
81 AT_WRITE_REG(hw, REG_OTP_CTRL, otp_ctrl_data); 83 otp_ctrl_data |= OTP_CTRL_CLK_EN;
82 AT_WRITE_FLUSH(hw); 84 AT_WRITE_REG(hw, REG_OTP_CTRL, otp_ctrl_data);
83 msleep(1); 85 AT_WRITE_FLUSH(hw);
86 msleep(1);
87 }
88 }
89
90 if (hw->nic_type == athr_l2c_b ||
91 hw->nic_type == athr_l2c_b2 ||
92 hw->nic_type == athr_l1d) {
93 atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x00);
94 if (atl1c_read_phy_reg(hw, MII_DBG_DATA, &phy_data))
95 goto out;
96 phy_data &= 0xFF7F;
97 atl1c_write_phy_reg(hw, MII_DBG_DATA, phy_data);
98
99 atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x3B);
100 if (atl1c_read_phy_reg(hw, MII_DBG_DATA, &phy_data))
101 goto out;
102 phy_data |= 0x8;
103 atl1c_write_phy_reg(hw, MII_DBG_DATA, phy_data);
104 udelay(20);
105 raise_vol = true;
84 } 106 }
85 107
86 AT_READ_REG(hw, REG_TWSI_CTRL, &twsi_ctrl_data); 108 AT_READ_REG(hw, REG_TWSI_CTRL, &twsi_ctrl_data);
@@ -96,11 +118,31 @@ static int atl1c_get_permanent_address(struct atl1c_hw *hw)
96 return -1; 118 return -1;
97 } 119 }
98 /* Disable OTP_CLK */ 120 /* Disable OTP_CLK */
99 if (otp_ctrl_data & OTP_CTRL_CLK_EN) { 121 if ((hw->nic_type == athr_l1c || hw->nic_type == athr_l2c)) {
100 otp_ctrl_data &= ~OTP_CTRL_CLK_EN; 122 if (otp_ctrl_data & OTP_CTRL_CLK_EN) {
101 AT_WRITE_REG(hw, REG_OTP_CTRL, otp_ctrl_data); 123 otp_ctrl_data &= ~OTP_CTRL_CLK_EN;
102 AT_WRITE_FLUSH(hw); 124 AT_WRITE_REG(hw, REG_OTP_CTRL, otp_ctrl_data);
103 msleep(1); 125 AT_WRITE_FLUSH(hw);
126 msleep(1);
127 }
128 }
129 if (raise_vol) {
130 if (hw->nic_type == athr_l2c_b ||
131 hw->nic_type == athr_l2c_b2 ||
132 hw->nic_type == athr_l1d) {
133 atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x00);
134 if (atl1c_read_phy_reg(hw, MII_DBG_DATA, &phy_data))
135 goto out;
136 phy_data |= 0x80;
137 atl1c_write_phy_reg(hw, MII_DBG_DATA, phy_data);
138
139 atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x3B);
140 if (atl1c_read_phy_reg(hw, MII_DBG_DATA, &phy_data))
141 goto out;
142 phy_data &= 0xFFF7;
143 atl1c_write_phy_reg(hw, MII_DBG_DATA, phy_data);
144 udelay(20);
145 }
104 } 146 }
105 147
106 /* maybe MAC-address is from BIOS */ 148 /* maybe MAC-address is from BIOS */
@@ -114,6 +156,7 @@ static int atl1c_get_permanent_address(struct atl1c_hw *hw)
114 return 0; 156 return 0;
115 } 157 }
116 158
159out:
117 return -1; 160 return -1;
118} 161}
119 162
@@ -307,7 +350,7 @@ static int atl1c_phy_setup_adv(struct atl1c_hw *hw)
307 mii_adv_data |= ADVERTISE_10HALF | ADVERTISE_10FULL | 350 mii_adv_data |= ADVERTISE_10HALF | ADVERTISE_10FULL |
308 ADVERTISE_100HALF | ADVERTISE_100FULL; 351 ADVERTISE_100HALF | ADVERTISE_100FULL;
309 352
310 if (hw->ctrl_flags & ATL1C_LINK_CAP_1000M) { 353 if (hw->link_cap_flags & ATL1C_LINK_CAP_1000M) {
311 if (hw->autoneg_advertised & ADVERTISED_1000baseT_Half) 354 if (hw->autoneg_advertised & ADVERTISED_1000baseT_Half)
312 mii_giga_ctrl_data |= ADVERTISE_1000HALF; 355 mii_giga_ctrl_data |= ADVERTISE_1000HALF;
313 if (hw->autoneg_advertised & ADVERTISED_1000baseT_Full) 356 if (hw->autoneg_advertised & ADVERTISED_1000baseT_Full)
@@ -389,6 +432,7 @@ int atl1c_phy_reset(struct atl1c_hw *hw)
389{ 432{
390 struct atl1c_adapter *adapter = hw->adapter; 433 struct atl1c_adapter *adapter = hw->adapter;
391 struct pci_dev *pdev = adapter->pdev; 434 struct pci_dev *pdev = adapter->pdev;
435 u16 phy_data;
392 u32 phy_ctrl_data = GPHY_CTRL_DEFAULT; 436 u32 phy_ctrl_data = GPHY_CTRL_DEFAULT;
393 u32 mii_ier_data = IER_LINK_UP | IER_LINK_DOWN; 437 u32 mii_ier_data = IER_LINK_UP | IER_LINK_DOWN;
394 int err; 438 int err;
@@ -404,6 +448,21 @@ int atl1c_phy_reset(struct atl1c_hw *hw)
404 AT_WRITE_FLUSH(hw); 448 AT_WRITE_FLUSH(hw);
405 msleep(10); 449 msleep(10);
406 450
451 if (hw->nic_type == athr_l2c_b) {
452 atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x0A);
453 atl1c_read_phy_reg(hw, MII_DBG_DATA, &phy_data);
454 atl1c_write_phy_reg(hw, MII_DBG_DATA, phy_data & 0xDFFF);
455 }
456
457 if (hw->nic_type == athr_l2c_b ||
458 hw->nic_type == athr_l2c_b2 ||
459 hw->nic_type == athr_l1d) {
460 atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x3B);
461 atl1c_read_phy_reg(hw, MII_DBG_DATA, &phy_data);
462 atl1c_write_phy_reg(hw, MII_DBG_DATA, phy_data & 0xFFF7);
463 msleep(20);
464 }
465
407 /*Enable PHY LinkChange Interrupt */ 466 /*Enable PHY LinkChange Interrupt */
408 err = atl1c_write_phy_reg(hw, MII_IER, mii_ier_data); 467 err = atl1c_write_phy_reg(hw, MII_IER, mii_ier_data);
409 if (err) { 468 if (err) {
diff --git a/drivers/net/atl1c/atl1c_hw.h b/drivers/net/atl1c/atl1c_hw.h
index c2c738df5c63..1eeb3ed9f0cb 100644
--- a/drivers/net/atl1c/atl1c_hw.h
+++ b/drivers/net/atl1c/atl1c_hw.h
@@ -57,6 +57,7 @@ int atl1c_restart_autoneg(struct atl1c_hw *hw);
57#define REG_LINK_CTRL 0x68 57#define REG_LINK_CTRL 0x68
58#define LINK_CTRL_L0S_EN 0x01 58#define LINK_CTRL_L0S_EN 0x01
59#define LINK_CTRL_L1_EN 0x02 59#define LINK_CTRL_L1_EN 0x02
60#define LINK_CTRL_EXT_SYNC 0x80
60 61
61#define REG_VPD_CAP 0x6C 62#define REG_VPD_CAP 0x6C
62#define VPD_CAP_ID_MASK 0xff 63#define VPD_CAP_ID_MASK 0xff
@@ -156,6 +157,8 @@ int atl1c_restart_autoneg(struct atl1c_hw *hw);
156#define PM_CTRL_PM_REQ_TIMER_SHIFT 20 157#define PM_CTRL_PM_REQ_TIMER_SHIFT 20
157#define PM_CTRL_LCKDET_TIMER_MASK 0x3F 158#define PM_CTRL_LCKDET_TIMER_MASK 0x3F
158#define PM_CTRL_LCKDET_TIMER_SHIFT 24 159#define PM_CTRL_LCKDET_TIMER_SHIFT 24
160#define PM_CTRL_EN_BUFS_RX_L0S 0x10000000
161#define PM_CTRL_SA_DLY_EN 0x20000000
159#define PM_CTRL_MAC_ASPM_CHK 0x40000000 162#define PM_CTRL_MAC_ASPM_CHK 0x40000000
160#define PM_CTRL_HOTRST 0x80000000 163#define PM_CTRL_HOTRST 0x80000000
161 164
@@ -314,6 +317,8 @@ int atl1c_restart_autoneg(struct atl1c_hw *hw);
314#define MAC_CTRL_BC_EN 0x4000000 317#define MAC_CTRL_BC_EN 0x4000000
315#define MAC_CTRL_DBG 0x8000000 318#define MAC_CTRL_DBG 0x8000000
316#define MAC_CTRL_SINGLE_PAUSE_EN 0x10000000 319#define MAC_CTRL_SINGLE_PAUSE_EN 0x10000000
320#define MAC_CTRL_HASH_ALG_CRC32 0x20000000
321#define MAC_CTRL_SPEED_MODE_SW 0x40000000
317 322
318/* MAC IPG/IFG Control Register */ 323/* MAC IPG/IFG Control Register */
319#define REG_MAC_IPG_IFG 0x1484 324#define REG_MAC_IPG_IFG 0x1484
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
index d98095df05be..3d4c0a5a77eb 100644
--- a/drivers/net/atl1c/atl1c_main.c
+++ b/drivers/net/atl1c/atl1c_main.c
@@ -21,11 +21,18 @@
21 21
22#include "atl1c.h" 22#include "atl1c.h"
23 23
24#define ATL1C_DRV_VERSION "1.0.0.1-NAPI" 24#define ATL1C_DRV_VERSION "1.0.0.2-NAPI"
25char atl1c_driver_name[] = "atl1c"; 25char atl1c_driver_name[] = "atl1c";
26char atl1c_driver_version[] = ATL1C_DRV_VERSION; 26char atl1c_driver_version[] = ATL1C_DRV_VERSION;
27#define PCI_DEVICE_ID_ATTANSIC_L2C 0x1062 27#define PCI_DEVICE_ID_ATTANSIC_L2C 0x1062
28#define PCI_DEVICE_ID_ATTANSIC_L1C 0x1063 28#define PCI_DEVICE_ID_ATTANSIC_L1C 0x1063
29#define PCI_DEVICE_ID_ATHEROS_L2C_B 0x2060 /* AR8152 v1.1 Fast 10/100 */
30#define PCI_DEVICE_ID_ATHEROS_L2C_B2 0x2062 /* AR8152 v2.0 Fast 10/100 */
31#define PCI_DEVICE_ID_ATHEROS_L1D 0x1073 /* AR8151 v1.0 Gigabit 1000 */
32
33#define L2CB_V10 0xc0
34#define L2CB_V11 0xc1
35
29/* 36/*
30 * atl1c_pci_tbl - PCI Device ID Table 37 * atl1c_pci_tbl - PCI Device ID Table
31 * 38 *
@@ -38,6 +45,9 @@ char atl1c_driver_version[] = ATL1C_DRV_VERSION;
38static DEFINE_PCI_DEVICE_TABLE(atl1c_pci_tbl) = { 45static DEFINE_PCI_DEVICE_TABLE(atl1c_pci_tbl) = {
39 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L1C)}, 46 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L1C)},
40 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L2C)}, 47 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L2C)},
48 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L2C_B)},
49 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L2C_B2)},
50 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L1D)},
41 /* required last entry */ 51 /* required last entry */
42 { 0 } 52 { 0 }
43}; 53};
@@ -593,11 +603,18 @@ static void atl1c_set_mac_type(struct atl1c_hw *hw)
593 case PCI_DEVICE_ID_ATTANSIC_L2C: 603 case PCI_DEVICE_ID_ATTANSIC_L2C:
594 hw->nic_type = athr_l2c; 604 hw->nic_type = athr_l2c;
595 break; 605 break;
596
597 case PCI_DEVICE_ID_ATTANSIC_L1C: 606 case PCI_DEVICE_ID_ATTANSIC_L1C:
598 hw->nic_type = athr_l1c; 607 hw->nic_type = athr_l1c;
599 break; 608 break;
600 609 case PCI_DEVICE_ID_ATHEROS_L2C_B:
610 hw->nic_type = athr_l2c_b;
611 break;
612 case PCI_DEVICE_ID_ATHEROS_L2C_B2:
613 hw->nic_type = athr_l2c_b2;
614 break;
615 case PCI_DEVICE_ID_ATHEROS_L1D:
616 hw->nic_type = athr_l1d;
617 break;
601 default: 618 default:
602 break; 619 break;
603 } 620 }
@@ -620,10 +637,13 @@ static int atl1c_setup_mac_funcs(struct atl1c_hw *hw)
620 hw->ctrl_flags |= ATL1C_ASPM_L0S_SUPPORT; 637 hw->ctrl_flags |= ATL1C_ASPM_L0S_SUPPORT;
621 if (link_ctrl_data & LINK_CTRL_L1_EN) 638 if (link_ctrl_data & LINK_CTRL_L1_EN)
622 hw->ctrl_flags |= ATL1C_ASPM_L1_SUPPORT; 639 hw->ctrl_flags |= ATL1C_ASPM_L1_SUPPORT;
640 if (link_ctrl_data & LINK_CTRL_EXT_SYNC)
641 hw->ctrl_flags |= ATL1C_LINK_EXT_SYNC;
623 642
624 if (hw->nic_type == athr_l1c) { 643 if (hw->nic_type == athr_l1c ||
644 hw->nic_type == athr_l1d) {
625 hw->ctrl_flags |= ATL1C_ASPM_CTRL_MON; 645 hw->ctrl_flags |= ATL1C_ASPM_CTRL_MON;
626 hw->ctrl_flags |= ATL1C_LINK_CAP_1000M; 646 hw->link_cap_flags |= ATL1C_LINK_CAP_1000M;
627 } 647 }
628 return 0; 648 return 0;
629} 649}
@@ -1234,21 +1254,92 @@ static void atl1c_disable_l0s_l1(struct atl1c_hw *hw)
1234static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup) 1254static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup)
1235{ 1255{
1236 u32 pm_ctrl_data; 1256 u32 pm_ctrl_data;
1257 u32 link_ctrl_data;
1237 1258
1238 AT_READ_REG(hw, REG_PM_CTRL, &pm_ctrl_data); 1259 AT_READ_REG(hw, REG_PM_CTRL, &pm_ctrl_data);
1239 1260 AT_READ_REG(hw, REG_LINK_CTRL, &link_ctrl_data);
1240 pm_ctrl_data &= ~PM_CTRL_SERDES_PD_EX_L1; 1261 pm_ctrl_data &= ~PM_CTRL_SERDES_PD_EX_L1;
1262
1241 pm_ctrl_data &= ~(PM_CTRL_L1_ENTRY_TIMER_MASK << 1263 pm_ctrl_data &= ~(PM_CTRL_L1_ENTRY_TIMER_MASK <<
1242 PM_CTRL_L1_ENTRY_TIMER_SHIFT); 1264 PM_CTRL_L1_ENTRY_TIMER_SHIFT);
1265 pm_ctrl_data &= ~(PM_CTRL_LCKDET_TIMER_MASK <<
1266 PM_CTRL_LCKDET_TIMER_SHIFT);
1243 1267
1244 pm_ctrl_data |= PM_CTRL_MAC_ASPM_CHK; 1268 pm_ctrl_data |= PM_CTRL_MAC_ASPM_CHK;
1269 pm_ctrl_data &= ~PM_CTRL_ASPM_L1_EN;
1270 pm_ctrl_data |= PM_CTRL_RBER_EN;
1271 pm_ctrl_data |= PM_CTRL_SDES_EN;
1272
1273 if (hw->nic_type == athr_l2c_b ||
1274 hw->nic_type == athr_l1d ||
1275 hw->nic_type == athr_l2c_b2) {
1276 link_ctrl_data &= ~LINK_CTRL_EXT_SYNC;
1277 if (!(hw->ctrl_flags & ATL1C_APS_MODE_ENABLE)) {
1278 if (hw->nic_type == athr_l2c_b &&
1279 hw->revision_id == L2CB_V10)
1280 link_ctrl_data |= LINK_CTRL_EXT_SYNC;
1281 }
1282
1283 AT_WRITE_REG(hw, REG_LINK_CTRL, link_ctrl_data);
1284
1285 pm_ctrl_data |= PM_CTRL_PCIE_RECV;
1286 pm_ctrl_data |= AT_ASPM_L1_TIMER << PM_CTRL_PM_REQ_TIMER_SHIFT;
1287 pm_ctrl_data &= ~PM_CTRL_EN_BUFS_RX_L0S;
1288 pm_ctrl_data &= ~PM_CTRL_SA_DLY_EN;
1289 pm_ctrl_data &= ~PM_CTRL_HOTRST;
1290 pm_ctrl_data |= 1 << PM_CTRL_L1_ENTRY_TIMER_SHIFT;
1291 pm_ctrl_data |= PM_CTRL_SERDES_PD_EX_L1;
1292 }
1245 1293
1246 if (linkup) { 1294 if (linkup) {
1247 pm_ctrl_data |= PM_CTRL_SERDES_PLL_L1_EN; 1295 pm_ctrl_data &= ~PM_CTRL_ASPM_L1_EN;
1248 pm_ctrl_data &= ~PM_CTRL_CLK_SWH_L1; 1296 pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
1297 if (hw->ctrl_flags & ATL1C_ASPM_L1_SUPPORT)
1298 pm_ctrl_data |= PM_CTRL_ASPM_L1_EN;
1299 if (hw->ctrl_flags & ATL1C_ASPM_L0S_SUPPORT)
1300 pm_ctrl_data |= PM_CTRL_ASPM_L0S_EN;
1301
1302 if (hw->nic_type == athr_l2c_b ||
1303 hw->nic_type == athr_l1d ||
1304 hw->nic_type == athr_l2c_b2) {
1305 if (hw->nic_type == athr_l2c_b)
1306 if (!(hw->ctrl_flags & ATL1C_APS_MODE_ENABLE))
1307 pm_ctrl_data &= PM_CTRL_ASPM_L0S_EN;
1308 pm_ctrl_data &= ~PM_CTRL_SERDES_L1_EN;
1309 pm_ctrl_data &= ~PM_CTRL_SERDES_PLL_L1_EN;
1310 pm_ctrl_data &= ~PM_CTRL_SERDES_BUDS_RX_L1_EN;
1311 pm_ctrl_data |= PM_CTRL_CLK_SWH_L1;
1312 if (hw->adapter->link_speed == SPEED_100 ||
1313 hw->adapter->link_speed == SPEED_1000) {
1314 pm_ctrl_data &=
1315 ~(PM_CTRL_L1_ENTRY_TIMER_MASK <<
1316 PM_CTRL_L1_ENTRY_TIMER_SHIFT);
1317 if (hw->nic_type == athr_l1d)
1318 pm_ctrl_data |= 0xF <<
1319 PM_CTRL_L1_ENTRY_TIMER_SHIFT;
1320 else
1321 pm_ctrl_data |= 7 <<
1322 PM_CTRL_L1_ENTRY_TIMER_SHIFT;
1323 }
1324 } else {
1325 pm_ctrl_data |= PM_CTRL_SERDES_L1_EN;
1326 pm_ctrl_data |= PM_CTRL_SERDES_PLL_L1_EN;
1327 pm_ctrl_data |= PM_CTRL_SERDES_BUDS_RX_L1_EN;
1328 pm_ctrl_data &= ~PM_CTRL_CLK_SWH_L1;
1329 pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
1330 pm_ctrl_data &= ~PM_CTRL_ASPM_L1_EN;
1331 }
1332 atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x29);
1333 if (hw->adapter->link_speed == SPEED_10)
1334 if (hw->nic_type == athr_l1d)
1335 atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0xB69D);
1336 else
1337 atl1c_write_phy_reg(hw, MII_DBG_DATA, 0xB6DD);
1338 else if (hw->adapter->link_speed == SPEED_100)
1339 atl1c_write_phy_reg(hw, MII_DBG_DATA, 0xB2DD);
1340 else
1341 atl1c_write_phy_reg(hw, MII_DBG_DATA, 0x96DD);
1249 1342
1250 pm_ctrl_data |= PM_CTRL_SERDES_BUDS_RX_L1_EN;
1251 pm_ctrl_data |= PM_CTRL_SERDES_L1_EN;
1252 } else { 1343 } else {
1253 pm_ctrl_data &= ~PM_CTRL_SERDES_BUDS_RX_L1_EN; 1344 pm_ctrl_data &= ~PM_CTRL_SERDES_BUDS_RX_L1_EN;
1254 pm_ctrl_data &= ~PM_CTRL_SERDES_L1_EN; 1345 pm_ctrl_data &= ~PM_CTRL_SERDES_L1_EN;
@@ -1302,6 +1393,10 @@ static void atl1c_setup_mac_ctrl(struct atl1c_adapter *adapter)
1302 mac_ctrl_data |= MAC_CTRL_MC_ALL_EN; 1393 mac_ctrl_data |= MAC_CTRL_MC_ALL_EN;
1303 1394
1304 mac_ctrl_data |= MAC_CTRL_SINGLE_PAUSE_EN; 1395 mac_ctrl_data |= MAC_CTRL_SINGLE_PAUSE_EN;
1396 if (hw->nic_type == athr_l1d || hw->nic_type == athr_l2c_b2) {
1397 mac_ctrl_data |= MAC_CTRL_SPEED_MODE_SW;
1398 mac_ctrl_data |= MAC_CTRL_HASH_ALG_CRC32;
1399 }
1305 AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); 1400 AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data);
1306} 1401}
1307 1402