diff options
-rw-r--r-- | drivers/staging/et131x/et1310_address_map.h | 45 | ||||
-rw-r--r-- | drivers/staging/et131x/et1310_mac.c | 12 | ||||
-rw-r--r-- | drivers/staging/et131x/et1310_pm.c | 27 | ||||
-rw-r--r-- | drivers/staging/et131x/et131x_initpci.c | 20 | ||||
-rw-r--r-- | drivers/staging/et131x/et131x_isr.c | 13 |
5 files changed, 43 insertions, 74 deletions
diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index b395f9c660e..8aaa62bc113 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h | |||
@@ -73,37 +73,20 @@ | |||
73 | /* | 73 | /* |
74 | * structure for power management control status reg in global address map | 74 | * structure for power management control status reg in global address map |
75 | * located at address 0x0010 | 75 | * located at address 0x0010 |
76 | * jagcore_rx_rdy bit 9 | ||
77 | * jagcore_tx_rdy bit 8 | ||
78 | * phy_lped_en bit 7 | ||
79 | * phy_sw_coma bit 6 | ||
80 | * rxclk_gate bit 5 | ||
81 | * txclk_gate bit 4 | ||
82 | * sysclk_gate bit 3 | ||
83 | * jagcore_rx_en bit 2 | ||
84 | * jagcore_tx_en bit 1 | ||
85 | * gigephy_en bit 0 | ||
76 | */ | 86 | */ |
77 | typedef union _PM_CSR_t { | 87 | |
78 | u32 value; | 88 | #define ET_PM_PHY_SW_COMA 0x40 |
79 | struct { | 89 | #define ET_PMCSR_INIT 0x38 |
80 | #ifdef _BIT_FIELDS_HTOL | ||
81 | u32 unused:22; /* bits 10-31 */ | ||
82 | u32 pm_jagcore_rx_rdy:1; /* bit 9 */ | ||
83 | u32 pm_jagcore_tx_rdy:1; /* bit 8 */ | ||
84 | u32 pm_phy_lped_en:1; /* bit 7 */ | ||
85 | u32 pm_phy_sw_coma:1; /* bit 6 */ | ||
86 | u32 pm_rxclk_gate:1; /* bit 5 */ | ||
87 | u32 pm_txclk_gate:1; /* bit 4 */ | ||
88 | u32 pm_sysclk_gate:1; /* bit 3 */ | ||
89 | u32 pm_jagcore_rx_en:1; /* bit 2 */ | ||
90 | u32 pm_jagcore_tx_en:1; /* bit 1 */ | ||
91 | u32 pm_gigephy_en:1; /* bit 0 */ | ||
92 | #else | ||
93 | u32 pm_gigephy_en:1; /* bit 0 */ | ||
94 | u32 pm_jagcore_tx_en:1; /* bit 1 */ | ||
95 | u32 pm_jagcore_rx_en:1; /* bit 2 */ | ||
96 | u32 pm_sysclk_gate:1; /* bit 3 */ | ||
97 | u32 pm_txclk_gate:1; /* bit 4 */ | ||
98 | u32 pm_rxclk_gate:1; /* bit 5 */ | ||
99 | u32 pm_phy_sw_coma:1; /* bit 6 */ | ||
100 | u32 pm_phy_lped_en:1; /* bit 7 */ | ||
101 | u32 pm_jagcore_tx_rdy:1; /* bit 8 */ | ||
102 | u32 pm_jagcore_rx_rdy:1; /* bit 9 */ | ||
103 | u32 unused:22; /* bits 10-31 */ | ||
104 | #endif | ||
105 | } bits; | ||
106 | } PM_CSR_t, *PPM_CSR_t; | ||
107 | 90 | ||
108 | /* | 91 | /* |
109 | * structure for interrupt status reg in global address map | 92 | * structure for interrupt status reg in global address map |
@@ -271,7 +254,7 @@ typedef struct _GLOBAL_t { /* Location: */ | |||
271 | u32 txq_end_addr; /* 0x0004 */ | 254 | u32 txq_end_addr; /* 0x0004 */ |
272 | u32 rxq_start_addr; /* 0x0008 */ | 255 | u32 rxq_start_addr; /* 0x0008 */ |
273 | u32 rxq_end_addr; /* 0x000C */ | 256 | u32 rxq_end_addr; /* 0x000C */ |
274 | PM_CSR_t pm_csr; /* 0x0010 */ | 257 | u32 pm_csr; /* 0x0010 */ |
275 | u32 unused; /* 0x0014 */ | 258 | u32 unused; /* 0x0014 */ |
276 | INTERRUPT_t int_status; /* 0x0018 */ | 259 | INTERRUPT_t int_status; /* 0x0018 */ |
277 | INTERRUPT_t int_mask; /* 0x001C */ | 260 | INTERRUPT_t int_mask; /* 0x001C */ |
diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c index b2123d0a8b0..a27d8157b24 100644 --- a/drivers/staging/et131x/et1310_mac.c +++ b/drivers/staging/et131x/et1310_mac.c | |||
@@ -672,7 +672,7 @@ void SetupDeviceForMulticast(struct et131x_adapter *etdev) | |||
672 | uint32_t hash2 = 0; | 672 | uint32_t hash2 = 0; |
673 | uint32_t hash3 = 0; | 673 | uint32_t hash3 = 0; |
674 | uint32_t hash4 = 0; | 674 | uint32_t hash4 = 0; |
675 | PM_CSR_t pm_csr; | 675 | u32 pm_csr; |
676 | 676 | ||
677 | DBG_ENTER(et131x_dbginfo); | 677 | DBG_ENTER(et131x_dbginfo); |
678 | 678 | ||
@@ -718,8 +718,8 @@ void SetupDeviceForMulticast(struct et131x_adapter *etdev) | |||
718 | } | 718 | } |
719 | 719 | ||
720 | /* Write out the new hash to the device */ | 720 | /* Write out the new hash to the device */ |
721 | pm_csr.value = readl(&etdev->regs->global.pm_csr.value); | 721 | pm_csr = readl(&etdev->regs->global.pm_csr); |
722 | if (pm_csr.bits.pm_phy_sw_coma == 0) { | 722 | if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) { |
723 | writel(hash1, &rxmac->multi_hash1); | 723 | writel(hash1, &rxmac->multi_hash1); |
724 | writel(hash2, &rxmac->multi_hash2); | 724 | writel(hash2, &rxmac->multi_hash2); |
725 | writel(hash3, &rxmac->multi_hash3); | 725 | writel(hash3, &rxmac->multi_hash3); |
@@ -735,7 +735,7 @@ void SetupDeviceForUnicast(struct et131x_adapter *etdev) | |||
735 | RXMAC_UNI_PF_ADDR1_t uni_pf1; | 735 | RXMAC_UNI_PF_ADDR1_t uni_pf1; |
736 | RXMAC_UNI_PF_ADDR2_t uni_pf2; | 736 | RXMAC_UNI_PF_ADDR2_t uni_pf2; |
737 | RXMAC_UNI_PF_ADDR3_t uni_pf3; | 737 | RXMAC_UNI_PF_ADDR3_t uni_pf3; |
738 | PM_CSR_t pm_csr; | 738 | u32 pm_csr; |
739 | 739 | ||
740 | DBG_ENTER(et131x_dbginfo); | 740 | DBG_ENTER(et131x_dbginfo); |
741 | 741 | ||
@@ -763,8 +763,8 @@ void SetupDeviceForUnicast(struct et131x_adapter *etdev) | |||
763 | uni_pf1.bits.addr1_5 = etdev->CurrentAddress[4]; | 763 | uni_pf1.bits.addr1_5 = etdev->CurrentAddress[4]; |
764 | uni_pf1.bits.addr1_6 = etdev->CurrentAddress[5]; | 764 | uni_pf1.bits.addr1_6 = etdev->CurrentAddress[5]; |
765 | 765 | ||
766 | pm_csr.value = readl(&etdev->regs->global.pm_csr.value); | 766 | pm_csr = readl(&etdev->regs->global.pm_csr); |
767 | if (pm_csr.bits.pm_phy_sw_coma == 0) { | 767 | if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) { |
768 | writel(uni_pf1.value, &rxmac->uni_pf_addr1.value); | 768 | writel(uni_pf1.value, &rxmac->uni_pf_addr1.value); |
769 | writel(uni_pf2.value, &rxmac->uni_pf_addr2.value); | 769 | writel(uni_pf2.value, &rxmac->uni_pf_addr2.value); |
770 | writel(uni_pf3.value, &rxmac->uni_pf_addr3.value); | 770 | writel(uni_pf3.value, &rxmac->uni_pf_addr3.value); |
diff --git a/drivers/staging/et131x/et1310_pm.c b/drivers/staging/et131x/et1310_pm.c index 846c80b2c57..ea186a8cc5d 100644 --- a/drivers/staging/et131x/et1310_pm.c +++ b/drivers/staging/et131x/et1310_pm.c | |||
@@ -120,12 +120,11 @@ extern dbg_info_t *et131x_dbginfo; | |||
120 | void EnablePhyComa(struct et131x_adapter *etdev) | 120 | void EnablePhyComa(struct et131x_adapter *etdev) |
121 | { | 121 | { |
122 | unsigned long flags; | 122 | unsigned long flags; |
123 | PM_CSR_t GlobalPmCSR; | 123 | u32 GlobalPmCSR; |
124 | int32_t LoopCounter = 10; | ||
125 | 124 | ||
126 | DBG_ENTER(et131x_dbginfo); | 125 | DBG_ENTER(et131x_dbginfo); |
127 | 126 | ||
128 | GlobalPmCSR.value = readl(&etdev->regs->global.pm_csr.value); | 127 | GlobalPmCSR = readl(&etdev->regs->global.pm_csr); |
129 | 128 | ||
130 | /* Save the GbE PHY speed and duplex modes. Need to restore this | 129 | /* Save the GbE PHY speed and duplex modes. Need to restore this |
131 | * when cable is plugged back in | 130 | * when cable is plugged back in |
@@ -141,14 +140,12 @@ void EnablePhyComa(struct et131x_adapter *etdev) | |||
141 | /* Wait for outstanding Receive packets */ | 140 | /* Wait for outstanding Receive packets */ |
142 | 141 | ||
143 | /* Gate off JAGCore 3 clock domains */ | 142 | /* Gate off JAGCore 3 clock domains */ |
144 | GlobalPmCSR.bits.pm_sysclk_gate = 0; | 143 | GlobalPmCSR &= ~ET_PMCSR_INIT; |
145 | GlobalPmCSR.bits.pm_txclk_gate = 0; | 144 | writel(GlobalPmCSR, &etdev->regs->global.pm_csr); |
146 | GlobalPmCSR.bits.pm_rxclk_gate = 0; | ||
147 | writel(GlobalPmCSR.value, &etdev->regs->global.pm_csr.value); | ||
148 | 145 | ||
149 | /* Program gigE PHY in to Coma mode */ | 146 | /* Program gigE PHY in to Coma mode */ |
150 | GlobalPmCSR.bits.pm_phy_sw_coma = 1; | 147 | GlobalPmCSR |= ET_PM_PHY_SW_COMA; |
151 | writel(GlobalPmCSR.value, &etdev->regs->global.pm_csr.value); | 148 | writel(GlobalPmCSR, &etdev->regs->global.pm_csr); |
152 | 149 | ||
153 | DBG_LEAVE(et131x_dbginfo); | 150 | DBG_LEAVE(et131x_dbginfo); |
154 | } | 151 | } |
@@ -159,18 +156,16 @@ void EnablePhyComa(struct et131x_adapter *etdev) | |||
159 | */ | 156 | */ |
160 | void DisablePhyComa(struct et131x_adapter *etdev) | 157 | void DisablePhyComa(struct et131x_adapter *etdev) |
161 | { | 158 | { |
162 | PM_CSR_t GlobalPmCSR; | 159 | u32 GlobalPmCSR; |
163 | 160 | ||
164 | DBG_ENTER(et131x_dbginfo); | 161 | DBG_ENTER(et131x_dbginfo); |
165 | 162 | ||
166 | GlobalPmCSR.value = readl(&etdev->regs->global.pm_csr.value); | 163 | GlobalPmCSR = readl(&etdev->regs->global.pm_csr); |
167 | 164 | ||
168 | /* Disable phy_sw_coma register and re-enable JAGCore clocks */ | 165 | /* Disable phy_sw_coma register and re-enable JAGCore clocks */ |
169 | GlobalPmCSR.bits.pm_sysclk_gate = 1; | 166 | GlobalPmCSR |= ET_PMCSR_INIT; |
170 | GlobalPmCSR.bits.pm_txclk_gate = 1; | 167 | GlobalPmCSR &= ~ET_PM_PHY_SW_COMA; |
171 | GlobalPmCSR.bits.pm_rxclk_gate = 1; | 168 | writel(GlobalPmCSR, &etdev->regs->global.pm_csr); |
172 | GlobalPmCSR.bits.pm_phy_sw_coma = 0; | ||
173 | writel(GlobalPmCSR.value, &etdev->regs->global.pm_csr.value); | ||
174 | 169 | ||
175 | /* Restore the GbE PHY speed and duplex modes; | 170 | /* Restore the GbE PHY speed and duplex modes; |
176 | * Reset JAGCore; re-configure and initialize JAGCore and gigE PHY | 171 | * Reset JAGCore; re-configure and initialize JAGCore and gigE PHY |
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c index bea9918d168..d7a1b34550a 100644 --- a/drivers/staging/et131x/et131x_initpci.c +++ b/drivers/staging/et131x/et131x_initpci.c | |||
@@ -474,16 +474,16 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) | |||
474 | void et131x_error_timer_handler(unsigned long data) | 474 | void et131x_error_timer_handler(unsigned long data) |
475 | { | 475 | { |
476 | struct et131x_adapter *etdev = (struct et131x_adapter *) data; | 476 | struct et131x_adapter *etdev = (struct et131x_adapter *) data; |
477 | PM_CSR_t pm_csr; | 477 | u32 pm_csr; |
478 | 478 | ||
479 | pm_csr.value = readl(&etdev->regs->global.pm_csr.value); | 479 | pm_csr = readl(&etdev->regs->global.pm_csr); |
480 | 480 | ||
481 | if (pm_csr.bits.pm_phy_sw_coma == 0) | 481 | if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) |
482 | UpdateMacStatHostCounters(etdev); | 482 | UpdateMacStatHostCounters(etdev); |
483 | else | 483 | else |
484 | DBG_VERBOSE(et131x_dbginfo, | 484 | DBG_VERBOSE(et131x_dbginfo, |
485 | "No interrupts, in PHY coma, pm_csr = 0x%x\n", | 485 | "No interrupts, in PHY coma, pm_csr = 0x%x\n", |
486 | pm_csr.value); | 486 | pm_csr); |
487 | 487 | ||
488 | if (!etdev->Bmsr.bits.link_status && | 488 | if (!etdev->Bmsr.bits.link_status && |
489 | etdev->RegistryPhyComa && | 489 | etdev->RegistryPhyComa && |
@@ -494,7 +494,7 @@ void et131x_error_timer_handler(unsigned long data) | |||
494 | if (etdev->PoMgmt.TransPhyComaModeOnBoot == 10) { | 494 | if (etdev->PoMgmt.TransPhyComaModeOnBoot == 10) { |
495 | if (!etdev->Bmsr.bits.link_status | 495 | if (!etdev->Bmsr.bits.link_status |
496 | && etdev->RegistryPhyComa) { | 496 | && etdev->RegistryPhyComa) { |
497 | if (pm_csr.bits.pm_phy_sw_coma == 0) { | 497 | if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) { |
498 | /* NOTE - This was originally a 'sync with | 498 | /* NOTE - This was originally a 'sync with |
499 | * interrupt'. How to do that under Linux? | 499 | * interrupt'. How to do that under Linux? |
500 | */ | 500 | */ |
@@ -1002,15 +1002,7 @@ int __devinit et131x_pci_setup(struct pci_dev *pdev, | |||
1002 | /* Perform device-specific initialization here (See code below) */ | 1002 | /* Perform device-specific initialization here (See code below) */ |
1003 | 1003 | ||
1004 | /* If Phy COMA mode was enabled when we went down, disable it here. */ | 1004 | /* If Phy COMA mode was enabled when we went down, disable it here. */ |
1005 | { | 1005 | writel(ET_PMCSR_INIT, &adapter->regs->global.pm_csr); |
1006 | PM_CSR_t GlobalPmCSR = { 0 }; | ||
1007 | |||
1008 | GlobalPmCSR.bits.pm_sysclk_gate = 1; | ||
1009 | GlobalPmCSR.bits.pm_txclk_gate = 1; | ||
1010 | GlobalPmCSR.bits.pm_rxclk_gate = 1; | ||
1011 | writel(GlobalPmCSR.value, | ||
1012 | &adapter->regs->global.pm_csr.value); | ||
1013 | } | ||
1014 | 1006 | ||
1015 | /* Issue a global reset to the et1310 */ | 1007 | /* Issue a global reset to the et1310 */ |
1016 | DBG_TRACE(et131x_dbginfo, "Issuing soft reset...\n"); | 1008 | DBG_TRACE(et131x_dbginfo, "Issuing soft reset...\n"); |
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c index 478569fcab1..00b815ac12c 100644 --- a/drivers/staging/et131x/et131x_isr.c +++ b/drivers/staging/et131x/et131x_isr.c | |||
@@ -274,14 +274,13 @@ void et131x_isr_handler(struct work_struct *work) | |||
274 | */ | 274 | */ |
275 | if (etdev->FlowControl == TxOnly || | 275 | if (etdev->FlowControl == TxOnly || |
276 | etdev->FlowControl == Both) { | 276 | etdev->FlowControl == Both) { |
277 | PM_CSR_t pm_csr; | 277 | u32 pm_csr; |
278 | 278 | ||
279 | /* Tell the device to send a pause packet via | 279 | /* Tell the device to send a pause packet via |
280 | * the back pressure register | 280 | * the back pressure register |
281 | */ | 281 | */ |
282 | pm_csr.value = | 282 | pm_csr = readl(&iomem->global.pm_csr); |
283 | readl(&iomem->global.pm_csr.value); | 283 | if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) { |
284 | if (pm_csr.bits.pm_phy_sw_coma == 0) { | ||
285 | TXMAC_BP_CTRL_t bp_ctrl = { 0 }; | 284 | TXMAC_BP_CTRL_t bp_ctrl = { 0 }; |
286 | 285 | ||
287 | bp_ctrl.bits.bp_req = 1; | 286 | bp_ctrl.bits.bp_req = 1; |
@@ -351,7 +350,7 @@ void et131x_isr_handler(struct work_struct *work) | |||
351 | 350 | ||
352 | /* Handle the PHY interrupt */ | 351 | /* Handle the PHY interrupt */ |
353 | if (GlobStatus.bits.phy_interrupt) { | 352 | if (GlobStatus.bits.phy_interrupt) { |
354 | PM_CSR_t pm_csr; | 353 | u32 pm_csr; |
355 | MI_BMSR_t BmsrInts, BmsrData; | 354 | MI_BMSR_t BmsrInts, BmsrData; |
356 | MI_ISR_t myIsr; | 355 | MI_ISR_t myIsr; |
357 | 356 | ||
@@ -360,8 +359,8 @@ void et131x_isr_handler(struct work_struct *work) | |||
360 | /* If we are in coma mode when we get this interrupt, | 359 | /* If we are in coma mode when we get this interrupt, |
361 | * we need to disable it. | 360 | * we need to disable it. |
362 | */ | 361 | */ |
363 | pm_csr.value = readl(&iomem->global.pm_csr.value); | 362 | pm_csr = readl(&iomem->global.pm_csr); |
364 | if (pm_csr.bits.pm_phy_sw_coma == 1) { | 363 | if (pm_csr & ET_PM_PHY_SW_COMA) { |
365 | /* | 364 | /* |
366 | * Check to see if we are in coma mode and if | 365 | * Check to see if we are in coma mode and if |
367 | * so, disable it because we will not be able | 366 | * so, disable it because we will not be able |