* [PATCH 01/26] et1310: kill pAdapter in favour of a sane name
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
@ 2009-08-25 14:57 ` Alan Cox
2009-08-26 5:49 ` Greg KH
2009-08-25 14:57 ` [PATCH 02/26] et131x: spinlocks Alan Cox
` (24 subsequent siblings)
25 siblings, 1 reply; 28+ messages in thread
From: Alan Cox @ 2009-08-25 14:57 UTC (permalink / raw)
To: greg, netdev
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_eeprom.c | 14 -
drivers/staging/et131x/et1310_jagcore.c | 20 +
drivers/staging/et131x/et1310_mac.c | 220 ++++++++-------
drivers/staging/et131x/et1310_phy.c | 370 +++++++++++++-------------
drivers/staging/et131x/et1310_pm.c | 46 ++-
drivers/staging/et131x/et1310_rx.c | 202 +++++++-------
drivers/staging/et131x/et1310_tx.c | 442 ++++++++++++++++---------------
drivers/staging/et131x/et131x_config.c | 90 +++---
drivers/staging/et131x/et131x_debug.c | 20 +
drivers/staging/et131x/et131x_initpci.c | 82 +++---
drivers/staging/et131x/et131x_isr.c | 44 ++-
drivers/staging/et131x/et131x_netdev.c | 38 +--
12 files changed, 794 insertions(+), 794 deletions(-)
diff --git a/drivers/staging/et131x/et1310_eeprom.c b/drivers/staging/et131x/et1310_eeprom.c
index 3a81a85..9a6dbd6 100644
--- a/drivers/staging/et131x/et1310_eeprom.c
+++ b/drivers/staging/et131x/et1310_eeprom.c
@@ -143,7 +143,7 @@
/**
* EepromWriteByte - Write a byte to the ET1310's EEPROM
- * @pAdapter: pointer to our private adapter structure
+ * @etdev: pointer to our private adapter structure
* @unAddress: the address to write
* @bData: the value to write
* @unEepronId: the ID of the EEPROM
@@ -151,11 +151,11 @@
*
* Returns SUCCESS or FAILURE
*/
-int32_t EepromWriteByte(struct et131x_adapter *pAdapter, uint32_t unAddress,
+int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress,
uint8_t bData, uint32_t unEepromId,
uint32_t unAddressingMode)
{
- struct pci_dev *pdev = pAdapter->pdev;
+ struct pci_dev *pdev = etdev->pdev;
int32_t nIndex;
int32_t nRetries;
int32_t nError = false;
@@ -292,7 +292,7 @@ int32_t EepromWriteByte(struct et131x_adapter *pAdapter, uint32_t unAddress,
* so we do a blind write for load bug.
*/
if (bStatus & LBCIF_STATUS_GENERAL_ERROR
- && pAdapter->RevisionID == 0) {
+ && etdev->RevisionID == 0) {
break;
}
@@ -349,7 +349,7 @@ int32_t EepromWriteByte(struct et131x_adapter *pAdapter, uint32_t unAddress,
/**
* EepromReadByte - Read a byte from the ET1310's EEPROM
- * @pAdapter: pointer to our private adapter structure
+ * @etdev: pointer to our private adapter structure
* @unAddress: the address from which to read
* @pbData: a pointer to a byte in which to store the value of the read
* @unEepronId: the ID of the EEPROM
@@ -357,11 +357,11 @@ int32_t EepromWriteByte(struct et131x_adapter *pAdapter, uint32_t unAddress,
*
* Returns SUCCESS or FAILURE
*/
-int32_t EepromReadByte(struct et131x_adapter *pAdapter, uint32_t unAddress,
+int32_t EepromReadByte(struct et131x_adapter *etdev, uint32_t unAddress,
uint8_t *pbData, uint32_t unEepromId,
uint32_t unAddressingMode)
{
- struct pci_dev *pdev = pAdapter->pdev;
+ struct pci_dev *pdev = etdev->pdev;
int32_t nIndex;
int32_t nError = 0;
uint8_t bControl;
diff --git a/drivers/staging/et131x/et1310_jagcore.c b/drivers/staging/et131x/et1310_jagcore.c
index 6fb2c6d..3b4b273 100644
--- a/drivers/staging/et131x/et1310_jagcore.c
+++ b/drivers/staging/et131x/et1310_jagcore.c
@@ -99,27 +99,27 @@ extern dbg_info_t *et131x_dbginfo;
* ConfigGlobalRegs - Used to configure the global registers on the JAGCore
* @pAdpater: pointer to our adapter structure
*/
-void ConfigGlobalRegs(struct et131x_adapter *pAdapter)
+void ConfigGlobalRegs(struct et131x_adapter *etdev)
{
- struct _GLOBAL_t __iomem *pGbl = &pAdapter->CSRAddress->global;
+ struct _GLOBAL_t __iomem *pGbl = &etdev->CSRAddress->global;
DBG_ENTER(et131x_dbginfo);
- if (pAdapter->RegistryPhyLoopbk == false) {
- if (pAdapter->RegistryJumboPacket < 2048) {
+ if (etdev->RegistryPhyLoopbk == false) {
+ if (etdev->RegistryJumboPacket < 2048) {
/* Tx / RxDMA and Tx/Rx MAC interfaces have a 1k word
* block of RAM that the driver can split between Tx
* and Rx as it desires. Our default is to split it
* 50/50:
*/
writel(0, &pGbl->rxq_start_addr.value);
- writel(pAdapter->RegistryRxMemEnd,
+ writel(etdev->RegistryRxMemEnd,
&pGbl->rxq_end_addr.value);
- writel(pAdapter->RegistryRxMemEnd + 1,
+ writel(etdev->RegistryRxMemEnd + 1,
&pGbl->txq_start_addr.value);
writel(INTERNAL_MEM_SIZE - 1,
&pGbl->txq_end_addr.value);
- } else if (pAdapter->RegistryJumboPacket < 8192) {
+ } else if (etdev->RegistryJumboPacket < 8192) {
/* For jumbo packets > 2k but < 8k, split 50-50. */
writel(0, &pGbl->rxq_start_addr.value);
writel(INTERNAL_MEM_RX_OFFSET,
@@ -171,9 +171,9 @@ void ConfigGlobalRegs(struct et131x_adapter *pAdapter)
/**
* ConfigMMCRegs - Used to configure the main memory registers in the JAGCore
- * @pAdapter: pointer to our adapter structure
+ * @etdev: pointer to our adapter structure
*/
-void ConfigMMCRegs(struct et131x_adapter *pAdapter)
+void ConfigMMCRegs(struct et131x_adapter *etdev)
{
MMC_CTRL_t mmc_ctrl = { 0 };
@@ -188,7 +188,7 @@ void ConfigMMCRegs(struct et131x_adapter *pAdapter)
mmc_ctrl.bits.arb_disable = 0x0;
mmc_ctrl.bits.mmc_enable = 0x1;
- writel(mmc_ctrl.value, &pAdapter->CSRAddress->mmc.mmc_ctrl.value);
+ writel(mmc_ctrl.value, &etdev->CSRAddress->mmc.mmc_ctrl.value);
DBG_LEAVE(et131x_dbginfo);
}
diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index 5200dbf..4cb4cfc 100644
--- a/drivers/staging/et131x/et1310_mac.c
+++ b/drivers/staging/et131x/et1310_mac.c
@@ -101,9 +101,9 @@ extern dbg_info_t *et131x_dbginfo;
* ConfigMacRegs1 - Initialize the first part of MAC regs
* @pAdpater: pointer to our adapter structure
*/
-void ConfigMACRegs1(struct et131x_adapter *pAdapter)
+void ConfigMACRegs1(struct et131x_adapter *etdev)
{
- struct _MAC_t __iomem *pMac = &pAdapter->CSRAddress->mac;
+ struct _MAC_t __iomem *pMac = &etdev->CSRAddress->mac;
MAC_STATION_ADDR1_t station1;
MAC_STATION_ADDR2_t station2;
MAC_IPG_t ipg;
@@ -151,12 +151,12 @@ void ConfigMACRegs1(struct et131x_adapter *pAdapter)
* station address is used for generating and checking pause control
* packets.
*/
- station2.bits.Octet1 = pAdapter->CurrentAddress[0];
- station2.bits.Octet2 = pAdapter->CurrentAddress[1];
- station1.bits.Octet3 = pAdapter->CurrentAddress[2];
- station1.bits.Octet4 = pAdapter->CurrentAddress[3];
- station1.bits.Octet5 = pAdapter->CurrentAddress[4];
- station1.bits.Octet6 = pAdapter->CurrentAddress[5];
+ station2.bits.Octet1 = etdev->CurrentAddress[0];
+ station2.bits.Octet2 = etdev->CurrentAddress[1];
+ station1.bits.Octet3 = etdev->CurrentAddress[2];
+ station1.bits.Octet4 = etdev->CurrentAddress[3];
+ station1.bits.Octet5 = etdev->CurrentAddress[4];
+ station1.bits.Octet6 = etdev->CurrentAddress[5];
writel(station1.value, &pMac->station_addr_1.value);
writel(station2.value, &pMac->station_addr_2.value);
@@ -167,7 +167,7 @@ void ConfigMACRegs1(struct et131x_adapter *pAdapter)
* Packets larger than (RegistryJumboPacket) that do not contain a
* VLAN ID will be dropped by the Rx function.
*/
- writel(pAdapter->RegistryJumboPacket + 4, &pMac->max_fm_len.value);
+ writel(etdev->RegistryJumboPacket + 4, &pMac->max_fm_len.value);
/* clear out MAC config reset */
writel(0, &pMac->cfg1.value);
@@ -179,10 +179,10 @@ void ConfigMACRegs1(struct et131x_adapter *pAdapter)
* ConfigMacRegs2 - Initialize the second part of MAC regs
* @pAdpater: pointer to our adapter structure
*/
-void ConfigMACRegs2(struct et131x_adapter *pAdapter)
+void ConfigMACRegs2(struct et131x_adapter *etdev)
{
int32_t delay = 0;
- struct _MAC_t __iomem *pMac = &pAdapter->CSRAddress->mac;
+ struct _MAC_t __iomem *pMac = &etdev->CSRAddress->mac;
MAC_CFG1_t cfg1;
MAC_CFG2_t cfg2;
MAC_IF_CTRL_t ifctrl;
@@ -190,12 +190,12 @@ void ConfigMACRegs2(struct et131x_adapter *pAdapter)
DBG_ENTER(et131x_dbginfo);
- ctl.value = readl(&pAdapter->CSRAddress->txmac.ctl.value);
+ ctl.value = readl(&etdev->CSRAddress->txmac.ctl.value);
cfg1.value = readl(&pMac->cfg1.value);
cfg2.value = readl(&pMac->cfg2.value);
ifctrl.value = readl(&pMac->if_ctrl.value);
- if (pAdapter->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
+ if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
cfg2.bits.if_mode = 0x2;
ifctrl.bits.phy_mode = 0x0;
} else {
@@ -210,8 +210,8 @@ void ConfigMACRegs2(struct et131x_adapter *pAdapter)
/* Set up flow control */
cfg1.bits.tx_flow = 0x1;
- if ((pAdapter->FlowControl == RxOnly) ||
- (pAdapter->FlowControl == Both)) {
+ if ((etdev->FlowControl == RxOnly) ||
+ (etdev->FlowControl == Both)) {
cfg1.bits.rx_flow = 0x1;
} else {
cfg1.bits.rx_flow = 0x0;
@@ -232,7 +232,7 @@ void ConfigMACRegs2(struct et131x_adapter *pAdapter)
*/
cfg2.bits.len_check = 0x1;
- if (pAdapter->RegistryPhyLoopbk == false) {
+ if (etdev->RegistryPhyLoopbk == false) {
cfg2.bits.pad_crc = 0x1;
cfg2.bits.crc_enable = 0x1;
} else {
@@ -241,8 +241,8 @@ void ConfigMACRegs2(struct et131x_adapter *pAdapter)
}
/* 1 - full duplex, 0 - half-duplex */
- cfg2.bits.full_duplex = pAdapter->uiDuplexMode;
- ifctrl.bits.ghd_mode = !pAdapter->uiDuplexMode;
+ cfg2.bits.full_duplex = etdev->uiDuplexMode;
+ ifctrl.bits.ghd_mode = !etdev->uiDuplexMode;
writel(ifctrl.value, &pMac->if_ctrl.value);
writel(cfg2.value, &pMac->cfg2.value);
@@ -262,19 +262,19 @@ void ConfigMACRegs2(struct et131x_adapter *pAdapter)
DBG_TRACE(et131x_dbginfo,
"Speed %d, Dup %d, CFG1 0x%08x, CFG2 0x%08x, if_ctrl 0x%08x\n",
- pAdapter->uiLinkSpeed, pAdapter->uiDuplexMode,
+ etdev->uiLinkSpeed, etdev->uiDuplexMode,
readl(&pMac->cfg1.value), readl(&pMac->cfg2.value),
readl(&pMac->if_ctrl.value));
/* Enable TXMAC */
ctl.bits.txmac_en = 0x1;
ctl.bits.fc_disable = 0x1;
- writel(ctl.value, &pAdapter->CSRAddress->txmac.ctl.value);
+ writel(ctl.value, &etdev->CSRAddress->txmac.ctl.value);
/* Ready to start the RXDMA/TXDMA engine */
- if (!MP_TEST_FLAG(pAdapter, fMP_ADAPTER_LOWER_POWER)) {
- et131x_rx_dma_enable(pAdapter);
- et131x_tx_dma_enable(pAdapter);
+ if (!MP_TEST_FLAG(etdev, fMP_ADAPTER_LOWER_POWER)) {
+ et131x_rx_dma_enable(etdev);
+ et131x_tx_dma_enable(etdev);
} else {
DBG_WARNING(et131x_dbginfo,
"Didn't enable Rx/Tx due to low-power mode\n");
@@ -283,9 +283,9 @@ void ConfigMACRegs2(struct et131x_adapter *pAdapter)
DBG_LEAVE(et131x_dbginfo);
}
-void ConfigRxMacRegs(struct et131x_adapter *pAdapter)
+void ConfigRxMacRegs(struct et131x_adapter *etdev)
{
- struct _RXMAC_t __iomem *pRxMac = &pAdapter->CSRAddress->rxmac;
+ struct _RXMAC_t __iomem *pRxMac = &etdev->CSRAddress->rxmac;
RXMAC_WOL_SA_LO_t sa_lo;
RXMAC_WOL_SA_HI_t sa_hi;
RXMAC_PF_CTRL_t pf_ctrl = { 0 };
@@ -330,22 +330,22 @@ void ConfigRxMacRegs(struct et131x_adapter *pAdapter)
writel(0, &pRxMac->mask4_word3);
/* Lets setup the WOL Source Address */
- sa_lo.bits.sa3 = pAdapter->CurrentAddress[2];
- sa_lo.bits.sa4 = pAdapter->CurrentAddress[3];
- sa_lo.bits.sa5 = pAdapter->CurrentAddress[4];
- sa_lo.bits.sa6 = pAdapter->CurrentAddress[5];
+ sa_lo.bits.sa3 = etdev->CurrentAddress[2];
+ sa_lo.bits.sa4 = etdev->CurrentAddress[3];
+ sa_lo.bits.sa5 = etdev->CurrentAddress[4];
+ sa_lo.bits.sa6 = etdev->CurrentAddress[5];
writel(sa_lo.value, &pRxMac->sa_lo.value);
- sa_hi.bits.sa1 = pAdapter->CurrentAddress[0];
- sa_hi.bits.sa2 = pAdapter->CurrentAddress[1];
+ sa_hi.bits.sa1 = etdev->CurrentAddress[0];
+ sa_hi.bits.sa2 = etdev->CurrentAddress[1];
writel(sa_hi.value, &pRxMac->sa_hi.value);
/* Disable all Packet Filtering */
writel(0, &pRxMac->pf_ctrl.value);
/* Let's initialize the Unicast Packet filtering address */
- if (pAdapter->PacketFilter & ET131X_PACKET_TYPE_DIRECTED) {
- SetupDeviceForUnicast(pAdapter);
+ if (etdev->PacketFilter & ET131X_PACKET_TYPE_DIRECTED) {
+ SetupDeviceForUnicast(etdev);
pf_ctrl.bits.filter_uni_en = 1;
} else {
writel(0, &pRxMac->uni_pf_addr1.value);
@@ -354,18 +354,18 @@ void ConfigRxMacRegs(struct et131x_adapter *pAdapter)
}
/* Let's initialize the Multicast hash */
- if (pAdapter->PacketFilter & ET131X_PACKET_TYPE_ALL_MULTICAST) {
+ if (etdev->PacketFilter & ET131X_PACKET_TYPE_ALL_MULTICAST) {
pf_ctrl.bits.filter_multi_en = 0;
} else {
pf_ctrl.bits.filter_multi_en = 1;
- SetupDeviceForMulticast(pAdapter);
+ SetupDeviceForMulticast(etdev);
}
/* Runt packet filtering. Didn't work in version A silicon. */
pf_ctrl.bits.min_pkt_size = NIC_MIN_PACKET_SIZE + 4;
pf_ctrl.bits.filter_frag_en = 1;
- if (pAdapter->RegistryJumboPacket > 8192) {
+ if (etdev->RegistryJumboPacket > 8192) {
RXMAC_MCIF_CTRL_MAX_SEG_t mcif_ctrl_max_seg;
/* In order to transmit jumbo packets greater than 8k, the
@@ -408,7 +408,7 @@ void ConfigRxMacRegs(struct et131x_adapter *pAdapter)
* bit 16: Receive frame truncated.
* bit 17: Drop packet enable
*/
- if (pAdapter->uiLinkSpeed == TRUEPHY_SPEED_100MBPS)
+ if (etdev->uiLinkSpeed == TRUEPHY_SPEED_100MBPS)
writel(0x30038, &pRxMac->mif_ctrl.value);
else
writel(0x30030, &pRxMac->mif_ctrl.value);
@@ -425,9 +425,9 @@ void ConfigRxMacRegs(struct et131x_adapter *pAdapter)
DBG_LEAVE(et131x_dbginfo);
}
-void ConfigTxMacRegs(struct et131x_adapter *pAdapter)
+void ConfigTxMacRegs(struct et131x_adapter *etdev)
{
- struct _TXMAC_t __iomem *pTxMac = &pAdapter->CSRAddress->txmac;
+ struct _TXMAC_t __iomem *pTxMac = &etdev->CSRAddress->txmac;
TXMAC_CF_PARAM_t Local;
DBG_ENTER(et131x_dbginfo);
@@ -436,7 +436,7 @@ void ConfigTxMacRegs(struct et131x_adapter *pAdapter)
* cfpt - control frame pause timer set to 64 (0x40)
* cfep - control frame extended pause timer set to 0x0
*/
- if (pAdapter->FlowControl == None) {
+ if (etdev->FlowControl == None) {
writel(0, &pTxMac->cf_param.value);
} else {
Local.bits.cfpt = 0x40;
@@ -447,10 +447,10 @@ void ConfigTxMacRegs(struct et131x_adapter *pAdapter)
DBG_LEAVE(et131x_dbginfo);
}
-void ConfigMacStatRegs(struct et131x_adapter *pAdapter)
+void ConfigMacStatRegs(struct et131x_adapter *etdev)
{
struct _MAC_STAT_t __iomem *pDevMacStat =
- &pAdapter->CSRAddress->macStat;
+ &etdev->CSRAddress->macStat;
DBG_ENTER(et131x_dbginfo);
@@ -538,50 +538,50 @@ void ConfigMacStatRegs(struct et131x_adapter *pAdapter)
DBG_LEAVE(et131x_dbginfo);
}
-void ConfigFlowControl(struct et131x_adapter *pAdapter)
+void ConfigFlowControl(struct et131x_adapter *etdev)
{
- if (pAdapter->uiDuplexMode == 0) {
- pAdapter->FlowControl = None;
+ if (etdev->uiDuplexMode == 0) {
+ etdev->FlowControl = None;
} else {
char RemotePause, RemoteAsyncPause;
- ET1310_PhyAccessMiBit(pAdapter,
+ ET1310_PhyAccessMiBit(etdev,
TRUEPHY_BIT_READ, 5, 10, &RemotePause);
- ET1310_PhyAccessMiBit(pAdapter,
+ ET1310_PhyAccessMiBit(etdev,
TRUEPHY_BIT_READ, 5, 11,
&RemoteAsyncPause);
if ((RemotePause == TRUEPHY_BIT_SET) &&
(RemoteAsyncPause == TRUEPHY_BIT_SET)) {
- pAdapter->FlowControl = pAdapter->RegistryFlowControl;
+ etdev->FlowControl = etdev->RegistryFlowControl;
} else if ((RemotePause == TRUEPHY_BIT_SET) &&
(RemoteAsyncPause == TRUEPHY_BIT_CLEAR)) {
- if (pAdapter->RegistryFlowControl == Both)
- pAdapter->FlowControl = Both;
+ if (etdev->RegistryFlowControl == Both)
+ etdev->FlowControl = Both;
else
- pAdapter->FlowControl = None;
+ etdev->FlowControl = None;
} else if ((RemotePause == TRUEPHY_BIT_CLEAR) &&
(RemoteAsyncPause == TRUEPHY_BIT_CLEAR)) {
- pAdapter->FlowControl = None;
+ etdev->FlowControl = None;
} else {/* if (RemotePause == TRUEPHY_CLEAR_BIT &&
RemoteAsyncPause == TRUEPHY_SET_BIT) */
- if (pAdapter->RegistryFlowControl == Both)
- pAdapter->FlowControl = RxOnly;
+ if (etdev->RegistryFlowControl == Both)
+ etdev->FlowControl = RxOnly;
else
- pAdapter->FlowControl = None;
+ etdev->FlowControl = None;
}
}
}
/**
* UpdateMacStatHostCounters - Update the local copy of the statistics
- * @pAdapter: pointer to the adapter structure
+ * @etdev: pointer to the adapter structure
*/
-void UpdateMacStatHostCounters(struct et131x_adapter *pAdapter)
+void UpdateMacStatHostCounters(struct et131x_adapter *etdev)
{
- struct _ce_stats_t *stats = &pAdapter->Stats;
+ struct _ce_stats_t *stats = &etdev->Stats;
struct _MAC_STAT_t __iomem *pDevMacStat =
- &pAdapter->CSRAddress->macStat;
+ &etdev->CSRAddress->macStat;
stats->collisions += readl(&pDevMacStat->TNcl);
stats->first_collision += readl(&pDevMacStat->TScl);
@@ -603,13 +603,13 @@ void UpdateMacStatHostCounters(struct et131x_adapter *pAdapter)
/**
* HandleMacStatInterrupt
- * @pAdapter: pointer to the adapter structure
+ * @etdev: pointer to the adapter structure
*
* One of the MACSTAT counters has wrapped. Update the local copy of
* the statistics held in the adapter structure, checking the "wrap"
* bit for each counter.
*/
-void HandleMacStatInterrupt(struct et131x_adapter *pAdapter)
+void HandleMacStatInterrupt(struct et131x_adapter *etdev)
{
MAC_STAT_REG_1_t Carry1;
MAC_STAT_REG_2_t Carry2;
@@ -619,11 +619,11 @@ void HandleMacStatInterrupt(struct et131x_adapter *pAdapter)
/* Read the interrupt bits from the register(s). These are Clear On
* Write.
*/
- Carry1.value = readl(&pAdapter->CSRAddress->macStat.Carry1.value);
- Carry2.value = readl(&pAdapter->CSRAddress->macStat.Carry2.value);
+ Carry1.value = readl(&etdev->CSRAddress->macStat.Carry1.value);
+ Carry2.value = readl(&etdev->CSRAddress->macStat.Carry2.value);
- writel(Carry1.value, &pAdapter->CSRAddress->macStat.Carry1.value);
- writel(Carry2.value, &pAdapter->CSRAddress->macStat.Carry2.value);
+ writel(Carry1.value, &etdev->CSRAddress->macStat.Carry1.value);
+ writel(Carry2.value, &etdev->CSRAddress->macStat.Carry2.value);
/* We need to do update the host copy of all the MAC_STAT counters.
* For each counter, check it's overflow bit. If the overflow bit is
@@ -632,40 +632,40 @@ void HandleMacStatInterrupt(struct et131x_adapter *pAdapter)
* block indicates that one of the counters has wrapped.
*/
if (Carry1.bits.rfcs)
- pAdapter->Stats.code_violations += COUNTER_WRAP_16_BIT;
+ etdev->Stats.code_violations += COUNTER_WRAP_16_BIT;
if (Carry1.bits.raln)
- pAdapter->Stats.alignment_err += COUNTER_WRAP_12_BIT;
+ etdev->Stats.alignment_err += COUNTER_WRAP_12_BIT;
if (Carry1.bits.rflr)
- pAdapter->Stats.length_err += COUNTER_WRAP_16_BIT;
+ etdev->Stats.length_err += COUNTER_WRAP_16_BIT;
if (Carry1.bits.rfrg)
- pAdapter->Stats.other_errors += COUNTER_WRAP_16_BIT;
+ etdev->Stats.other_errors += COUNTER_WRAP_16_BIT;
if (Carry1.bits.rcde)
- pAdapter->Stats.crc_err += COUNTER_WRAP_16_BIT;
+ etdev->Stats.crc_err += COUNTER_WRAP_16_BIT;
if (Carry1.bits.rovr)
- pAdapter->Stats.rx_ov_flow += COUNTER_WRAP_16_BIT;
+ etdev->Stats.rx_ov_flow += COUNTER_WRAP_16_BIT;
if (Carry1.bits.rdrp)
- pAdapter->Stats.norcvbuf += COUNTER_WRAP_16_BIT;
+ etdev->Stats.norcvbuf += COUNTER_WRAP_16_BIT;
if (Carry2.bits.tovr)
- pAdapter->Stats.max_pkt_error += COUNTER_WRAP_12_BIT;
+ etdev->Stats.max_pkt_error += COUNTER_WRAP_12_BIT;
if (Carry2.bits.tund)
- pAdapter->Stats.tx_uflo += COUNTER_WRAP_12_BIT;
+ etdev->Stats.tx_uflo += COUNTER_WRAP_12_BIT;
if (Carry2.bits.tscl)
- pAdapter->Stats.first_collision += COUNTER_WRAP_12_BIT;
+ etdev->Stats.first_collision += COUNTER_WRAP_12_BIT;
if (Carry2.bits.tdfr)
- pAdapter->Stats.tx_deferred += COUNTER_WRAP_12_BIT;
+ etdev->Stats.tx_deferred += COUNTER_WRAP_12_BIT;
if (Carry2.bits.tmcl)
- pAdapter->Stats.excessive_collisions += COUNTER_WRAP_12_BIT;
+ etdev->Stats.excessive_collisions += COUNTER_WRAP_12_BIT;
if (Carry2.bits.tlcl)
- pAdapter->Stats.late_collisions += COUNTER_WRAP_12_BIT;
+ etdev->Stats.late_collisions += COUNTER_WRAP_12_BIT;
if (Carry2.bits.tncl)
- pAdapter->Stats.collisions += COUNTER_WRAP_12_BIT;
+ etdev->Stats.collisions += COUNTER_WRAP_12_BIT;
DBG_LEAVE(et131x_dbginfo);
}
-void SetupDeviceForMulticast(struct et131x_adapter *pAdapter)
+void SetupDeviceForMulticast(struct et131x_adapter *etdev)
{
- struct _RXMAC_t __iomem *rxmac = &pAdapter->CSRAddress->rxmac;
+ struct _RXMAC_t __iomem *rxmac = &etdev->CSRAddress->rxmac;
uint32_t nIndex;
uint32_t result;
uint32_t hash1 = 0;
@@ -681,24 +681,24 @@ void SetupDeviceForMulticast(struct et131x_adapter *pAdapter)
* specified) then we should pass NO multi-cast addresses to the
* driver.
*/
- if (pAdapter->PacketFilter & ET131X_PACKET_TYPE_MULTICAST) {
+ if (etdev->PacketFilter & ET131X_PACKET_TYPE_MULTICAST) {
DBG_VERBOSE(et131x_dbginfo,
"MULTICAST flag is set, MCCount: %d\n",
- pAdapter->MCAddressCount);
+ etdev->MCAddressCount);
/* Loop through our multicast array and set up the device */
- for (nIndex = 0; nIndex < pAdapter->MCAddressCount; nIndex++) {
+ for (nIndex = 0; nIndex < etdev->MCAddressCount; nIndex++) {
DBG_VERBOSE(et131x_dbginfo,
"MCList[%d]: %02x:%02x:%02x:%02x:%02x:%02x\n",
nIndex,
- pAdapter->MCList[nIndex][0],
- pAdapter->MCList[nIndex][1],
- pAdapter->MCList[nIndex][2],
- pAdapter->MCList[nIndex][3],
- pAdapter->MCList[nIndex][4],
- pAdapter->MCList[nIndex][5]);
+ etdev->MCList[nIndex][0],
+ etdev->MCList[nIndex][1],
+ etdev->MCList[nIndex][2],
+ etdev->MCList[nIndex][3],
+ etdev->MCList[nIndex][4],
+ etdev->MCList[nIndex][5]);
- result = ether_crc(6, pAdapter->MCList[nIndex]);
+ result = ether_crc(6, etdev->MCList[nIndex]);
result = (result & 0x3F800000) >> 23;
@@ -718,7 +718,7 @@ void SetupDeviceForMulticast(struct et131x_adapter *pAdapter)
}
/* Write out the new hash to the device */
- pm_csr.value = readl(&pAdapter->CSRAddress->global.pm_csr.value);
+ pm_csr.value = readl(&etdev->CSRAddress->global.pm_csr.value);
if (pm_csr.bits.pm_phy_sw_coma == 0) {
writel(hash1, &rxmac->multi_hash1);
writel(hash2, &rxmac->multi_hash2);
@@ -729,9 +729,9 @@ void SetupDeviceForMulticast(struct et131x_adapter *pAdapter)
DBG_LEAVE(et131x_dbginfo);
}
-void SetupDeviceForUnicast(struct et131x_adapter *pAdapter)
+void SetupDeviceForUnicast(struct et131x_adapter *etdev)
{
- struct _RXMAC_t __iomem *rxmac = &pAdapter->CSRAddress->rxmac;
+ struct _RXMAC_t __iomem *rxmac = &etdev->CSRAddress->rxmac;
RXMAC_UNI_PF_ADDR1_t uni_pf1;
RXMAC_UNI_PF_ADDR2_t uni_pf2;
RXMAC_UNI_PF_ADDR3_t uni_pf3;
@@ -748,22 +748,22 @@ void SetupDeviceForUnicast(struct et131x_adapter *pAdapter)
* Set up unicast packet filter reg 3 to be the octets 2 - 5 of the
* MAC address for first address
*/
- uni_pf3.bits.addr1_1 = pAdapter->CurrentAddress[0];
- uni_pf3.bits.addr1_2 = pAdapter->CurrentAddress[1];
- uni_pf3.bits.addr2_1 = pAdapter->CurrentAddress[0];
- uni_pf3.bits.addr2_2 = pAdapter->CurrentAddress[1];
-
- uni_pf2.bits.addr2_3 = pAdapter->CurrentAddress[2];
- uni_pf2.bits.addr2_4 = pAdapter->CurrentAddress[3];
- uni_pf2.bits.addr2_5 = pAdapter->CurrentAddress[4];
- uni_pf2.bits.addr2_6 = pAdapter->CurrentAddress[5];
-
- uni_pf1.bits.addr1_3 = pAdapter->CurrentAddress[2];
- uni_pf1.bits.addr1_4 = pAdapter->CurrentAddress[3];
- uni_pf1.bits.addr1_5 = pAdapter->CurrentAddress[4];
- uni_pf1.bits.addr1_6 = pAdapter->CurrentAddress[5];
-
- pm_csr.value = readl(&pAdapter->CSRAddress->global.pm_csr.value);
+ uni_pf3.bits.addr1_1 = etdev->CurrentAddress[0];
+ uni_pf3.bits.addr1_2 = etdev->CurrentAddress[1];
+ uni_pf3.bits.addr2_1 = etdev->CurrentAddress[0];
+ uni_pf3.bits.addr2_2 = etdev->CurrentAddress[1];
+
+ uni_pf2.bits.addr2_3 = etdev->CurrentAddress[2];
+ uni_pf2.bits.addr2_4 = etdev->CurrentAddress[3];
+ uni_pf2.bits.addr2_5 = etdev->CurrentAddress[4];
+ uni_pf2.bits.addr2_6 = etdev->CurrentAddress[5];
+
+ uni_pf1.bits.addr1_3 = etdev->CurrentAddress[2];
+ uni_pf1.bits.addr1_4 = etdev->CurrentAddress[3];
+ uni_pf1.bits.addr1_5 = etdev->CurrentAddress[4];
+ uni_pf1.bits.addr1_6 = etdev->CurrentAddress[5];
+
+ pm_csr.value = readl(&etdev->CSRAddress->global.pm_csr.value);
if (pm_csr.bits.pm_phy_sw_coma == 0) {
writel(uni_pf1.value, &rxmac->uni_pf_addr1.value);
writel(uni_pf2.value, &rxmac->uni_pf_addr2.value);
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index 326d389..82fcb66 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -474,7 +474,7 @@ static int et131x_xcvr_init(struct et131x_adapter *adapter)
}
}
-void et131x_Mii_check(struct et131x_adapter *pAdapter,
+void et131x_Mii_check(struct et131x_adapter *etdev,
MI_BMSR_t bmsr, MI_BMSR_t bmsr_ints)
{
uint8_t ucLinkStatus;
@@ -490,37 +490,37 @@ void et131x_Mii_check(struct et131x_adapter *pAdapter,
if (bmsr_ints.bits.link_status) {
if (bmsr.bits.link_status) {
- pAdapter->PoMgmt.TransPhyComaModeOnBoot = 20;
+ etdev->PoMgmt.TransPhyComaModeOnBoot = 20;
/* Update our state variables and indicate the
* connected state
*/
- spin_lock_irqsave(&pAdapter->Lock, lockflags);
+ spin_lock_irqsave(&etdev->Lock, lockflags);
- pAdapter->MediaState = NETIF_STATUS_MEDIA_CONNECT;
- MP_CLEAR_FLAG(pAdapter, fMP_ADAPTER_LINK_DETECTION);
+ etdev->MediaState = NETIF_STATUS_MEDIA_CONNECT;
+ MP_CLEAR_FLAG(etdev, fMP_ADAPTER_LINK_DETECTION);
- spin_unlock_irqrestore(&pAdapter->Lock, lockflags);
+ spin_unlock_irqrestore(&etdev->Lock, lockflags);
/* Don't indicate state if we're in loopback mode */
- if (pAdapter->RegistryPhyLoopbk == false)
- netif_carrier_on(pAdapter->netdev);
+ if (etdev->RegistryPhyLoopbk == false)
+ netif_carrier_on(etdev->netdev);
} else {
DBG_WARNING(et131x_dbginfo,
"Link down cable problem\n");
- if (pAdapter->uiLinkSpeed == TRUEPHY_SPEED_10MBPS) {
+ if (etdev->uiLinkSpeed == TRUEPHY_SPEED_10MBPS) {
/* NOTE - Is there a way to query this without
* TruePHY?
- * && TRU_QueryCoreType(pAdapter->hTruePhy, 0) == EMI_TRUEPHY_A13O) {
+ * && TRU_QueryCoreType(etdev->hTruePhy, 0) == EMI_TRUEPHY_A13O) {
*/
uint16_t Register18;
- MiRead(pAdapter, 0x12, &Register18);
- MiWrite(pAdapter, 0x12, Register18 | 0x4);
- MiWrite(pAdapter, 0x10, Register18 | 0x8402);
- MiWrite(pAdapter, 0x11, Register18 | 511);
- MiWrite(pAdapter, 0x12, Register18);
+ MiRead(etdev, 0x12, &Register18);
+ MiWrite(etdev, 0x12, Register18 | 0x4);
+ MiWrite(etdev, 0x10, Register18 | 0x8402);
+ MiWrite(etdev, 0x11, Register18 | 511);
+ MiWrite(etdev, 0x12, Register18);
}
/* For the first N seconds of life, we are in "link
@@ -530,33 +530,33 @@ void et131x_Mii_check(struct et131x_adapter *pAdapter,
* in the LinkDetectionDPC).
*/
if ((MP_IS_FLAG_CLEAR
- (pAdapter, fMP_ADAPTER_LINK_DETECTION))
- || (pAdapter->MediaState ==
+ (etdev, fMP_ADAPTER_LINK_DETECTION))
+ || (etdev->MediaState ==
NETIF_STATUS_MEDIA_DISCONNECT)) {
- spin_lock_irqsave(&pAdapter->Lock, lockflags);
- pAdapter->MediaState =
+ spin_lock_irqsave(&etdev->Lock, lockflags);
+ etdev->MediaState =
NETIF_STATUS_MEDIA_DISCONNECT;
- spin_unlock_irqrestore(&pAdapter->Lock,
+ spin_unlock_irqrestore(&etdev->Lock,
lockflags);
/* Only indicate state if we're in loopback
* mode
*/
- if (pAdapter->RegistryPhyLoopbk == false)
- netif_carrier_off(pAdapter->netdev);
+ if (etdev->RegistryPhyLoopbk == false)
+ netif_carrier_off(etdev->netdev);
}
- pAdapter->uiLinkSpeed = 0;
- pAdapter->uiDuplexMode = 0;
+ etdev->uiLinkSpeed = 0;
+ etdev->uiDuplexMode = 0;
/* Free the packets being actively sent & stopped */
- et131x_free_busy_send_packets(pAdapter);
+ et131x_free_busy_send_packets(etdev);
/* Re-initialize the send structures */
- et131x_init_send(pAdapter);
+ et131x_init_send(etdev);
/* Reset the RFD list and re-start RU */
- et131x_reset_recv(pAdapter);
+ et131x_reset_recv(etdev);
/*
* Bring the device back to the state it was during
@@ -564,61 +564,61 @@ void et131x_Mii_check(struct et131x_adapter *pAdapter,
* way, when we get the auto-neg complete interrupt,
* we can complete init by calling ConfigMacREGS2.
*/
- et131x_soft_reset(pAdapter);
+ et131x_soft_reset(etdev);
/* Setup ET1310 as per the documentation */
- et131x_adapter_setup(pAdapter);
+ et131x_adapter_setup(etdev);
/* Setup the PHY into coma mode until the cable is
* plugged back in
*/
- if (pAdapter->RegistryPhyComa == 1)
- EnablePhyComa(pAdapter);
+ if (etdev->RegistryPhyComa == 1)
+ EnablePhyComa(etdev);
}
}
if (bmsr_ints.bits.auto_neg_complete ||
- (pAdapter->AiForceDpx == 3 && bmsr_ints.bits.link_status)) {
- if (bmsr.bits.auto_neg_complete || pAdapter->AiForceDpx == 3) {
- ET1310_PhyLinkStatus(pAdapter,
+ (etdev->AiForceDpx == 3 && bmsr_ints.bits.link_status)) {
+ if (bmsr.bits.auto_neg_complete || etdev->AiForceDpx == 3) {
+ ET1310_PhyLinkStatus(etdev,
&ucLinkStatus, &uiAutoNegStatus,
&uiSpeed, &uiDuplex, &uiMdiMdix,
&uiMasterSlave, &uiPolarity);
- pAdapter->uiLinkSpeed = uiSpeed;
- pAdapter->uiDuplexMode = uiDuplex;
+ etdev->uiLinkSpeed = uiSpeed;
+ etdev->uiDuplexMode = uiDuplex;
DBG_TRACE(et131x_dbginfo,
- "pAdapter->uiLinkSpeed 0x%04x, pAdapter->uiDuplex 0x%08x\n",
- pAdapter->uiLinkSpeed,
- pAdapter->uiDuplexMode);
+ "etdev->uiLinkSpeed 0x%04x, etdev->uiDuplex 0x%08x\n",
+ etdev->uiLinkSpeed,
+ etdev->uiDuplexMode);
- pAdapter->PoMgmt.TransPhyComaModeOnBoot = 20;
+ etdev->PoMgmt.TransPhyComaModeOnBoot = 20;
- if (pAdapter->uiLinkSpeed == TRUEPHY_SPEED_10MBPS) {
+ if (etdev->uiLinkSpeed == TRUEPHY_SPEED_10MBPS) {
/*
* NOTE - Is there a way to query this without
* TruePHY?
- * && TRU_QueryCoreType(pAdapter->hTruePhy, 0)== EMI_TRUEPHY_A13O) {
+ * && TRU_QueryCoreType(etdev->hTruePhy, 0)== EMI_TRUEPHY_A13O) {
*/
uint16_t Register18;
- MiRead(pAdapter, 0x12, &Register18);
- MiWrite(pAdapter, 0x12, Register18 | 0x4);
- MiWrite(pAdapter, 0x10, Register18 | 0x8402);
- MiWrite(pAdapter, 0x11, Register18 | 511);
- MiWrite(pAdapter, 0x12, Register18);
+ MiRead(etdev, 0x12, &Register18);
+ MiWrite(etdev, 0x12, Register18 | 0x4);
+ MiWrite(etdev, 0x10, Register18 | 0x8402);
+ MiWrite(etdev, 0x11, Register18 | 511);
+ MiWrite(etdev, 0x12, Register18);
}
- ConfigFlowControl(pAdapter);
+ ConfigFlowControl(etdev);
- if (pAdapter->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS &&
- pAdapter->RegistryJumboPacket > 2048)
- ET1310_PhyAndOrReg(pAdapter, 0x16, 0xcfff,
+ if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS &&
+ etdev->RegistryJumboPacket > 2048)
+ ET1310_PhyAndOrReg(etdev, 0x16, 0xcfff,
0x2000);
- SetRxDmaTimer(pAdapter);
- ConfigMACRegs2(pAdapter);
+ SetRxDmaTimer(etdev);
+ ConfigMACRegs2(etdev);
}
}
@@ -627,230 +627,230 @@ void et131x_Mii_check(struct et131x_adapter *pAdapter,
/**
* TPAL_SetPhy10HalfDuplex - Force the phy into 10 Base T Half Duplex mode.
- * @pAdapter: pointer to the adapter structure
+ * @etdev: pointer to the adapter structure
*
* Also sets the MAC so it is syncd up properly
*/
-void TPAL_SetPhy10HalfDuplex(struct et131x_adapter *pAdapter)
+void TPAL_SetPhy10HalfDuplex(struct et131x_adapter *etdev)
{
DBG_ENTER(et131x_dbginfo);
/* Power down PHY */
- ET1310_PhyPowerDown(pAdapter, 1);
+ ET1310_PhyPowerDown(etdev, 1);
/* First we need to turn off all other advertisement */
- ET1310_PhyAdvertise1000BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
- ET1310_PhyAdvertise100BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
/* Set our advertise values accordingly */
- ET1310_PhyAdvertise10BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_HALF);
+ ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_HALF);
/* Power up PHY */
- ET1310_PhyPowerDown(pAdapter, 0);
+ ET1310_PhyPowerDown(etdev, 0);
DBG_LEAVE(et131x_dbginfo);
}
/**
* TPAL_SetPhy10FullDuplex - Force the phy into 10 Base T Full Duplex mode.
- * @pAdapter: pointer to the adapter structure
+ * @etdev: pointer to the adapter structure
*
* Also sets the MAC so it is syncd up properly
*/
-void TPAL_SetPhy10FullDuplex(struct et131x_adapter *pAdapter)
+void TPAL_SetPhy10FullDuplex(struct et131x_adapter *etdev)
{
DBG_ENTER(et131x_dbginfo);
/* Power down PHY */
- ET1310_PhyPowerDown(pAdapter, 1);
+ ET1310_PhyPowerDown(etdev, 1);
/* First we need to turn off all other advertisement */
- ET1310_PhyAdvertise1000BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
- ET1310_PhyAdvertise100BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
/* Set our advertise values accordingly */
- ET1310_PhyAdvertise10BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_FULL);
+ ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL);
/* Power up PHY */
- ET1310_PhyPowerDown(pAdapter, 0);
+ ET1310_PhyPowerDown(etdev, 0);
DBG_LEAVE(et131x_dbginfo);
}
/**
* TPAL_SetPhy10Force - Force Base-T FD mode WITHOUT using autonegotiation
- * @pAdapter: pointer to the adapter structure
+ * @etdev: pointer to the adapter structure
*/
-void TPAL_SetPhy10Force(struct et131x_adapter *pAdapter)
+void TPAL_SetPhy10Force(struct et131x_adapter *etdev)
{
DBG_ENTER(et131x_dbginfo);
/* Power down PHY */
- ET1310_PhyPowerDown(pAdapter, 1);
+ ET1310_PhyPowerDown(etdev, 1);
/* Disable autoneg */
- ET1310_PhyAutoNeg(pAdapter, false);
+ ET1310_PhyAutoNeg(etdev, false);
/* Disable all advertisement */
- ET1310_PhyAdvertise1000BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
- ET1310_PhyAdvertise10BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
- ET1310_PhyAdvertise100BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
/* Force 10 Mbps */
- ET1310_PhySpeedSelect(pAdapter, TRUEPHY_SPEED_10MBPS);
+ ET1310_PhySpeedSelect(etdev, TRUEPHY_SPEED_10MBPS);
/* Force Full duplex */
- ET1310_PhyDuplexMode(pAdapter, TRUEPHY_DUPLEX_FULL);
+ ET1310_PhyDuplexMode(etdev, TRUEPHY_DUPLEX_FULL);
/* Power up PHY */
- ET1310_PhyPowerDown(pAdapter, 0);
+ ET1310_PhyPowerDown(etdev, 0);
DBG_LEAVE(et131x_dbginfo);
}
/**
* TPAL_SetPhy100HalfDuplex - Force 100 Base T Half Duplex mode.
- * @pAdapter: pointer to the adapter structure
+ * @etdev: pointer to the adapter structure
*
* Also sets the MAC so it is syncd up properly.
*/
-void TPAL_SetPhy100HalfDuplex(struct et131x_adapter *pAdapter)
+void TPAL_SetPhy100HalfDuplex(struct et131x_adapter *etdev)
{
DBG_ENTER(et131x_dbginfo);
/* Power down PHY */
- ET1310_PhyPowerDown(pAdapter, 1);
+ ET1310_PhyPowerDown(etdev, 1);
/* first we need to turn off all other advertisement */
- ET1310_PhyAdvertise1000BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
- ET1310_PhyAdvertise10BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
/* Set our advertise values accordingly */
- ET1310_PhyAdvertise100BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_HALF);
+ ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_HALF);
/* Set speed */
- ET1310_PhySpeedSelect(pAdapter, TRUEPHY_SPEED_100MBPS);
+ ET1310_PhySpeedSelect(etdev, TRUEPHY_SPEED_100MBPS);
/* Power up PHY */
- ET1310_PhyPowerDown(pAdapter, 0);
+ ET1310_PhyPowerDown(etdev, 0);
DBG_LEAVE(et131x_dbginfo);
}
/**
* TPAL_SetPhy100FullDuplex - Force 100 Base T Full Duplex mode.
- * @pAdapter: pointer to the adapter structure
+ * @etdev: pointer to the adapter structure
*
* Also sets the MAC so it is syncd up properly
*/
-void TPAL_SetPhy100FullDuplex(struct et131x_adapter *pAdapter)
+void TPAL_SetPhy100FullDuplex(struct et131x_adapter *etdev)
{
DBG_ENTER(et131x_dbginfo);
/* Power down PHY */
- ET1310_PhyPowerDown(pAdapter, 1);
+ ET1310_PhyPowerDown(etdev, 1);
/* First we need to turn off all other advertisement */
- ET1310_PhyAdvertise1000BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
- ET1310_PhyAdvertise10BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
/* Set our advertise values accordingly */
- ET1310_PhyAdvertise100BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_FULL);
+ ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL);
/* Power up PHY */
- ET1310_PhyPowerDown(pAdapter, 0);
+ ET1310_PhyPowerDown(etdev, 0);
DBG_LEAVE(et131x_dbginfo);
}
/**
* TPAL_SetPhy100Force - Force 100 BaseT FD mode WITHOUT using autonegotiation
- * @pAdapter: pointer to the adapter structure
+ * @etdev: pointer to the adapter structure
*/
-void TPAL_SetPhy100Force(struct et131x_adapter *pAdapter)
+void TPAL_SetPhy100Force(struct et131x_adapter *etdev)
{
DBG_ENTER(et131x_dbginfo);
/* Power down PHY */
- ET1310_PhyPowerDown(pAdapter, 1);
+ ET1310_PhyPowerDown(etdev, 1);
/* Disable autoneg */
- ET1310_PhyAutoNeg(pAdapter, false);
+ ET1310_PhyAutoNeg(etdev, false);
/* Disable all advertisement */
- ET1310_PhyAdvertise1000BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
- ET1310_PhyAdvertise10BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
- ET1310_PhyAdvertise100BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
/* Force 100 Mbps */
- ET1310_PhySpeedSelect(pAdapter, TRUEPHY_SPEED_100MBPS);
+ ET1310_PhySpeedSelect(etdev, TRUEPHY_SPEED_100MBPS);
/* Force Full duplex */
- ET1310_PhyDuplexMode(pAdapter, TRUEPHY_DUPLEX_FULL);
+ ET1310_PhyDuplexMode(etdev, TRUEPHY_DUPLEX_FULL);
/* Power up PHY */
- ET1310_PhyPowerDown(pAdapter, 0);
+ ET1310_PhyPowerDown(etdev, 0);
DBG_LEAVE(et131x_dbginfo);
}
/**
* TPAL_SetPhy1000FullDuplex - Force 1000 Base T Full Duplex mode
- * @pAdapter: pointer to the adapter structure
+ * @etdev: pointer to the adapter structure
*
* Also sets the MAC so it is syncd up properly.
*/
-void TPAL_SetPhy1000FullDuplex(struct et131x_adapter *pAdapter)
+void TPAL_SetPhy1000FullDuplex(struct et131x_adapter *etdev)
{
DBG_ENTER(et131x_dbginfo);
/* Power down PHY */
- ET1310_PhyPowerDown(pAdapter, 1);
+ ET1310_PhyPowerDown(etdev, 1);
/* first we need to turn off all other advertisement */
- ET1310_PhyAdvertise100BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
- ET1310_PhyAdvertise10BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
/* set our advertise values accordingly */
- ET1310_PhyAdvertise1000BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_FULL);
+ ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL);
/* power up PHY */
- ET1310_PhyPowerDown(pAdapter, 0);
+ ET1310_PhyPowerDown(etdev, 0);
DBG_LEAVE(et131x_dbginfo);
}
/**
* TPAL_SetPhyAutoNeg - Set phy to autonegotiation mode.
- * @pAdapter: pointer to the adapter structure
+ * @etdev: pointer to the adapter structure
*/
-void TPAL_SetPhyAutoNeg(struct et131x_adapter *pAdapter)
+void TPAL_SetPhyAutoNeg(struct et131x_adapter *etdev)
{
DBG_ENTER(et131x_dbginfo);
/* Power down PHY */
- ET1310_PhyPowerDown(pAdapter, 1);
+ ET1310_PhyPowerDown(etdev, 1);
/* Turn on advertisement of all capabilities */
- ET1310_PhyAdvertise10BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_BOTH);
+ ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_BOTH);
- ET1310_PhyAdvertise100BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_BOTH);
+ ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_BOTH);
- if (pAdapter->DeviceID != ET131X_PCI_DEVICE_ID_FAST)
- ET1310_PhyAdvertise1000BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_FULL);
+ if (etdev->DeviceID != ET131X_PCI_DEVICE_ID_FAST)
+ ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL);
else
- ET1310_PhyAdvertise1000BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
/* Make sure auto-neg is ON (it is disabled in FORCE modes) */
- ET1310_PhyAutoNeg(pAdapter, true);
+ ET1310_PhyAutoNeg(etdev, true);
/* Power up PHY */
- ET1310_PhyPowerDown(pAdapter, 0);
+ ET1310_PhyPowerDown(etdev, 0);
DBG_LEAVE(et131x_dbginfo);
}
@@ -903,135 +903,135 @@ static const uint16_t ConfigPhy[25][2] = {
};
/* condensed version of the phy initialization routine */
-void ET1310_PhyInit(struct et131x_adapter *pAdapter)
+void ET1310_PhyInit(struct et131x_adapter *etdev)
{
uint16_t usData, usIndex;
- if (pAdapter == NULL)
+ if (etdev == NULL)
return;
/* get the identity (again ?) */
- MiRead(pAdapter, PHY_ID_1, &usData);
- MiRead(pAdapter, PHY_ID_2, &usData);
+ MiRead(etdev, PHY_ID_1, &usData);
+ MiRead(etdev, PHY_ID_2, &usData);
/* what does this do/achieve ? */
- MiRead(pAdapter, PHY_MPHY_CONTROL_REG, &usData); /* should read 0002 */
- MiWrite(pAdapter, PHY_MPHY_CONTROL_REG, 0x0006);
+ MiRead(etdev, PHY_MPHY_CONTROL_REG, &usData); /* should read 0002 */
+ MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006);
/* read modem register 0402, should I do something with the return
data ? */
- MiWrite(pAdapter, PHY_INDEX_REG, 0x0402);
- MiRead(pAdapter, PHY_DATA_REG, &usData);
+ MiWrite(etdev, PHY_INDEX_REG, 0x0402);
+ MiRead(etdev, PHY_DATA_REG, &usData);
/* what does this do/achieve ? */
- MiWrite(pAdapter, PHY_MPHY_CONTROL_REG, 0x0002);
+ MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002);
/* get the identity (again ?) */
- MiRead(pAdapter, PHY_ID_1, &usData);
- MiRead(pAdapter, PHY_ID_2, &usData);
+ MiRead(etdev, PHY_ID_1, &usData);
+ MiRead(etdev, PHY_ID_2, &usData);
/* what does this achieve ? */
- MiRead(pAdapter, PHY_MPHY_CONTROL_REG, &usData); /* should read 0002 */
- MiWrite(pAdapter, PHY_MPHY_CONTROL_REG, 0x0006);
+ MiRead(etdev, PHY_MPHY_CONTROL_REG, &usData); /* should read 0002 */
+ MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006);
/* read modem register 0402, should I do something with
the return data? */
- MiWrite(pAdapter, PHY_INDEX_REG, 0x0402);
- MiRead(pAdapter, PHY_DATA_REG, &usData);
+ MiWrite(etdev, PHY_INDEX_REG, 0x0402);
+ MiRead(etdev, PHY_DATA_REG, &usData);
- MiWrite(pAdapter, PHY_MPHY_CONTROL_REG, 0x0002);
+ MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002);
/* what does this achieve (should return 0x1040) */
- MiRead(pAdapter, PHY_CONTROL, &usData);
- MiRead(pAdapter, PHY_MPHY_CONTROL_REG, &usData); /* should read 0002 */
- MiWrite(pAdapter, PHY_CONTROL, 0x1840);
+ MiRead(etdev, PHY_CONTROL, &usData);
+ MiRead(etdev, PHY_MPHY_CONTROL_REG, &usData); /* should read 0002 */
+ MiWrite(etdev, PHY_CONTROL, 0x1840);
- MiWrite(pAdapter, PHY_MPHY_CONTROL_REG, 0x0007);
+ MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0007);
/* here the writing of the array starts.... */
usIndex = 0;
while (ConfigPhy[usIndex][0] != 0x0000) {
/* write value */
- MiWrite(pAdapter, PHY_INDEX_REG, ConfigPhy[usIndex][0]);
- MiWrite(pAdapter, PHY_DATA_REG, ConfigPhy[usIndex][1]);
+ MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[usIndex][0]);
+ MiWrite(etdev, PHY_DATA_REG, ConfigPhy[usIndex][1]);
/* read it back */
- MiWrite(pAdapter, PHY_INDEX_REG, ConfigPhy[usIndex][0]);
- MiRead(pAdapter, PHY_DATA_REG, &usData);
+ MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[usIndex][0]);
+ MiRead(etdev, PHY_DATA_REG, &usData);
/* do a check on the value read back ? */
usIndex++;
}
/* here the writing of the array ends... */
- MiRead(pAdapter, PHY_CONTROL, &usData); /* 0x1840 */
- MiRead(pAdapter, PHY_MPHY_CONTROL_REG, &usData);/* should read 0007 */
- MiWrite(pAdapter, PHY_CONTROL, 0x1040);
- MiWrite(pAdapter, PHY_MPHY_CONTROL_REG, 0x0002);
+ MiRead(etdev, PHY_CONTROL, &usData); /* 0x1840 */
+ MiRead(etdev, PHY_MPHY_CONTROL_REG, &usData);/* should read 0007 */
+ MiWrite(etdev, PHY_CONTROL, 0x1040);
+ MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002);
}
-void ET1310_PhyReset(struct et131x_adapter *pAdapter)
+void ET1310_PhyReset(struct et131x_adapter *etdev)
{
- MiWrite(pAdapter, PHY_CONTROL, 0x8000);
+ MiWrite(etdev, PHY_CONTROL, 0x8000);
}
-void ET1310_PhyPowerDown(struct et131x_adapter *pAdapter, bool down)
+void ET1310_PhyPowerDown(struct et131x_adapter *etdev, bool down)
{
uint16_t usData;
- MiRead(pAdapter, PHY_CONTROL, &usData);
+ MiRead(etdev, PHY_CONTROL, &usData);
if (down == false) {
/* Power UP */
usData &= ~0x0800;
- MiWrite(pAdapter, PHY_CONTROL, usData);
+ MiWrite(etdev, PHY_CONTROL, usData);
} else {
/* Power DOWN */
usData |= 0x0800;
- MiWrite(pAdapter, PHY_CONTROL, usData);
+ MiWrite(etdev, PHY_CONTROL, usData);
}
}
-void ET1310_PhyAutoNeg(struct et131x_adapter *pAdapter, bool enable)
+void ET1310_PhyAutoNeg(struct et131x_adapter *etdev, bool enable)
{
uint16_t usData;
- MiRead(pAdapter, PHY_CONTROL, &usData);
+ MiRead(etdev, PHY_CONTROL, &usData);
if (enable == true) {
/* Autonegotiation ON */
usData |= 0x1000;
- MiWrite(pAdapter, PHY_CONTROL, usData);
+ MiWrite(etdev, PHY_CONTROL, usData);
} else {
/* Autonegotiation OFF */
usData &= ~0x1000;
- MiWrite(pAdapter, PHY_CONTROL, usData);
+ MiWrite(etdev, PHY_CONTROL, usData);
}
}
-void ET1310_PhyDuplexMode(struct et131x_adapter *pAdapter, uint16_t duplex)
+void ET1310_PhyDuplexMode(struct et131x_adapter *etdev, uint16_t duplex)
{
uint16_t usData;
- MiRead(pAdapter, PHY_CONTROL, &usData);
+ MiRead(etdev, PHY_CONTROL, &usData);
if (duplex == TRUEPHY_DUPLEX_FULL) {
/* Set Full Duplex */
usData |= 0x100;
- MiWrite(pAdapter, PHY_CONTROL, usData);
+ MiWrite(etdev, PHY_CONTROL, usData);
} else {
/* Set Half Duplex */
usData &= ~0x100;
- MiWrite(pAdapter, PHY_CONTROL, usData);
+ MiWrite(etdev, PHY_CONTROL, usData);
}
}
-void ET1310_PhySpeedSelect(struct et131x_adapter *pAdapter, uint16_t speed)
+void ET1310_PhySpeedSelect(struct et131x_adapter *etdev, uint16_t speed)
{
uint16_t usData;
/* Read the PHY control register */
- MiRead(pAdapter, PHY_CONTROL, &usData);
+ MiRead(etdev, PHY_CONTROL, &usData);
/* Clear all Speed settings (Bits 6, 13) */
usData &= ~0x2040;
@@ -1054,16 +1054,16 @@ void ET1310_PhySpeedSelect(struct et131x_adapter *pAdapter, uint16_t speed)
}
/* Write back the new speed */
- MiWrite(pAdapter, PHY_CONTROL, usData);
+ MiWrite(etdev, PHY_CONTROL, usData);
}
-void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *pAdapter,
+void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *etdev,
uint16_t duplex)
{
uint16_t usData;
/* Read the PHY 1000 Base-T Control Register */
- MiRead(pAdapter, PHY_1000_CONTROL, &usData);
+ MiRead(etdev, PHY_1000_CONTROL, &usData);
/* Clear Bits 8,9 */
usData &= ~0x0300;
@@ -1090,16 +1090,16 @@ void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *pAdapter,
}
/* Write back advertisement */
- MiWrite(pAdapter, PHY_1000_CONTROL, usData);
+ MiWrite(etdev, PHY_1000_CONTROL, usData);
}
-void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *pAdapter,
+void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *etdev,
uint16_t duplex)
{
uint16_t usData;
/* Read the Autonegotiation Register (10/100) */
- MiRead(pAdapter, PHY_AUTO_ADVERTISEMENT, &usData);
+ MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &usData);
/* Clear bits 7,8 */
usData &= ~0x0180;
@@ -1127,16 +1127,16 @@ void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *pAdapter,
}
/* Write back advertisement */
- MiWrite(pAdapter, PHY_AUTO_ADVERTISEMENT, usData);
+ MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, usData);
}
-void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *pAdapter,
+void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *etdev,
uint16_t duplex)
{
uint16_t usData;
/* Read the Autonegotiation Register (10/100) */
- MiRead(pAdapter, PHY_AUTO_ADVERTISEMENT, &usData);
+ MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &usData);
/* Clear bits 5,6 */
usData &= ~0x0060;
@@ -1164,10 +1164,10 @@ void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *pAdapter,
}
/* Write back advertisement */
- MiWrite(pAdapter, PHY_AUTO_ADVERTISEMENT, usData);
+ MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, usData);
}
-void ET1310_PhyLinkStatus(struct et131x_adapter *pAdapter,
+void ET1310_PhyLinkStatus(struct et131x_adapter *etdev,
uint8_t *ucLinkStatus,
uint32_t *uiAutoNeg,
uint32_t *uiLinkSpeed,
@@ -1180,10 +1180,10 @@ void ET1310_PhyLinkStatus(struct et131x_adapter *pAdapter,
uint16_t usVmiPhyStatus = 0;
uint16_t usControl = 0;
- MiRead(pAdapter, PHY_STATUS, &usMiStatus);
- MiRead(pAdapter, PHY_1000_STATUS, &us1000BaseT);
- MiRead(pAdapter, PHY_PHY_STATUS, &usVmiPhyStatus);
- MiRead(pAdapter, PHY_CONTROL, &usControl);
+ MiRead(etdev, PHY_STATUS, &usMiStatus);
+ MiRead(etdev, PHY_1000_STATUS, &us1000BaseT);
+ MiRead(etdev, PHY_PHY_STATUS, &usVmiPhyStatus);
+ MiRead(etdev, PHY_CONTROL, &usControl);
if (ucLinkStatus) {
*ucLinkStatus =
@@ -1221,13 +1221,13 @@ void ET1310_PhyLinkStatus(struct et131x_adapter *pAdapter,
}
}
-void ET1310_PhyAndOrReg(struct et131x_adapter *pAdapter,
+void ET1310_PhyAndOrReg(struct et131x_adapter *etdev,
uint16_t regnum, uint16_t andMask, uint16_t orMask)
{
uint16_t reg;
/* Read the requested register */
- MiRead(pAdapter, regnum, ®);
+ MiRead(etdev, regnum, ®);
/* Apply the AND mask */
reg &= andMask;
@@ -1236,10 +1236,10 @@ void ET1310_PhyAndOrReg(struct et131x_adapter *pAdapter,
reg |= orMask;
/* Write the value back to the register */
- MiWrite(pAdapter, regnum, reg);
+ MiWrite(etdev, regnum, reg);
}
-void ET1310_PhyAccessMiBit(struct et131x_adapter *pAdapter, uint16_t action,
+void ET1310_PhyAccessMiBit(struct et131x_adapter *etdev, uint16_t action,
uint16_t regnum, uint16_t bitnum, uint8_t *value)
{
uint16_t reg;
@@ -1249,7 +1249,7 @@ void ET1310_PhyAccessMiBit(struct et131x_adapter *pAdapter, uint16_t action,
mask = 0x0001 << bitnum;
/* Read the requested register */
- MiRead(pAdapter, regnum, ®);
+ MiRead(etdev, regnum, ®);
switch (action) {
case TRUEPHY_BIT_READ:
@@ -1259,12 +1259,12 @@ void ET1310_PhyAccessMiBit(struct et131x_adapter *pAdapter, uint16_t action,
case TRUEPHY_BIT_SET:
reg |= mask;
- MiWrite(pAdapter, regnum, reg);
+ MiWrite(etdev, regnum, reg);
break;
case TRUEPHY_BIT_CLEAR:
reg &= ~mask;
- MiWrite(pAdapter, regnum, reg);
+ MiWrite(etdev, regnum, reg);
break;
default:
diff --git a/drivers/staging/et131x/et1310_pm.c b/drivers/staging/et131x/et1310_pm.c
index 5d652ca..864d3ad 100644
--- a/drivers/staging/et131x/et1310_pm.c
+++ b/drivers/staging/et131x/et1310_pm.c
@@ -99,7 +99,7 @@ extern dbg_info_t *et131x_dbginfo;
/**
* EnablePhyComa - called when network cable is unplugged
- * @pAdapter: pointer to our adapter structure
+ * @etdev: pointer to our adapter structure
*
* driver receive an phy status change interrupt while in D0 and check that
* phy_status is down.
@@ -117,7 +117,7 @@ extern dbg_info_t *et131x_dbginfo;
* indicating linkup status, call the MPDisablePhyComa routine to
* restore JAGCore and gigE PHY
*/
-void EnablePhyComa(struct et131x_adapter *pAdapter)
+void EnablePhyComa(struct et131x_adapter *etdev)
{
unsigned long lockflags;
PM_CSR_t GlobalPmCSR;
@@ -125,81 +125,81 @@ void EnablePhyComa(struct et131x_adapter *pAdapter)
DBG_ENTER(et131x_dbginfo);
- GlobalPmCSR.value = readl(&pAdapter->CSRAddress->global.pm_csr.value);
+ GlobalPmCSR.value = readl(&etdev->CSRAddress->global.pm_csr.value);
/* Save the GbE PHY speed and duplex modes. Need to restore this
* when cable is plugged back in
*/
- pAdapter->PoMgmt.PowerDownSpeed = pAdapter->AiForceSpeed;
- pAdapter->PoMgmt.PowerDownDuplex = pAdapter->AiForceDpx;
+ etdev->PoMgmt.PowerDownSpeed = etdev->AiForceSpeed;
+ etdev->PoMgmt.PowerDownDuplex = etdev->AiForceDpx;
/* Stop sending packets. */
- spin_lock_irqsave(&pAdapter->SendHWLock, lockflags);
- MP_SET_FLAG(pAdapter, fMP_ADAPTER_LOWER_POWER);
- spin_unlock_irqrestore(&pAdapter->SendHWLock, lockflags);
+ spin_lock_irqsave(&etdev->SendHWLock, lockflags);
+ MP_SET_FLAG(etdev, fMP_ADAPTER_LOWER_POWER);
+ spin_unlock_irqrestore(&etdev->SendHWLock, lockflags);
/* Wait for outstanding Receive packets */
- while ((MP_GET_RCV_REF(pAdapter) != 0) && (LoopCounter-- > 0))
+ while ((MP_GET_RCV_REF(etdev) != 0) && (LoopCounter-- > 0))
mdelay(2);
/* Gate off JAGCore 3 clock domains */
GlobalPmCSR.bits.pm_sysclk_gate = 0;
GlobalPmCSR.bits.pm_txclk_gate = 0;
GlobalPmCSR.bits.pm_rxclk_gate = 0;
- writel(GlobalPmCSR.value, &pAdapter->CSRAddress->global.pm_csr.value);
+ writel(GlobalPmCSR.value, &etdev->CSRAddress->global.pm_csr.value);
/* Program gigE PHY in to Coma mode */
GlobalPmCSR.bits.pm_phy_sw_coma = 1;
- writel(GlobalPmCSR.value, &pAdapter->CSRAddress->global.pm_csr.value);
+ writel(GlobalPmCSR.value, &etdev->CSRAddress->global.pm_csr.value);
DBG_LEAVE(et131x_dbginfo);
}
/**
* DisablePhyComa - Disable the Phy Coma Mode
- * @pAdapter: pointer to our adapter structure
+ * @etdev: pointer to our adapter structure
*/
-void DisablePhyComa(struct et131x_adapter *pAdapter)
+void DisablePhyComa(struct et131x_adapter *etdev)
{
PM_CSR_t GlobalPmCSR;
DBG_ENTER(et131x_dbginfo);
- GlobalPmCSR.value = readl(&pAdapter->CSRAddress->global.pm_csr.value);
+ GlobalPmCSR.value = readl(&etdev->CSRAddress->global.pm_csr.value);
/* Disable phy_sw_coma register and re-enable JAGCore clocks */
GlobalPmCSR.bits.pm_sysclk_gate = 1;
GlobalPmCSR.bits.pm_txclk_gate = 1;
GlobalPmCSR.bits.pm_rxclk_gate = 1;
GlobalPmCSR.bits.pm_phy_sw_coma = 0;
- writel(GlobalPmCSR.value, &pAdapter->CSRAddress->global.pm_csr.value);
+ writel(GlobalPmCSR.value, &etdev->CSRAddress->global.pm_csr.value);
/* Restore the GbE PHY speed and duplex modes;
* Reset JAGCore; re-configure and initialize JAGCore and gigE PHY
*/
- pAdapter->AiForceSpeed = pAdapter->PoMgmt.PowerDownSpeed;
- pAdapter->AiForceDpx = pAdapter->PoMgmt.PowerDownDuplex;
+ etdev->AiForceSpeed = etdev->PoMgmt.PowerDownSpeed;
+ etdev->AiForceDpx = etdev->PoMgmt.PowerDownDuplex;
/* Re-initialize the send structures */
- et131x_init_send(pAdapter);
+ et131x_init_send(etdev);
/* Reset the RFD list and re-start RU */
- et131x_reset_recv(pAdapter);
+ et131x_reset_recv(etdev);
/* Bring the device back to the state it was during init prior to
* autonegotiation being complete. This way, when we get the auto-neg
* complete interrupt, we can complete init by calling ConfigMacREGS2.
*/
- et131x_soft_reset(pAdapter);
+ et131x_soft_reset(etdev);
/* setup et1310 as per the documentation ?? */
- et131x_adapter_setup(pAdapter);
+ et131x_adapter_setup(etdev);
/* Allow Tx to restart */
- MP_CLEAR_FLAG(pAdapter, fMP_ADAPTER_LOWER_POWER);
+ MP_CLEAR_FLAG(etdev, fMP_ADAPTER_LOWER_POWER);
/* Need to re-enable Rx. */
- et131x_rx_dma_enable(pAdapter);
+ et131x_rx_dma_enable(etdev);
DBG_LEAVE(et131x_dbginfo);
}
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index 9b9e773..f8cc6a6 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -99,7 +99,7 @@ extern dbg_info_t *et131x_dbginfo;
#endif /* CONFIG_ET131X_DEBUG */
-void nic_return_rfd(struct et131x_adapter *pAdapter, PMP_RFD pMpRfd);
+void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd);
/**
* et131x_rx_dma_memory_alloc
@@ -676,12 +676,12 @@ void et131x_rfd_resources_free(struct et131x_adapter *adapter, MP_RFD *pMpRfd)
/**
* ConfigRxDmaRegs - Start of Rx_DMA init sequence
- * @pAdapter: pointer to our adapter structure
+ * @etdev: pointer to our adapter structure
*/
-void ConfigRxDmaRegs(struct et131x_adapter *pAdapter)
+void ConfigRxDmaRegs(struct et131x_adapter *etdev)
{
- struct _RXDMA_t __iomem *pRxDma = &pAdapter->CSRAddress->rxdma;
- struct _rx_ring_t *pRxLocal = &pAdapter->RxRing;
+ struct _RXDMA_t __iomem *pRxDma = &etdev->CSRAddress->rxdma;
+ struct _rx_ring_t *pRxLocal = &etdev->RxRing;
PFBR_DESC_t pFbrEntry;
uint32_t iEntry;
RXDMA_PSR_NUM_DES_t psr_num_des;
@@ -690,7 +690,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *pAdapter)
DBG_ENTER(et131x_dbginfo);
/* Halt RXDMA to perform the reconfigure. */
- et131x_rx_dma_disable(pAdapter);
+ et131x_rx_dma_disable(etdev);
/* Load the completion writeback physical address
*
@@ -718,7 +718,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *pAdapter)
writel((psr_num_des.bits.psr_ndes * LO_MARK_PERCENT_FOR_PSR) / 100,
&pRxDma->psr_min_des.value);
- spin_lock_irqsave(&pAdapter->RcvLock, lockflags);
+ spin_lock_irqsave(&etdev->RcvLock, lockflags);
/* These local variables track the PSR in the adapter structure */
pRxLocal->local_psr_full.bits.psr_full = 0;
@@ -792,52 +792,52 @@ void ConfigRxDmaRegs(struct et131x_adapter *pAdapter)
* For version B silicon, this value gets updated once autoneg is
*complete.
*/
- writel(pAdapter->RegistryRxNumBuffers, &pRxDma->num_pkt_done.value);
+ writel(etdev->RegistryRxNumBuffers, &pRxDma->num_pkt_done.value);
/* The "time_done" is not working correctly to coalesce interrupts
* after a given time period, but rather is giving us an interrupt
* regardless of whether we have received packets.
* This value gets updated once autoneg is complete.
*/
- writel(pAdapter->RegistryRxTimeInterval, &pRxDma->max_pkt_time.value);
+ writel(etdev->RegistryRxTimeInterval, &pRxDma->max_pkt_time.value);
- spin_unlock_irqrestore(&pAdapter->RcvLock, lockflags);
+ spin_unlock_irqrestore(&etdev->RcvLock, lockflags);
DBG_LEAVE(et131x_dbginfo);
}
/**
* SetRxDmaTimer - Set the heartbeat timer according to line rate.
- * @pAdapter: pointer to our adapter structure
+ * @etdev: pointer to our adapter structure
*/
-void SetRxDmaTimer(struct et131x_adapter *pAdapter)
+void SetRxDmaTimer(struct et131x_adapter *etdev)
{
/* For version B silicon, we do not use the RxDMA timer for 10 and 100
* Mbits/s line rates. We do not enable and RxDMA interrupt coalescing.
*/
- if ((pAdapter->uiLinkSpeed == TRUEPHY_SPEED_100MBPS) ||
- (pAdapter->uiLinkSpeed == TRUEPHY_SPEED_10MBPS)) {
- writel(0, &pAdapter->CSRAddress->rxdma.max_pkt_time.value);
- writel(1, &pAdapter->CSRAddress->rxdma.num_pkt_done.value);
+ if ((etdev->uiLinkSpeed == TRUEPHY_SPEED_100MBPS) ||
+ (etdev->uiLinkSpeed == TRUEPHY_SPEED_10MBPS)) {
+ writel(0, &etdev->CSRAddress->rxdma.max_pkt_time.value);
+ writel(1, &etdev->CSRAddress->rxdma.num_pkt_done.value);
}
}
/**
* et131x_rx_dma_disable - Stop of Rx_DMA on the ET1310
- * @pAdapter: pointer to our adapter structure
+ * @etdev: pointer to our adapter structure
*/
-void et131x_rx_dma_disable(struct et131x_adapter *pAdapter)
+void et131x_rx_dma_disable(struct et131x_adapter *etdev)
{
RXDMA_CSR_t csr;
DBG_ENTER(et131x_dbginfo);
/* Setup the receive dma configuration register */
- writel(0x00002001, &pAdapter->CSRAddress->rxdma.csr.value);
- csr.value = readl(&pAdapter->CSRAddress->rxdma.csr.value);
+ writel(0x00002001, &etdev->CSRAddress->rxdma.csr.value);
+ csr.value = readl(&etdev->CSRAddress->rxdma.csr.value);
if (csr.bits.halt_status != 1) {
udelay(5);
- csr.value = readl(&pAdapter->CSRAddress->rxdma.csr.value);
+ csr.value = readl(&etdev->CSRAddress->rxdma.csr.value);
if (csr.bits.halt_status != 1)
DBG_ERROR(et131x_dbginfo,
"RX Dma failed to enter halt state. CSR 0x%08x\n",
@@ -849,41 +849,41 @@ void et131x_rx_dma_disable(struct et131x_adapter *pAdapter)
/**
* et131x_rx_dma_enable - re-start of Rx_DMA on the ET1310.
- * @pAdapter: pointer to our adapter structure
+ * @etdev: pointer to our adapter structure
*/
-void et131x_rx_dma_enable(struct et131x_adapter *pAdapter)
+void et131x_rx_dma_enable(struct et131x_adapter *etdev)
{
DBG_RX_ENTER(et131x_dbginfo);
- if (pAdapter->RegistryPhyLoopbk)
+ if (etdev->RegistryPhyLoopbk)
/* RxDMA is disabled for loopback operation. */
- writel(0x1, &pAdapter->CSRAddress->rxdma.csr.value);
+ writel(0x1, &etdev->CSRAddress->rxdma.csr.value);
else {
/* Setup the receive dma configuration register for normal operation */
RXDMA_CSR_t csr = { 0 };
csr.bits.fbr1_enable = 1;
- if (pAdapter->RxRing.Fbr1BufferSize == 4096)
+ if (etdev->RxRing.Fbr1BufferSize == 4096)
csr.bits.fbr1_size = 1;
- else if (pAdapter->RxRing.Fbr1BufferSize == 8192)
+ else if (etdev->RxRing.Fbr1BufferSize == 8192)
csr.bits.fbr1_size = 2;
- else if (pAdapter->RxRing.Fbr1BufferSize == 16384)
+ else if (etdev->RxRing.Fbr1BufferSize == 16384)
csr.bits.fbr1_size = 3;
#ifdef USE_FBR0
csr.bits.fbr0_enable = 1;
- if (pAdapter->RxRing.Fbr0BufferSize == 256)
+ if (etdev->RxRing.Fbr0BufferSize == 256)
csr.bits.fbr0_size = 1;
- else if (pAdapter->RxRing.Fbr0BufferSize == 512)
+ else if (etdev->RxRing.Fbr0BufferSize == 512)
csr.bits.fbr0_size = 2;
- else if (pAdapter->RxRing.Fbr0BufferSize == 1024)
+ else if (etdev->RxRing.Fbr0BufferSize == 1024)
csr.bits.fbr0_size = 3;
#endif
- writel(csr.value, &pAdapter->CSRAddress->rxdma.csr.value);
+ writel(csr.value, &etdev->CSRAddress->rxdma.csr.value);
- csr.value = readl(&pAdapter->CSRAddress->rxdma.csr.value);
+ csr.value = readl(&etdev->CSRAddress->rxdma.csr.value);
if (csr.bits.halt_status != 0) {
udelay(5);
- csr.value = readl(&pAdapter->CSRAddress->rxdma.csr.value);
+ csr.value = readl(&etdev->CSRAddress->rxdma.csr.value);
if (csr.bits.halt_status != 0) {
DBG_ERROR(et131x_dbginfo,
"RX Dma failed to exit halt state. CSR 0x%08x\n",
@@ -897,7 +897,7 @@ void et131x_rx_dma_enable(struct et131x_adapter *pAdapter)
/**
* nic_rx_pkts - Checks the hardware for available packets
- * @pAdapter: pointer to our adapter
+ * @etdev: pointer to our adapter
*
* Returns pMpRfd, a pointer to our MPRFD.
*
@@ -906,9 +906,9 @@ void et131x_rx_dma_enable(struct et131x_adapter *pAdapter)
* the packet to it, puts the RFD in the RecvPendList, and also returns
* the pointer to the RFD.
*/
-PMP_RFD nic_rx_pkts(struct et131x_adapter *pAdapter)
+PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev)
{
- struct _rx_ring_t *pRxLocal = &pAdapter->RxRing;
+ struct _rx_ring_t *pRxLocal = &etdev->RxRing;
PRX_STATUS_BLOCK_t pRxStatusBlock;
PPKT_STAT_DESC_t pPSREntry;
PMP_RFD pMpRfd;
@@ -978,7 +978,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *pAdapter)
}
writel(pRxLocal->local_psr_full.value,
- &pAdapter->CSRAddress->rxdma.psr_full_offset.value);
+ &etdev->CSRAddress->rxdma.psr_full_offset.value);
#ifndef USE_FBR0
if (ringIndex != 1) {
@@ -1013,7 +1013,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *pAdapter)
}
/* Get and fill the RFD. */
- spin_lock_irqsave(&pAdapter->RcvLock, lockflags);
+ spin_lock_irqsave(&etdev->RcvLock, lockflags);
pMpRfd = NULL;
element = pRxLocal->RecvList.next;
@@ -1023,14 +1023,14 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *pAdapter)
DBG_RX(et131x_dbginfo,
"NULL RFD returned from RecvList via list_entry()\n");
DBG_RX_LEAVE(et131x_dbginfo);
- spin_unlock_irqrestore(&pAdapter->RcvLock, lockflags);
+ spin_unlock_irqrestore(&etdev->RcvLock, lockflags);
return NULL;
}
list_del(&pMpRfd->list_node);
pRxLocal->nReadyRecv--;
- spin_unlock_irqrestore(&pAdapter->RcvLock, lockflags);
+ spin_unlock_irqrestore(&etdev->RcvLock, lockflags);
pMpRfd->iBufferIndex = bufferIndex;
pMpRfd->iRingIndex = ringIndex;
@@ -1041,19 +1041,19 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *pAdapter)
* also counted here.
*/
if (localLen < (NIC_MIN_PACKET_SIZE + 4)) {
- pAdapter->Stats.other_errors++;
+ etdev->Stats.other_errors++;
localLen = 0;
}
if (localLen) {
- if (pAdapter->ReplicaPhyLoopbk == 1) {
+ if (etdev->ReplicaPhyLoopbk == 1) {
pBufVa = pRxLocal->Fbr[ringIndex]->Va[bufferIndex];
- if (memcmp(&pBufVa[6], &pAdapter->CurrentAddress[0],
+ if (memcmp(&pBufVa[6], &etdev->CurrentAddress[0],
ETH_ALEN) == 0) {
if (memcmp(&pBufVa[42], "Replica packet",
ETH_HLEN)) {
- pAdapter->ReplicaPhyLoopbkPF = 1;
+ etdev->ReplicaPhyLoopbkPF = 1;
}
}
DBG_WARNING(et131x_dbginfo,
@@ -1063,12 +1063,12 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *pAdapter)
DBG_WARNING(et131x_dbginfo,
"CurrentAddr:\t%02x:%02x:%02x:%02x:%02x:%02x\n",
- pAdapter->CurrentAddress[0],
- pAdapter->CurrentAddress[1],
- pAdapter->CurrentAddress[2],
- pAdapter->CurrentAddress[3],
- pAdapter->CurrentAddress[4],
- pAdapter->CurrentAddress[5]);
+ etdev->CurrentAddress[0],
+ etdev->CurrentAddress[1],
+ etdev->CurrentAddress[2],
+ etdev->CurrentAddress[3],
+ etdev->CurrentAddress[4],
+ etdev->CurrentAddress[5]);
}
/* Determine if this is a multicast packet coming in */
@@ -1081,9 +1081,9 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *pAdapter)
* filters. Generally filter is 0x2b when in
* promiscuous mode.
*/
- if ((pAdapter->PacketFilter & ET131X_PACKET_TYPE_MULTICAST)
- && !(pAdapter->PacketFilter & ET131X_PACKET_TYPE_PROMISCUOUS)
- && !(pAdapter->PacketFilter & ET131X_PACKET_TYPE_ALL_MULTICAST)) {
+ if ((etdev->PacketFilter & ET131X_PACKET_TYPE_MULTICAST)
+ && !(etdev->PacketFilter & ET131X_PACKET_TYPE_PROMISCUOUS)
+ && !(etdev->PacketFilter & ET131X_PACKET_TYPE_ALL_MULTICAST)) {
pBufVa = pRxLocal->Fbr[ringIndex]->
Va[bufferIndex];
@@ -1092,20 +1092,20 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *pAdapter)
* matches one in our list.
*/
for (nIndex = 0;
- nIndex < pAdapter->MCAddressCount;
+ nIndex < etdev->MCAddressCount;
nIndex++) {
if (pBufVa[0] ==
- pAdapter->MCList[nIndex][0]
+ etdev->MCList[nIndex][0]
&& pBufVa[1] ==
- pAdapter->MCList[nIndex][1]
+ etdev->MCList[nIndex][1]
&& pBufVa[2] ==
- pAdapter->MCList[nIndex][2]
+ etdev->MCList[nIndex][2]
&& pBufVa[3] ==
- pAdapter->MCList[nIndex][3]
+ etdev->MCList[nIndex][3]
&& pBufVa[4] ==
- pAdapter->MCList[nIndex][4]
+ etdev->MCList[nIndex][4]
&& pBufVa[5] ==
- pAdapter->MCList[nIndex][5]) {
+ etdev->MCList[nIndex][5]) {
break;
}
}
@@ -1118,21 +1118,21 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *pAdapter)
* so we free our RFD when we return
* from this function.
*/
- if (nIndex == pAdapter->MCAddressCount)
+ if (nIndex == etdev->MCAddressCount)
localLen = 0;
}
if (localLen > 0)
- pAdapter->Stats.multircv++;
+ etdev->Stats.multircv++;
} else if (Word0.value & ALCATEL_BROADCAST_PKT)
- pAdapter->Stats.brdcstrcv++;
+ etdev->Stats.brdcstrcv++;
else
/* Not sure what this counter measures in
* promiscuous mode. Perhaps we should check
* the MAC address to see if it is directed
* to us in promiscuous mode.
*/
- pAdapter->Stats.unircv++;
+ etdev->Stats.unircv++;
}
if (localLen > 0) {
@@ -1149,14 +1149,14 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *pAdapter)
return NULL;
}
- pAdapter->net_stats.rx_bytes += pMpRfd->PacketSize;
+ etdev->net_stats.rx_bytes += pMpRfd->PacketSize;
memcpy(skb_put(skb, pMpRfd->PacketSize),
pRxLocal->Fbr[ringIndex]->Va[bufferIndex],
pMpRfd->PacketSize);
- skb->dev = pAdapter->netdev;
- skb->protocol = eth_type_trans(skb, pAdapter->netdev);
+ skb->dev = etdev->netdev;
+ skb->protocol = eth_type_trans(skb, etdev->netdev);
skb->ip_summed = CHECKSUM_NONE;
netif_rx(skb);
@@ -1164,7 +1164,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *pAdapter)
pMpRfd->PacketSize = 0;
}
- nic_return_rfd(pAdapter, pMpRfd);
+ nic_return_rfd(etdev, pMpRfd);
DBG_RX(et131x_dbginfo, "(1)\n");
DBG_RX_LEAVE(et131x_dbginfo);
@@ -1173,28 +1173,28 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *pAdapter)
/**
* et131x_reset_recv - Reset the receive list
- * @pAdapter: pointer to our adapter
+ * @etdev: pointer to our adapter
*
* Assumption, Rcv spinlock has been acquired.
*/
-void et131x_reset_recv(struct et131x_adapter *pAdapter)
+void et131x_reset_recv(struct et131x_adapter *etdev)
{
PMP_RFD pMpRfd;
struct list_head *element;
DBG_ENTER(et131x_dbginfo);
- DBG_ASSERT(!list_empty(&pAdapter->RxRing.RecvList));
+ DBG_ASSERT(!list_empty(&etdev->RxRing.RecvList));
/* Take all the RFD's from the pending list, and stick them on the
* RecvList.
*/
- while (!list_empty(&pAdapter->RxRing.RecvPendingList)) {
- element = pAdapter->RxRing.RecvPendingList.next;
+ while (!list_empty(&etdev->RxRing.RecvPendingList)) {
+ element = etdev->RxRing.RecvPendingList.next;
pMpRfd = (PMP_RFD) list_entry(element, MP_RFD, list_node);
- list_move_tail(&pMpRfd->list_node, &pAdapter->RxRing.RecvList);
+ list_move_tail(&pMpRfd->list_node, &etdev->RxRing.RecvList);
}
DBG_LEAVE(et131x_dbginfo);
@@ -1202,11 +1202,11 @@ void et131x_reset_recv(struct et131x_adapter *pAdapter)
/**
* et131x_handle_recv_interrupt - Interrupt handler for receive processing
- * @pAdapter: pointer to our adapter
+ * @etdev: pointer to our adapter
*
* Assumption, Rcv spinlock has been acquired.
*/
-void et131x_handle_recv_interrupt(struct et131x_adapter *pAdapter)
+void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
{
PMP_RFD pMpRfd = NULL;
struct sk_buff *PacketArray[NUM_PACKETS_HANDLED];
@@ -1222,14 +1222,14 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *pAdapter)
/* Process up to available RFD's */
while (PacketArrayCount < PacketsToHandle) {
- if (list_empty(&pAdapter->RxRing.RecvList)) {
- DBG_ASSERT(pAdapter->RxRing.nReadyRecv == 0);
+ if (list_empty(&etdev->RxRing.RecvList)) {
+ DBG_ASSERT(etdev->RxRing.nReadyRecv == 0);
DBG_ERROR(et131x_dbginfo, "NO RFD's !!!!!!!!!!!!!\n");
TempUnfinishedRec = true;
break;
}
- pMpRfd = nic_rx_pkts(pAdapter);
+ pMpRfd = nic_rx_pkts(etdev);
if (pMpRfd == NULL)
break;
@@ -1240,18 +1240,18 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *pAdapter)
* If length is zero, return the RFD in order to advance the
* Free buffer ring.
*/
- if ((!pAdapter->PacketFilter) ||
- (pAdapter->PoMgmt.PowerState != NdisDeviceStateD0) ||
- (!MP_LINK_DETECTED(pAdapter)) ||
+ if ((!etdev->PacketFilter) ||
+ (etdev->PoMgmt.PowerState != NdisDeviceStateD0) ||
+ (!MP_LINK_DETECTED(etdev)) ||
(pMpRfd->PacketSize == 0)) {
continue;
}
/* Increment the number of packets we received */
- pAdapter->Stats.ipackets++;
+ etdev->Stats.ipackets++;
/* Set the status on the packet, either resources or success */
- if (pAdapter->RxRing.nReadyRecv >= RFD_LOW_WATER_MARK) {
+ if (etdev->RxRing.nReadyRecv >= RFD_LOW_WATER_MARK) {
/* Put this RFD on the pending list
*
* NOTE: nic_rx_pkts() above is already returning the
@@ -1260,13 +1260,13 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *pAdapter)
* Besides, we don't really need (at this point) the
* pending list anyway.
*/
- /* spin_lock_irqsave( &pAdapter->RcvPendLock, lockflags );
- * list_add_tail( &pMpRfd->list_node, &pAdapter->RxRing.RecvPendingList );
- * spin_unlock_irqrestore( &pAdapter->RcvPendLock, lockflags );
+ /* spin_lock_irqsave( &etdev->RcvPendLock, lockflags );
+ * list_add_tail( &pMpRfd->list_node, &etdev->RxRing.RecvPendingList );
+ * spin_unlock_irqrestore( &etdev->RcvPendLock, lockflags );
*/
/* Update the number of outstanding Recvs */
- /* MP_INC_RCV_REF( pAdapter ); */
+ /* MP_INC_RCV_REF( etdev ); */
} else {
RFDFreeArray[PacketFreeCount] = pMpRfd;
PacketFreeCount++;
@@ -1280,12 +1280,12 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *pAdapter)
}
if ((PacketArrayCount == NUM_PACKETS_HANDLED) || TempUnfinishedRec) {
- pAdapter->RxRing.UnfinishedReceives = true;
- writel(pAdapter->RegistryTxTimeInterval * NANO_IN_A_MICRO,
- &pAdapter->CSRAddress->global.watchdog_timer);
+ etdev->RxRing.UnfinishedReceives = true;
+ writel(etdev->RegistryTxTimeInterval * NANO_IN_A_MICRO,
+ &etdev->CSRAddress->global.watchdog_timer);
} else {
/* Watchdog timer will disable itself if appropriate. */
- pAdapter->RxRing.UnfinishedReceives = false;
+ etdev->RxRing.UnfinishedReceives = false;
}
DBG_RX_LEAVE(et131x_dbginfo);
@@ -1293,13 +1293,13 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *pAdapter)
/**
* NICReturnRFD - Recycle a RFD and put it back onto the receive list
- * @pAdapter: pointer to our adapter
+ * @etdev: pointer to our adapter
* @pMpRfd: pointer to the RFD
*/
-void nic_return_rfd(struct et131x_adapter *pAdapter, PMP_RFD pMpRfd)
+void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd)
{
- struct _rx_ring_t *pRxLocal = &pAdapter->RxRing;
- struct _RXDMA_t __iomem *pRxDma = &pAdapter->CSRAddress->rxdma;
+ struct _rx_ring_t *pRxLocal = &etdev->RxRing;
+ struct _RXDMA_t __iomem *pRxDma = &etdev->CSRAddress->rxdma;
uint16_t bi = pMpRfd->iBufferIndex;
uint8_t ri = pMpRfd->iRingIndex;
unsigned long lockflags;
@@ -1314,7 +1314,7 @@ void nic_return_rfd(struct et131x_adapter *pAdapter, PMP_RFD pMpRfd)
(ri == 0 && bi < pRxLocal->Fbr0NumEntries) ||
#endif
(ri == 1 && bi < pRxLocal->Fbr1NumEntries)) {
- spin_lock_irqsave(&pAdapter->FbrLock, lockflags);
+ spin_lock_irqsave(&etdev->FbrLock, lockflags);
if (ri == 1) {
PFBR_DESC_t pNextDesc =
@@ -1362,7 +1362,7 @@ void nic_return_rfd(struct et131x_adapter *pAdapter, PMP_RFD pMpRfd)
&pRxDma->fbr0_full_offset.value);
}
#endif
- spin_unlock_irqrestore(&pAdapter->FbrLock, lockflags);
+ spin_unlock_irqrestore(&etdev->FbrLock, lockflags);
} else {
DBG_ERROR(et131x_dbginfo,
"NICReturnRFD illegal Buffer Index returned\n");
@@ -1371,10 +1371,10 @@ void nic_return_rfd(struct et131x_adapter *pAdapter, PMP_RFD pMpRfd)
/* The processing on this RFD is done, so put it back on the tail of
* our list
*/
- spin_lock_irqsave(&pAdapter->RcvLock, lockflags);
+ spin_lock_irqsave(&etdev->RcvLock, lockflags);
list_add_tail(&pMpRfd->list_node, &pRxLocal->RecvList);
pRxLocal->nReadyRecv++;
- spin_unlock_irqrestore(&pAdapter->RcvLock, lockflags);
+ spin_unlock_irqrestore(&etdev->RcvLock, lockflags);
DBG_ASSERT(pRxLocal->nReadyRecv <= pRxLocal->NumRfd);
DBG_RX_LEAVE(et131x_dbginfo);
diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c
index b4e7726..db0f538 100644
--- a/drivers/staging/et131x/et1310_tx.c
+++ b/drivers/staging/et131x/et1310_tx.c
@@ -99,13 +99,13 @@
extern dbg_info_t *et131x_dbginfo;
#endif /* CONFIG_ET131X_DEBUG */
-static void et131x_update_tcb_list(struct et131x_adapter *pAdapter);
-static void et131x_check_send_wait_list(struct et131x_adapter *pAdapter);
-static inline void et131x_free_send_packet(struct et131x_adapter *pAdapter,
+static void et131x_update_tcb_list(struct et131x_adapter *etdev);
+static void et131x_check_send_wait_list(struct et131x_adapter *etdev);
+static inline void et131x_free_send_packet(struct et131x_adapter *etdev,
PMP_TCB pMpTcb);
static int et131x_send_packet(struct sk_buff *skb,
- struct et131x_adapter *pAdapter);
-static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb);
+ struct et131x_adapter *etdev);
+static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb);
/**
* et131x_tx_dma_memory_alloc
@@ -247,16 +247,16 @@ void et131x_tx_dma_memory_free(struct et131x_adapter *adapter)
* ConfigTxDmaRegs - Set up the tx dma section of the JAGCore.
* @adapter: pointer to our private adapter structure
*/
-void ConfigTxDmaRegs(struct et131x_adapter *pAdapter)
+void ConfigTxDmaRegs(struct et131x_adapter *etdev)
{
- struct _TXDMA_t __iomem *pTxDma = &pAdapter->CSRAddress->txdma;
+ struct _TXDMA_t __iomem *pTxDma = &etdev->CSRAddress->txdma;
DBG_ENTER(et131x_dbginfo);
/* Load the hardware with the start of the transmit descriptor ring. */
- writel((uint32_t) (pAdapter->TxRing.pTxDescRingAdjustedPa >> 32),
+ writel((uint32_t) (etdev->TxRing.pTxDescRingAdjustedPa >> 32),
&pTxDma->pr_base_hi);
- writel((uint32_t) pAdapter->TxRing.pTxDescRingAdjustedPa,
+ writel((uint32_t) etdev->TxRing.pTxDescRingAdjustedPa,
&pTxDma->pr_base_lo);
/* Initialise the transmit DMA engine */
@@ -270,43 +270,43 @@ void ConfigTxDmaRegs(struct et131x_adapter *pAdapter)
* storing the adjusted address.
*/
writel(0, &pTxDma->dma_wb_base_hi);
- writel(pAdapter->TxRing.pTxStatusPa, &pTxDma->dma_wb_base_lo);
+ writel(etdev->TxRing.pTxStatusPa, &pTxDma->dma_wb_base_lo);
- memset(pAdapter->TxRing.pTxStatusVa, 0, sizeof(TX_STATUS_BLOCK_t));
+ memset(etdev->TxRing.pTxStatusVa, 0, sizeof(TX_STATUS_BLOCK_t));
writel(0, &pTxDma->service_request.value);
- pAdapter->TxRing.txDmaReadyToSend.value = 0;
+ etdev->TxRing.txDmaReadyToSend.value = 0;
DBG_LEAVE(et131x_dbginfo);
}
/**
* et131x_tx_dma_disable - Stop of Tx_DMA on the ET1310
- * @pAdapter: pointer to our adapter structure
+ * @etdev: pointer to our adapter structure
*/
-void et131x_tx_dma_disable(struct et131x_adapter *pAdapter)
+void et131x_tx_dma_disable(struct et131x_adapter *etdev)
{
DBG_ENTER(et131x_dbginfo);
/* Setup the tramsmit dma configuration register */
- writel(0x101, &pAdapter->CSRAddress->txdma.csr.value);
+ writel(0x101, &etdev->CSRAddress->txdma.csr.value);
DBG_LEAVE(et131x_dbginfo);
}
/**
* et131x_tx_dma_enable - re-start of Tx_DMA on the ET1310.
- * @pAdapter: pointer to our adapter structure
+ * @etdev: pointer to our adapter structure
*
* Mainly used after a return to the D0 (full-power) state from a lower state.
*/
-void et131x_tx_dma_enable(struct et131x_adapter *pAdapter)
+void et131x_tx_dma_enable(struct et131x_adapter *etdev)
{
DBG_ENTER(et131x_dbginfo);
- if (pAdapter->RegistryPhyLoopbk) {
+ if (etdev->RegistryPhyLoopbk) {
/* TxDMA is disabled for loopback operation. */
- writel(0x101, &pAdapter->CSRAddress->txdma.csr.value);
+ writel(0x101, &etdev->CSRAddress->txdma.csr.value);
} else {
TXDMA_CSR_t csr = { 0 };
@@ -315,8 +315,8 @@ void et131x_tx_dma_enable(struct et131x_adapter *pAdapter)
*/
csr.bits.sngl_epkt_mode = 1;
csr.bits.halt = 0;
- csr.bits.cache_thrshld = pAdapter->RegistryDMACache;
- writel(csr.value, &pAdapter->CSRAddress->txdma.csr.value);
+ csr.bits.cache_thrshld = etdev->RegistryDMACache;
+ writel(csr.value, &etdev->CSRAddress->txdma.csr.value);
}
DBG_LEAVE(et131x_dbginfo);
@@ -377,11 +377,11 @@ void et131x_init_send(struct et131x_adapter *adapter)
int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev)
{
int status = 0;
- struct et131x_adapter *pAdapter = NULL;
+ struct et131x_adapter *etdev = NULL;
DBG_TX_ENTER(et131x_dbginfo);
- pAdapter = netdev_priv(netdev);
+ etdev = netdev_priv(netdev);
/* Send these packets
*
@@ -390,8 +390,8 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev)
*/
/* Queue is not empty or TCB is not available */
- if (!list_empty(&pAdapter->TxRing.SendWaitQueue) ||
- MP_TCB_RESOURCES_NOT_AVAILABLE(pAdapter)) {
+ if (!list_empty(&etdev->TxRing.SendWaitQueue) ||
+ MP_TCB_RESOURCES_NOT_AVAILABLE(etdev)) {
/* NOTE: If there's an error on send, no need to queue the
* packet under Linux; if we just send an error up to the
* netif layer, it will resend the skb to us.
@@ -403,10 +403,10 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev)
* netif layer think we're good and drop the packet
*/
/*
- * if( MP_SHOULD_FAIL_SEND( pAdapter ) ||
- * pAdapter->DriverNoPhyAccess )
+ * if( MP_SHOULD_FAIL_SEND( etdev ) ||
+ * etdev->DriverNoPhyAccess )
*/
- if (MP_SHOULD_FAIL_SEND(pAdapter) || pAdapter->DriverNoPhyAccess
+ if (MP_SHOULD_FAIL_SEND(etdev) || etdev->DriverNoPhyAccess
|| !netif_carrier_ok(netdev)) {
DBG_VERBOSE(et131x_dbginfo,
"Can't Tx, Link is DOWN; drop the packet\n");
@@ -414,9 +414,9 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev)
dev_kfree_skb_any(skb);
skb = NULL;
- pAdapter->net_stats.tx_dropped++;
+ etdev->net_stats.tx_dropped++;
} else {
- status = et131x_send_packet(skb, pAdapter);
+ status = et131x_send_packet(skb, etdev);
if (status == -ENOMEM) {
@@ -437,7 +437,7 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev)
dev_kfree_skb_any(skb);
skb = NULL;
- pAdapter->net_stats.tx_dropped++;
+ etdev->net_stats.tx_dropped++;
}
}
}
@@ -449,14 +449,14 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev)
/**
* et131x_send_packet - Do the work to send a packet
* @skb: the packet(s) to send
- * @pAdapter: a pointer to the device's private adapter structure
+ * @etdev: a pointer to the device's private adapter structure
*
* Return 0 in almost all cases; non-zero value in extreme hard failure only.
*
* Assumption: Send spinlock has been acquired
*/
static int et131x_send_packet(struct sk_buff *skb,
- struct et131x_adapter *pAdapter)
+ struct et131x_adapter *etdev)
{
int status = 0;
PMP_TCB pMpTcb = NULL;
@@ -482,24 +482,24 @@ static int et131x_send_packet(struct sk_buff *skb,
}
/* Get a TCB for this packet */
- spin_lock_irqsave(&pAdapter->TCBReadyQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBReadyQLock, lockflags);
- pMpTcb = pAdapter->TxRing.TCBReadyQueueHead;
+ pMpTcb = etdev->TxRing.TCBReadyQueueHead;
if (pMpTcb == NULL) {
- spin_unlock_irqrestore(&pAdapter->TCBReadyQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBReadyQLock, lockflags);
DBG_WARNING(et131x_dbginfo, "Can't obtain a TCB\n");
DBG_TX_LEAVE(et131x_dbginfo);
return -ENOMEM;
}
- pAdapter->TxRing.TCBReadyQueueHead = pMpTcb->Next;
+ etdev->TxRing.TCBReadyQueueHead = pMpTcb->Next;
- if (pAdapter->TxRing.TCBReadyQueueHead == NULL)
- pAdapter->TxRing.TCBReadyQueueTail = NULL;
+ if (etdev->TxRing.TCBReadyQueueHead == NULL)
+ etdev->TxRing.TCBReadyQueueTail = NULL;
- spin_unlock_irqrestore(&pAdapter->TCBReadyQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBReadyQLock, lockflags);
pMpTcb->PacketLength = skb->len;
pMpTcb->Packet = skb;
@@ -519,27 +519,27 @@ static int et131x_send_packet(struct sk_buff *skb,
/* Call the NIC specific send handler. */
if (status == 0)
- status = nic_send_packet(pAdapter, pMpTcb);
+ status = nic_send_packet(etdev, pMpTcb);
if (status != 0) {
- spin_lock_irqsave(&pAdapter->TCBReadyQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBReadyQLock, lockflags);
- if (pAdapter->TxRing.TCBReadyQueueTail) {
- pAdapter->TxRing.TCBReadyQueueTail->Next = pMpTcb;
+ if (etdev->TxRing.TCBReadyQueueTail) {
+ etdev->TxRing.TCBReadyQueueTail->Next = pMpTcb;
} else {
/* Apparently ready Q is empty. */
- pAdapter->TxRing.TCBReadyQueueHead = pMpTcb;
+ etdev->TxRing.TCBReadyQueueHead = pMpTcb;
}
- pAdapter->TxRing.TCBReadyQueueTail = pMpTcb;
+ etdev->TxRing.TCBReadyQueueTail = pMpTcb;
- spin_unlock_irqrestore(&pAdapter->TCBReadyQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBReadyQLock, lockflags);
DBG_TX_LEAVE(et131x_dbginfo);
return status;
}
- DBG_ASSERT(pAdapter->TxRing.nBusySend <= NUM_TCB);
+ DBG_ASSERT(etdev->TxRing.nBusySend <= NUM_TCB);
DBG_TX_LEAVE(et131x_dbginfo);
return 0;
@@ -547,12 +547,12 @@ static int et131x_send_packet(struct sk_buff *skb,
/**
* nic_send_packet - NIC specific send handler for version B silicon.
- * @pAdapter: pointer to our adapter
+ * @etdev: pointer to our adapter
* @pMpTcb: pointer to MP_TCB
*
* Returns 0 or errno.
*/
-static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
+static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
{
uint32_t loopIndex;
TX_DESC_ENTRY_t CurDesc[24];
@@ -600,7 +600,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
"filling desc entry %d, "
"TCB: 0x%p\n",
(pPacket->len - pPacket->data_len),
- pAdapter->TxRing.txDmaReadyToSend.bits.
+ etdev->TxRing.txDmaReadyToSend.bits.
val, pMpTcb);
CurDesc[FragmentNumber].DataBufferPtrHigh = 0;
@@ -618,7 +618,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
* subsystem)
*/
CurDesc[FragmentNumber++].DataBufferPtrLow =
- pci_map_single(pAdapter->pdev,
+ pci_map_single(etdev->pdev,
pPacket->data,
pPacket->len -
pPacket->data_len,
@@ -629,7 +629,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
"filling desc entry %d, "
"TCB: 0x%p\n",
(pPacket->len - pPacket->data_len),
- pAdapter->TxRing.txDmaReadyToSend.bits.
+ etdev->TxRing.txDmaReadyToSend.bits.
val, pMpTcb);
CurDesc[FragmentNumber].DataBufferPtrHigh = 0;
@@ -647,7 +647,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
* subsystem)
*/
CurDesc[FragmentNumber++].DataBufferPtrLow =
- pci_map_single(pAdapter->pdev,
+ pci_map_single(etdev->pdev,
pPacket->data,
((pPacket->len -
pPacket->data_len) / 2),
@@ -667,7 +667,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
* subsystem)
*/
CurDesc[FragmentNumber++].DataBufferPtrLow =
- pci_map_single(pAdapter->pdev,
+ pci_map_single(etdev->pdev,
pPacket->data +
((pPacket->len -
pPacket->data_len) / 2),
@@ -681,7 +681,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
"filling desc entry %d\n"
"TCB: 0x%p\n",
pFragList[loopIndex].size,
- pAdapter->TxRing.txDmaReadyToSend.bits.val,
+ etdev->TxRing.txDmaReadyToSend.bits.val,
pMpTcb);
CurDesc[FragmentNumber].DataBufferPtrHigh = 0;
@@ -696,7 +696,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
* addressable (as defined by the pci/dma subsystem)
*/
CurDesc[FragmentNumber++].DataBufferPtrLow =
- pci_map_page(pAdapter->pdev,
+ pci_map_page(etdev->pdev,
pFragList[loopIndex - 1].page,
pFragList[loopIndex - 1].page_offset,
pFragList[loopIndex - 1].size,
@@ -709,11 +709,11 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
return -EIO;
}
- if (pAdapter->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
- if (++pAdapter->TxRing.TxPacketsSinceLastinterrupt ==
- pAdapter->RegistryTxNumBuffers) {
+ if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
+ if (++etdev->TxRing.TxPacketsSinceLastinterrupt ==
+ etdev->RegistryTxNumBuffers) {
CurDesc[FragmentNumber - 1].word3.value = 0x5;
- pAdapter->TxRing.TxPacketsSinceLastinterrupt = 0;
+ etdev->TxRing.TxPacketsSinceLastinterrupt = 0;
} else {
CurDesc[FragmentNumber - 1].word3.value = 0x1;
}
@@ -723,13 +723,13 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
CurDesc[0].word3.bits.f = 1;
- pMpTcb->WrIndexStart = pAdapter->TxRing.txDmaReadyToSend;
+ pMpTcb->WrIndexStart = etdev->TxRing.txDmaReadyToSend;
pMpTcb->PacketStaleCount = 0;
- spin_lock_irqsave(&pAdapter->SendHWLock, lockflags1);
+ spin_lock_irqsave(&etdev->SendHWLock, lockflags1);
iThisCopy =
- NUM_DESC_PER_RING_TX - pAdapter->TxRing.txDmaReadyToSend.bits.val;
+ NUM_DESC_PER_RING_TX - etdev->TxRing.txDmaReadyToSend.bits.val;
if (iThisCopy >= FragmentNumber) {
iRemainder = 0;
@@ -738,67 +738,67 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
iRemainder = FragmentNumber - iThisCopy;
}
- memcpy(pAdapter->TxRing.pTxDescRingVa +
- pAdapter->TxRing.txDmaReadyToSend.bits.val, CurDesc,
+ memcpy(etdev->TxRing.pTxDescRingVa +
+ etdev->TxRing.txDmaReadyToSend.bits.val, CurDesc,
sizeof(TX_DESC_ENTRY_t) * iThisCopy);
- pAdapter->TxRing.txDmaReadyToSend.bits.val += iThisCopy;
+ etdev->TxRing.txDmaReadyToSend.bits.val += iThisCopy;
- if ((pAdapter->TxRing.txDmaReadyToSend.bits.val == 0) ||
- (pAdapter->TxRing.txDmaReadyToSend.bits.val ==
+ if ((etdev->TxRing.txDmaReadyToSend.bits.val == 0) ||
+ (etdev->TxRing.txDmaReadyToSend.bits.val ==
NUM_DESC_PER_RING_TX)) {
- if (pAdapter->TxRing.txDmaReadyToSend.bits.wrap)
- pAdapter->TxRing.txDmaReadyToSend.value = 0;
+ if (etdev->TxRing.txDmaReadyToSend.bits.wrap)
+ etdev->TxRing.txDmaReadyToSend.value = 0;
else
- pAdapter->TxRing.txDmaReadyToSend.value = 0x400;
+ etdev->TxRing.txDmaReadyToSend.value = 0x400;
}
if (iRemainder) {
- memcpy(pAdapter->TxRing.pTxDescRingVa,
+ memcpy(etdev->TxRing.pTxDescRingVa,
CurDesc + iThisCopy,
sizeof(TX_DESC_ENTRY_t) * iRemainder);
- pAdapter->TxRing.txDmaReadyToSend.bits.val += iRemainder;
+ etdev->TxRing.txDmaReadyToSend.bits.val += iRemainder;
}
- if (pAdapter->TxRing.txDmaReadyToSend.bits.val == 0) {
- if (pAdapter->TxRing.txDmaReadyToSend.value)
+ if (etdev->TxRing.txDmaReadyToSend.bits.val == 0) {
+ if (etdev->TxRing.txDmaReadyToSend.value)
pMpTcb->WrIndex.value = NUM_DESC_PER_RING_TX - 1;
else
pMpTcb->WrIndex.value =
0x400 | (NUM_DESC_PER_RING_TX - 1);
} else
pMpTcb->WrIndex.value =
- pAdapter->TxRing.txDmaReadyToSend.value - 1;
+ etdev->TxRing.txDmaReadyToSend.value - 1;
- spin_lock_irqsave(&pAdapter->TCBSendQLock, lockflags2);
+ spin_lock_irqsave(&etdev->TCBSendQLock, lockflags2);
- if (pAdapter->TxRing.CurrSendTail)
- pAdapter->TxRing.CurrSendTail->Next = pMpTcb;
+ if (etdev->TxRing.CurrSendTail)
+ etdev->TxRing.CurrSendTail->Next = pMpTcb;
else
- pAdapter->TxRing.CurrSendHead = pMpTcb;
+ etdev->TxRing.CurrSendHead = pMpTcb;
- pAdapter->TxRing.CurrSendTail = pMpTcb;
+ etdev->TxRing.CurrSendTail = pMpTcb;
DBG_ASSERT(pMpTcb->Next == NULL);
- pAdapter->TxRing.nBusySend++;
+ etdev->TxRing.nBusySend++;
- spin_unlock_irqrestore(&pAdapter->TCBSendQLock, lockflags2);
+ spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags2);
/* Write the new write pointer back to the device. */
- writel(pAdapter->TxRing.txDmaReadyToSend.value,
- &pAdapter->CSRAddress->txdma.service_request.value);
+ writel(etdev->TxRing.txDmaReadyToSend.value,
+ &etdev->CSRAddress->txdma.service_request.value);
/* For Gig only, we use Tx Interrupt coalescing. Enable the software
* timer to wake us up if this packet isn't followed by N more.
*/
- if (pAdapter->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
- writel(pAdapter->RegistryTxTimeInterval * NANO_IN_A_MICRO,
- &pAdapter->CSRAddress->global.watchdog_timer);
+ if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
+ writel(etdev->RegistryTxTimeInterval * NANO_IN_A_MICRO,
+ &etdev->CSRAddress->global.watchdog_timer);
}
- spin_unlock_irqrestore(&pAdapter->SendHWLock, lockflags1);
+ spin_unlock_irqrestore(&etdev->SendHWLock, lockflags1);
DBG_TX_LEAVE(et131x_dbginfo);
return 0;
@@ -812,7 +812,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
/**
* NICSendPacket - NIC specific send handler.
- * @pAdapter: pointer to our adapter
+ * @etdev: pointer to our adapter
* @pMpTcb: pointer to MP_TCB
*
* Returns 0 on succes, errno on failure.
@@ -820,7 +820,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
* This version of the send routine is designed for version A silicon.
* Assumption - Send spinlock has been acquired.
*/
-static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
+static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
{
uint32_t loopIndex, fragIndex, loopEnd;
uint32_t iSplitFirstElement = 0;
@@ -837,7 +837,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
DBG_TX_ENTER(et131x_dbginfo);
ServiceComplete.value =
- readl(&pAdapter->CSRAddress->txdma.NewServiceComplete.value);
+ readl(&etdev->CSRAddress->txdma.NewServiceComplete.value);
/*
* Attempt to fix TWO hardware bugs:
@@ -856,7 +856,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
DBG_TX(et131x_dbginfo,
"pMpTcb->PacketLength: %d\n", pMpTcb->PacketLength);
- if ((pAdapter->uiDuplexMode == 0)
+ if ((etdev->uiDuplexMode == 0)
&& (pMpTcb->PacketLength < NIC_MIN_PACKET_SIZE)) {
DBG_TX(et131x_dbginfo,
"HALF DUPLEX mode AND len < MIN_PKT_SIZE\n");
@@ -875,28 +875,28 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
SegmentSize = (pPacket->len - pPacket->data_len) / 2;
}
- spin_lock_irqsave(&pAdapter->SendHWLock, lockflags1);
+ spin_lock_irqsave(&etdev->SendHWLock, lockflags1);
- if (pAdapter->TxRing.txDmaReadyToSend.bits.serv_req_wrap ==
+ if (etdev->TxRing.txDmaReadyToSend.bits.serv_req_wrap ==
ServiceComplete.bits.serv_cpl_wrap) {
/* The ring hasn't wrapped. Slots available should be
* (RING_SIZE) - the difference between the two pointers.
*/
SlotsAvailable = NUM_DESC_PER_RING_TX -
- (pAdapter->TxRing.txDmaReadyToSend.bits.serv_req -
+ (etdev->TxRing.txDmaReadyToSend.bits.serv_req -
ServiceComplete.bits.serv_cpl);
} else {
/* The ring has wrapped. Slots available should be the
* difference between the two pointers.
*/
SlotsAvailable = ServiceComplete.bits.serv_cpl -
- pAdapter->TxRing.txDmaReadyToSend.bits.serv_req;
+ etdev->TxRing.txDmaReadyToSend.bits.serv_req;
}
if ((FragListCount + iSplitFirstElement) > SlotsAvailable) {
DBG_WARNING(et131x_dbginfo,
"Not Enough Space in Tx Desc Ring\n");
- spin_unlock_irqrestore(&pAdapter->SendHWLock, lockflags1);
+ spin_unlock_irqrestore(&etdev->SendHWLock, lockflags1);
return -ENOMEM;
}
@@ -926,7 +926,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
"Packet Length %d,"
"filling desc entry %d\n",
pPacket->len,
- pAdapter->TxRing.txDmaReadyToSend.bits.serv_req);
+ etdev->TxRing.txDmaReadyToSend.bits.serv_req);
/*
* NOTE - Should we do a paranoia check here to make sure the fragment
@@ -962,7 +962,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
length_in_bytes =
SegmentSize;
CurDesc.DataBufferPtrLow =
- pci_map_single(pAdapter->
+ pci_map_single(etdev->
pdev,
pPacket->
data,
@@ -990,7 +990,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
pPacket->data_len) -
SegmentSize);
CurDesc.DataBufferPtrLow =
- pci_map_single(pAdapter->
+ pci_map_single(etdev->
pdev,
(pPacket->
data +
@@ -1014,7 +1014,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
pPacket->len - pPacket->data_len;
CurDesc.DataBufferPtrLow =
- pci_map_single(pAdapter->pdev,
+ pci_map_single(etdev->pdev,
pPacket->data,
(pPacket->len -
pPacket->data_len),
@@ -1028,7 +1028,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
CurDesc.word2.bits.length_in_bytes =
pFragList[fragIndex - 1].size;
CurDesc.DataBufferPtrLow =
- pci_map_page(pAdapter->pdev,
+ pci_map_page(etdev->pdev,
pFragList[fragIndex - 1].page,
pFragList[fragIndex -
1].page_offset,
@@ -1050,23 +1050,23 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
CurDesc.word3.bits.f = 1;
pMpTcb->WrIndexStart =
- pAdapter->TxRing.txDmaReadyToSend;
+ etdev->TxRing.txDmaReadyToSend;
}
if ((loopIndex == (loopEnd - 1)) &&
- (pAdapter->uiDuplexMode ||
+ (etdev->uiDuplexMode ||
(pMpTcb->PacketLength >= NIC_MIN_PACKET_SIZE))) {
/* This is the Last descriptor of the packet */
DBG_TX(et131x_dbginfo,
"THIS is our LAST descriptor\n");
- if (pAdapter->uiLinkSpeed ==
+ if (etdev->uiLinkSpeed ==
TRUEPHY_SPEED_1000MBPS) {
- if (++pAdapter->TxRing.
+ if (++etdev->TxRing.
TxPacketsSinceLastinterrupt >=
- pAdapter->RegistryTxNumBuffers) {
+ etdev->RegistryTxNumBuffers) {
CurDesc.word3.value = 0x5;
- pAdapter->TxRing.
+ etdev->TxRing.
TxPacketsSinceLastinterrupt
= 0;
} else {
@@ -1080,7 +1080,7 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
* of packet
*/
pMpTcb->WrIndex =
- pAdapter->TxRing.txDmaReadyToSend;
+ etdev->TxRing.txDmaReadyToSend;
pMpTcb->PacketStaleCount = 0;
}
@@ -1088,13 +1088,13 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
* descriptor ring at the next free entry. Advance
* the "next free entry" variable
*/
- memcpy(pAdapter->TxRing.pTxDescRingVa +
- pAdapter->TxRing.txDmaReadyToSend.bits.serv_req,
+ memcpy(etdev->TxRing.pTxDescRingVa +
+ etdev->TxRing.txDmaReadyToSend.bits.serv_req,
&CurDesc, sizeof(TX_DESC_ENTRY_t));
CurDescPostCopy =
- pAdapter->TxRing.pTxDescRingVa +
- pAdapter->TxRing.txDmaReadyToSend.bits.serv_req;
+ etdev->TxRing.pTxDescRingVa +
+ etdev->TxRing.txDmaReadyToSend.bits.serv_req;
DBG_TX(et131x_dbginfo,
"CURRENT DESCRIPTOR\n"
@@ -1109,32 +1109,32 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
CurDescPostCopy->word2.value,
CurDescPostCopy->word3.value);
- if (++pAdapter->TxRing.txDmaReadyToSend.bits.serv_req >=
+ if (++etdev->TxRing.txDmaReadyToSend.bits.serv_req >=
NUM_DESC_PER_RING_TX) {
- if (pAdapter->TxRing.txDmaReadyToSend.bits.
+ if (etdev->TxRing.txDmaReadyToSend.bits.
serv_req_wrap) {
- pAdapter->TxRing.txDmaReadyToSend.
+ etdev->TxRing.txDmaReadyToSend.
value = 0;
} else {
- pAdapter->TxRing.txDmaReadyToSend.
+ etdev->TxRing.txDmaReadyToSend.
value = 0x400;
}
}
}
}
- if (pAdapter->uiDuplexMode == 0 &&
+ if (etdev->uiDuplexMode == 0 &&
pMpTcb->PacketLength < NIC_MIN_PACKET_SIZE) {
/* NOTE - Same 32/64-bit issue as above... */
CurDesc.DataBufferPtrHigh = 0x0;
- CurDesc.DataBufferPtrLow = pAdapter->TxRing.pTxDummyBlkPa;
+ CurDesc.DataBufferPtrLow = etdev->TxRing.pTxDummyBlkPa;
CurDesc.word2.value = 0;
- if (pAdapter->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
- if (++pAdapter->TxRing.TxPacketsSinceLastinterrupt >=
- pAdapter->RegistryTxNumBuffers) {
+ if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
+ if (++etdev->TxRing.TxPacketsSinceLastinterrupt >=
+ etdev->RegistryTxNumBuffers) {
CurDesc.word3.value = 0x5;
- pAdapter->TxRing.TxPacketsSinceLastinterrupt =
+ etdev->TxRing.TxPacketsSinceLastinterrupt =
0;
} else {
CurDesc.word3.value = 0x1;
@@ -1146,15 +1146,15 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
CurDesc.word2.bits.length_in_bytes =
NIC_MIN_PACKET_SIZE - pMpTcb->PacketLength;
- pMpTcb->WrIndex = pAdapter->TxRing.txDmaReadyToSend;
+ pMpTcb->WrIndex = etdev->TxRing.txDmaReadyToSend;
- memcpy(pAdapter->TxRing.pTxDescRingVa +
- pAdapter->TxRing.txDmaReadyToSend.bits.serv_req,
+ memcpy(etdev->TxRing.pTxDescRingVa +
+ etdev->TxRing.txDmaReadyToSend.bits.serv_req,
&CurDesc, sizeof(TX_DESC_ENTRY_t));
CurDescPostCopy =
- pAdapter->TxRing.pTxDescRingVa +
- pAdapter->TxRing.txDmaReadyToSend.bits.serv_req;
+ etdev->TxRing.pTxDescRingVa +
+ etdev->TxRing.txDmaReadyToSend.bits.serv_req;
DBG_TX(et131x_dbginfo,
"CURRENT DESCRIPTOR\n"
@@ -1169,54 +1169,54 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
CurDescPostCopy->word2.value,
CurDescPostCopy->word3.value);
- if (++pAdapter->TxRing.txDmaReadyToSend.bits.serv_req >=
+ if (++etdev->TxRing.txDmaReadyToSend.bits.serv_req >=
NUM_DESC_PER_RING_TX) {
- if (pAdapter->TxRing.txDmaReadyToSend.bits.
+ if (etdev->TxRing.txDmaReadyToSend.bits.
serv_req_wrap) {
- pAdapter->TxRing.txDmaReadyToSend.value = 0;
+ etdev->TxRing.txDmaReadyToSend.value = 0;
} else {
- pAdapter->TxRing.txDmaReadyToSend.value = 0x400;
+ etdev->TxRing.txDmaReadyToSend.value = 0x400;
}
}
DBG_TX(et131x_dbginfo, "Padding descriptor %d by %d bytes\n",
- /* pAdapter->TxRing.txDmaReadyToSend.value, */
- pAdapter->TxRing.txDmaReadyToSend.bits.serv_req,
+ /* etdev->TxRing.txDmaReadyToSend.value, */
+ etdev->TxRing.txDmaReadyToSend.bits.serv_req,
NIC_MIN_PACKET_SIZE - pMpTcb->PacketLength);
}
- spin_lock_irqsave(&pAdapter->TCBSendQLock, lockflags2);
+ spin_lock_irqsave(&etdev->TCBSendQLock, lockflags2);
- if (pAdapter->TxRing.CurrSendTail)
- pAdapter->TxRing.CurrSendTail->Next = pMpTcb;
+ if (etdev->TxRing.CurrSendTail)
+ etdev->TxRing.CurrSendTail->Next = pMpTcb;
else
- pAdapter->TxRing.CurrSendHead = pMpTcb;
+ etdev->TxRing.CurrSendHead = pMpTcb;
- pAdapter->TxRing.CurrSendTail = pMpTcb;
+ etdev->TxRing.CurrSendTail = pMpTcb;
DBG_ASSERT(pMpTcb->Next == NULL);
- pAdapter->TxRing.nBusySend++;
+ etdev->TxRing.nBusySend++;
- spin_unlock_irqrestore(&pAdapter->TCBSendQLock, lockflags2);
+ spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags2);
/* Write the new write pointer back to the device. */
- writel(pAdapter->TxRing.txDmaReadyToSend.value,
- &pAdapter->CSRAddress->txdma.service_request.value);
+ writel(etdev->TxRing.txDmaReadyToSend.value,
+ &etdev->CSRAddress->txdma.service_request.value);
#ifdef CONFIG_ET131X_DEBUG
- DumpDeviceBlock(DBG_TX_ON, pAdapter, 1);
+ DumpDeviceBlock(DBG_TX_ON, etdev, 1);
#endif
/* For Gig only, we use Tx Interrupt coalescing. Enable the software
* timer to wake us up if this packet isn't followed by N more.
*/
- if (pAdapter->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
- writel(pAdapter->RegistryTxTimeInterval * NANO_IN_A_MICRO,
- &pAdapter->CSRAddress->global.watchdog_timer);
+ if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
+ writel(etdev->RegistryTxTimeInterval * NANO_IN_A_MICRO,
+ &etdev->CSRAddress->global.watchdog_timer);
}
- spin_unlock_irqrestore(&pAdapter->SendHWLock, lockflags1);
+ spin_unlock_irqrestore(&etdev->SendHWLock, lockflags1);
DBG_TX_LEAVE(et131x_dbginfo);
return 0;
@@ -1226,24 +1226,24 @@ static int nic_send_packet(struct et131x_adapter *pAdapter, PMP_TCB pMpTcb)
/**
* et131x_free_send_packet - Recycle a MP_TCB, complete the packet if necessary
- * @pAdapter: pointer to our adapter
+ * @etdev: pointer to our adapter
* @pMpTcb: pointer to MP_TCB
*
* Assumption - Send spinlock has been acquired
*/
-inline void et131x_free_send_packet(struct et131x_adapter *pAdapter,
+inline void et131x_free_send_packet(struct et131x_adapter *etdev,
PMP_TCB pMpTcb)
{
unsigned long lockflags;
TX_DESC_ENTRY_t *desc = NULL;
- struct net_device_stats *stats = &pAdapter->net_stats;
+ struct net_device_stats *stats = &etdev->net_stats;
if (MP_TEST_FLAG(pMpTcb, fMP_DEST_BROAD))
- atomic_inc(&pAdapter->Stats.brdcstxmt);
+ atomic_inc(&etdev->Stats.brdcstxmt);
else if (MP_TEST_FLAG(pMpTcb, fMP_DEST_MULTI))
- atomic_inc(&pAdapter->Stats.multixmt);
+ atomic_inc(&etdev->Stats.multixmt);
else
- atomic_inc(&pAdapter->Stats.unixmt);
+ atomic_inc(&etdev->Stats.unixmt);
if (pMpTcb->Packet) {
stats->tx_bytes += pMpTcb->Packet->len;
@@ -1271,7 +1271,7 @@ inline void et131x_free_send_packet(struct et131x_adapter *pAdapter,
do {
desc =
- (TX_DESC_ENTRY_t *) (pAdapter->TxRing.
+ (TX_DESC_ENTRY_t *) (etdev->TxRing.
pTxDescRingVa +
pMpTcb->WrIndexStart.bits.val);
@@ -1288,7 +1288,7 @@ inline void et131x_free_send_packet(struct et131x_adapter *pAdapter,
desc->word2.value,
desc->word3.value);
- pci_unmap_single(pAdapter->pdev,
+ pci_unmap_single(etdev->pdev,
desc->DataBufferPtrLow,
desc->word2.value, PCI_DMA_TODEVICE);
@@ -1299,7 +1299,7 @@ inline void et131x_free_send_packet(struct et131x_adapter *pAdapter,
else
pMpTcb->WrIndexStart.value = 0x400;
}
- } while (desc != (pAdapter->TxRing.pTxDescRingVa +
+ } while (desc != (etdev->TxRing.pTxDescRingVa +
pMpTcb->WrIndex.bits.val));
DBG_TX(et131x_dbginfo,
@@ -1311,31 +1311,31 @@ inline void et131x_free_send_packet(struct et131x_adapter *pAdapter,
memset(pMpTcb, 0, sizeof(MP_TCB));
/* Add the TCB to the Ready Q */
- spin_lock_irqsave(&pAdapter->TCBReadyQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBReadyQLock, lockflags);
- pAdapter->Stats.opackets++;
+ etdev->Stats.opackets++;
- if (pAdapter->TxRing.TCBReadyQueueTail) {
- pAdapter->TxRing.TCBReadyQueueTail->Next = pMpTcb;
+ if (etdev->TxRing.TCBReadyQueueTail) {
+ etdev->TxRing.TCBReadyQueueTail->Next = pMpTcb;
} else {
/* Apparently ready Q is empty. */
- pAdapter->TxRing.TCBReadyQueueHead = pMpTcb;
+ etdev->TxRing.TCBReadyQueueHead = pMpTcb;
}
- pAdapter->TxRing.TCBReadyQueueTail = pMpTcb;
+ etdev->TxRing.TCBReadyQueueTail = pMpTcb;
- spin_unlock_irqrestore(&pAdapter->TCBReadyQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBReadyQLock, lockflags);
- DBG_ASSERT(pAdapter->TxRing.nBusySend >= 0);
+ DBG_ASSERT(etdev->TxRing.nBusySend >= 0);
}
/**
* et131x_free_busy_send_packets - Free and complete the stopped active sends
- * @pAdapter: pointer to our adapter
+ * @etdev: pointer to our adapter
*
* Assumption - Send spinlock has been acquired
*/
-void et131x_free_busy_send_packets(struct et131x_adapter *pAdapter)
+void et131x_free_busy_send_packets(struct et131x_adapter *etdev)
{
PMP_TCB pMpTcb;
struct list_head *pEntry;
@@ -1344,42 +1344,42 @@ void et131x_free_busy_send_packets(struct et131x_adapter *pAdapter)
DBG_ENTER(et131x_dbginfo);
- while (!list_empty(&pAdapter->TxRing.SendWaitQueue)) {
- spin_lock_irqsave(&pAdapter->SendWaitLock, lockflags);
+ while (!list_empty(&etdev->TxRing.SendWaitQueue)) {
+ spin_lock_irqsave(&etdev->SendWaitLock, lockflags);
- pAdapter->TxRing.nWaitSend--;
- spin_unlock_irqrestore(&pAdapter->SendWaitLock, lockflags);
+ etdev->TxRing.nWaitSend--;
+ spin_unlock_irqrestore(&etdev->SendWaitLock, lockflags);
- pEntry = pAdapter->TxRing.SendWaitQueue.next;
+ pEntry = etdev->TxRing.SendWaitQueue.next;
}
- pAdapter->TxRing.nWaitSend = 0;
+ etdev->TxRing.nWaitSend = 0;
/* Any packets being sent? Check the first TCB on the send list */
- spin_lock_irqsave(&pAdapter->TCBSendQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBSendQLock, lockflags);
- pMpTcb = pAdapter->TxRing.CurrSendHead;
+ pMpTcb = etdev->TxRing.CurrSendHead;
while ((pMpTcb != NULL) && (FreeCounter < NUM_TCB)) {
PMP_TCB pNext = pMpTcb->Next;
- pAdapter->TxRing.CurrSendHead = pNext;
+ etdev->TxRing.CurrSendHead = pNext;
if (pNext == NULL)
- pAdapter->TxRing.CurrSendTail = NULL;
+ etdev->TxRing.CurrSendTail = NULL;
- pAdapter->TxRing.nBusySend--;
+ etdev->TxRing.nBusySend--;
- spin_unlock_irqrestore(&pAdapter->TCBSendQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags);
DBG_VERBOSE(et131x_dbginfo, "pMpTcb = 0x%p\n", pMpTcb);
FreeCounter++;
- MP_FREE_SEND_PACKET_FUN(pAdapter, pMpTcb);
+ MP_FREE_SEND_PACKET_FUN(etdev, pMpTcb);
- spin_lock_irqsave(&pAdapter->TCBSendQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBSendQLock, lockflags);
- pMpTcb = pAdapter->TxRing.CurrSendHead;
+ pMpTcb = etdev->TxRing.CurrSendHead;
}
if (FreeCounter == NUM_TCB) {
@@ -1388,125 +1388,125 @@ void et131x_free_busy_send_packets(struct et131x_adapter *pAdapter)
BUG();
}
- spin_unlock_irqrestore(&pAdapter->TCBSendQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags);
- pAdapter->TxRing.nBusySend = 0;
+ etdev->TxRing.nBusySend = 0;
DBG_LEAVE(et131x_dbginfo);
}
/**
* et131x_handle_send_interrupt - Interrupt handler for sending processing
- * @pAdapter: pointer to our adapter
+ * @etdev: pointer to our adapter
*
* Re-claim the send resources, complete sends and get more to send from
* the send wait queue.
*
* Assumption - Send spinlock has been acquired
*/
-void et131x_handle_send_interrupt(struct et131x_adapter *pAdapter)
+void et131x_handle_send_interrupt(struct et131x_adapter *etdev)
{
DBG_TX_ENTER(et131x_dbginfo);
/* Mark as completed any packets which have been sent by the device. */
- et131x_update_tcb_list(pAdapter);
+ et131x_update_tcb_list(etdev);
/* If we queued any transmits because we didn't have any TCBs earlier,
* dequeue and send those packets now, as long as we have free TCBs.
*/
- et131x_check_send_wait_list(pAdapter);
+ et131x_check_send_wait_list(etdev);
DBG_TX_LEAVE(et131x_dbginfo);
}
/**
* et131x_update_tcb_list - Helper routine for Send Interrupt handler
- * @pAdapter: pointer to our adapter
+ * @etdev: pointer to our adapter
*
* Re-claims the send resources and completes sends. Can also be called as
* part of the NIC send routine when the "ServiceComplete" indication has
* wrapped.
*/
-static void et131x_update_tcb_list(struct et131x_adapter *pAdapter)
+static void et131x_update_tcb_list(struct et131x_adapter *etdev)
{
unsigned long lockflags;
DMA10W_t ServiceComplete;
PMP_TCB pMpTcb;
ServiceComplete.value =
- readl(&pAdapter->CSRAddress->txdma.NewServiceComplete.value);
+ readl(&etdev->CSRAddress->txdma.NewServiceComplete.value);
/* Has the ring wrapped? Process any descriptors that do not have
* the same "wrap" indicator as the current completion indicator
*/
- spin_lock_irqsave(&pAdapter->TCBSendQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBSendQLock, lockflags);
- pMpTcb = pAdapter->TxRing.CurrSendHead;
+ pMpTcb = etdev->TxRing.CurrSendHead;
while (pMpTcb &&
ServiceComplete.bits.wrap != pMpTcb->WrIndex.bits.wrap &&
ServiceComplete.bits.val < pMpTcb->WrIndex.bits.val) {
- pAdapter->TxRing.nBusySend--;
- pAdapter->TxRing.CurrSendHead = pMpTcb->Next;
+ etdev->TxRing.nBusySend--;
+ etdev->TxRing.CurrSendHead = pMpTcb->Next;
if (pMpTcb->Next == NULL)
- pAdapter->TxRing.CurrSendTail = NULL;
+ etdev->TxRing.CurrSendTail = NULL;
- spin_unlock_irqrestore(&pAdapter->TCBSendQLock, lockflags);
- MP_FREE_SEND_PACKET_FUN(pAdapter, pMpTcb);
- spin_lock_irqsave(&pAdapter->TCBSendQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags);
+ MP_FREE_SEND_PACKET_FUN(etdev, pMpTcb);
+ spin_lock_irqsave(&etdev->TCBSendQLock, lockflags);
/* Goto the next packet */
- pMpTcb = pAdapter->TxRing.CurrSendHead;
+ pMpTcb = etdev->TxRing.CurrSendHead;
}
while (pMpTcb &&
ServiceComplete.bits.wrap == pMpTcb->WrIndex.bits.wrap &&
ServiceComplete.bits.val > pMpTcb->WrIndex.bits.val) {
- pAdapter->TxRing.nBusySend--;
- pAdapter->TxRing.CurrSendHead = pMpTcb->Next;
+ etdev->TxRing.nBusySend--;
+ etdev->TxRing.CurrSendHead = pMpTcb->Next;
if (pMpTcb->Next == NULL)
- pAdapter->TxRing.CurrSendTail = NULL;
+ etdev->TxRing.CurrSendTail = NULL;
- spin_unlock_irqrestore(&pAdapter->TCBSendQLock, lockflags);
- MP_FREE_SEND_PACKET_FUN(pAdapter, pMpTcb);
- spin_lock_irqsave(&pAdapter->TCBSendQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags);
+ MP_FREE_SEND_PACKET_FUN(etdev, pMpTcb);
+ spin_lock_irqsave(&etdev->TCBSendQLock, lockflags);
/* Goto the next packet */
- pMpTcb = pAdapter->TxRing.CurrSendHead;
+ pMpTcb = etdev->TxRing.CurrSendHead;
}
/* Wake up the queue when we hit a low-water mark */
- if (pAdapter->TxRing.nBusySend <= (NUM_TCB / 3))
- netif_wake_queue(pAdapter->netdev);
+ if (etdev->TxRing.nBusySend <= (NUM_TCB / 3))
+ netif_wake_queue(etdev->netdev);
- spin_unlock_irqrestore(&pAdapter->TCBSendQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags);
}
/**
* et131x_check_send_wait_list - Helper routine for the interrupt handler
- * @pAdapter: pointer to our adapter
+ * @etdev: pointer to our adapter
*
* Takes packets from the send wait queue and posts them to the device (if
* room available).
*/
-static void et131x_check_send_wait_list(struct et131x_adapter *pAdapter)
+static void et131x_check_send_wait_list(struct et131x_adapter *etdev)
{
unsigned long lockflags;
- spin_lock_irqsave(&pAdapter->SendWaitLock, lockflags);
+ spin_lock_irqsave(&etdev->SendWaitLock, lockflags);
- while (!list_empty(&pAdapter->TxRing.SendWaitQueue) &&
- MP_TCB_RESOURCES_AVAILABLE(pAdapter)) {
+ while (!list_empty(&etdev->TxRing.SendWaitQueue) &&
+ MP_TCB_RESOURCES_AVAILABLE(etdev)) {
struct list_head *pEntry;
DBG_VERBOSE(et131x_dbginfo, "Tx packets on the wait queue\n");
- pEntry = pAdapter->TxRing.SendWaitQueue.next;
+ pEntry = etdev->TxRing.SendWaitQueue.next;
- pAdapter->TxRing.nWaitSend--;
+ etdev->TxRing.nWaitSend--;
DBG_WARNING(et131x_dbginfo,
"MpHandleSendInterrupt - sent a queued pkt. Waiting %d\n",
- pAdapter->TxRing.nWaitSend);
+ etdev->TxRing.nWaitSend);
}
- spin_unlock_irqrestore(&pAdapter->SendWaitLock, lockflags);
+ spin_unlock_irqrestore(&etdev->SendWaitLock, lockflags);
}
diff --git a/drivers/staging/et131x/et131x_config.c b/drivers/staging/et131x/et131x_config.c
index 15e6d4e..148672b 100644
--- a/drivers/staging/et131x/et131x_config.c
+++ b/drivers/staging/et131x/et131x_config.c
@@ -202,12 +202,12 @@ MODULE_PARM_DESC(et131x_speed_set,
/**
* et131x_config_parse
- * @pAdapter: pointer to the private adapter struct
+ * @etdev: pointer to the private adapter struct
*
* Parses a configuration from some location (module parameters, for example)
* into the private adapter struct
*/
-void et131x_config_parse(struct et131x_adapter *pAdapter)
+void et131x_config_parse(struct et131x_adapter *etdev)
{
uint8_t macAddrDef[] = PARM_MAC_ADDRESS_DEF;
@@ -237,85 +237,85 @@ void et131x_config_parse(struct et131x_adapter *pAdapter)
if (et131x_speed_set != PARM_SPEED_DUPLEX_DEF) {
DBG_VERBOSE(et131x_dbginfo, "Speed set manually to : %d \n",
et131x_speed_set);
- pAdapter->SpeedDuplex = et131x_speed_set;
+ etdev->SpeedDuplex = et131x_speed_set;
} else {
- pAdapter->SpeedDuplex = PARM_SPEED_DUPLEX_DEF;
+ etdev->SpeedDuplex = PARM_SPEED_DUPLEX_DEF;
}
- /* pAdapter->SpeedDuplex = PARM_SPEED_DUPLEX_DEF; */
-
- pAdapter->RegistryVlanTag = PARM_VLAN_TAG_DEF;
- pAdapter->RegistryFlowControl = PARM_FLOW_CTL_DEF;
- pAdapter->RegistryWOLLink = PARM_WOL_LINK_DEF;
- pAdapter->RegistryWOLMatch = PARM_WOL_MATCH_DEF;
- pAdapter->RegistryJumboPacket = PARM_JUMBO_PKT_DEF;
- pAdapter->RegistryPhyComa = PARM_PHY_COMA_DEF;
- pAdapter->RegistryRxNumBuffers = PARM_RX_NUM_BUFS_DEF;
- pAdapter->RegistryRxTimeInterval = PARM_RX_TIME_INT_DEF;
- pAdapter->RegistryTxNumBuffers = PARM_TX_NUM_BUFS_DEF;
- pAdapter->RegistryTxTimeInterval = PARM_TX_TIME_INT_DEF;
- pAdapter->RegistryRxMemEnd = PARM_RX_MEM_END_DEF;
- pAdapter->RegistryMACStat = PARM_MAC_STAT_DEF;
- pAdapter->RegistrySCGain = PARM_SC_GAIN_DEF;
- pAdapter->RegistryPMWOL = PARM_PM_WOL_DEF;
+ /* etdev->SpeedDuplex = PARM_SPEED_DUPLEX_DEF; */
+
+ etdev->RegistryVlanTag = PARM_VLAN_TAG_DEF;
+ etdev->RegistryFlowControl = PARM_FLOW_CTL_DEF;
+ etdev->RegistryWOLLink = PARM_WOL_LINK_DEF;
+ etdev->RegistryWOLMatch = PARM_WOL_MATCH_DEF;
+ etdev->RegistryJumboPacket = PARM_JUMBO_PKT_DEF;
+ etdev->RegistryPhyComa = PARM_PHY_COMA_DEF;
+ etdev->RegistryRxNumBuffers = PARM_RX_NUM_BUFS_DEF;
+ etdev->RegistryRxTimeInterval = PARM_RX_TIME_INT_DEF;
+ etdev->RegistryTxNumBuffers = PARM_TX_NUM_BUFS_DEF;
+ etdev->RegistryTxTimeInterval = PARM_TX_TIME_INT_DEF;
+ etdev->RegistryRxMemEnd = PARM_RX_MEM_END_DEF;
+ etdev->RegistryMACStat = PARM_MAC_STAT_DEF;
+ etdev->RegistrySCGain = PARM_SC_GAIN_DEF;
+ etdev->RegistryPMWOL = PARM_PM_WOL_DEF;
if (et131x_nmi_disable != PARM_NMI_DISABLE_DEF)
- pAdapter->RegistryNMIDisable = et131x_nmi_disable;
+ etdev->RegistryNMIDisable = et131x_nmi_disable;
else
- pAdapter->RegistryNMIDisable = PARM_NMI_DISABLE_DEF;
+ etdev->RegistryNMIDisable = PARM_NMI_DISABLE_DEF;
- pAdapter->RegistryDMACache = PARM_DMA_CACHE_DEF;
- pAdapter->RegistryPhyLoopbk = PARM_PHY_LOOPBK_DEF;
+ etdev->RegistryDMACache = PARM_DMA_CACHE_DEF;
+ etdev->RegistryPhyLoopbk = PARM_PHY_LOOPBK_DEF;
/* Set the MAC address to a default */
- memcpy(pAdapter->CurrentAddress, macAddrDef, ETH_ALEN);
- pAdapter->bOverrideAddress = false;
+ memcpy(etdev->CurrentAddress, macAddrDef, ETH_ALEN);
+ etdev->bOverrideAddress = false;
DBG_TRACE(et131x_dbginfo,
"Default MAC Address : %02x:%02x:%02x:%02x:%02x:%02x\n",
- pAdapter->CurrentAddress[0], pAdapter->CurrentAddress[1],
- pAdapter->CurrentAddress[2], pAdapter->CurrentAddress[3],
- pAdapter->CurrentAddress[4], pAdapter->CurrentAddress[5]);
+ etdev->CurrentAddress[0], etdev->CurrentAddress[1],
+ etdev->CurrentAddress[2], etdev->CurrentAddress[3],
+ etdev->CurrentAddress[4], etdev->CurrentAddress[5]);
/* Decode SpeedDuplex
*
* Set up as if we are auto negotiating always and then change if we
* go into force mode
*/
- pAdapter->AiForceSpeed = 0; /* Auto speed */
- pAdapter->AiForceDpx = 0; /* Auto FDX */
+ etdev->AiForceSpeed = 0; /* Auto speed */
+ etdev->AiForceDpx = 0; /* Auto FDX */
/* If we are the 10/100 device, and gigabit is somehow requested then
* knock it down to 100 full.
*/
- if (pAdapter->DeviceID == ET131X_PCI_DEVICE_ID_FAST &&
- pAdapter->SpeedDuplex == 5)
- pAdapter->SpeedDuplex = 4;
+ if (etdev->DeviceID == ET131X_PCI_DEVICE_ID_FAST &&
+ etdev->SpeedDuplex == 5)
+ etdev->SpeedDuplex = 4;
- switch (pAdapter->SpeedDuplex) {
+ switch (etdev->SpeedDuplex) {
case 1: /* 10Mb Half-Duplex */
- pAdapter->AiForceSpeed = 10;
- pAdapter->AiForceDpx = 1;
+ etdev->AiForceSpeed = 10;
+ etdev->AiForceDpx = 1;
break;
case 2: /* 10Mb Full-Duplex */
- pAdapter->AiForceSpeed = 10;
- pAdapter->AiForceDpx = 2;
+ etdev->AiForceSpeed = 10;
+ etdev->AiForceDpx = 2;
break;
case 3: /* 100Mb Half-Duplex */
- pAdapter->AiForceSpeed = 100;
- pAdapter->AiForceDpx = 1;
+ etdev->AiForceSpeed = 100;
+ etdev->AiForceDpx = 1;
break;
case 4: /* 100Mb Full-Duplex */
- pAdapter->AiForceSpeed = 100;
- pAdapter->AiForceDpx = 2;
+ etdev->AiForceSpeed = 100;
+ etdev->AiForceDpx = 2;
break;
case 5: /* 1000Mb Full-Duplex */
- pAdapter->AiForceSpeed = 1000;
- pAdapter->AiForceDpx = 2;
+ etdev->AiForceSpeed = 1000;
+ etdev->AiForceDpx = 2;
break;
}
diff --git a/drivers/staging/et131x/et131x_debug.c b/drivers/staging/et131x/et131x_debug.c
index c7f64a8..2730b9c 100644
--- a/drivers/staging/et131x/et131x_debug.c
+++ b/drivers/staging/et131x/et131x_debug.c
@@ -106,11 +106,11 @@ extern dbg_info_t *et131x_dbginfo;
/**
* DumpTxQueueContents - Dump out the tx queue and the shadow pointers
- * @pAdapter: pointer to our adapter structure
+ * @etdev: pointer to our adapter structure
*/
-void DumpTxQueueContents(int dbgLvl, struct et131x_adapter *pAdapter)
+void DumpTxQueueContents(int dbgLvl, struct et131x_adapter *etdev)
{
- MMC_t __iomem *mmc = &pAdapter->CSRAddress->mmc;
+ MMC_t __iomem *mmc = &etdev->CSRAddress->mmc;
uint32_t TxQueueAddr;
if (DBG_FLAGS(et131x_dbginfo) & dbgLvl) {
@@ -134,24 +134,24 @@ void DumpTxQueueContents(int dbgLvl, struct et131x_adapter *pAdapter)
}
DBG_PRINT("Shadow Pointers 0x%08x\n",
- readl(&pAdapter->CSRAddress->txmac.shadow_ptr.value));
+ readl(&etdev->CSRAddress->txmac.shadow_ptr.value));
}
}
/**
* DumpDeviceBlock
- * @pAdapter: pointer to our adapter
+ * @etdev: pointer to our adapter
*
* Dumps the first 64 regs of each block of the et-1310 (each block is
* mapped to a new page, each page is 4096 bytes).
*/
#define NUM_BLOCKS 8
-void DumpDeviceBlock(int dbgLvl, struct et131x_adapter *pAdapter,
+void DumpDeviceBlock(int dbgLvl, struct et131x_adapter *etdev,
uint32_t Block)
{
uint32_t Address1, Address2;
uint32_t __iomem *BigDevicePointer =
- (uint32_t __iomem *) pAdapter->CSRAddress;
+ (uint32_t __iomem *) etdev->CSRAddress;
const char *BlockNames[NUM_BLOCKS] = {
"Global", "Tx DMA", "Rx DMA", "Tx MAC",
"Rx MAC", "MAC", "MAC Stat", "MMC"
@@ -179,17 +179,17 @@ void DumpDeviceBlock(int dbgLvl, struct et131x_adapter *pAdapter,
/**
* DumpDeviceReg
- * @pAdapter: pointer to our adapter
+ * @etdev: pointer to our adapter
*
* Dumps the first 64 regs of each block of the et-1310 (each block is
* mapped to a new page, each page is 4096 bytes).
*/
-void DumpDeviceReg(int dbgLvl, struct et131x_adapter *pAdapter)
+void DumpDeviceReg(int dbgLvl, struct et131x_adapter *etdev)
{
uint32_t Address1, Address2;
uint32_t Block;
uint32_t __iomem *BigDevicePointer =
- (uint32_t __iomem *) pAdapter->CSRAddress;
+ (uint32_t __iomem *) etdev->CSRAddress;
uint32_t __iomem *Pointer;
const char *BlockNames[NUM_BLOCKS] = {
"Global", "Tx DMA", "Rx DMA", "Tx MAC",
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index c934589..8455e0a 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -447,40 +447,40 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev)
*/
void et131x_error_timer_handler(unsigned long data)
{
- struct et131x_adapter *pAdapter = (struct et131x_adapter *) data;
+ struct et131x_adapter *etdev = (struct et131x_adapter *) data;
PM_CSR_t pm_csr;
- pm_csr.value = readl(&pAdapter->CSRAddress->global.pm_csr.value);
+ pm_csr.value = readl(&etdev->CSRAddress->global.pm_csr.value);
if (pm_csr.bits.pm_phy_sw_coma == 0) {
- if (pAdapter->RegistryMACStat)
- UpdateMacStatHostCounters(pAdapter);
+ if (etdev->RegistryMACStat)
+ UpdateMacStatHostCounters(etdev);
} else
DBG_VERBOSE(et131x_dbginfo,
"No interrupts, in PHY coma, pm_csr = 0x%x\n",
pm_csr.value);
- if (!pAdapter->Bmsr.bits.link_status &&
- pAdapter->RegistryPhyComa &&
- pAdapter->PoMgmt.TransPhyComaModeOnBoot < 11) {
- pAdapter->PoMgmt.TransPhyComaModeOnBoot++;
+ if (!etdev->Bmsr.bits.link_status &&
+ etdev->RegistryPhyComa &&
+ etdev->PoMgmt.TransPhyComaModeOnBoot < 11) {
+ etdev->PoMgmt.TransPhyComaModeOnBoot++;
}
- if (pAdapter->PoMgmt.TransPhyComaModeOnBoot == 10) {
- if (!pAdapter->Bmsr.bits.link_status
- && pAdapter->RegistryPhyComa) {
+ if (etdev->PoMgmt.TransPhyComaModeOnBoot == 10) {
+ if (!etdev->Bmsr.bits.link_status
+ && etdev->RegistryPhyComa) {
if (pm_csr.bits.pm_phy_sw_coma == 0) {
/* NOTE - This was originally a 'sync with
* interrupt'. How to do that under Linux?
*/
- et131x_enable_interrupts(pAdapter);
- EnablePhyComa(pAdapter);
+ et131x_enable_interrupts(etdev);
+ EnablePhyComa(etdev);
}
}
}
/* This is a periodic timer, so reschedule */
- mod_timer(&pAdapter->ErrorTimer, jiffies +
+ mod_timer(&etdev->ErrorTimer, jiffies +
TX_ERROR_PERIOD * HZ / 1000);
}
@@ -491,23 +491,23 @@ void et131x_error_timer_handler(unsigned long data)
*/
void et131x_link_detection_handler(unsigned long data)
{
- struct et131x_adapter *pAdapter = (struct et131x_adapter *) data;
+ struct et131x_adapter *etdev = (struct et131x_adapter *) data;
unsigned long lockflags;
/* Let everyone know that we have run */
- pAdapter->bLinkTimerActive = false;
+ etdev->bLinkTimerActive = false;
- if (pAdapter->MediaState == 0) {
- spin_lock_irqsave(&pAdapter->Lock, lockflags);
+ if (etdev->MediaState == 0) {
+ spin_lock_irqsave(&etdev->Lock, lockflags);
- pAdapter->MediaState = NETIF_STATUS_MEDIA_DISCONNECT;
- MP_CLEAR_FLAG(pAdapter, fMP_ADAPTER_LINK_DETECTION);
+ etdev->MediaState = NETIF_STATUS_MEDIA_DISCONNECT;
+ MP_CLEAR_FLAG(etdev, fMP_ADAPTER_LINK_DETECTION);
- spin_unlock_irqrestore(&pAdapter->Lock, lockflags);
+ spin_unlock_irqrestore(&etdev->Lock, lockflags);
- netif_carrier_off(pAdapter->netdev);
+ netif_carrier_off(etdev->netdev);
- pAdapter->bSetPending = false;
+ etdev->bSetPending = false;
}
}
@@ -517,54 +517,54 @@ void et131x_link_detection_handler(unsigned long data)
*
* Returns 0 on success, errno on failure (as defined in errno.h)
*/
-int et131x_adapter_setup(struct et131x_adapter *pAdapter)
+int et131x_adapter_setup(struct et131x_adapter *etdev)
{
int status = 0;
DBG_ENTER(et131x_dbginfo);
/* Configure the JAGCore */
- ConfigGlobalRegs(pAdapter);
+ ConfigGlobalRegs(etdev);
- ConfigMACRegs1(pAdapter);
- ConfigMMCRegs(pAdapter);
+ ConfigMACRegs1(etdev);
+ ConfigMMCRegs(etdev);
- ConfigRxMacRegs(pAdapter);
- ConfigTxMacRegs(pAdapter);
+ ConfigRxMacRegs(etdev);
+ ConfigTxMacRegs(etdev);
- ConfigRxDmaRegs(pAdapter);
- ConfigTxDmaRegs(pAdapter);
+ ConfigRxDmaRegs(etdev);
+ ConfigTxDmaRegs(etdev);
- ConfigMacStatRegs(pAdapter);
+ ConfigMacStatRegs(etdev);
/* Move the following code to Timer function?? */
- status = et131x_xcvr_find(pAdapter);
+ status = et131x_xcvr_find(etdev);
if (status != 0)
DBG_WARNING(et131x_dbginfo, "Could not find the xcvr\n");
/* Prepare the TRUEPHY library. */
- ET1310_PhyInit(pAdapter);
+ ET1310_PhyInit(etdev);
/* Reset the phy now so changes take place */
- ET1310_PhyReset(pAdapter);
+ ET1310_PhyReset(etdev);
/* Power down PHY */
- ET1310_PhyPowerDown(pAdapter, 1);
+ ET1310_PhyPowerDown(etdev, 1);
/*
* We need to turn off 1000 base half dulplex, the mac does not
* support it. For the 10/100 part, turn off all gig advertisement
*/
- if (pAdapter->DeviceID != ET131X_PCI_DEVICE_ID_FAST)
- ET1310_PhyAdvertise1000BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_FULL);
+ if (etdev->DeviceID != ET131X_PCI_DEVICE_ID_FAST)
+ ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL);
else
- ET1310_PhyAdvertise1000BaseT(pAdapter, TRUEPHY_ADV_DUPLEX_NONE);
+ ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
/* Power up PHY */
- ET1310_PhyPowerDown(pAdapter, 0);
+ ET1310_PhyPowerDown(etdev, 0);
- et131x_setphy_normal(pAdapter);
+ et131x_setphy_normal(etdev);
DBG_LEAVE(et131x_dbginfo);
return status;
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c
index bbe3c1a..9f51425 100644
--- a/drivers/staging/et131x/et131x_isr.c
+++ b/drivers/staging/et131x/et131x_isr.c
@@ -211,10 +211,10 @@ out:
*/
void et131x_isr_handler(struct work_struct *work)
{
- struct et131x_adapter *pAdapter =
+ struct et131x_adapter *etdev =
container_of(work, struct et131x_adapter, task);
- INTERRUPT_t GlobStatus = pAdapter->Stats.InterruptStatus;
- ADDRESS_MAP_t __iomem *iomem = pAdapter->CSRAddress;
+ INTERRUPT_t GlobStatus = etdev->Stats.InterruptStatus;
+ ADDRESS_MAP_t __iomem *iomem = etdev->CSRAddress;
/*
* These first two are by far the most common. Once handled, we clear
@@ -224,13 +224,13 @@ void et131x_isr_handler(struct work_struct *work)
/* Handle all the completed Transmit interrupts */
if (GlobStatus.bits.txdma_isr) {
DBG_TX(et131x_dbginfo, "TXDMA_ISR interrupt\n");
- et131x_handle_send_interrupt(pAdapter);
+ et131x_handle_send_interrupt(etdev);
}
/* Handle all the completed Receives interrupts */
if (GlobStatus.bits.rxdma_xfr_done) {
DBG_RX(et131x_dbginfo, "RXDMA_XFR_DONE interrupt\n");
- et131x_handle_recv_interrupt(pAdapter);
+ et131x_handle_recv_interrupt(etdev);
}
GlobStatus.value &= 0xffffffd7;
@@ -272,8 +272,8 @@ void et131x_isr_handler(struct work_struct *work)
/* If the user has flow control on, then we will
* send a pause packet, otherwise just exit
*/
- if (pAdapter->FlowControl == TxOnly ||
- pAdapter->FlowControl == Both) {
+ if (etdev->FlowControl == TxOnly ||
+ etdev->FlowControl == Both) {
PM_CSR_t pm_csr;
/* Tell the device to send a pause packet via
@@ -330,11 +330,11 @@ void et131x_isr_handler(struct work_struct *work)
*/
/* TRAP();*/
- pAdapter->TxMacTest.value =
+ etdev->TxMacTest.value =
readl(&iomem->txmac.tx_test.value);
DBG_WARNING(et131x_dbginfo,
"RxDMA_ERR interrupt, error %x\n",
- pAdapter->TxMacTest.value);
+ etdev->TxMacTest.value);
}
/* Handle the Wake on LAN Event */
@@ -370,23 +370,23 @@ void et131x_isr_handler(struct work_struct *work)
DBG_VERBOSE(et131x_dbginfo,
"Device is in COMA mode, "
"need to wake up\n");
- DisablePhyComa(pAdapter);
+ DisablePhyComa(etdev);
}
/* Read the PHY ISR to clear the reason for the
* interrupt.
*/
- MiRead(pAdapter, (uint8_t) offsetof(MI_REGS_t, isr),
+ MiRead(etdev, (uint8_t) offsetof(MI_REGS_t, isr),
&myIsr.value);
- if (!pAdapter->ReplicaPhyLoopbk) {
- MiRead(pAdapter,
+ if (!etdev->ReplicaPhyLoopbk) {
+ MiRead(etdev,
(uint8_t) offsetof(MI_REGS_t, bmsr),
&BmsrData.value);
BmsrInts.value =
- pAdapter->Bmsr.value ^ BmsrData.value;
- pAdapter->Bmsr.value = BmsrData.value;
+ etdev->Bmsr.value ^ BmsrData.value;
+ etdev->Bmsr.value = BmsrData.value;
DBG_VERBOSE(et131x_dbginfo,
"Bmsr.value = 0x%04x,"
@@ -394,13 +394,13 @@ void et131x_isr_handler(struct work_struct *work)
BmsrData.value, BmsrInts.value);
/* Do all the cable in / cable out stuff */
- et131x_Mii_check(pAdapter, BmsrData, BmsrInts);
+ et131x_Mii_check(etdev, BmsrData, BmsrInts);
}
}
/* Let's move on to the TxMac */
if (GlobStatus.bits.txmac_interrupt) {
- pAdapter->TxRing.TxMacErr.value =
+ etdev->TxRing.TxMacErr.value =
readl(&iomem->txmac.err.value);
/*
@@ -415,7 +415,7 @@ void et131x_isr_handler(struct work_struct *work)
*/
DBG_WARNING(et131x_dbginfo,
"TXMAC interrupt, error 0x%08x\n",
- pAdapter->TxRing.TxMacErr.value);
+ etdev->TxRing.TxMacErr.value);
/* If we are debugging, we want to see this error,
* otherwise we just want the device to be reset and
@@ -432,7 +432,7 @@ void et131x_isr_handler(struct work_struct *work)
* set the flag to cause us to reset so we can solve
* this issue.
*/
- /* MP_SET_FLAG( pAdapter,
+ /* MP_SET_FLAG( etdev,
fMP_ADAPTER_HARDWARE_ERROR); */
DBG_WARNING(et131x_dbginfo,
@@ -461,7 +461,7 @@ void et131x_isr_handler(struct work_struct *work)
* counter(s).
*/
DBG_VERBOSE(et131x_dbginfo, "MAC_STAT interrupt\n");
- HandleMacStatInterrupt(pAdapter);
+ HandleMacStatInterrupt(etdev);
}
/* Handle SLV Timeout Interrupt */
@@ -479,6 +479,6 @@ void et131x_isr_handler(struct work_struct *work)
}
}
- if (pAdapter->PoMgmt.PowerState == NdisDeviceStateD0)
- et131x_enable_interrupts(pAdapter);
+ if (etdev->PoMgmt.PowerState == NdisDeviceStateD0)
+ et131x_enable_interrupts(etdev);
}
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index 74a8375..77fac95 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -308,7 +308,7 @@ int et131x_close(struct net_device *netdev)
int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
{
int status = 0;
- struct et131x_adapter *pAdapter = netdev_priv(netdev);
+ struct et131x_adapter *etdev = netdev_priv(netdev);
struct mii_ioctl_data *data = if_mii(reqbuf);
DBG_ENTER(et131x_dbginfo);
@@ -316,7 +316,7 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
switch (cmd) {
case SIOCGMIIPHY:
DBG_VERBOSE(et131x_dbginfo, "SIOCGMIIPHY\n");
- data->phy_id = pAdapter->Stats.xcvr_addr;
+ data->phy_id = etdev->Stats.xcvr_addr;
break;
case SIOCGMIIREG:
@@ -324,7 +324,7 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
if (!capable(CAP_NET_ADMIN)) {
status = -EPERM;
} else {
- status = MiRead(pAdapter,
+ status = MiRead(etdev,
data->reg_num, &data->val_out);
}
break;
@@ -334,7 +334,7 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
if (!capable(CAP_NET_ADMIN)) {
status = -EPERM;
} else {
- status = MiWrite(pAdapter, data->reg_num,
+ status = MiWrite(etdev, data->reg_num,
data->val_in);
}
break;
@@ -608,14 +608,14 @@ int et131x_tx(struct sk_buff *skb, struct net_device *netdev)
*/
void et131x_tx_timeout(struct net_device *netdev)
{
- struct et131x_adapter *pAdapter = netdev_priv(netdev);
+ struct et131x_adapter *etdev = netdev_priv(netdev);
PMP_TCB pMpTcb;
unsigned long lockflags;
DBG_WARNING(et131x_dbginfo, "TX TIMEOUT\n");
/* Just skip this part if the adapter is doing link detection */
- if (MP_TEST_FLAG(pAdapter, fMP_ADAPTER_LINK_DETECTION)) {
+ if (MP_TEST_FLAG(etdev, fMP_ADAPTER_LINK_DETECTION)) {
DBG_ERROR(et131x_dbginfo, "Still doing link detection\n");
return;
}
@@ -623,21 +623,21 @@ void et131x_tx_timeout(struct net_device *netdev)
/* Any nonrecoverable hardware error?
* Checks adapter->flags for any failure in phy reading
*/
- if (MP_TEST_FLAG(pAdapter, fMP_ADAPTER_NON_RECOVER_ERROR)) {
+ if (MP_TEST_FLAG(etdev, fMP_ADAPTER_NON_RECOVER_ERROR)) {
DBG_WARNING(et131x_dbginfo, "Non recoverable error - remove\n");
return;
}
/* Hardware failure? */
- if (MP_TEST_FLAG(pAdapter, fMP_ADAPTER_HARDWARE_ERROR)) {
+ if (MP_TEST_FLAG(etdev, fMP_ADAPTER_HARDWARE_ERROR)) {
DBG_WARNING(et131x_dbginfo, "hardware error - reset\n");
return;
}
/* Is send stuck? */
- spin_lock_irqsave(&pAdapter->TCBSendQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBSendQLock, lockflags);
- pMpTcb = pAdapter->TxRing.CurrSendHead;
+ pMpTcb = etdev->TxRing.CurrSendHead;
if (pMpTcb != NULL) {
pMpTcb->Count++;
@@ -645,21 +645,21 @@ void et131x_tx_timeout(struct net_device *netdev)
if (pMpTcb->Count > NIC_SEND_HANG_THRESHOLD) {
#ifdef CONFIG_ET131X_DEBUG
TX_STATUS_BLOCK_t txDmaComplete =
- *(pAdapter->TxRing.pTxStatusVa);
+ *(etdev->TxRing.pTxStatusVa);
PTX_DESC_ENTRY_t pDesc =
- pAdapter->TxRing.pTxDescRingVa +
+ etdev->TxRing.pTxDescRingVa +
pMpTcb->WrIndex.bits.val;
#endif
TX_DESC_ENTRY_t StuckDescriptors[10];
if (pMpTcb->WrIndex.bits.val > 7) {
memcpy(StuckDescriptors,
- pAdapter->TxRing.pTxDescRingVa +
+ etdev->TxRing.pTxDescRingVa +
pMpTcb->WrIndex.bits.val - 6,
sizeof(TX_DESC_ENTRY_t) * 10);
}
- spin_unlock_irqrestore(&pAdapter->TCBSendQLock,
+ spin_unlock_irqrestore(&etdev->TCBSendQLock,
lockflags);
DBG_WARNING(et131x_dbginfo,
@@ -677,10 +677,10 @@ void et131x_tx_timeout(struct net_device *netdev)
"WbStatus 0x%08x\n", txDmaComplete.value);
#ifdef CONFIG_ET131X_DEBUG
- DumpDeviceBlock(DBG_WARNING_ON, pAdapter, 0);
- DumpDeviceBlock(DBG_WARNING_ON, pAdapter, 1);
- DumpDeviceBlock(DBG_WARNING_ON, pAdapter, 3);
- DumpDeviceBlock(DBG_WARNING_ON, pAdapter, 5);
+ DumpDeviceBlock(DBG_WARNING_ON, etdev, 0);
+ DumpDeviceBlock(DBG_WARNING_ON, etdev, 1);
+ DumpDeviceBlock(DBG_WARNING_ON, etdev, 3);
+ DumpDeviceBlock(DBG_WARNING_ON, etdev, 5);
#endif
et131x_close(netdev);
et131x_open(netdev);
@@ -689,7 +689,7 @@ void et131x_tx_timeout(struct net_device *netdev)
}
}
- spin_unlock_irqrestore(&pAdapter->TCBSendQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags);
}
/**
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 02/26] et131x: spinlocks
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
2009-08-25 14:57 ` [PATCH 01/26] et1310: kill pAdapter in favour of a sane name Alan Cox
@ 2009-08-25 14:57 ` Alan Cox
2009-08-25 14:57 ` [PATCH 03/26] et131x: power state Alan Cox
` (23 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 14:57 UTC (permalink / raw)
To: greg, netdev
Switch to the more normal "flags" naming. Also fix up the nested use of
spin_lock_irqsave
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_phy.c | 10 ++--
drivers/staging/et131x/et1310_pm.c | 6 +--
drivers/staging/et131x/et1310_rx.c | 28 ++++++------
drivers/staging/et131x/et1310_tx.c | 74 ++++++++++++++++---------------
drivers/staging/et131x/et131x_initpci.c | 6 +--
drivers/staging/et131x/et131x_netdev.c | 14 +++---
6 files changed, 69 insertions(+), 69 deletions(-)
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index 82fcb66..d9c7a44 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -484,7 +484,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
uint32_t uiMdiMdix;
uint32_t uiMasterSlave;
uint32_t uiPolarity;
- unsigned long lockflags;
+ unsigned long flags;
DBG_ENTER(et131x_dbginfo);
@@ -495,12 +495,12 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
/* Update our state variables and indicate the
* connected state
*/
- spin_lock_irqsave(&etdev->Lock, lockflags);
+ spin_lock_irqsave(&etdev->Lock, flags);
etdev->MediaState = NETIF_STATUS_MEDIA_CONNECT;
MP_CLEAR_FLAG(etdev, fMP_ADAPTER_LINK_DETECTION);
- spin_unlock_irqrestore(&etdev->Lock, lockflags);
+ spin_unlock_irqrestore(&etdev->Lock, flags);
/* Don't indicate state if we're in loopback mode */
if (etdev->RegistryPhyLoopbk == false)
@@ -533,11 +533,11 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
(etdev, fMP_ADAPTER_LINK_DETECTION))
|| (etdev->MediaState ==
NETIF_STATUS_MEDIA_DISCONNECT)) {
- spin_lock_irqsave(&etdev->Lock, lockflags);
+ spin_lock_irqsave(&etdev->Lock, flags);
etdev->MediaState =
NETIF_STATUS_MEDIA_DISCONNECT;
spin_unlock_irqrestore(&etdev->Lock,
- lockflags);
+ flags);
/* Only indicate state if we're in loopback
* mode
diff --git a/drivers/staging/et131x/et1310_pm.c b/drivers/staging/et131x/et1310_pm.c
index 864d3ad..a507411 100644
--- a/drivers/staging/et131x/et1310_pm.c
+++ b/drivers/staging/et131x/et1310_pm.c
@@ -119,7 +119,7 @@ extern dbg_info_t *et131x_dbginfo;
*/
void EnablePhyComa(struct et131x_adapter *etdev)
{
- unsigned long lockflags;
+ unsigned long flags;
PM_CSR_t GlobalPmCSR;
int32_t LoopCounter = 10;
@@ -134,9 +134,9 @@ void EnablePhyComa(struct et131x_adapter *etdev)
etdev->PoMgmt.PowerDownDuplex = etdev->AiForceDpx;
/* Stop sending packets. */
- spin_lock_irqsave(&etdev->SendHWLock, lockflags);
+ spin_lock_irqsave(&etdev->SendHWLock, flags);
MP_SET_FLAG(etdev, fMP_ADAPTER_LOWER_POWER);
- spin_unlock_irqrestore(&etdev->SendHWLock, lockflags);
+ spin_unlock_irqrestore(&etdev->SendHWLock, flags);
/* Wait for outstanding Receive packets */
while ((MP_GET_RCV_REF(etdev) != 0) && (LoopCounter-- > 0))
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index f8cc6a6..9dc08fb 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -685,7 +685,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
PFBR_DESC_t pFbrEntry;
uint32_t iEntry;
RXDMA_PSR_NUM_DES_t psr_num_des;
- unsigned long lockflags;
+ unsigned long flags;
DBG_ENTER(et131x_dbginfo);
@@ -718,7 +718,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
writel((psr_num_des.bits.psr_ndes * LO_MARK_PERCENT_FOR_PSR) / 100,
&pRxDma->psr_min_des.value);
- spin_lock_irqsave(&etdev->RcvLock, lockflags);
+ spin_lock_irqsave(&etdev->RcvLock, flags);
/* These local variables track the PSR in the adapter structure */
pRxLocal->local_psr_full.bits.psr_full = 0;
@@ -801,7 +801,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
*/
writel(etdev->RegistryRxTimeInterval, &pRxDma->max_pkt_time.value);
- spin_unlock_irqrestore(&etdev->RcvLock, lockflags);
+ spin_unlock_irqrestore(&etdev->RcvLock, flags);
DBG_LEAVE(et131x_dbginfo);
}
@@ -914,7 +914,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev)
PMP_RFD pMpRfd;
uint32_t nIndex;
uint8_t *pBufVa;
- unsigned long lockflags;
+ unsigned long flags;
struct list_head *element;
uint8_t ringIndex;
uint16_t bufferIndex;
@@ -1013,7 +1013,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev)
}
/* Get and fill the RFD. */
- spin_lock_irqsave(&etdev->RcvLock, lockflags);
+ spin_lock_irqsave(&etdev->RcvLock, flags);
pMpRfd = NULL;
element = pRxLocal->RecvList.next;
@@ -1023,14 +1023,14 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev)
DBG_RX(et131x_dbginfo,
"NULL RFD returned from RecvList via list_entry()\n");
DBG_RX_LEAVE(et131x_dbginfo);
- spin_unlock_irqrestore(&etdev->RcvLock, lockflags);
+ spin_unlock_irqrestore(&etdev->RcvLock, flags);
return NULL;
}
list_del(&pMpRfd->list_node);
pRxLocal->nReadyRecv--;
- spin_unlock_irqrestore(&etdev->RcvLock, lockflags);
+ spin_unlock_irqrestore(&etdev->RcvLock, flags);
pMpRfd->iBufferIndex = bufferIndex;
pMpRfd->iRingIndex = ringIndex;
@@ -1260,9 +1260,9 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
* Besides, we don't really need (at this point) the
* pending list anyway.
*/
- /* spin_lock_irqsave( &etdev->RcvPendLock, lockflags );
+ /* spin_lock_irqsave( &etdev->RcvPendLock, flags );
* list_add_tail( &pMpRfd->list_node, &etdev->RxRing.RecvPendingList );
- * spin_unlock_irqrestore( &etdev->RcvPendLock, lockflags );
+ * spin_unlock_irqrestore( &etdev->RcvPendLock, flags );
*/
/* Update the number of outstanding Recvs */
@@ -1302,7 +1302,7 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd)
struct _RXDMA_t __iomem *pRxDma = &etdev->CSRAddress->rxdma;
uint16_t bi = pMpRfd->iBufferIndex;
uint8_t ri = pMpRfd->iRingIndex;
- unsigned long lockflags;
+ unsigned long flags;
DBG_RX_ENTER(et131x_dbginfo);
@@ -1314,7 +1314,7 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd)
(ri == 0 && bi < pRxLocal->Fbr0NumEntries) ||
#endif
(ri == 1 && bi < pRxLocal->Fbr1NumEntries)) {
- spin_lock_irqsave(&etdev->FbrLock, lockflags);
+ spin_lock_irqsave(&etdev->FbrLock, flags);
if (ri == 1) {
PFBR_DESC_t pNextDesc =
@@ -1362,7 +1362,7 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd)
&pRxDma->fbr0_full_offset.value);
}
#endif
- spin_unlock_irqrestore(&etdev->FbrLock, lockflags);
+ spin_unlock_irqrestore(&etdev->FbrLock, flags);
} else {
DBG_ERROR(et131x_dbginfo,
"NICReturnRFD illegal Buffer Index returned\n");
@@ -1371,10 +1371,10 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd)
/* The processing on this RFD is done, so put it back on the tail of
* our list
*/
- spin_lock_irqsave(&etdev->RcvLock, lockflags);
+ spin_lock_irqsave(&etdev->RcvLock, flags);
list_add_tail(&pMpRfd->list_node, &pRxLocal->RecvList);
pRxLocal->nReadyRecv++;
- spin_unlock_irqrestore(&etdev->RcvLock, lockflags);
+ spin_unlock_irqrestore(&etdev->RcvLock, flags);
DBG_ASSERT(pRxLocal->nReadyRecv <= pRxLocal->NumRfd);
DBG_RX_LEAVE(et131x_dbginfo);
diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c
index db0f538..a017d27 100644
--- a/drivers/staging/et131x/et1310_tx.c
+++ b/drivers/staging/et131x/et1310_tx.c
@@ -461,7 +461,7 @@ static int et131x_send_packet(struct sk_buff *skb,
int status = 0;
PMP_TCB pMpTcb = NULL;
uint16_t *pShBufVa;
- unsigned long lockflags;
+ unsigned long flags;
DBG_TX_ENTER(et131x_dbginfo);
@@ -482,12 +482,12 @@ static int et131x_send_packet(struct sk_buff *skb,
}
/* Get a TCB for this packet */
- spin_lock_irqsave(&etdev->TCBReadyQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBReadyQLock, flags);
pMpTcb = etdev->TxRing.TCBReadyQueueHead;
if (pMpTcb == NULL) {
- spin_unlock_irqrestore(&etdev->TCBReadyQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags);
DBG_WARNING(et131x_dbginfo, "Can't obtain a TCB\n");
DBG_TX_LEAVE(et131x_dbginfo);
@@ -499,7 +499,7 @@ static int et131x_send_packet(struct sk_buff *skb,
if (etdev->TxRing.TCBReadyQueueHead == NULL)
etdev->TxRing.TCBReadyQueueTail = NULL;
- spin_unlock_irqrestore(&etdev->TCBReadyQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags);
pMpTcb->PacketLength = skb->len;
pMpTcb->Packet = skb;
@@ -522,7 +522,7 @@ static int et131x_send_packet(struct sk_buff *skb,
status = nic_send_packet(etdev, pMpTcb);
if (status != 0) {
- spin_lock_irqsave(&etdev->TCBReadyQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBReadyQLock, flags);
if (etdev->TxRing.TCBReadyQueueTail) {
etdev->TxRing.TCBReadyQueueTail->Next = pMpTcb;
@@ -533,7 +533,7 @@ static int et131x_send_packet(struct sk_buff *skb,
etdev->TxRing.TCBReadyQueueTail = pMpTcb;
- spin_unlock_irqrestore(&etdev->TCBReadyQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags);
DBG_TX_LEAVE(et131x_dbginfo);
return status;
@@ -561,7 +561,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
struct sk_buff *pPacket = pMpTcb->Packet;
uint32_t FragListCount = skb_shinfo(pPacket)->nr_frags + 1;
struct skb_frag_struct *pFragList = &skb_shinfo(pPacket)->frags[0];
- unsigned long lockflags1, lockflags2;
+ unsigned long flags;
DBG_TX_ENTER(et131x_dbginfo);
@@ -726,7 +726,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
pMpTcb->WrIndexStart = etdev->TxRing.txDmaReadyToSend;
pMpTcb->PacketStaleCount = 0;
- spin_lock_irqsave(&etdev->SendHWLock, lockflags1);
+ spin_lock_irqsave(&etdev->SendHWLock, flags);
iThisCopy =
NUM_DESC_PER_RING_TX - etdev->TxRing.txDmaReadyToSend.bits.val;
@@ -771,7 +771,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
pMpTcb->WrIndex.value =
etdev->TxRing.txDmaReadyToSend.value - 1;
- spin_lock_irqsave(&etdev->TCBSendQLock, lockflags2);
+ spin_lock(&etdev->TCBSendQLock);
if (etdev->TxRing.CurrSendTail)
etdev->TxRing.CurrSendTail->Next = pMpTcb;
@@ -784,7 +784,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
etdev->TxRing.nBusySend++;
- spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags2);
+ spin_unlock(&etdev->TCBSendQLock);
/* Write the new write pointer back to the device. */
writel(etdev->TxRing.txDmaReadyToSend.value,
@@ -798,7 +798,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
&etdev->CSRAddress->global.watchdog_timer);
}
- spin_unlock_irqrestore(&etdev->SendHWLock, lockflags1);
+ spin_unlock_irqrestore(&etdev->SendHWLock, flags);
DBG_TX_LEAVE(et131x_dbginfo);
return 0;
@@ -829,7 +829,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
TX_DESC_ENTRY_t *CurDescPostCopy = NULL;
uint32_t SlotsAvailable;
DMA10W_t ServiceComplete;
- unsigned int lockflags1, lockflags2;
+ unsigned int flags;
struct sk_buff *pPacket = pMpTcb->Packet;
uint32_t FragListCount = skb_shinfo(pPacket)->nr_frags + 1;
struct skb_frag_struct *pFragList = &skb_shinfo(pPacket)->frags[0];
@@ -875,7 +875,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
SegmentSize = (pPacket->len - pPacket->data_len) / 2;
}
- spin_lock_irqsave(&etdev->SendHWLock, lockflags1);
+ spin_lock_irqsave(&etdev->SendHWLock, flags);
if (etdev->TxRing.txDmaReadyToSend.bits.serv_req_wrap ==
ServiceComplete.bits.serv_cpl_wrap) {
@@ -896,7 +896,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
if ((FragListCount + iSplitFirstElement) > SlotsAvailable) {
DBG_WARNING(et131x_dbginfo,
"Not Enough Space in Tx Desc Ring\n");
- spin_unlock_irqrestore(&etdev->SendHWLock, lockflags1);
+ spin_unlock_irqrestore(&etdev->SendHWLock, flags);
return -ENOMEM;
}
@@ -1185,7 +1185,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
NIC_MIN_PACKET_SIZE - pMpTcb->PacketLength);
}
- spin_lock_irqsave(&etdev->TCBSendQLock, lockflags2);
+ spin_lock(&etdev->TCBSendQLock);
if (etdev->TxRing.CurrSendTail)
etdev->TxRing.CurrSendTail->Next = pMpTcb;
@@ -1198,7 +1198,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
etdev->TxRing.nBusySend++;
- spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags2);
+ spin_unlock(&etdev->TCBSendQLock);
/* Write the new write pointer back to the device. */
writel(etdev->TxRing.txDmaReadyToSend.value,
@@ -1216,7 +1216,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
&etdev->CSRAddress->global.watchdog_timer);
}
- spin_unlock_irqrestore(&etdev->SendHWLock, lockflags1);
+ spin_unlock_irqrestore(&etdev->SendHWLock, flags);
DBG_TX_LEAVE(et131x_dbginfo);
return 0;
@@ -1234,7 +1234,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
inline void et131x_free_send_packet(struct et131x_adapter *etdev,
PMP_TCB pMpTcb)
{
- unsigned long lockflags;
+ unsigned long flags;
TX_DESC_ENTRY_t *desc = NULL;
struct net_device_stats *stats = &etdev->net_stats;
@@ -1311,7 +1311,7 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev,
memset(pMpTcb, 0, sizeof(MP_TCB));
/* Add the TCB to the Ready Q */
- spin_lock_irqsave(&etdev->TCBReadyQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBReadyQLock, flags);
etdev->Stats.opackets++;
@@ -1324,7 +1324,7 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev,
etdev->TxRing.TCBReadyQueueTail = pMpTcb;
- spin_unlock_irqrestore(&etdev->TCBReadyQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags);
DBG_ASSERT(etdev->TxRing.nBusySend >= 0);
}
@@ -1339,16 +1339,16 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev)
{
PMP_TCB pMpTcb;
struct list_head *pEntry;
- unsigned long lockflags;
+ unsigned long flags;
uint32_t FreeCounter = 0;
DBG_ENTER(et131x_dbginfo);
while (!list_empty(&etdev->TxRing.SendWaitQueue)) {
- spin_lock_irqsave(&etdev->SendWaitLock, lockflags);
+ spin_lock_irqsave(&etdev->SendWaitLock, flags);
etdev->TxRing.nWaitSend--;
- spin_unlock_irqrestore(&etdev->SendWaitLock, lockflags);
+ spin_unlock_irqrestore(&etdev->SendWaitLock, flags);
pEntry = etdev->TxRing.SendWaitQueue.next;
}
@@ -1356,7 +1356,7 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev)
etdev->TxRing.nWaitSend = 0;
/* Any packets being sent? Check the first TCB on the send list */
- spin_lock_irqsave(&etdev->TCBSendQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBSendQLock, flags);
pMpTcb = etdev->TxRing.CurrSendHead;
@@ -1370,14 +1370,14 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev)
etdev->TxRing.nBusySend--;
- spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
DBG_VERBOSE(et131x_dbginfo, "pMpTcb = 0x%p\n", pMpTcb);
FreeCounter++;
MP_FREE_SEND_PACKET_FUN(etdev, pMpTcb);
- spin_lock_irqsave(&etdev->TCBSendQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBSendQLock, flags);
pMpTcb = etdev->TxRing.CurrSendHead;
}
@@ -1388,7 +1388,7 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev)
BUG();
}
- spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
etdev->TxRing.nBusySend = 0;
@@ -1429,7 +1429,7 @@ void et131x_handle_send_interrupt(struct et131x_adapter *etdev)
*/
static void et131x_update_tcb_list(struct et131x_adapter *etdev)
{
- unsigned long lockflags;
+ unsigned long flags;
DMA10W_t ServiceComplete;
PMP_TCB pMpTcb;
@@ -1439,7 +1439,7 @@ static void et131x_update_tcb_list(struct et131x_adapter *etdev)
/* Has the ring wrapped? Process any descriptors that do not have
* the same "wrap" indicator as the current completion indicator
*/
- spin_lock_irqsave(&etdev->TCBSendQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBSendQLock, flags);
pMpTcb = etdev->TxRing.CurrSendHead;
while (pMpTcb &&
@@ -1450,9 +1450,9 @@ static void et131x_update_tcb_list(struct et131x_adapter *etdev)
if (pMpTcb->Next == NULL)
etdev->TxRing.CurrSendTail = NULL;
- spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
MP_FREE_SEND_PACKET_FUN(etdev, pMpTcb);
- spin_lock_irqsave(&etdev->TCBSendQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBSendQLock, flags);
/* Goto the next packet */
pMpTcb = etdev->TxRing.CurrSendHead;
@@ -1465,9 +1465,9 @@ static void et131x_update_tcb_list(struct et131x_adapter *etdev)
if (pMpTcb->Next == NULL)
etdev->TxRing.CurrSendTail = NULL;
- spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
MP_FREE_SEND_PACKET_FUN(etdev, pMpTcb);
- spin_lock_irqsave(&etdev->TCBSendQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBSendQLock, flags);
/* Goto the next packet */
pMpTcb = etdev->TxRing.CurrSendHead;
@@ -1477,7 +1477,7 @@ static void et131x_update_tcb_list(struct et131x_adapter *etdev)
if (etdev->TxRing.nBusySend <= (NUM_TCB / 3))
netif_wake_queue(etdev->netdev);
- spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
}
/**
@@ -1489,9 +1489,9 @@ static void et131x_update_tcb_list(struct et131x_adapter *etdev)
*/
static void et131x_check_send_wait_list(struct et131x_adapter *etdev)
{
- unsigned long lockflags;
+ unsigned long flags;
- spin_lock_irqsave(&etdev->SendWaitLock, lockflags);
+ spin_lock_irqsave(&etdev->SendWaitLock, flags);
while (!list_empty(&etdev->TxRing.SendWaitQueue) &&
MP_TCB_RESOURCES_AVAILABLE(etdev)) {
@@ -1508,5 +1508,5 @@ static void et131x_check_send_wait_list(struct et131x_adapter *etdev)
etdev->TxRing.nWaitSend);
}
- spin_unlock_irqrestore(&etdev->SendWaitLock, lockflags);
+ spin_unlock_irqrestore(&etdev->SendWaitLock, flags);
}
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index 8455e0a..b9018e6 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -492,18 +492,18 @@ void et131x_error_timer_handler(unsigned long data)
void et131x_link_detection_handler(unsigned long data)
{
struct et131x_adapter *etdev = (struct et131x_adapter *) data;
- unsigned long lockflags;
+ unsigned long flags;
/* Let everyone know that we have run */
etdev->bLinkTimerActive = false;
if (etdev->MediaState == 0) {
- spin_lock_irqsave(&etdev->Lock, lockflags);
+ spin_lock_irqsave(&etdev->Lock, flags);
etdev->MediaState = NETIF_STATUS_MEDIA_DISCONNECT;
MP_CLEAR_FLAG(etdev, fMP_ADAPTER_LINK_DETECTION);
- spin_unlock_irqrestore(&etdev->Lock, lockflags);
+ spin_unlock_irqrestore(&etdev->Lock, flags);
netif_carrier_off(etdev->netdev);
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index 77fac95..74ba177 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -467,12 +467,12 @@ void et131x_multicast(struct net_device *netdev)
struct et131x_adapter *adapter = netdev_priv(netdev);
uint32_t PacketFilter = 0;
uint32_t count;
- unsigned long lockflags;
+ unsigned long flags;
struct dev_mc_list *mclist = netdev->mc_list;
DBG_ENTER(et131x_dbginfo);
- spin_lock_irqsave(&adapter->Lock, lockflags);
+ spin_lock_irqsave(&adapter->Lock, flags);
/* Before we modify the platform-independent filter flags, store them
* locally. This allows us to determine if anything's changed and if
@@ -552,7 +552,7 @@ void et131x_multicast(struct net_device *netdev)
"NO UPDATE REQUIRED, FLAGS didn't change\n");
}
- spin_unlock_irqrestore(&adapter->Lock, lockflags);
+ spin_unlock_irqrestore(&adapter->Lock, flags);
DBG_LEAVE(et131x_dbginfo);
}
@@ -610,7 +610,7 @@ void et131x_tx_timeout(struct net_device *netdev)
{
struct et131x_adapter *etdev = netdev_priv(netdev);
PMP_TCB pMpTcb;
- unsigned long lockflags;
+ unsigned long flags;
DBG_WARNING(et131x_dbginfo, "TX TIMEOUT\n");
@@ -635,7 +635,7 @@ void et131x_tx_timeout(struct net_device *netdev)
}
/* Is send stuck? */
- spin_lock_irqsave(&etdev->TCBSendQLock, lockflags);
+ spin_lock_irqsave(&etdev->TCBSendQLock, flags);
pMpTcb = etdev->TxRing.CurrSendHead;
@@ -660,7 +660,7 @@ void et131x_tx_timeout(struct net_device *netdev)
}
spin_unlock_irqrestore(&etdev->TCBSendQLock,
- lockflags);
+ flags);
DBG_WARNING(et131x_dbginfo,
"Send stuck - reset. pMpTcb->WrIndex %x, Flags 0x%08x\n",
@@ -689,7 +689,7 @@ void et131x_tx_timeout(struct net_device *netdev)
}
}
- spin_unlock_irqrestore(&etdev->TCBSendQLock, lockflags);
+ spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
}
/**
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 03/26] et131x: power state
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
2009-08-25 14:57 ` [PATCH 01/26] et1310: kill pAdapter in favour of a sane name Alan Cox
2009-08-25 14:57 ` [PATCH 02/26] et131x: spinlocks Alan Cox
@ 2009-08-25 14:57 ` Alan Cox
2009-08-25 14:57 ` [PATCH 04/26] et131x: kill unused RCV_REF macros Alan Cox
` (22 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 14:57 UTC (permalink / raw)
To: greg, netdev
This is assigned once to ndis d0, and then never changes so it is a constant
and we can zap it
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_pm.h | 10 ----------
drivers/staging/et131x/et1310_rx.c | 2 --
drivers/staging/et131x/et131x_initpci.c | 2 --
drivers/staging/et131x/et131x_isr.c | 3 +--
4 files changed, 1 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/et131x/et1310_pm.h b/drivers/staging/et131x/et1310_pm.h
index dca9977..8e06039 100644
--- a/drivers/staging/et131x/et1310_pm.h
+++ b/drivers/staging/et131x/et1310_pm.h
@@ -66,15 +66,6 @@
#define NUM_WOL_PATTERNS 0x5
#define CRC16_POLY 0x1021
-/* Definition of NDIS_DEVICE_POWER_STATE */
-typedef enum {
- NdisDeviceStateUnspecified = 0,
- NdisDeviceStateD0,
- NdisDeviceStateD1,
- NdisDeviceStateD2,
- NdisDeviceStateD3
-} NDIS_DEVICE_POWER_STATE;
-
typedef struct _MP_POWER_MGMT {
/* variable putting the phy into coma mode when boot up with no cable
* plugged in after 5 seconds
@@ -97,7 +88,6 @@ typedef struct _MP_POWER_MGMT {
} IPAddress;
/* Current Power state of the adapter. */
- NDIS_DEVICE_POWER_STATE PowerState;
bool WOLState;
bool WOLEnabled;
bool Failed10Half;
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index 9dc08fb..b05b8c5 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -1235,13 +1235,11 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
break;
/* Do not receive any packets until a filter has been set.
- * Do not receive any packets until we are at D0.
* Do not receive any packets until we have link.
* If length is zero, return the RFD in order to advance the
* Free buffer ring.
*/
if ((!etdev->PacketFilter) ||
- (etdev->PoMgmt.PowerState != NdisDeviceStateD0) ||
(!MP_LINK_DETECTED(etdev)) ||
(pMpRfd->PacketSize == 0)) {
continue;
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index b9018e6..d84b654 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -967,8 +967,6 @@ int __devinit et131x_pci_setup(struct pci_dev *pdev,
DBG_TRACE(et131x_dbginfo, "Init send data structures...\n");
et131x_init_send(adapter);
- adapter->PoMgmt.PowerState = NdisDeviceStateD0;
-
/* Register the interrupt
*
* NOTE - This is being done in the open routine, where most other
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c
index 9f51425..f9687b3 100644
--- a/drivers/staging/et131x/et131x_isr.c
+++ b/drivers/staging/et131x/et131x_isr.c
@@ -479,6 +479,5 @@ void et131x_isr_handler(struct work_struct *work)
}
}
- if (etdev->PoMgmt.PowerState == NdisDeviceStateD0)
- et131x_enable_interrupts(etdev);
+ et131x_enable_interrupts(etdev);
}
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 04/26] et131x: kill unused RCV_REF macros
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (2 preceding siblings ...)
2009-08-25 14:57 ` [PATCH 03/26] et131x: power state Alan Cox
@ 2009-08-25 14:57 ` Alan Cox
2009-08-25 14:58 ` [PATCH 05/26] et131x: kill refcount Alan Cox
` (21 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 14:57 UTC (permalink / raw)
To: greg, netdev
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et131x_adapter.h | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index 2b55319..82686ea 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -108,8 +108,6 @@
#define MP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F))
#define MP_IS_FLAG_CLEAR(_M, _F) (((_M)->Flags & (_F)) == 0)
-#define MP_INC_RCV_REF(_A) atomic_inc(&(_A)->RcvRefCount)
-#define MP_DEC_RCV_REF(_A) atomic_dec(&(_A)->RcvRefCount)
#define MP_GET_RCV_REF(_A) atomic_read(&(_A)->RcvRefCount)
/* Macros specific to the private adapter structure */
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 05/26] et131x: kill refcount
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (3 preceding siblings ...)
2009-08-25 14:57 ` [PATCH 04/26] et131x: kill unused RCV_REF macros Alan Cox
@ 2009-08-25 14:58 ` Alan Cox
2009-08-25 14:58 ` [PATCH 06/26] et131x: MPSend macros Alan Cox
` (20 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 14:58 UTC (permalink / raw)
To: greg, netdev
The RefCount field is accessed only by a macro and the only use of it in
the tree is to read it, so it can go
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_pm.c | 2 --
drivers/staging/et131x/et1310_rx.c | 7 -------
drivers/staging/et131x/et131x_adapter.h | 4 ----
3 files changed, 0 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/et131x/et1310_pm.c b/drivers/staging/et131x/et1310_pm.c
index a507411..848d6b0 100644
--- a/drivers/staging/et131x/et1310_pm.c
+++ b/drivers/staging/et131x/et1310_pm.c
@@ -139,8 +139,6 @@ void EnablePhyComa(struct et131x_adapter *etdev)
spin_unlock_irqrestore(&etdev->SendHWLock, flags);
/* Wait for outstanding Receive packets */
- while ((MP_GET_RCV_REF(etdev) != 0) && (LoopCounter-- > 0))
- mdelay(2);
/* Gate off JAGCore 3 clock domains */
GlobalPmCSR.bits.pm_sysclk_gate = 0;
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index b05b8c5..6423552 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -1258,13 +1258,6 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
* Besides, we don't really need (at this point) the
* pending list anyway.
*/
- /* spin_lock_irqsave( &etdev->RcvPendLock, flags );
- * list_add_tail( &pMpRfd->list_node, &etdev->RxRing.RecvPendingList );
- * spin_unlock_irqrestore( &etdev->RcvPendLock, flags );
- */
-
- /* Update the number of outstanding Recvs */
- /* MP_INC_RCV_REF( etdev ); */
} else {
RFDFreeArray[PacketFreeCount] = pMpRfd;
PacketFreeCount++;
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index 82686ea..04de4ff 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -108,8 +108,6 @@
#define MP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F))
#define MP_IS_FLAG_CLEAR(_M, _F) (((_M)->Flags & (_F)) == 0)
-#define MP_GET_RCV_REF(_A) atomic_read(&(_A)->RcvRefCount)
-
/* Macros specific to the private adapter structure */
#define MP_TCB_RESOURCES_AVAILABLE(_M) ((_M)->TxRing.nBusySend < NUM_TCB)
#define MP_TCB_RESOURCES_NOT_AVAILABLE(_M) ((_M)->TxRing.nBusySend >= NUM_TCB)
@@ -311,8 +309,6 @@ struct et131x_adapter {
MP_POWER_MGMT PoMgmt;
INTERRUPT_t CachedMaskValue;
- atomic_t RcvRefCount; /* Num packets not yet returned */
-
/* Xcvr status at last poll */
MI_BMSR_t Bmsr;
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 06/26] et131x: MPSend macros
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (4 preceding siblings ...)
2009-08-25 14:58 ` [PATCH 05/26] et131x: kill refcount Alan Cox
@ 2009-08-25 14:58 ` Alan Cox
2009-08-25 14:58 ` [PATCH 07/26] et131x: kill copied PCI fields Alan Cox
` (19 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 14:58 UTC (permalink / raw)
To: greg, netdev
Most are unused, one is used and can be replaced with the definition
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_tx.c | 8 ++++----
drivers/staging/et131x/et131x_adapter.h | 5 -----
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c
index a017d27..43f5b62 100644
--- a/drivers/staging/et131x/et1310_tx.c
+++ b/drivers/staging/et131x/et1310_tx.c
@@ -1375,7 +1375,7 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev)
DBG_VERBOSE(et131x_dbginfo, "pMpTcb = 0x%p\n", pMpTcb);
FreeCounter++;
- MP_FREE_SEND_PACKET_FUN(etdev, pMpTcb);
+ et131x_free_send_packet(etdev, pMpTcb);
spin_lock_irqsave(&etdev->TCBSendQLock, flags);
@@ -1384,7 +1384,7 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev)
if (FreeCounter == NUM_TCB) {
DBG_ERROR(et131x_dbginfo,
- "MpFreeBusySendPackets exitted loop for a bad reason\n");
+ "MpFreeBusySendPackets exited loop for a bad reason\n");
BUG();
}
@@ -1451,7 +1451,7 @@ static void et131x_update_tcb_list(struct et131x_adapter *etdev)
etdev->TxRing.CurrSendTail = NULL;
spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
- MP_FREE_SEND_PACKET_FUN(etdev, pMpTcb);
+ et131x_free_send_packet(etdev, pMpTcb);
spin_lock_irqsave(&etdev->TCBSendQLock, flags);
/* Goto the next packet */
@@ -1466,7 +1466,7 @@ static void et131x_update_tcb_list(struct et131x_adapter *etdev)
etdev->TxRing.CurrSendTail = NULL;
spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
- MP_FREE_SEND_PACKET_FUN(etdev, pMpTcb);
+ et131x_free_send_packet(etdev, pMpTcb);
spin_lock_irqsave(&etdev->TCBSendQLock, flags);
/* Goto the next packet */
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index 04de4ff..df4a625 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -333,9 +333,4 @@ struct et131x_adapter {
struct net_device_stats net_stats_prev;
};
-#define MPSendPacketsHandler MPSendPackets
-#define MP_FREE_SEND_PACKET_FUN(Adapter, pMpTcb) \
- et131x_free_send_packet(Adapter, pMpTcb)
-#define MpSendPacketFun(Adapter, Packet) MpSendPacket(Adapter, Packet)
-
#endif /* __ET131X_ADAPTER_H__ */
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 07/26] et131x: kill copied PCI fields
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (5 preceding siblings ...)
2009-08-25 14:58 ` [PATCH 06/26] et131x: MPSend macros Alan Cox
@ 2009-08-25 14:58 ` Alan Cox
2009-08-25 14:58 ` [PATCH 08/26] et131x: Take a kref for the PCI pointer we cache Alan Cox
` (18 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 14:58 UTC (permalink / raw)
To: greg, netdev
They are all in the pcidev anyway plus are not used by the code
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_eeprom.c | 2 +-
drivers/staging/et131x/et1310_phy.c | 2 +-
drivers/staging/et131x/et131x_adapter.h | 13 -------------
drivers/staging/et131x/et131x_config.c | 3 ++-
drivers/staging/et131x/et131x_initpci.c | 20 ++++----------------
5 files changed, 8 insertions(+), 32 deletions(-)
diff --git a/drivers/staging/et131x/et1310_eeprom.c b/drivers/staging/et131x/et1310_eeprom.c
index 9a6dbd6..29d1c0e 100644
--- a/drivers/staging/et131x/et1310_eeprom.c
+++ b/drivers/staging/et131x/et1310_eeprom.c
@@ -292,7 +292,7 @@ int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress,
* so we do a blind write for load bug.
*/
if (bStatus & LBCIF_STATUS_GENERAL_ERROR
- && etdev->RevisionID == 0) {
+ && etdev->pdev->revision == 0) {
break;
}
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index d9c7a44..63a23b9 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -841,7 +841,7 @@ void TPAL_SetPhyAutoNeg(struct et131x_adapter *etdev)
ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_BOTH);
- if (etdev->DeviceID != ET131X_PCI_DEVICE_ID_FAST)
+ if (etdev->pdev->device != ET131X_PCI_DEVICE_ID_FAST)
ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL);
else
ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index df4a625..69509d7 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -250,19 +250,6 @@ struct et131x_adapter {
/* Pointer to the device's PCI register space */
ADDRESS_MAP_t __iomem *CSRAddress;
- /* PCI config space info, for debug purposes only. */
- u8 RevisionID;
- u16 VendorID;
- u16 DeviceID;
- u16 SubVendorID;
- u16 SubSystemID;
- u32 CacheFillSize;
- u16 PciXDevCtl;
- u8 pci_lat_timer;
- u8 pci_hdr_type;
- u8 pci_bist;
- u32 pci_cfg_state[64 / sizeof(u32)];
-
/* Registry parameters */
u8 SpeedDuplex; /* speed/duplex */
eFLOW_CONTROL_t RegistryFlowControl; /* for 802.3x flow control */
diff --git a/drivers/staging/et131x/et131x_config.c b/drivers/staging/et131x/et131x_config.c
index 148672b..499cf75 100644
--- a/drivers/staging/et131x/et131x_config.c
+++ b/drivers/staging/et131x/et131x_config.c
@@ -76,6 +76,7 @@
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/bitops.h>
+#include <linux/pci.h>
#include <asm/system.h>
#include <linux/netdevice.h>
@@ -288,7 +289,7 @@ void et131x_config_parse(struct et131x_adapter *etdev)
/* If we are the 10/100 device, and gigabit is somehow requested then
* knock it down to 100 full.
*/
- if (etdev->DeviceID == ET131X_PCI_DEVICE_ID_FAST &&
+ if (etdev->pdev->device == ET131X_PCI_DEVICE_ID_FAST &&
etdev->SpeedDuplex == 5)
etdev->SpeedDuplex = 4;
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index d84b654..86bd55d 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -240,6 +240,7 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev)
uint8_t eepromStat;
uint8_t maxPayload = 0;
uint8_t read_size_reg;
+ u8 rev;
DBG_ENTER(et131x_dbginfo);
@@ -283,15 +284,14 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev)
* present, we need to fail.
*/
if (eepromStat & 0x4C) {
- result = pci_read_config_byte(pdev, PCI_REVISION_ID,
- &adapter->RevisionID);
+ result = pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
if (result != PCIBIOS_SUCCESSFUL) {
DBG_ERROR(et131x_dbginfo,
"Could not read PCI config space for "
"Revision ID\n");
DBG_LEAVE(et131x_dbginfo);
return -EIO;
- } else if (adapter->RevisionID == 0x01) {
+ } else if (rev == 0x01) {
int32_t nLoop;
uint8_t ucTemp[4] = { 0xFE, 0x13, 0x10, 0xFF };
@@ -405,16 +405,6 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev)
return -EIO;
}
- /* PCI Express Configuration registers 0x48-0x5B (Device Control) */
- result = pci_read_config_word(pdev, ET1310_PCI_DEV_CTRL,
- &adapter->PciXDevCtl);
- if (result != PCIBIOS_SUCCESSFUL) {
- DBG_ERROR(et131x_dbginfo,
- "Could not read PCI config space for PCI Express Dev Ctl\n");
- DBG_LEAVE(et131x_dbginfo);
- return -EIO;
- }
-
/* Get MAC address from config space if an eeprom exists, otherwise
* the MAC address there will not be valid
*/
@@ -556,7 +546,7 @@ int et131x_adapter_setup(struct et131x_adapter *etdev)
* We need to turn off 1000 base half dulplex, the mac does not
* support it. For the 10/100 part, turn off all gig advertisement
*/
- if (etdev->DeviceID != ET131X_PCI_DEVICE_ID_FAST)
+ if (etdev->pdev->device != ET131X_PCI_DEVICE_ID_FAST)
ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL);
else
ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE);
@@ -890,8 +880,6 @@ int __devinit et131x_pci_setup(struct pci_dev *pdev,
adapter = netdev_priv(netdev);
adapter->pdev = pdev;
adapter->netdev = netdev;
- adapter->VendorID = pdev->vendor;
- adapter->DeviceID = pdev->device;
/* Do the same for the netdev struct */
netdev->irq = pdev->irq;
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 08/26] et131x: Take a kref for the PCI pointer we cache
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (6 preceding siblings ...)
2009-08-25 14:58 ` [PATCH 07/26] et131x: kill copied PCI fields Alan Cox
@ 2009-08-25 14:58 ` Alan Cox
2009-08-25 14:58 ` [PATCH 09/26] et131x: CSRAddress to regs Alan Cox
` (17 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 14:58 UTC (permalink / raw)
To: greg, netdev
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et131x_initpci.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index 86bd55d..5485dd7 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -742,6 +742,7 @@ void __devexit et131x_pci_remove(struct pci_dev *pdev)
unregister_netdev(netdev);
et131x_adapter_memory_free(adapter);
iounmap(adapter->CSRAddress);
+ pci_dev_put(adapter->pdev);
free_netdev(netdev);
pci_release_regions(pdev);
pci_disable_device(pdev);
@@ -878,7 +879,7 @@ int __devinit et131x_pci_setup(struct pci_dev *pdev,
/* Allocate private adapter struct and copy in relevant information */
adapter = netdev_priv(netdev);
- adapter->pdev = pdev;
+ adapter->pdev = pci_dev_get(pdev);
adapter->netdev = netdev;
/* Do the same for the netdev struct */
@@ -1022,6 +1023,7 @@ err_mem_free:
err_iounmap:
iounmap(adapter->CSRAddress);
err_free_dev:
+ pci_dev_put(pdev);
free_netdev(netdev);
err_release_res:
pci_release_regions(pdev);
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 09/26] et131x: CSRAddress to regs
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (7 preceding siblings ...)
2009-08-25 14:58 ` [PATCH 08/26] et131x: Take a kref for the PCI pointer we cache Alan Cox
@ 2009-08-25 14:58 ` Alan Cox
2009-08-25 14:59 ` [PATCH 10/26] et131x: Eliminate RegistryDMA Cache Alan Cox
` (16 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 14:58 UTC (permalink / raw)
To: greg, netdev
Switch this to a Linux like naming as it occurs all over.
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_jagcore.c | 8 ++++----
drivers/staging/et131x/et1310_mac.c | 32 ++++++++++++++++---------------
drivers/staging/et131x/et1310_phy.c | 4 ++--
drivers/staging/et131x/et1310_pm.c | 10 +++++-----
drivers/staging/et131x/et1310_rx.c | 26 +++++++++++++------------
drivers/staging/et131x/et1310_tx.c | 20 ++++++++++---------
drivers/staging/et131x/et131x_adapter.h | 2 +-
drivers/staging/et131x/et131x_debug.c | 8 ++++----
drivers/staging/et131x/et131x_initpci.c | 20 ++++++++++---------
drivers/staging/et131x/et131x_isr.c | 6 +++---
drivers/staging/et131x/et131x_netdev.c | 8 ++++----
11 files changed, 72 insertions(+), 72 deletions(-)
diff --git a/drivers/staging/et131x/et1310_jagcore.c b/drivers/staging/et131x/et1310_jagcore.c
index 3b4b273..4032589 100644
--- a/drivers/staging/et131x/et1310_jagcore.c
+++ b/drivers/staging/et131x/et1310_jagcore.c
@@ -101,7 +101,7 @@ extern dbg_info_t *et131x_dbginfo;
*/
void ConfigGlobalRegs(struct et131x_adapter *etdev)
{
- struct _GLOBAL_t __iomem *pGbl = &etdev->CSRAddress->global;
+ struct _GLOBAL_t __iomem *pGbl = &etdev->regs->global;
DBG_ENTER(et131x_dbginfo);
@@ -188,7 +188,7 @@ void ConfigMMCRegs(struct et131x_adapter *etdev)
mmc_ctrl.bits.arb_disable = 0x0;
mmc_ctrl.bits.mmc_enable = 0x1;
- writel(mmc_ctrl.value, &etdev->CSRAddress->mmc.mmc_ctrl.value);
+ writel(mmc_ctrl.value, &etdev->regs->mmc.mmc_ctrl.value);
DBG_LEAVE(et131x_dbginfo);
}
@@ -207,12 +207,12 @@ void et131x_enable_interrupts(struct et131x_adapter *adapter)
MaskValue |= 0x10000;
adapter->CachedMaskValue.value = MaskValue;
- writel(MaskValue, &adapter->CSRAddress->global.int_mask.value);
+ writel(MaskValue, &adapter->regs->global.int_mask.value);
}
void et131x_disable_interrupts(struct et131x_adapter *adapter)
{
/* Disable all global interrupts */
adapter->CachedMaskValue.value = INT_MASK_DISABLE;
- writel(INT_MASK_DISABLE, &adapter->CSRAddress->global.int_mask.value);
+ writel(INT_MASK_DISABLE, &adapter->regs->global.int_mask.value);
}
diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index 4cb4cfc..9461a2d 100644
--- a/drivers/staging/et131x/et1310_mac.c
+++ b/drivers/staging/et131x/et1310_mac.c
@@ -103,7 +103,7 @@ extern dbg_info_t *et131x_dbginfo;
*/
void ConfigMACRegs1(struct et131x_adapter *etdev)
{
- struct _MAC_t __iomem *pMac = &etdev->CSRAddress->mac;
+ struct _MAC_t __iomem *pMac = &etdev->regs->mac;
MAC_STATION_ADDR1_t station1;
MAC_STATION_ADDR2_t station2;
MAC_IPG_t ipg;
@@ -182,7 +182,7 @@ void ConfigMACRegs1(struct et131x_adapter *etdev)
void ConfigMACRegs2(struct et131x_adapter *etdev)
{
int32_t delay = 0;
- struct _MAC_t __iomem *pMac = &etdev->CSRAddress->mac;
+ struct _MAC_t __iomem *pMac = &etdev->regs->mac;
MAC_CFG1_t cfg1;
MAC_CFG2_t cfg2;
MAC_IF_CTRL_t ifctrl;
@@ -190,7 +190,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
DBG_ENTER(et131x_dbginfo);
- ctl.value = readl(&etdev->CSRAddress->txmac.ctl.value);
+ ctl.value = readl(&etdev->regs->txmac.ctl.value);
cfg1.value = readl(&pMac->cfg1.value);
cfg2.value = readl(&pMac->cfg2.value);
ifctrl.value = readl(&pMac->if_ctrl.value);
@@ -269,7 +269,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
/* Enable TXMAC */
ctl.bits.txmac_en = 0x1;
ctl.bits.fc_disable = 0x1;
- writel(ctl.value, &etdev->CSRAddress->txmac.ctl.value);
+ writel(ctl.value, &etdev->regs->txmac.ctl.value);
/* Ready to start the RXDMA/TXDMA engine */
if (!MP_TEST_FLAG(etdev, fMP_ADAPTER_LOWER_POWER)) {
@@ -285,7 +285,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
void ConfigRxMacRegs(struct et131x_adapter *etdev)
{
- struct _RXMAC_t __iomem *pRxMac = &etdev->CSRAddress->rxmac;
+ struct _RXMAC_t __iomem *pRxMac = &etdev->regs->rxmac;
RXMAC_WOL_SA_LO_t sa_lo;
RXMAC_WOL_SA_HI_t sa_hi;
RXMAC_PF_CTRL_t pf_ctrl = { 0 };
@@ -427,7 +427,7 @@ void ConfigRxMacRegs(struct et131x_adapter *etdev)
void ConfigTxMacRegs(struct et131x_adapter *etdev)
{
- struct _TXMAC_t __iomem *pTxMac = &etdev->CSRAddress->txmac;
+ struct _TXMAC_t __iomem *pTxMac = &etdev->regs->txmac;
TXMAC_CF_PARAM_t Local;
DBG_ENTER(et131x_dbginfo);
@@ -450,7 +450,7 @@ void ConfigTxMacRegs(struct et131x_adapter *etdev)
void ConfigMacStatRegs(struct et131x_adapter *etdev)
{
struct _MAC_STAT_t __iomem *pDevMacStat =
- &etdev->CSRAddress->macStat;
+ &etdev->regs->macStat;
DBG_ENTER(et131x_dbginfo);
@@ -581,7 +581,7 @@ void UpdateMacStatHostCounters(struct et131x_adapter *etdev)
{
struct _ce_stats_t *stats = &etdev->Stats;
struct _MAC_STAT_t __iomem *pDevMacStat =
- &etdev->CSRAddress->macStat;
+ &etdev->regs->macStat;
stats->collisions += readl(&pDevMacStat->TNcl);
stats->first_collision += readl(&pDevMacStat->TScl);
@@ -619,11 +619,11 @@ void HandleMacStatInterrupt(struct et131x_adapter *etdev)
/* Read the interrupt bits from the register(s). These are Clear On
* Write.
*/
- Carry1.value = readl(&etdev->CSRAddress->macStat.Carry1.value);
- Carry2.value = readl(&etdev->CSRAddress->macStat.Carry2.value);
+ Carry1.value = readl(&etdev->regs->macStat.Carry1.value);
+ Carry2.value = readl(&etdev->regs->macStat.Carry2.value);
- writel(Carry1.value, &etdev->CSRAddress->macStat.Carry1.value);
- writel(Carry2.value, &etdev->CSRAddress->macStat.Carry2.value);
+ writel(Carry1.value, &etdev->regs->macStat.Carry1.value);
+ writel(Carry2.value, &etdev->regs->macStat.Carry2.value);
/* We need to do update the host copy of all the MAC_STAT counters.
* For each counter, check it's overflow bit. If the overflow bit is
@@ -665,7 +665,7 @@ void HandleMacStatInterrupt(struct et131x_adapter *etdev)
void SetupDeviceForMulticast(struct et131x_adapter *etdev)
{
- struct _RXMAC_t __iomem *rxmac = &etdev->CSRAddress->rxmac;
+ struct _RXMAC_t __iomem *rxmac = &etdev->regs->rxmac;
uint32_t nIndex;
uint32_t result;
uint32_t hash1 = 0;
@@ -718,7 +718,7 @@ void SetupDeviceForMulticast(struct et131x_adapter *etdev)
}
/* Write out the new hash to the device */
- pm_csr.value = readl(&etdev->CSRAddress->global.pm_csr.value);
+ pm_csr.value = readl(&etdev->regs->global.pm_csr.value);
if (pm_csr.bits.pm_phy_sw_coma == 0) {
writel(hash1, &rxmac->multi_hash1);
writel(hash2, &rxmac->multi_hash2);
@@ -731,7 +731,7 @@ void SetupDeviceForMulticast(struct et131x_adapter *etdev)
void SetupDeviceForUnicast(struct et131x_adapter *etdev)
{
- struct _RXMAC_t __iomem *rxmac = &etdev->CSRAddress->rxmac;
+ struct _RXMAC_t __iomem *rxmac = &etdev->regs->rxmac;
RXMAC_UNI_PF_ADDR1_t uni_pf1;
RXMAC_UNI_PF_ADDR2_t uni_pf2;
RXMAC_UNI_PF_ADDR3_t uni_pf3;
@@ -763,7 +763,7 @@ void SetupDeviceForUnicast(struct et131x_adapter *etdev)
uni_pf1.bits.addr1_5 = etdev->CurrentAddress[4];
uni_pf1.bits.addr1_6 = etdev->CurrentAddress[5];
- pm_csr.value = readl(&etdev->CSRAddress->global.pm_csr.value);
+ pm_csr.value = readl(&etdev->regs->global.pm_csr.value);
if (pm_csr.bits.pm_phy_sw_coma == 0) {
writel(uni_pf1.value, &rxmac->uni_pf_addr1.value);
writel(uni_pf2.value, &rxmac->uni_pf_addr2.value);
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index 63a23b9..d0a3c83 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -118,7 +118,7 @@ static int et131x_xcvr_init(struct et131x_adapter *adapter);
int PhyMiRead(struct et131x_adapter *adapter, uint8_t xcvrAddr,
uint8_t xcvrReg, uint16_t *value)
{
- struct _MAC_t __iomem *mac = &adapter->CSRAddress->mac;
+ struct _MAC_t __iomem *mac = &adapter->regs->mac;
int status = 0;
uint32_t delay;
MII_MGMT_ADDR_t miiAddr;
@@ -202,7 +202,7 @@ int PhyMiRead(struct et131x_adapter *adapter, uint8_t xcvrAddr,
*/
int MiWrite(struct et131x_adapter *adapter, uint8_t xcvrReg, uint16_t value)
{
- struct _MAC_t __iomem *mac = &adapter->CSRAddress->mac;
+ struct _MAC_t __iomem *mac = &adapter->regs->mac;
int status = 0;
uint8_t xcvrAddr = adapter->Stats.xcvr_addr;
uint32_t delay;
diff --git a/drivers/staging/et131x/et1310_pm.c b/drivers/staging/et131x/et1310_pm.c
index 848d6b0..846c80b 100644
--- a/drivers/staging/et131x/et1310_pm.c
+++ b/drivers/staging/et131x/et1310_pm.c
@@ -125,7 +125,7 @@ void EnablePhyComa(struct et131x_adapter *etdev)
DBG_ENTER(et131x_dbginfo);
- GlobalPmCSR.value = readl(&etdev->CSRAddress->global.pm_csr.value);
+ GlobalPmCSR.value = readl(&etdev->regs->global.pm_csr.value);
/* Save the GbE PHY speed and duplex modes. Need to restore this
* when cable is plugged back in
@@ -144,11 +144,11 @@ void EnablePhyComa(struct et131x_adapter *etdev)
GlobalPmCSR.bits.pm_sysclk_gate = 0;
GlobalPmCSR.bits.pm_txclk_gate = 0;
GlobalPmCSR.bits.pm_rxclk_gate = 0;
- writel(GlobalPmCSR.value, &etdev->CSRAddress->global.pm_csr.value);
+ writel(GlobalPmCSR.value, &etdev->regs->global.pm_csr.value);
/* Program gigE PHY in to Coma mode */
GlobalPmCSR.bits.pm_phy_sw_coma = 1;
- writel(GlobalPmCSR.value, &etdev->CSRAddress->global.pm_csr.value);
+ writel(GlobalPmCSR.value, &etdev->regs->global.pm_csr.value);
DBG_LEAVE(et131x_dbginfo);
}
@@ -163,14 +163,14 @@ void DisablePhyComa(struct et131x_adapter *etdev)
DBG_ENTER(et131x_dbginfo);
- GlobalPmCSR.value = readl(&etdev->CSRAddress->global.pm_csr.value);
+ GlobalPmCSR.value = readl(&etdev->regs->global.pm_csr.value);
/* Disable phy_sw_coma register and re-enable JAGCore clocks */
GlobalPmCSR.bits.pm_sysclk_gate = 1;
GlobalPmCSR.bits.pm_txclk_gate = 1;
GlobalPmCSR.bits.pm_rxclk_gate = 1;
GlobalPmCSR.bits.pm_phy_sw_coma = 0;
- writel(GlobalPmCSR.value, &etdev->CSRAddress->global.pm_csr.value);
+ writel(GlobalPmCSR.value, &etdev->regs->global.pm_csr.value);
/* Restore the GbE PHY speed and duplex modes;
* Reset JAGCore; re-configure and initialize JAGCore and gigE PHY
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index 6423552..c60e05e 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -680,7 +680,7 @@ void et131x_rfd_resources_free(struct et131x_adapter *adapter, MP_RFD *pMpRfd)
*/
void ConfigRxDmaRegs(struct et131x_adapter *etdev)
{
- struct _RXDMA_t __iomem *pRxDma = &etdev->CSRAddress->rxdma;
+ struct _RXDMA_t __iomem *pRxDma = &etdev->regs->rxdma;
struct _rx_ring_t *pRxLocal = &etdev->RxRing;
PFBR_DESC_t pFbrEntry;
uint32_t iEntry;
@@ -817,8 +817,8 @@ void SetRxDmaTimer(struct et131x_adapter *etdev)
*/
if ((etdev->uiLinkSpeed == TRUEPHY_SPEED_100MBPS) ||
(etdev->uiLinkSpeed == TRUEPHY_SPEED_10MBPS)) {
- writel(0, &etdev->CSRAddress->rxdma.max_pkt_time.value);
- writel(1, &etdev->CSRAddress->rxdma.num_pkt_done.value);
+ writel(0, &etdev->regs->rxdma.max_pkt_time.value);
+ writel(1, &etdev->regs->rxdma.num_pkt_done.value);
}
}
@@ -833,11 +833,11 @@ void et131x_rx_dma_disable(struct et131x_adapter *etdev)
DBG_ENTER(et131x_dbginfo);
/* Setup the receive dma configuration register */
- writel(0x00002001, &etdev->CSRAddress->rxdma.csr.value);
- csr.value = readl(&etdev->CSRAddress->rxdma.csr.value);
+ writel(0x00002001, &etdev->regs->rxdma.csr.value);
+ csr.value = readl(&etdev->regs->rxdma.csr.value);
if (csr.bits.halt_status != 1) {
udelay(5);
- csr.value = readl(&etdev->CSRAddress->rxdma.csr.value);
+ csr.value = readl(&etdev->regs->rxdma.csr.value);
if (csr.bits.halt_status != 1)
DBG_ERROR(et131x_dbginfo,
"RX Dma failed to enter halt state. CSR 0x%08x\n",
@@ -857,7 +857,7 @@ void et131x_rx_dma_enable(struct et131x_adapter *etdev)
if (etdev->RegistryPhyLoopbk)
/* RxDMA is disabled for loopback operation. */
- writel(0x1, &etdev->CSRAddress->rxdma.csr.value);
+ writel(0x1, &etdev->regs->rxdma.csr.value);
else {
/* Setup the receive dma configuration register for normal operation */
RXDMA_CSR_t csr = { 0 };
@@ -878,12 +878,12 @@ void et131x_rx_dma_enable(struct et131x_adapter *etdev)
else if (etdev->RxRing.Fbr0BufferSize == 1024)
csr.bits.fbr0_size = 3;
#endif
- writel(csr.value, &etdev->CSRAddress->rxdma.csr.value);
+ writel(csr.value, &etdev->regs->rxdma.csr.value);
- csr.value = readl(&etdev->CSRAddress->rxdma.csr.value);
+ csr.value = readl(&etdev->regs->rxdma.csr.value);
if (csr.bits.halt_status != 0) {
udelay(5);
- csr.value = readl(&etdev->CSRAddress->rxdma.csr.value);
+ csr.value = readl(&etdev->regs->rxdma.csr.value);
if (csr.bits.halt_status != 0) {
DBG_ERROR(et131x_dbginfo,
"RX Dma failed to exit halt state. CSR 0x%08x\n",
@@ -978,7 +978,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev)
}
writel(pRxLocal->local_psr_full.value,
- &etdev->CSRAddress->rxdma.psr_full_offset.value);
+ &etdev->regs->rxdma.psr_full_offset.value);
#ifndef USE_FBR0
if (ringIndex != 1) {
@@ -1273,7 +1273,7 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
if ((PacketArrayCount == NUM_PACKETS_HANDLED) || TempUnfinishedRec) {
etdev->RxRing.UnfinishedReceives = true;
writel(etdev->RegistryTxTimeInterval * NANO_IN_A_MICRO,
- &etdev->CSRAddress->global.watchdog_timer);
+ &etdev->regs->global.watchdog_timer);
} else {
/* Watchdog timer will disable itself if appropriate. */
etdev->RxRing.UnfinishedReceives = false;
@@ -1290,7 +1290,7 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd)
{
struct _rx_ring_t *pRxLocal = &etdev->RxRing;
- struct _RXDMA_t __iomem *pRxDma = &etdev->CSRAddress->rxdma;
+ struct _RXDMA_t __iomem *pRxDma = &etdev->regs->rxdma;
uint16_t bi = pMpRfd->iBufferIndex;
uint8_t ri = pMpRfd->iRingIndex;
unsigned long flags;
diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c
index 43f5b62..0dbb824 100644
--- a/drivers/staging/et131x/et1310_tx.c
+++ b/drivers/staging/et131x/et1310_tx.c
@@ -249,7 +249,7 @@ void et131x_tx_dma_memory_free(struct et131x_adapter *adapter)
*/
void ConfigTxDmaRegs(struct et131x_adapter *etdev)
{
- struct _TXDMA_t __iomem *pTxDma = &etdev->CSRAddress->txdma;
+ struct _TXDMA_t __iomem *pTxDma = &etdev->regs->txdma;
DBG_ENTER(et131x_dbginfo);
@@ -289,7 +289,7 @@ void et131x_tx_dma_disable(struct et131x_adapter *etdev)
DBG_ENTER(et131x_dbginfo);
/* Setup the tramsmit dma configuration register */
- writel(0x101, &etdev->CSRAddress->txdma.csr.value);
+ writel(0x101, &etdev->regs->txdma.csr.value);
DBG_LEAVE(et131x_dbginfo);
}
@@ -306,7 +306,7 @@ void et131x_tx_dma_enable(struct et131x_adapter *etdev)
if (etdev->RegistryPhyLoopbk) {
/* TxDMA is disabled for loopback operation. */
- writel(0x101, &etdev->CSRAddress->txdma.csr.value);
+ writel(0x101, &etdev->regs->txdma.csr.value);
} else {
TXDMA_CSR_t csr = { 0 };
@@ -316,7 +316,7 @@ void et131x_tx_dma_enable(struct et131x_adapter *etdev)
csr.bits.sngl_epkt_mode = 1;
csr.bits.halt = 0;
csr.bits.cache_thrshld = etdev->RegistryDMACache;
- writel(csr.value, &etdev->CSRAddress->txdma.csr.value);
+ writel(csr.value, &etdev->regs->txdma.csr.value);
}
DBG_LEAVE(et131x_dbginfo);
@@ -788,14 +788,14 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
/* Write the new write pointer back to the device. */
writel(etdev->TxRing.txDmaReadyToSend.value,
- &etdev->CSRAddress->txdma.service_request.value);
+ &etdev->regs->txdma.service_request.value);
/* For Gig only, we use Tx Interrupt coalescing. Enable the software
* timer to wake us up if this packet isn't followed by N more.
*/
if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
writel(etdev->RegistryTxTimeInterval * NANO_IN_A_MICRO,
- &etdev->CSRAddress->global.watchdog_timer);
+ &etdev->regs->global.watchdog_timer);
}
spin_unlock_irqrestore(&etdev->SendHWLock, flags);
@@ -837,7 +837,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
DBG_TX_ENTER(et131x_dbginfo);
ServiceComplete.value =
- readl(&etdev->CSRAddress->txdma.NewServiceComplete.value);
+ readl(&etdev->regs->txdma.NewServiceComplete.value);
/*
* Attempt to fix TWO hardware bugs:
@@ -1202,7 +1202,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
/* Write the new write pointer back to the device. */
writel(etdev->TxRing.txDmaReadyToSend.value,
- &etdev->CSRAddress->txdma.service_request.value);
+ &etdev->regs->txdma.service_request.value);
#ifdef CONFIG_ET131X_DEBUG
DumpDeviceBlock(DBG_TX_ON, etdev, 1);
@@ -1213,7 +1213,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
*/
if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
writel(etdev->RegistryTxTimeInterval * NANO_IN_A_MICRO,
- &etdev->CSRAddress->global.watchdog_timer);
+ &etdev->regs->global.watchdog_timer);
}
spin_unlock_irqrestore(&etdev->SendHWLock, flags);
@@ -1434,7 +1434,7 @@ static void et131x_update_tcb_list(struct et131x_adapter *etdev)
PMP_TCB pMpTcb;
ServiceComplete.value =
- readl(&etdev->CSRAddress->txdma.NewServiceComplete.value);
+ readl(&etdev->regs->txdma.NewServiceComplete.value);
/* Has the ring wrapped? Process any descriptors that do not have
* the same "wrap" indicator as the current completion indicator
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index 69509d7..70a90b8 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -248,7 +248,7 @@ struct et131x_adapter {
TXMAC_TXTEST_t TxMacTest;
/* Pointer to the device's PCI register space */
- ADDRESS_MAP_t __iomem *CSRAddress;
+ ADDRESS_MAP_t __iomem *regs;
/* Registry parameters */
u8 SpeedDuplex; /* speed/duplex */
diff --git a/drivers/staging/et131x/et131x_debug.c b/drivers/staging/et131x/et131x_debug.c
index 2730b9c..4346c82 100644
--- a/drivers/staging/et131x/et131x_debug.c
+++ b/drivers/staging/et131x/et131x_debug.c
@@ -110,7 +110,7 @@ extern dbg_info_t *et131x_dbginfo;
*/
void DumpTxQueueContents(int dbgLvl, struct et131x_adapter *etdev)
{
- MMC_t __iomem *mmc = &etdev->CSRAddress->mmc;
+ MMC_t __iomem *mmc = &etdev->regs->mmc;
uint32_t TxQueueAddr;
if (DBG_FLAGS(et131x_dbginfo) & dbgLvl) {
@@ -134,7 +134,7 @@ void DumpTxQueueContents(int dbgLvl, struct et131x_adapter *etdev)
}
DBG_PRINT("Shadow Pointers 0x%08x\n",
- readl(&etdev->CSRAddress->txmac.shadow_ptr.value));
+ readl(&etdev->regs->txmac.shadow_ptr.value));
}
}
@@ -151,7 +151,7 @@ void DumpDeviceBlock(int dbgLvl, struct et131x_adapter *etdev,
{
uint32_t Address1, Address2;
uint32_t __iomem *BigDevicePointer =
- (uint32_t __iomem *) etdev->CSRAddress;
+ (uint32_t __iomem *) etdev->regs;
const char *BlockNames[NUM_BLOCKS] = {
"Global", "Tx DMA", "Rx DMA", "Tx MAC",
"Rx MAC", "MAC", "MAC Stat", "MMC"
@@ -189,7 +189,7 @@ void DumpDeviceReg(int dbgLvl, struct et131x_adapter *etdev)
uint32_t Address1, Address2;
uint32_t Block;
uint32_t __iomem *BigDevicePointer =
- (uint32_t __iomem *) etdev->CSRAddress;
+ (uint32_t __iomem *) etdev->regs;
uint32_t __iomem *Pointer;
const char *BlockNames[NUM_BLOCKS] = {
"Global", "Tx DMA", "Rx DMA", "Tx MAC",
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index 5485dd7..4d45941 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -440,7 +440,7 @@ void et131x_error_timer_handler(unsigned long data)
struct et131x_adapter *etdev = (struct et131x_adapter *) data;
PM_CSR_t pm_csr;
- pm_csr.value = readl(&etdev->CSRAddress->global.pm_csr.value);
+ pm_csr.value = readl(&etdev->regs->global.pm_csr.value);
if (pm_csr.bits.pm_phy_sw_coma == 0) {
if (etdev->RegistryMACStat)
@@ -615,12 +615,12 @@ void et131x_soft_reset(struct et131x_adapter *adapter)
DBG_ENTER(et131x_dbginfo);
/* Disable MAC Core */
- writel(0xc00f0000, &adapter->CSRAddress->mac.cfg1.value);
+ writel(0xc00f0000, &adapter->regs->mac.cfg1.value);
/* Set everything to a reset value */
- writel(0x7F, &adapter->CSRAddress->global.sw_reset.value);
- writel(0x000f0000, &adapter->CSRAddress->mac.cfg1.value);
- writel(0x00000000, &adapter->CSRAddress->mac.cfg1.value);
+ writel(0x7F, &adapter->regs->global.sw_reset.value);
+ writel(0x000f0000, &adapter->regs->mac.cfg1.value);
+ writel(0x00000000, &adapter->regs->mac.cfg1.value);
DBG_LEAVE(et131x_dbginfo);
}
@@ -741,7 +741,7 @@ void __devexit et131x_pci_remove(struct pci_dev *pdev)
/* Perform device cleanup */
unregister_netdev(netdev);
et131x_adapter_memory_free(adapter);
- iounmap(adapter->CSRAddress);
+ iounmap(adapter->regs);
pci_dev_put(adapter->pdev);
free_netdev(netdev);
pci_release_regions(pdev);
@@ -915,9 +915,9 @@ int __devinit et131x_pci_setup(struct pci_dev *pdev,
DBG_TRACE(et131x_dbginfo,
"Mapping bus-relative registers to virtual memory...\n");
- adapter->CSRAddress = ioremap_nocache(pci_resource_start(pdev, 0),
+ adapter->regs = ioremap_nocache(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0));
- if (adapter->CSRAddress == NULL) {
+ if (adapter->regs == NULL) {
DBG_ERROR(et131x_dbginfo, "Cannot map device registers\n");
result = -ENOMEM;
goto err_free_dev;
@@ -933,7 +933,7 @@ int __devinit et131x_pci_setup(struct pci_dev *pdev,
GlobalPmCSR.bits.pm_txclk_gate = 1;
GlobalPmCSR.bits.pm_rxclk_gate = 1;
writel(GlobalPmCSR.value,
- &adapter->CSRAddress->global.pm_csr.value);
+ &adapter->regs->global.pm_csr.value);
}
/* Issue a global reset to the et1310 */
@@ -1021,7 +1021,7 @@ out:
err_mem_free:
et131x_adapter_memory_free(adapter);
err_iounmap:
- iounmap(adapter->CSRAddress);
+ iounmap(adapter->regs);
err_free_dev:
pci_dev_put(pdev);
free_netdev(netdev);
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c
index f9687b3..478569f 100644
--- a/drivers/staging/et131x/et131x_isr.c
+++ b/drivers/staging/et131x/et131x_isr.c
@@ -129,7 +129,7 @@ irqreturn_t et131x_isr(int irq, void *dev_id)
/* Get a copy of the value in the interrupt status register
* so we can process the interrupting section
*/
- status.value = readl(&adapter->CSRAddress->global.int_status.value);
+ status.value = readl(&adapter->regs->global.int_status.value);
if (adapter->FlowControl == TxOnly ||
adapter->FlowControl == Both) {
@@ -168,7 +168,7 @@ irqreturn_t et131x_isr(int irq, void *dev_id)
if (adapter->RxRing.UnfinishedReceives)
status.bits.rxdma_xfr_done = 1;
else if (pMpTcb == NULL)
- writel(0, &adapter->CSRAddress->global.watchdog_timer);
+ writel(0, &adapter->regs->global.watchdog_timer);
status.bits.watchdog_interrupt = 0;
#ifdef CONFIG_ET131X_DEBUG
@@ -214,7 +214,7 @@ void et131x_isr_handler(struct work_struct *work)
struct et131x_adapter *etdev =
container_of(work, struct et131x_adapter, task);
INTERRUPT_t GlobStatus = etdev->Stats.InterruptStatus;
- ADDRESS_MAP_t __iomem *iomem = etdev->CSRAddress;
+ ADDRESS_MAP_t __iomem *iomem = etdev->regs;
/*
* These first two are by far the most common. Once handled, we clear
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index 74ba177..fec3f86 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -393,8 +393,8 @@ int et131x_set_packet_filter(struct et131x_adapter *adapter)
DBG_ENTER(et131x_dbginfo);
- ctrl.value = readl(&adapter->CSRAddress->rxmac.ctrl.value);
- pf_ctrl.value = readl(&adapter->CSRAddress->rxmac.pf_ctrl.value);
+ ctrl.value = readl(&adapter->regs->rxmac.ctrl.value);
+ pf_ctrl.value = readl(&adapter->regs->rxmac.pf_ctrl.value);
/* Default to disabled packet filtering. Enable it in the individual
* case statements that require the device to filter something
@@ -450,8 +450,8 @@ int et131x_set_packet_filter(struct et131x_adapter *adapter)
* in the control reg.
*/
writel(pf_ctrl.value,
- &adapter->CSRAddress->rxmac.pf_ctrl.value);
- writel(ctrl.value, &adapter->CSRAddress->rxmac.ctrl.value);
+ &adapter->regs->rxmac.pf_ctrl.value);
+ writel(ctrl.value, &adapter->regs->rxmac.ctrl.value);
}
DBG_LEAVE(et131x_dbginfo);
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 10/26] et131x: Eliminate RegistryDMA Cache
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (8 preceding siblings ...)
2009-08-25 14:58 ` [PATCH 09/26] et131x: CSRAddress to regs Alan Cox
@ 2009-08-25 14:59 ` Alan Cox
2009-08-25 14:59 ` [PATCH 11/26] et131x: eliminate write only registry fields Alan Cox
` (15 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 14:59 UTC (permalink / raw)
To: greg, netdev
One writer, of a constant, one user .. it can go.
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_tx.c | 2 +-
drivers/staging/et131x/et131x_adapter.h | 1 -
drivers/staging/et131x/et131x_config.c | 1 -
3 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c
index 0dbb824..8e8486a 100644
--- a/drivers/staging/et131x/et1310_tx.c
+++ b/drivers/staging/et131x/et1310_tx.c
@@ -315,7 +315,7 @@ void et131x_tx_dma_enable(struct et131x_adapter *etdev)
*/
csr.bits.sngl_epkt_mode = 1;
csr.bits.halt = 0;
- csr.bits.cache_thrshld = etdev->RegistryDMACache;
+ csr.bits.cache_thrshld = PARM_DMA_CACHE_DEF;
writel(csr.value, &etdev->regs->txdma.csr.value);
}
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index 70a90b8..8e811af 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -271,7 +271,6 @@ struct et131x_adapter {
/* Validation helpers */
u8 RegistryPMWOL;
u8 RegistryNMIDisable;
- u32 RegistryDMACache;
u32 RegistrySCGain;
u8 RegistryPhyLoopbk; /* Enable Phy loopback */
diff --git a/drivers/staging/et131x/et131x_config.c b/drivers/staging/et131x/et131x_config.c
index 499cf75..628d6ad 100644
--- a/drivers/staging/et131x/et131x_config.c
+++ b/drivers/staging/et131x/et131x_config.c
@@ -265,7 +265,6 @@ void et131x_config_parse(struct et131x_adapter *etdev)
else
etdev->RegistryNMIDisable = PARM_NMI_DISABLE_DEF;
- etdev->RegistryDMACache = PARM_DMA_CACHE_DEF;
etdev->RegistryPhyLoopbk = PARM_PHY_LOOPBK_DEF;
/* Set the MAC address to a default */
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 11/26] et131x: eliminate write only registry fields
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (9 preceding siblings ...)
2009-08-25 14:59 ` [PATCH 10/26] et131x: Eliminate RegistryDMA Cache Alan Cox
@ 2009-08-25 14:59 ` Alan Cox
2009-08-25 14:59 ` [PATCH 12/26] et131x: clean up constant rx/tx " Alan Cox
` (14 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 14:59 UTC (permalink / raw)
To: greg, netdev
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et131x_adapter.h | 4 ----
drivers/staging/et131x/et131x_config.c | 4 ----
2 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index 8e811af..a7402a3 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -253,8 +253,6 @@ struct et131x_adapter {
/* Registry parameters */
u8 SpeedDuplex; /* speed/duplex */
eFLOW_CONTROL_t RegistryFlowControl; /* for 802.3x flow control */
- u8 RegistryWOLMatch; /* Enable WOL pattern-matching */
- u8 RegistryWOLLink; /* Link state change is independant */
u8 RegistryPhyComa; /* Phy Coma mode enable/disable */
u32 RegistryRxMemEnd; /* Size of internal rx memory */
@@ -269,9 +267,7 @@ struct et131x_adapter {
u32 RegistryRxTimeInterval;
/* Validation helpers */
- u8 RegistryPMWOL;
u8 RegistryNMIDisable;
- u32 RegistrySCGain;
u8 RegistryPhyLoopbk; /* Enable Phy loopback */
/* Derived from the registry: */
diff --git a/drivers/staging/et131x/et131x_config.c b/drivers/staging/et131x/et131x_config.c
index 628d6ad..f8273d1 100644
--- a/drivers/staging/et131x/et131x_config.c
+++ b/drivers/staging/et131x/et131x_config.c
@@ -247,8 +247,6 @@ void et131x_config_parse(struct et131x_adapter *etdev)
etdev->RegistryVlanTag = PARM_VLAN_TAG_DEF;
etdev->RegistryFlowControl = PARM_FLOW_CTL_DEF;
- etdev->RegistryWOLLink = PARM_WOL_LINK_DEF;
- etdev->RegistryWOLMatch = PARM_WOL_MATCH_DEF;
etdev->RegistryJumboPacket = PARM_JUMBO_PKT_DEF;
etdev->RegistryPhyComa = PARM_PHY_COMA_DEF;
etdev->RegistryRxNumBuffers = PARM_RX_NUM_BUFS_DEF;
@@ -257,8 +255,6 @@ void et131x_config_parse(struct et131x_adapter *etdev)
etdev->RegistryTxTimeInterval = PARM_TX_TIME_INT_DEF;
etdev->RegistryRxMemEnd = PARM_RX_MEM_END_DEF;
etdev->RegistryMACStat = PARM_MAC_STAT_DEF;
- etdev->RegistrySCGain = PARM_SC_GAIN_DEF;
- etdev->RegistryPMWOL = PARM_PM_WOL_DEF;
if (et131x_nmi_disable != PARM_NMI_DISABLE_DEF)
etdev->RegistryNMIDisable = et131x_nmi_disable;
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 12/26] et131x: clean up constant rx/tx registry fields
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (10 preceding siblings ...)
2009-08-25 14:59 ` [PATCH 11/26] et131x: eliminate write only registry fields Alan Cox
@ 2009-08-25 14:59 ` Alan Cox
2009-08-25 14:59 ` [PATCH 13/26] et131x: attack the config stuff Alan Cox
` (13 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 14:59 UTC (permalink / raw)
To: greg, netdev
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_jagcore.c | 4 ++--
drivers/staging/et131x/et1310_rx.c | 6 +++---
drivers/staging/et131x/et1310_tx.c | 11 ++++++-----
drivers/staging/et131x/et131x_adapter.h | 6 ------
drivers/staging/et131x/et131x_config.c | 27 ---------------------------
drivers/staging/et131x/et131x_defs.h | 8 ++++++++
6 files changed, 19 insertions(+), 43 deletions(-)
diff --git a/drivers/staging/et131x/et1310_jagcore.c b/drivers/staging/et131x/et1310_jagcore.c
index 4032589..5c847ad 100644
--- a/drivers/staging/et131x/et1310_jagcore.c
+++ b/drivers/staging/et131x/et1310_jagcore.c
@@ -113,9 +113,9 @@ void ConfigGlobalRegs(struct et131x_adapter *etdev)
* 50/50:
*/
writel(0, &pGbl->rxq_start_addr.value);
- writel(etdev->RegistryRxMemEnd,
+ writel(PARM_RX_MEM_END_DEF,
&pGbl->rxq_end_addr.value);
- writel(etdev->RegistryRxMemEnd + 1,
+ writel(PARM_RX_MEM_END_DEF + 1,
&pGbl->txq_start_addr.value);
writel(INTERNAL_MEM_SIZE - 1,
&pGbl->txq_end_addr.value);
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index c60e05e..53efa08 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -792,14 +792,14 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
* For version B silicon, this value gets updated once autoneg is
*complete.
*/
- writel(etdev->RegistryRxNumBuffers, &pRxDma->num_pkt_done.value);
+ writel(PARM_RX_NUM_BUFS_DEF, &pRxDma->num_pkt_done.value);
/* The "time_done" is not working correctly to coalesce interrupts
* after a given time period, but rather is giving us an interrupt
* regardless of whether we have received packets.
* This value gets updated once autoneg is complete.
*/
- writel(etdev->RegistryRxTimeInterval, &pRxDma->max_pkt_time.value);
+ writel(PARM_RX_TIME_INT_DEF, &pRxDma->max_pkt_time.value);
spin_unlock_irqrestore(&etdev->RcvLock, flags);
@@ -1272,7 +1272,7 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
if ((PacketArrayCount == NUM_PACKETS_HANDLED) || TempUnfinishedRec) {
etdev->RxRing.UnfinishedReceives = true;
- writel(etdev->RegistryTxTimeInterval * NANO_IN_A_MICRO,
+ writel(PARM_TX_TIME_INT_DEF * NANO_IN_A_MICRO,
&etdev->regs->global.watchdog_timer);
} else {
/* Watchdog timer will disable itself if appropriate. */
diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c
index 8e8486a..8472c1b 100644
--- a/drivers/staging/et131x/et1310_tx.c
+++ b/drivers/staging/et131x/et1310_tx.c
@@ -94,6 +94,7 @@
#include "et1310_tx.h"
+
/* Data for debugging facilities */
#ifdef CONFIG_ET131X_DEBUG
extern dbg_info_t *et131x_dbginfo;
@@ -711,7 +712,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
if (++etdev->TxRing.TxPacketsSinceLastinterrupt ==
- etdev->RegistryTxNumBuffers) {
+ PARM_TX_NUM_BUFS_DEF) {
CurDesc[FragmentNumber - 1].word3.value = 0x5;
etdev->TxRing.TxPacketsSinceLastinterrupt = 0;
} else {
@@ -794,7 +795,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
* timer to wake us up if this packet isn't followed by N more.
*/
if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
- writel(etdev->RegistryTxTimeInterval * NANO_IN_A_MICRO,
+ writel(PARM_TX_TIME_INT_DEF * NANO_IN_A_MICRO,
&etdev->regs->global.watchdog_timer);
}
@@ -1064,7 +1065,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
TRUEPHY_SPEED_1000MBPS) {
if (++etdev->TxRing.
TxPacketsSinceLastinterrupt >=
- etdev->RegistryTxNumBuffers) {
+ PARM_TX_NUM_BUFS_DEF) {
CurDesc.word3.value = 0x5;
etdev->TxRing.
TxPacketsSinceLastinterrupt
@@ -1132,7 +1133,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
if (++etdev->TxRing.TxPacketsSinceLastinterrupt >=
- etdev->RegistryTxNumBuffers) {
+ PARM_TX_NUM_BUFS_DEF) {
CurDesc.word3.value = 0x5;
etdev->TxRing.TxPacketsSinceLastinterrupt =
0;
@@ -1212,7 +1213,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
* timer to wake us up if this packet isn't followed by N more.
*/
if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
- writel(etdev->RegistryTxTimeInterval * NANO_IN_A_MICRO,
+ writel(PARM_TX_TIME_INT_DEF * NANO_IN_A_MICRO,
&etdev->regs->global.watchdog_timer);
}
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index a7402a3..bbbada0 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -260,12 +260,6 @@ struct et131x_adapter {
u32 RegistryVlanTag; /* 802.1q Vlan TAG */
u32 RegistryJumboPacket; /* Max supported ethernet packet size */
- u32 RegistryTxNumBuffers;
- u32 RegistryTxTimeInterval;
-
- u32 RegistryRxNumBuffers;
- u32 RegistryRxTimeInterval;
-
/* Validation helpers */
u8 RegistryNMIDisable;
u8 RegistryPhyLoopbk; /* Enable Phy loopback */
diff --git a/drivers/staging/et131x/et131x_config.c b/drivers/staging/et131x/et131x_config.c
index f8273d1..a31f82a 100644
--- a/drivers/staging/et131x/et131x_config.c
+++ b/drivers/staging/et131x/et131x_config.c
@@ -129,26 +129,6 @@ extern dbg_info_t *et131x_dbginfo;
#define PARM_PHY_COMA_MIN 0
#define PARM_PHY_COMA_MAX 1
-#define PARM_RX_NUM_BUFS_DEF 4
-#define PARM_RX_NUM_BUFS_MIN 1
-#define PARM_RX_NUM_BUFS_MAX 64
-
-#define PARM_RX_TIME_INT_DEF 10
-#define PARM_RX_TIME_INT_MIN 2
-#define PARM_RX_TIME_INT_MAX 320
-
-#define PARM_TX_NUM_BUFS_DEF 4
-#define PARM_TX_NUM_BUFS_MIN 1
-#define PARM_TX_NUM_BUFS_MAX 40
-
-#define PARM_TX_TIME_INT_DEF 40
-#define PARM_TX_TIME_INT_MIN 1
-#define PARM_TX_TIME_INT_MAX 140
-
-#define PARM_RX_MEM_END_DEF 0x2bc
-#define PARM_RX_MEM_END_MIN 0
-#define PARM_RX_MEM_END_MAX 0x3ff
-
#define PARM_MAC_STAT_DEF 1
#define PARM_MAC_STAT_MIN 0
#define PARM_MAC_STAT_MAX 1
@@ -166,8 +146,6 @@ extern dbg_info_t *et131x_dbginfo;
#define PARM_NMI_DISABLE_MAX 2
#define PARM_DMA_CACHE_DEF 0
-#define PARM_DMA_CACHE_MIN 0
-#define PARM_DMA_CACHE_MAX 15
#define PARM_PHY_LOOPBK_DEF 0
#define PARM_PHY_LOOPBK_MIN 0
@@ -249,11 +227,6 @@ void et131x_config_parse(struct et131x_adapter *etdev)
etdev->RegistryFlowControl = PARM_FLOW_CTL_DEF;
etdev->RegistryJumboPacket = PARM_JUMBO_PKT_DEF;
etdev->RegistryPhyComa = PARM_PHY_COMA_DEF;
- etdev->RegistryRxNumBuffers = PARM_RX_NUM_BUFS_DEF;
- etdev->RegistryRxTimeInterval = PARM_RX_TIME_INT_DEF;
- etdev->RegistryTxNumBuffers = PARM_TX_NUM_BUFS_DEF;
- etdev->RegistryTxTimeInterval = PARM_TX_TIME_INT_DEF;
- etdev->RegistryRxMemEnd = PARM_RX_MEM_END_DEF;
etdev->RegistryMACStat = PARM_MAC_STAT_DEF;
if (et131x_nmi_disable != PARM_NMI_DISABLE_DEF)
diff --git a/drivers/staging/et131x/et131x_defs.h b/drivers/staging/et131x/et131x_defs.h
index 9d609e5..5665c6a 100644
--- a/drivers/staging/et131x/et131x_defs.h
+++ b/drivers/staging/et131x/et131x_defs.h
@@ -125,4 +125,12 @@
/* Define order of magnitude converter */
#define NANO_IN_A_MICRO 1000
+#define PARM_RX_NUM_BUFS_DEF 4
+#define PARM_RX_TIME_INT_DEF 10
+#define PARM_RX_MEM_END_DEF 0x2bc
+#define PARM_TX_TIME_INT_DEF 40
+#define PARM_TX_NUM_BUFS_DEF 4
+#define PARM_DMA_CACHE_DEF 0
+
+
#endif /* __ET131X_DEFS_H__ */
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 13/26] et131x: attack the config stuff
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (11 preceding siblings ...)
2009-08-25 14:59 ` [PATCH 12/26] et131x: clean up constant rx/tx " Alan Cox
@ 2009-08-25 14:59 ` Alan Cox
2009-08-25 14:59 ` [PATCH 14/26] et131x: config is already zeroed Alan Cox
` (12 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 14:59 UTC (permalink / raw)
To: greg, netdev
Prune this back as most of it isn't relevant or used
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et131x_adapter.h | 2 -
drivers/staging/et131x/et131x_config.c | 110 ++++++-------------------------
drivers/staging/et131x/et131x_initpci.c | 7 +-
3 files changed, 23 insertions(+), 96 deletions(-)
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index bbbada0..63d7c8a 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -256,8 +256,6 @@ struct et131x_adapter {
u8 RegistryPhyComa; /* Phy Coma mode enable/disable */
u32 RegistryRxMemEnd; /* Size of internal rx memory */
- u8 RegistryMACStat; /* If set, read MACSTAT, else don't */
- u32 RegistryVlanTag; /* 802.1q Vlan TAG */
u32 RegistryJumboPacket; /* Max supported ethernet packet size */
/* Validation helpers */
diff --git a/drivers/staging/et131x/et131x_config.c b/drivers/staging/et131x/et131x_config.c
index a31f82a..358e6f6 100644
--- a/drivers/staging/et131x/et131x_config.c
+++ b/drivers/staging/et131x/et131x_config.c
@@ -105,22 +105,10 @@ extern dbg_info_t *et131x_dbginfo;
#define PARM_SPEED_DUPLEX_MIN 0
#define PARM_SPEED_DUPLEX_MAX 5
-#define PARM_VLAN_TAG_DEF 0
-#define PARM_VLAN_TAG_MIN 0
-#define PARM_VLAN_TAG_MAX 4095
-
#define PARM_FLOW_CTL_DEF 0
#define PARM_FLOW_CTL_MIN 0
#define PARM_FLOW_CTL_MAX 3
-#define PARM_WOL_LINK_DEF 3
-#define PARM_WOL_LINK_MIN 0
-#define PARM_WOL_LINK_MAX 3
-
-#define PARM_WOL_MATCH_DEF 7
-#define PARM_WOL_MATCH_MIN 0
-#define PARM_WOL_MATCH_MAX 7
-
#define PARM_JUMBO_PKT_DEF 1514
#define PARM_JUMBO_PKT_MIN 1514
#define PARM_JUMBO_PKT_MAX 9216
@@ -129,10 +117,6 @@ extern dbg_info_t *et131x_dbginfo;
#define PARM_PHY_COMA_MIN 0
#define PARM_PHY_COMA_MAX 1
-#define PARM_MAC_STAT_DEF 1
-#define PARM_MAC_STAT_MIN 0
-#define PARM_MAC_STAT_MAX 1
-
#define PARM_SC_GAIN_DEF 7
#define PARM_SC_GAIN_MIN 0
#define PARM_SC_GAIN_MAX 7
@@ -145,13 +129,7 @@ extern dbg_info_t *et131x_dbginfo;
#define PARM_NMI_DISABLE_MIN 0
#define PARM_NMI_DISABLE_MAX 2
-#define PARM_DMA_CACHE_DEF 0
-
-#define PARM_PHY_LOOPBK_DEF 0
-#define PARM_PHY_LOOPBK_MIN 0
-#define PARM_PHY_LOOPBK_MAX 1
-#define PARM_MAC_ADDRESS_DEF { 0x00, 0x05, 0x3d, 0x00, 0x02, 0x00 }
/* Module parameter for disabling NMI
* et131x_speed_set :
@@ -184,109 +162,61 @@ MODULE_PARM_DESC(et131x_speed_set,
* @etdev: pointer to the private adapter struct
*
* Parses a configuration from some location (module parameters, for example)
- * into the private adapter struct
+ * into the private adapter struct. This really has no sensible analogy in
+ * Linux as sysfs parameters are dynamic. Several things that were hee could
+ * go into sysfs, but other stuff like speed handling is part of the mii
+ * interfaces/ethtool.
*/
void et131x_config_parse(struct et131x_adapter *etdev)
{
- uint8_t macAddrDef[] = PARM_MAC_ADDRESS_DEF;
+ static const u8 default_mac[] = { 0x00, 0x05, 0x3d, 0x00, 0x02, 0x00 };
+ static const u8 duplex[] = { 0, 1, 2, 1, 2, 2 };
+ static const u16 speed[] = { 0, 10, 10, 100, 100, 1000 };
DBG_ENTER(et131x_dbginfo);
- /*
- * The NDIS driver uses the registry to store persistent per-device
- * configuration, and reads this configuration into the appropriate
- * elements of the private adapter structure on initialization.
- * Because Linux has no analog to the registry, use this function to
- * initialize the private adapter structure with a default
- * configuration.
- *
- * One other possibility is to use a series of module parameters which
- * can be passed in by the caller when the module is initialized.
- * However, this implementation does not allow for seperate
- * configurations in the event multiple devices are present, and hence
- * will not suffice.
- *
- * If another method is derived which addresses this problem, this is
- * where it should be implemented.
- */
+ etdev->SpeedDuplex = et131x_speed_set;
- /* Set the private adapter struct with default values for the
- * corresponding parameters
- */
- if (et131x_speed_set != PARM_SPEED_DUPLEX_DEF) {
+ if (et131x_speed_set < PARM_SPEED_DUPLEX_MIN ||
+ et131x_speed_set > PARM_SPEED_DUPLEX_MAX) {
+ dev_warn(&etdev->pdev->dev, "invalid speed setting ignored.\n");
+ et131x_speed_set = PARM_SPEED_DUPLEX_DEF;
+ }
+ else if (et131x_speed_set != PARM_SPEED_DUPLEX_DEF)
DBG_VERBOSE(et131x_dbginfo, "Speed set manually to : %d \n",
et131x_speed_set);
- etdev->SpeedDuplex = et131x_speed_set;
- } else {
- etdev->SpeedDuplex = PARM_SPEED_DUPLEX_DEF;
- }
/* etdev->SpeedDuplex = PARM_SPEED_DUPLEX_DEF; */
- etdev->RegistryVlanTag = PARM_VLAN_TAG_DEF;
etdev->RegistryFlowControl = PARM_FLOW_CTL_DEF;
etdev->RegistryJumboPacket = PARM_JUMBO_PKT_DEF;
etdev->RegistryPhyComa = PARM_PHY_COMA_DEF;
- etdev->RegistryMACStat = PARM_MAC_STAT_DEF;
if (et131x_nmi_disable != PARM_NMI_DISABLE_DEF)
etdev->RegistryNMIDisable = et131x_nmi_disable;
else
etdev->RegistryNMIDisable = PARM_NMI_DISABLE_DEF;
- etdev->RegistryPhyLoopbk = PARM_PHY_LOOPBK_DEF;
+ etdev->RegistryPhyLoopbk = 0; /* 0 off 1 on */
/* Set the MAC address to a default */
- memcpy(etdev->CurrentAddress, macAddrDef, ETH_ALEN);
+ memcpy(etdev->CurrentAddress, default_mac, ETH_ALEN);
etdev->bOverrideAddress = false;
- DBG_TRACE(et131x_dbginfo,
- "Default MAC Address : %02x:%02x:%02x:%02x:%02x:%02x\n",
- etdev->CurrentAddress[0], etdev->CurrentAddress[1],
- etdev->CurrentAddress[2], etdev->CurrentAddress[3],
- etdev->CurrentAddress[4], etdev->CurrentAddress[5]);
-
/* Decode SpeedDuplex
*
* Set up as if we are auto negotiating always and then change if we
* go into force mode
- */
- etdev->AiForceSpeed = 0; /* Auto speed */
- etdev->AiForceDpx = 0; /* Auto FDX */
-
- /* If we are the 10/100 device, and gigabit is somehow requested then
+ *
+ * If we are the 10/100 device, and gigabit is somehow requested then
* knock it down to 100 full.
*/
if (etdev->pdev->device == ET131X_PCI_DEVICE_ID_FAST &&
etdev->SpeedDuplex == 5)
etdev->SpeedDuplex = 4;
- switch (etdev->SpeedDuplex) {
- case 1: /* 10Mb Half-Duplex */
- etdev->AiForceSpeed = 10;
- etdev->AiForceDpx = 1;
- break;
-
- case 2: /* 10Mb Full-Duplex */
- etdev->AiForceSpeed = 10;
- etdev->AiForceDpx = 2;
- break;
-
- case 3: /* 100Mb Half-Duplex */
- etdev->AiForceSpeed = 100;
- etdev->AiForceDpx = 1;
- break;
-
- case 4: /* 100Mb Full-Duplex */
- etdev->AiForceSpeed = 100;
- etdev->AiForceDpx = 2;
- break;
-
- case 5: /* 1000Mb Full-Duplex */
- etdev->AiForceSpeed = 1000;
- etdev->AiForceDpx = 2;
- break;
- }
+ etdev->AiForceSpeed = speed[etdev->SpeedDuplex];
+ etdev->AiForceDpx = duplex[etdev->SpeedDuplex]; /* Auto FDX */
DBG_LEAVE(et131x_dbginfo);
}
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index 4d45941..c489090 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -442,10 +442,9 @@ void et131x_error_timer_handler(unsigned long data)
pm_csr.value = readl(&etdev->regs->global.pm_csr.value);
- if (pm_csr.bits.pm_phy_sw_coma == 0) {
- if (etdev->RegistryMACStat)
- UpdateMacStatHostCounters(etdev);
- } else
+ if (pm_csr.bits.pm_phy_sw_coma == 0)
+ UpdateMacStatHostCounters(etdev);
+ else
DBG_VERBOSE(et131x_dbginfo,
"No interrupts, in PHY coma, pm_csr = 0x%x\n",
pm_csr.value);
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 14/26] et131x: config is already zeroed
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (12 preceding siblings ...)
2009-08-25 14:59 ` [PATCH 13/26] et131x: attack the config stuff Alan Cox
@ 2009-08-25 14:59 ` Alan Cox
2009-08-25 14:59 ` [PATCH 15/26] et131x: fold the diet config into the other code Alan Cox
` (11 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 14:59 UTC (permalink / raw)
To: greg, netdev
Adapter was cleared by netdev allocation so any zero defaults do not need
writing.
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et131x_config.c | 75 ++++++++------------------------
1 files changed, 18 insertions(+), 57 deletions(-)
diff --git a/drivers/staging/et131x/et131x_config.c b/drivers/staging/et131x/et131x_config.c
index 358e6f6..cde727d 100644
--- a/drivers/staging/et131x/et131x_config.c
+++ b/drivers/staging/et131x/et131x_config.c
@@ -101,58 +101,30 @@ extern dbg_info_t *et131x_dbginfo;
#endif /* CONFIG_ET131X_DEBUG */
/* Defines for Parameter Default/Min/Max vaules */
-#define PARM_SPEED_DUPLEX_DEF 0
#define PARM_SPEED_DUPLEX_MIN 0
#define PARM_SPEED_DUPLEX_MAX 5
-#define PARM_FLOW_CTL_DEF 0
-#define PARM_FLOW_CTL_MIN 0
-#define PARM_FLOW_CTL_MAX 3
-
-#define PARM_JUMBO_PKT_DEF 1514
-#define PARM_JUMBO_PKT_MIN 1514
-#define PARM_JUMBO_PKT_MAX 9216
-
-#define PARM_PHY_COMA_DEF 0
-#define PARM_PHY_COMA_MIN 0
-#define PARM_PHY_COMA_MAX 1
-
-#define PARM_SC_GAIN_DEF 7
-#define PARM_SC_GAIN_MIN 0
-#define PARM_SC_GAIN_MAX 7
-
-#define PARM_PM_WOL_DEF 0
-#define PARM_PM_WOL_MIN 0
-#define PARM_PM_WOL_MAX 1
-
-#define PARM_NMI_DISABLE_DEF 0
-#define PARM_NMI_DISABLE_MIN 0
-#define PARM_NMI_DISABLE_MAX 2
-
-
-
/* Module parameter for disabling NMI
- * et131x_speed_set :
+ * et131x_nmi_disable :
+ * Disable NMI (0-2) [0]
+ * 0 :
+ * 1 :
+ * 2 :
+ */
+static u32 et131x_nmi_disable; /* 0-2 */
+module_param(et131x_nmi_disable, uint, 0);
+MODULE_PARM_DESC(et131x_nmi_disable, "Disable NMI (0-2) [0]");
+
+/* Module parameter for manual speed setting
* Set Link speed and dublex manually (0-5) [0]
* 1 : 10Mb Half-Duplex
* 2 : 10Mb Full-Duplex
* 3 : 100Mb Half-Duplex
* 4 : 100Mb Full-Duplex
* 5 : 1000Mb Full-Duplex
- * 0 : Auto Speed Auto Dublex // default
- */
-static u32 et131x_nmi_disable = PARM_NMI_DISABLE_DEF;
-module_param(et131x_nmi_disable, uint, 0);
-MODULE_PARM_DESC(et131x_nmi_disable, "Disable NMI (0-2) [0]");
-
-/* Module parameter for manual speed setting
- * et131x_nmi_disable :
- * Disable NMI (0-2) [0]
- * 0 :
- * 1 :
- * 2 :
+ * 0 : Auto Speed Auto Duplex // default
*/
-static u32 et131x_speed_set = PARM_SPEED_DUPLEX_DEF;
+static u32 et131x_speed_set;
module_param(et131x_speed_set, uint, 0);
MODULE_PARM_DESC(et131x_speed_set,
"Set Link speed and dublex manually (0-5) [0] \n 1 : 10Mb Half-Duplex \n 2 : 10Mb Full-Duplex \n 3 : 100Mb Half-Duplex \n 4 : 100Mb Full-Duplex \n 5 : 1000Mb Full-Duplex \n 0 : Auto Speed Auto Dublex");
@@ -175,33 +147,22 @@ void et131x_config_parse(struct et131x_adapter *etdev)
DBG_ENTER(et131x_dbginfo);
- etdev->SpeedDuplex = et131x_speed_set;
-
if (et131x_speed_set < PARM_SPEED_DUPLEX_MIN ||
et131x_speed_set > PARM_SPEED_DUPLEX_MAX) {
dev_warn(&etdev->pdev->dev, "invalid speed setting ignored.\n");
- et131x_speed_set = PARM_SPEED_DUPLEX_DEF;
+ et131x_speed_set = 0;
}
- else if (et131x_speed_set != PARM_SPEED_DUPLEX_DEF)
+ else if (et131x_speed_set)
DBG_VERBOSE(et131x_dbginfo, "Speed set manually to : %d \n",
et131x_speed_set);
- /* etdev->SpeedDuplex = PARM_SPEED_DUPLEX_DEF; */
-
- etdev->RegistryFlowControl = PARM_FLOW_CTL_DEF;
- etdev->RegistryJumboPacket = PARM_JUMBO_PKT_DEF;
- etdev->RegistryPhyComa = PARM_PHY_COMA_DEF;
-
- if (et131x_nmi_disable != PARM_NMI_DISABLE_DEF)
- etdev->RegistryNMIDisable = et131x_nmi_disable;
- else
- etdev->RegistryNMIDisable = PARM_NMI_DISABLE_DEF;
+ etdev->SpeedDuplex = et131x_speed_set;
+ etdev->RegistryJumboPacket = 1514; /* 1514-9216 */
- etdev->RegistryPhyLoopbk = 0; /* 0 off 1 on */
+ etdev->RegistryNMIDisable = et131x_nmi_disable;
/* Set the MAC address to a default */
memcpy(etdev->CurrentAddress, default_mac, ETH_ALEN);
- etdev->bOverrideAddress = false;
/* Decode SpeedDuplex
*
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 15/26] et131x: fold the diet config into the other code
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (13 preceding siblings ...)
2009-08-25 14:59 ` [PATCH 14/26] et131x: config is already zeroed Alan Cox
@ 2009-08-25 14:59 ` Alan Cox
2009-08-25 15:00 ` [PATCH 16/26] et131x: de-hungarianise a bit Alan Cox
` (10 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 14:59 UTC (permalink / raw)
To: greg, netdev
No point having a file just for that
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/Makefile | 1
drivers/staging/et131x/et131x_config.c | 183 -------------------------------
drivers/staging/et131x/et131x_initpci.c | 86 +++++++++++++++
3 files changed, 86 insertions(+), 184 deletions(-)
diff --git a/drivers/staging/et131x/Makefile b/drivers/staging/et131x/Makefile
index 3ad571d..3ddbc64 100644
--- a/drivers/staging/et131x/Makefile
+++ b/drivers/staging/et131x/Makefile
@@ -11,7 +11,6 @@ et131x-objs := et1310_eeprom.o \
et1310_pm.o \
et1310_rx.o \
et1310_tx.o \
- et131x_config.o \
et131x_debug.o \
et131x_initpci.o \
et131x_isr.o \
diff --git a/drivers/staging/et131x/et131x_config.c b/drivers/staging/et131x/et131x_config.c
index cde727d..e69de29 100644
--- a/drivers/staging/et131x/et131x_config.c
+++ b/drivers/staging/et131x/et131x_config.c
@@ -1,183 +0,0 @@
-/*
- * Agere Systems Inc.
- * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
- *
- * Copyright © 2005 Agere Systems Inc.
- * All rights reserved.
- * http://www.agere.com
- *
- *------------------------------------------------------------------------------
- *
- * et131x_config.c - Handles parsing of configuration data during
- * initialization.
- *
- *------------------------------------------------------------------------------
- *
- * SOFTWARE LICENSE
- *
- * This software is provided subject to the following terms and conditions,
- * which you should read carefully before using the software. Using this
- * software indicates your acceptance of these terms and conditions. If you do
- * not agree with these terms and conditions, do not use the software.
- *
- * Copyright © 2005 Agere Systems Inc.
- * All rights reserved.
- *
- * Redistribution and use in source or binary forms, with or without
- * modifications, are permitted provided that the following conditions are met:
- *
- * . Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following Disclaimer as comments in the code as
- * well as in the documentation and/or other materials provided with the
- * distribution.
- *
- * . Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following Disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * . Neither the name of Agere Systems Inc. nor the names of the contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
- * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
- * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- */
-
-#include "et131x_version.h"
-#include "et131x_debug.h"
-#include "et131x_defs.h"
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-
-#include <linux/sched.h>
-#include <linux/ptrace.h>
-#include <linux/slab.h>
-#include <linux/ctype.h>
-#include <linux/string.h>
-#include <linux/timer.h>
-#include <linux/interrupt.h>
-#include <linux/in.h>
-#include <linux/delay.h>
-#include <linux/io.h>
-#include <linux/bitops.h>
-#include <linux/pci.h>
-#include <asm/system.h>
-
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/if_arp.h>
-#include <linux/ioport.h>
-
-#include "et1310_phy.h"
-#include "et1310_pm.h"
-#include "et1310_jagcore.h"
-
-#include "et131x_adapter.h"
-#include "et131x_initpci.h"
-#include "et131x_config.h"
-
-#include "et1310_tx.h"
-
-/* Data for debugging facilities */
-#ifdef CONFIG_ET131X_DEBUG
-extern dbg_info_t *et131x_dbginfo;
-#endif /* CONFIG_ET131X_DEBUG */
-
-/* Defines for Parameter Default/Min/Max vaules */
-#define PARM_SPEED_DUPLEX_MIN 0
-#define PARM_SPEED_DUPLEX_MAX 5
-
-/* Module parameter for disabling NMI
- * et131x_nmi_disable :
- * Disable NMI (0-2) [0]
- * 0 :
- * 1 :
- * 2 :
- */
-static u32 et131x_nmi_disable; /* 0-2 */
-module_param(et131x_nmi_disable, uint, 0);
-MODULE_PARM_DESC(et131x_nmi_disable, "Disable NMI (0-2) [0]");
-
-/* Module parameter for manual speed setting
- * Set Link speed and dublex manually (0-5) [0]
- * 1 : 10Mb Half-Duplex
- * 2 : 10Mb Full-Duplex
- * 3 : 100Mb Half-Duplex
- * 4 : 100Mb Full-Duplex
- * 5 : 1000Mb Full-Duplex
- * 0 : Auto Speed Auto Duplex // default
- */
-static u32 et131x_speed_set;
-module_param(et131x_speed_set, uint, 0);
-MODULE_PARM_DESC(et131x_speed_set,
- "Set Link speed and dublex manually (0-5) [0] \n 1 : 10Mb Half-Duplex \n 2 : 10Mb Full-Duplex \n 3 : 100Mb Half-Duplex \n 4 : 100Mb Full-Duplex \n 5 : 1000Mb Full-Duplex \n 0 : Auto Speed Auto Dublex");
-
-/**
- * et131x_config_parse
- * @etdev: pointer to the private adapter struct
- *
- * Parses a configuration from some location (module parameters, for example)
- * into the private adapter struct. This really has no sensible analogy in
- * Linux as sysfs parameters are dynamic. Several things that were hee could
- * go into sysfs, but other stuff like speed handling is part of the mii
- * interfaces/ethtool.
- */
-void et131x_config_parse(struct et131x_adapter *etdev)
-{
- static const u8 default_mac[] = { 0x00, 0x05, 0x3d, 0x00, 0x02, 0x00 };
- static const u8 duplex[] = { 0, 1, 2, 1, 2, 2 };
- static const u16 speed[] = { 0, 10, 10, 100, 100, 1000 };
-
- DBG_ENTER(et131x_dbginfo);
-
- if (et131x_speed_set < PARM_SPEED_DUPLEX_MIN ||
- et131x_speed_set > PARM_SPEED_DUPLEX_MAX) {
- dev_warn(&etdev->pdev->dev, "invalid speed setting ignored.\n");
- et131x_speed_set = 0;
- }
- else if (et131x_speed_set)
- DBG_VERBOSE(et131x_dbginfo, "Speed set manually to : %d \n",
- et131x_speed_set);
-
- etdev->SpeedDuplex = et131x_speed_set;
- etdev->RegistryJumboPacket = 1514; /* 1514-9216 */
-
- etdev->RegistryNMIDisable = et131x_nmi_disable;
-
- /* Set the MAC address to a default */
- memcpy(etdev->CurrentAddress, default_mac, ETH_ALEN);
-
- /* Decode SpeedDuplex
- *
- * Set up as if we are auto negotiating always and then change if we
- * go into force mode
- *
- * If we are the 10/100 device, and gigabit is somehow requested then
- * knock it down to 100 full.
- */
- if (etdev->pdev->device == ET131X_PCI_DEVICE_ID_FAST &&
- etdev->SpeedDuplex == 5)
- etdev->SpeedDuplex = 4;
-
- etdev->AiForceSpeed = speed[etdev->SpeedDuplex];
- etdev->AiForceDpx = duplex[etdev->SpeedDuplex]; /* Auto FDX */
-
- DBG_LEAVE(et131x_dbginfo);
-}
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index c489090..34737d1 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -140,6 +140,37 @@ static dbg_info_t et131x_info = { DRIVER_NAME_EXT, 0, 0 };
dbg_info_t *et131x_dbginfo = &et131x_info;
#endif /* CONFIG_ET131X_DEBUG */
+/* Defines for Parameter Default/Min/Max vaules */
+#define PARM_SPEED_DUPLEX_MIN 0
+#define PARM_SPEED_DUPLEX_MAX 5
+
+/* Module parameter for disabling NMI
+ * et131x_nmi_disable :
+ * Disable NMI (0-2) [0]
+ * 0 :
+ * 1 :
+ * 2 :
+ */
+static u32 et131x_nmi_disable; /* 0-2 */
+module_param(et131x_nmi_disable, uint, 0);
+MODULE_PARM_DESC(et131x_nmi_disable, "Disable NMI (0-2) [0]");
+
+/* Module parameter for manual speed setting
+ * Set Link speed and dublex manually (0-5) [0]
+ * 1 : 10Mb Half-Duplex
+ * 2 : 10Mb Full-Duplex
+ * 3 : 100Mb Half-Duplex
+ * 4 : 100Mb Full-Duplex
+ * 5 : 1000Mb Full-Duplex
+ * 0 : Auto Speed Auto Duplex // default
+ */
+static u32 et131x_speed_set;
+module_param(et131x_speed_set, uint, 0);
+MODULE_PARM_DESC(et131x_speed_set,
+ "Set Link speed and dublex manually (0-5) [0] \n 1 : 10Mb Half-Duplex \n 2 : 10Mb Full-Duplex \n 3 : 100Mb Half-Duplex \n 4 : 100Mb Full-Duplex \n 5 : 1000Mb Full-Duplex \n 0 : Auto Speed Auto Dublex");
+
+
+
static struct pci_device_id et131x_pci_table[] __devinitdata = {
{ET131X_PCI_VENDOR_ID, ET131X_PCI_DEVICE_ID_GIG, PCI_ANY_ID,
PCI_ANY_ID, 0, 0, 0UL},
@@ -202,6 +233,12 @@ int et131x_init_module(void)
DBG_ENTER(et131x_dbginfo);
DBG_PRINT("%s\n", DRIVER_INFO);
+ if (et131x_speed_set < PARM_SPEED_DUPLEX_MIN ||
+ et131x_speed_set > PARM_SPEED_DUPLEX_MAX) {
+ printk(KERN_WARNING "et131x: invalid speed setting ignored.\n");
+ et131x_speed_set = 0;
+ }
+
result = pci_register_driver(&et131x_driver);
DBG_LEAVE(et131x_dbginfo);
@@ -750,6 +787,55 @@ void __devexit et131x_pci_remove(struct pci_dev *pdev)
}
/**
+ * et131x_config_parse
+ * @etdev: pointer to the private adapter struct
+ *
+ * Parses a configuration from some location (module parameters, for example)
+ * into the private adapter struct. This really has no sensible analogy in
+ * Linux as sysfs parameters are dynamic. Several things that were hee could
+ * go into sysfs, but other stuff like speed handling is part of the mii
+ * interfaces/ethtool.
+ */
+void et131x_config_parse(struct et131x_adapter *etdev)
+{
+ static const u8 default_mac[] = { 0x00, 0x05, 0x3d, 0x00, 0x02, 0x00 };
+ static const u8 duplex[] = { 0, 1, 2, 1, 2, 2 };
+ static const u16 speed[] = { 0, 10, 10, 100, 100, 1000 };
+
+ DBG_ENTER(et131x_dbginfo);
+
+ if (et131x_speed_set)
+ DBG_VERBOSE(et131x_dbginfo, "Speed set manually to : %d \n",
+ et131x_speed_set);
+
+ etdev->SpeedDuplex = et131x_speed_set;
+ etdev->RegistryJumboPacket = 1514; /* 1514-9216 */
+
+ etdev->RegistryNMIDisable = et131x_nmi_disable;
+
+ /* Set the MAC address to a default */
+ memcpy(etdev->CurrentAddress, default_mac, ETH_ALEN);
+
+ /* Decode SpeedDuplex
+ *
+ * Set up as if we are auto negotiating always and then change if we
+ * go into force mode
+ *
+ * If we are the 10/100 device, and gigabit is somehow requested then
+ * knock it down to 100 full.
+ */
+ if (etdev->pdev->device == ET131X_PCI_DEVICE_ID_FAST &&
+ etdev->SpeedDuplex == 5)
+ etdev->SpeedDuplex = 4;
+
+ etdev->AiForceSpeed = speed[etdev->SpeedDuplex];
+ etdev->AiForceDpx = duplex[etdev->SpeedDuplex]; /* Auto FDX */
+
+ DBG_LEAVE(et131x_dbginfo);
+}
+
+
+/**
* et131x_pci_setup - Perform device initialization
* @pdev: a pointer to the device's pci_dev structure
* @ent: this device's entry in the pci_device_id table
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 16/26] et131x: de-hungarianise a bit
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (14 preceding siblings ...)
2009-08-25 14:59 ` [PATCH 15/26] et131x: fold the diet config into the other code Alan Cox
@ 2009-08-25 15:00 ` Alan Cox
2009-08-25 15:00 ` [PATCH 17/26] et131x: continue pruning unused fields Alan Cox
` (9 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 15:00 UTC (permalink / raw)
To: greg, netdev
bOverrideAddress is write only so kill it rather than fix it
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_eeprom.c | 192 +++++++++++++------------
drivers/staging/et131x/et1310_mac.c | 12 +-
drivers/staging/et131x/et1310_phy.c | 238 ++++++++++++++++---------------
drivers/staging/et131x/et1310_phy.h | 12 +-
drivers/staging/et131x/et1310_rx.c | 136 +++++++++---------
drivers/staging/et131x/et1310_tx.c | 92 ++++++------
drivers/staging/et131x/et131x_adapter.h | 18 +-
drivers/staging/et131x/et131x_initpci.c | 70 ++++-----
8 files changed, 377 insertions(+), 393 deletions(-)
diff --git a/drivers/staging/et131x/et1310_eeprom.c b/drivers/staging/et131x/et1310_eeprom.c
index 29d1c0e..9453862 100644
--- a/drivers/staging/et131x/et1310_eeprom.c
+++ b/drivers/staging/et131x/et1310_eeprom.c
@@ -137,34 +137,34 @@
* Define macros that allow individual register values to be extracted from a
* DWORD1 register grouping
*/
-#define EXTRACT_DATA_REGISTER(x) (uint8_t)(x & 0xFF)
-#define EXTRACT_STATUS_REGISTER(x) (uint8_t)((x >> 16) & 0xFF)
-#define EXTRACT_CONTROL_REG(x) (uint8_t)((x >> 8) & 0xFF)
+#define EXTRACT_DATA_REGISTER(x) (u8)(x & 0xFF)
+#define EXTRACT_STATUS_REGISTER(x) (u8)((x >> 16) & 0xFF)
+#define EXTRACT_CONTROL_REG(x) (u8)((x >> 8) & 0xFF)
/**
* EepromWriteByte - Write a byte to the ET1310's EEPROM
* @etdev: pointer to our private adapter structure
- * @unAddress: the address to write
- * @bData: the value to write
- * @unEepronId: the ID of the EEPROM
- * @unAddressingMode: how the EEPROM is to be accessed
+ * @addr: the address to write
+ * @data: the value to write
+ * @eeprom_id: the ID of the EEPROM
+ * @addrmode: how the EEPROM is to be accessed
*
* Returns SUCCESS or FAILURE
*/
-int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress,
- uint8_t bData, uint32_t unEepromId,
- uint32_t unAddressingMode)
+int EepromWriteByte(struct et131x_adapter *etdev, u32 addr,
+ u8 data, u32 eeprom_id,
+ u32 addrmode)
{
struct pci_dev *pdev = etdev->pdev;
- int32_t nIndex;
- int32_t nRetries;
- int32_t nError = false;
- int32_t nI2CWriteActive = 0;
- int32_t nWriteSuccessful = 0;
- uint8_t bControl;
- uint8_t bStatus = 0;
- uint32_t unDword1 = 0;
- uint32_t unData = 0;
+ int index;
+ int retries;
+ int err = 0;
+ int i2c_wack = 0;
+ int writeok = 0;
+ u8 control;
+ u8 status = 0;
+ u32 dword1 = 0;
+ u32 val = 0;
/*
* The following excerpt is from "Serial EEPROM HW Design
@@ -215,89 +215,89 @@ int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress,
*/
/* Step 1: */
- for (nIndex = 0; nIndex < MAX_NUM_REGISTER_POLLS; nIndex++) {
+ for (index = 0; index < MAX_NUM_REGISTER_POLLS; index++) {
/* Read registers grouped in DWORD1 */
if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET,
- &unDword1)) {
- nError = 1;
+ &dword1)) {
+ err = 1;
break;
}
- bStatus = EXTRACT_STATUS_REGISTER(unDword1);
+ status = EXTRACT_STATUS_REGISTER(dword1);
- if (bStatus & LBCIF_STATUS_PHY_QUEUE_AVAIL &&
- bStatus & LBCIF_STATUS_I2C_IDLE)
+ if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL &&
+ status & LBCIF_STATUS_I2C_IDLE)
/* bits 1:0 are equal to 1 */
break;
}
- if (nError || (nIndex >= MAX_NUM_REGISTER_POLLS))
+ if (err || (index >= MAX_NUM_REGISTER_POLLS))
return FAILURE;
/* Step 2: */
- bControl = 0;
- bControl |= LBCIF_CONTROL_LBCIF_ENABLE | LBCIF_CONTROL_I2C_WRITE;
+ control = 0;
+ control |= LBCIF_CONTROL_LBCIF_ENABLE | LBCIF_CONTROL_I2C_WRITE;
- if (unAddressingMode == DUAL_BYTE)
- bControl |= LBCIF_CONTROL_TWO_BYTE_ADDR;
+ if (addrmode == DUAL_BYTE)
+ control |= LBCIF_CONTROL_TWO_BYTE_ADDR;
if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET,
- bControl)) {
+ control)) {
return FAILURE;
}
- nI2CWriteActive = 1;
+ i2c_wack = 1;
/* Prepare EEPROM address for Step 3 */
- unAddress |= (unAddressingMode == DUAL_BYTE) ?
- (unEepromId << 16) : (unEepromId << 8);
+ addr |= (addrmode == DUAL_BYTE) ?
+ (eeprom_id << 16) : (eeprom_id << 8);
- for (nRetries = 0; nRetries < MAX_NUM_WRITE_RETRIES; nRetries++) {
+ for (retries = 0; retries < MAX_NUM_WRITE_RETRIES; retries++) {
/* Step 3:*/
if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET,
- unAddress)) {
+ addr)) {
break;
}
/* Step 4: */
if (pci_write_config_byte(pdev, LBCIF_DATA_REGISTER_OFFSET,
- bData)) {
+ data)) {
break;
}
/* Step 5: */
- for (nIndex = 0; nIndex < MAX_NUM_REGISTER_POLLS; nIndex++) {
+ for (index = 0; index < MAX_NUM_REGISTER_POLLS; index++) {
/* Read registers grouped in DWORD1 */
if (pci_read_config_dword(pdev,
LBCIF_DWORD1_GROUP_OFFSET,
- &unDword1)) {
- nError = 1;
+ &dword1)) {
+ err = 1;
break;
}
- bStatus = EXTRACT_STATUS_REGISTER(unDword1);
+ status = EXTRACT_STATUS_REGISTER(dword1);
- if (bStatus & LBCIF_STATUS_PHY_QUEUE_AVAIL &&
- bStatus & LBCIF_STATUS_I2C_IDLE) {
+ if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL &&
+ status & LBCIF_STATUS_I2C_IDLE) {
/* I2C write complete */
break;
}
}
- if (nError || (nIndex >= MAX_NUM_REGISTER_POLLS))
+ if (err || (index >= MAX_NUM_REGISTER_POLLS))
break;
/*
* Step 6: Don't break here if we are revision 1, this is
* so we do a blind write for load bug.
*/
- if (bStatus & LBCIF_STATUS_GENERAL_ERROR
+ if (status & LBCIF_STATUS_GENERAL_ERROR
&& etdev->pdev->revision == 0) {
break;
}
/* Step 7 */
- if (bStatus & LBCIF_STATUS_ACK_ERROR) {
+ if (status & LBCIF_STATUS_ACK_ERROR) {
/*
* This could be due to an actual hardware failure
* or the EEPROM may still be in its internal write
@@ -308,19 +308,19 @@ int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress,
continue;
}
- nWriteSuccessful = 1;
+ writeok = 1;
break;
}
/* Step 8: */
udelay(10);
- nIndex = 0;
- while (nI2CWriteActive) {
- bControl &= ~LBCIF_CONTROL_I2C_WRITE;
+ index = 0;
+ while (i2c_wack) {
+ control &= ~LBCIF_CONTROL_I2C_WRITE;
if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET,
- bControl)) {
- nWriteSuccessful = 0;
+ control)) {
+ writeok = 0;
}
/* Do read until internal ACK_ERROR goes away meaning write
@@ -329,44 +329,44 @@ int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress,
do {
pci_write_config_dword(pdev,
LBCIF_ADDRESS_REGISTER_OFFSET,
- unAddress);
+ addr);
do {
pci_read_config_dword(pdev,
- LBCIF_DATA_REGISTER_OFFSET, &unData);
- } while ((unData & 0x00010000) == 0);
- } while (unData & 0x00040000);
+ LBCIF_DATA_REGISTER_OFFSET, &val);
+ } while ((val & 0x00010000) == 0);
+ } while (val & 0x00040000);
- bControl = EXTRACT_CONTROL_REG(unData);
+ control = EXTRACT_CONTROL_REG(val);
- if (bControl != 0xC0 || nIndex == 10000)
+ if (control != 0xC0 || index == 10000)
break;
- nIndex++;
+ index++;
}
- return nWriteSuccessful ? SUCCESS : FAILURE;
+ return writeok ? SUCCESS : FAILURE;
}
/**
* EepromReadByte - Read a byte from the ET1310's EEPROM
* @etdev: pointer to our private adapter structure
- * @unAddress: the address from which to read
- * @pbData: a pointer to a byte in which to store the value of the read
- * @unEepronId: the ID of the EEPROM
- * @unAddressingMode: how the EEPROM is to be accessed
+ * @addr: the address from which to read
+ * @pdata: a pointer to a byte in which to store the value of the read
+ * @eeprom_id: the ID of the EEPROM
+ * @addrmode: how the EEPROM is to be accessed
*
* Returns SUCCESS or FAILURE
*/
-int32_t EepromReadByte(struct et131x_adapter *etdev, uint32_t unAddress,
- uint8_t *pbData, uint32_t unEepromId,
- uint32_t unAddressingMode)
+int EepromReadByte(struct et131x_adapter *etdev, u32 addr,
+ u8 *pdata, u32 eeprom_id,
+ u32 addrmode)
{
struct pci_dev *pdev = etdev->pdev;
- int32_t nIndex;
- int32_t nError = 0;
- uint8_t bControl;
- uint8_t bStatus = 0;
- uint32_t unDword1 = 0;
+ int index;
+ int err = 0;
+ u8 control;
+ u8 status = 0;
+ u32 dword1 = 0;
/*
* The following excerpt is from "Serial EEPROM HW Design
@@ -403,70 +403,70 @@ int32_t EepromReadByte(struct et131x_adapter *etdev, uint32_t unAddress,
*/
/* Step 1: */
- for (nIndex = 0; nIndex < MAX_NUM_REGISTER_POLLS; nIndex++) {
+ for (index = 0; index < MAX_NUM_REGISTER_POLLS; index++) {
/* Read registers grouped in DWORD1 */
if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET,
- &unDword1)) {
- nError = 1;
+ &dword1)) {
+ err = 1;
break;
}
- bStatus = EXTRACT_STATUS_REGISTER(unDword1);
+ status = EXTRACT_STATUS_REGISTER(dword1);
- if (bStatus & LBCIF_STATUS_PHY_QUEUE_AVAIL &&
- bStatus & LBCIF_STATUS_I2C_IDLE) {
+ if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL &&
+ status & LBCIF_STATUS_I2C_IDLE) {
/* bits 1:0 are equal to 1 */
break;
}
}
- if (nError || (nIndex >= MAX_NUM_REGISTER_POLLS))
+ if (err || (index >= MAX_NUM_REGISTER_POLLS))
return FAILURE;
/* Step 2: */
- bControl = 0;
- bControl |= LBCIF_CONTROL_LBCIF_ENABLE;
+ control = 0;
+ control |= LBCIF_CONTROL_LBCIF_ENABLE;
- if (unAddressingMode == DUAL_BYTE)
- bControl |= LBCIF_CONTROL_TWO_BYTE_ADDR;
+ if (addrmode == DUAL_BYTE)
+ control |= LBCIF_CONTROL_TWO_BYTE_ADDR;
if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET,
- bControl)) {
+ control)) {
return FAILURE;
}
/* Step 3: */
- unAddress |= (unAddressingMode == DUAL_BYTE) ?
- (unEepromId << 16) : (unEepromId << 8);
+ addr |= (addrmode == DUAL_BYTE) ?
+ (eeprom_id << 16) : (eeprom_id << 8);
if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET,
- unAddress)) {
+ addr)) {
return FAILURE;
}
/* Step 4: */
- for (nIndex = 0; nIndex < MAX_NUM_REGISTER_POLLS; nIndex++) {
+ for (index = 0; index < MAX_NUM_REGISTER_POLLS; index++) {
/* Read registers grouped in DWORD1 */
if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET,
- &unDword1)) {
- nError = 1;
+ &dword1)) {
+ err = 1;
break;
}
- bStatus = EXTRACT_STATUS_REGISTER(unDword1);
+ status = EXTRACT_STATUS_REGISTER(dword1);
- if (bStatus & LBCIF_STATUS_PHY_QUEUE_AVAIL
- && bStatus & LBCIF_STATUS_I2C_IDLE) {
+ if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL
+ && status & LBCIF_STATUS_I2C_IDLE) {
/* I2C read complete */
break;
}
}
- if (nError || (nIndex >= MAX_NUM_REGISTER_POLLS))
+ if (err || (index >= MAX_NUM_REGISTER_POLLS))
return FAILURE;
/* Step 6: */
- *pbData = EXTRACT_DATA_REGISTER(unDword1);
+ *pdata = EXTRACT_DATA_REGISTER(dword1);
- return (bStatus & LBCIF_STATUS_ACK_ERROR) ? FAILURE : SUCCESS;
+ return (status & LBCIF_STATUS_ACK_ERROR) ? FAILURE : SUCCESS;
}
diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index 9461a2d..b2123d0 100644
--- a/drivers/staging/et131x/et1310_mac.c
+++ b/drivers/staging/et131x/et1310_mac.c
@@ -195,7 +195,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
cfg2.value = readl(&pMac->cfg2.value);
ifctrl.value = readl(&pMac->if_ctrl.value);
- if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
+ if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) {
cfg2.bits.if_mode = 0x2;
ifctrl.bits.phy_mode = 0x0;
} else {
@@ -241,8 +241,8 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
}
/* 1 - full duplex, 0 - half-duplex */
- cfg2.bits.full_duplex = etdev->uiDuplexMode;
- ifctrl.bits.ghd_mode = !etdev->uiDuplexMode;
+ cfg2.bits.full_duplex = etdev->duplex_mode;
+ ifctrl.bits.ghd_mode = !etdev->duplex_mode;
writel(ifctrl.value, &pMac->if_ctrl.value);
writel(cfg2.value, &pMac->cfg2.value);
@@ -262,7 +262,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
DBG_TRACE(et131x_dbginfo,
"Speed %d, Dup %d, CFG1 0x%08x, CFG2 0x%08x, if_ctrl 0x%08x\n",
- etdev->uiLinkSpeed, etdev->uiDuplexMode,
+ etdev->linkspeed, etdev->duplex_mode,
readl(&pMac->cfg1.value), readl(&pMac->cfg2.value),
readl(&pMac->if_ctrl.value));
@@ -408,7 +408,7 @@ void ConfigRxMacRegs(struct et131x_adapter *etdev)
* bit 16: Receive frame truncated.
* bit 17: Drop packet enable
*/
- if (etdev->uiLinkSpeed == TRUEPHY_SPEED_100MBPS)
+ if (etdev->linkspeed == TRUEPHY_SPEED_100MBPS)
writel(0x30038, &pRxMac->mif_ctrl.value);
else
writel(0x30030, &pRxMac->mif_ctrl.value);
@@ -540,7 +540,7 @@ void ConfigMacStatRegs(struct et131x_adapter *etdev)
void ConfigFlowControl(struct et131x_adapter *etdev)
{
- if (etdev->uiDuplexMode == 0) {
+ if (etdev->duplex_mode == 0) {
etdev->FlowControl = None;
} else {
char RemotePause, RemoteAsyncPause;
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index d0a3c83..a16ce16 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -477,13 +477,13 @@ static int et131x_xcvr_init(struct et131x_adapter *adapter)
void et131x_Mii_check(struct et131x_adapter *etdev,
MI_BMSR_t bmsr, MI_BMSR_t bmsr_ints)
{
- uint8_t ucLinkStatus;
- uint32_t uiAutoNegStatus;
- uint32_t uiSpeed;
- uint32_t uiDuplex;
- uint32_t uiMdiMdix;
- uint32_t uiMasterSlave;
- uint32_t uiPolarity;
+ uint8_t link_status;
+ uint32_t autoneg_status;
+ uint32_t speed;
+ uint32_t duplex;
+ uint32_t mdi_mdix;
+ uint32_t masterslave;
+ uint32_t polarity;
unsigned long flags;
DBG_ENTER(et131x_dbginfo);
@@ -509,7 +509,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
DBG_WARNING(et131x_dbginfo,
"Link down cable problem\n");
- if (etdev->uiLinkSpeed == TRUEPHY_SPEED_10MBPS) {
+ if (etdev->linkspeed == TRUEPHY_SPEED_10MBPS) {
/* NOTE - Is there a way to query this without
* TruePHY?
* && TRU_QueryCoreType(etdev->hTruePhy, 0) == EMI_TRUEPHY_A13O) {
@@ -546,8 +546,8 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
netif_carrier_off(etdev->netdev);
}
- etdev->uiLinkSpeed = 0;
- etdev->uiDuplexMode = 0;
+ etdev->linkspeed = 0;
+ etdev->duplexMode = 0;
/* Free the packets being actively sent & stopped */
et131x_free_busy_send_packets(etdev);
@@ -581,21 +581,21 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
(etdev->AiForceDpx == 3 && bmsr_ints.bits.link_status)) {
if (bmsr.bits.auto_neg_complete || etdev->AiForceDpx == 3) {
ET1310_PhyLinkStatus(etdev,
- &ucLinkStatus, &uiAutoNegStatus,
- &uiSpeed, &uiDuplex, &uiMdiMdix,
- &uiMasterSlave, &uiPolarity);
+ &link_status, &autoneg_status,
+ &speed, &duplex, &mdi_mdix,
+ &masterslave, &polarity);
- etdev->uiLinkSpeed = uiSpeed;
- etdev->uiDuplexMode = uiDuplex;
+ etdev->linkspeed = speed;
+ etdev->duplex_mode = duplex;
DBG_TRACE(et131x_dbginfo,
- "etdev->uiLinkSpeed 0x%04x, etdev->uiDuplex 0x%08x\n",
- etdev->uiLinkSpeed,
- etdev->uiDuplexMode);
+ "etdev->linkspeed 0x%04x, etdev->duplex_mode 0x%08x\n",
+ etdev->linkspeed,
+ etdev->duplex_mode);
etdev->PoMgmt.TransPhyComaModeOnBoot = 20;
- if (etdev->uiLinkSpeed == TRUEPHY_SPEED_10MBPS) {
+ if (etdev->linkspeed == TRUEPHY_SPEED_10MBPS) {
/*
* NOTE - Is there a way to query this without
* TruePHY?
@@ -612,7 +612,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
ConfigFlowControl(etdev);
- if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS &&
+ if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS &&
etdev->RegistryJumboPacket > 2048)
ET1310_PhyAndOrReg(etdev, 0x16, 0xcfff,
0x2000);
@@ -905,67 +905,67 @@ static const uint16_t ConfigPhy[25][2] = {
/* condensed version of the phy initialization routine */
void ET1310_PhyInit(struct et131x_adapter *etdev)
{
- uint16_t usData, usIndex;
+ uint16_t data, index;
if (etdev == NULL)
return;
/* get the identity (again ?) */
- MiRead(etdev, PHY_ID_1, &usData);
- MiRead(etdev, PHY_ID_2, &usData);
+ MiRead(etdev, PHY_ID_1, &data);
+ MiRead(etdev, PHY_ID_2, &data);
/* what does this do/achieve ? */
- MiRead(etdev, PHY_MPHY_CONTROL_REG, &usData); /* should read 0002 */
+ MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */
MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006);
/* read modem register 0402, should I do something with the return
data ? */
MiWrite(etdev, PHY_INDEX_REG, 0x0402);
- MiRead(etdev, PHY_DATA_REG, &usData);
+ MiRead(etdev, PHY_DATA_REG, &data);
/* what does this do/achieve ? */
MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002);
/* get the identity (again ?) */
- MiRead(etdev, PHY_ID_1, &usData);
- MiRead(etdev, PHY_ID_2, &usData);
+ MiRead(etdev, PHY_ID_1, &data);
+ MiRead(etdev, PHY_ID_2, &data);
/* what does this achieve ? */
- MiRead(etdev, PHY_MPHY_CONTROL_REG, &usData); /* should read 0002 */
+ MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */
MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006);
/* read modem register 0402, should I do something with
the return data? */
MiWrite(etdev, PHY_INDEX_REG, 0x0402);
- MiRead(etdev, PHY_DATA_REG, &usData);
+ MiRead(etdev, PHY_DATA_REG, &data);
MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002);
/* what does this achieve (should return 0x1040) */
- MiRead(etdev, PHY_CONTROL, &usData);
- MiRead(etdev, PHY_MPHY_CONTROL_REG, &usData); /* should read 0002 */
+ MiRead(etdev, PHY_CONTROL, &data);
+ MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */
MiWrite(etdev, PHY_CONTROL, 0x1840);
MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0007);
/* here the writing of the array starts.... */
- usIndex = 0;
- while (ConfigPhy[usIndex][0] != 0x0000) {
+ index = 0;
+ while (ConfigPhy[index][0] != 0x0000) {
/* write value */
- MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[usIndex][0]);
- MiWrite(etdev, PHY_DATA_REG, ConfigPhy[usIndex][1]);
+ MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[index][0]);
+ MiWrite(etdev, PHY_DATA_REG, ConfigPhy[index][1]);
/* read it back */
- MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[usIndex][0]);
- MiRead(etdev, PHY_DATA_REG, &usData);
+ MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[index][0]);
+ MiRead(etdev, PHY_DATA_REG, &data);
/* do a check on the value read back ? */
- usIndex++;
+ index++;
}
/* here the writing of the array ends... */
- MiRead(etdev, PHY_CONTROL, &usData); /* 0x1840 */
- MiRead(etdev, PHY_MPHY_CONTROL_REG, &usData);/* should read 0007 */
+ MiRead(etdev, PHY_CONTROL, &data); /* 0x1840 */
+ MiRead(etdev, PHY_MPHY_CONTROL_REG, &data);/* should read 0007 */
MiWrite(etdev, PHY_CONTROL, 0x1040);
MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002);
}
@@ -977,64 +977,64 @@ void ET1310_PhyReset(struct et131x_adapter *etdev)
void ET1310_PhyPowerDown(struct et131x_adapter *etdev, bool down)
{
- uint16_t usData;
+ uint16_t data;
- MiRead(etdev, PHY_CONTROL, &usData);
+ MiRead(etdev, PHY_CONTROL, &data);
if (down == false) {
/* Power UP */
- usData &= ~0x0800;
- MiWrite(etdev, PHY_CONTROL, usData);
+ data &= ~0x0800;
+ MiWrite(etdev, PHY_CONTROL, data);
} else {
/* Power DOWN */
- usData |= 0x0800;
- MiWrite(etdev, PHY_CONTROL, usData);
+ data |= 0x0800;
+ MiWrite(etdev, PHY_CONTROL, data);
}
}
void ET1310_PhyAutoNeg(struct et131x_adapter *etdev, bool enable)
{
- uint16_t usData;
+ uint16_t data;
- MiRead(etdev, PHY_CONTROL, &usData);
+ MiRead(etdev, PHY_CONTROL, &data);
if (enable == true) {
/* Autonegotiation ON */
- usData |= 0x1000;
- MiWrite(etdev, PHY_CONTROL, usData);
+ data |= 0x1000;
+ MiWrite(etdev, PHY_CONTROL, data);
} else {
/* Autonegotiation OFF */
- usData &= ~0x1000;
- MiWrite(etdev, PHY_CONTROL, usData);
+ data &= ~0x1000;
+ MiWrite(etdev, PHY_CONTROL, data);
}
}
void ET1310_PhyDuplexMode(struct et131x_adapter *etdev, uint16_t duplex)
{
- uint16_t usData;
+ uint16_t data;
- MiRead(etdev, PHY_CONTROL, &usData);
+ MiRead(etdev, PHY_CONTROL, &data);
if (duplex == TRUEPHY_DUPLEX_FULL) {
/* Set Full Duplex */
- usData |= 0x100;
- MiWrite(etdev, PHY_CONTROL, usData);
+ data |= 0x100;
+ MiWrite(etdev, PHY_CONTROL, data);
} else {
/* Set Half Duplex */
- usData &= ~0x100;
- MiWrite(etdev, PHY_CONTROL, usData);
+ data &= ~0x100;
+ MiWrite(etdev, PHY_CONTROL, data);
}
}
void ET1310_PhySpeedSelect(struct et131x_adapter *etdev, uint16_t speed)
{
- uint16_t usData;
+ uint16_t data;
/* Read the PHY control register */
- MiRead(etdev, PHY_CONTROL, &usData);
+ MiRead(etdev, PHY_CONTROL, &data);
/* Clear all Speed settings (Bits 6, 13) */
- usData &= ~0x2040;
+ data &= ~0x2040;
/* Reset the speed bits based on user selection */
switch (speed) {
@@ -1044,29 +1044,29 @@ void ET1310_PhySpeedSelect(struct et131x_adapter *etdev, uint16_t speed)
case TRUEPHY_SPEED_100MBPS:
/* 100M == Set bit 13 */
- usData |= 0x2000;
+ data |= 0x2000;
break;
case TRUEPHY_SPEED_1000MBPS:
default:
- usData |= 0x0040;
+ data |= 0x0040;
break;
}
/* Write back the new speed */
- MiWrite(etdev, PHY_CONTROL, usData);
+ MiWrite(etdev, PHY_CONTROL, data);
}
void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *etdev,
uint16_t duplex)
{
- uint16_t usData;
+ uint16_t data;
/* Read the PHY 1000 Base-T Control Register */
- MiRead(etdev, PHY_1000_CONTROL, &usData);
+ MiRead(etdev, PHY_1000_CONTROL, &data);
/* Clear Bits 8,9 */
- usData &= ~0x0300;
+ data &= ~0x0300;
switch (duplex) {
case TRUEPHY_ADV_DUPLEX_NONE:
@@ -1075,34 +1075,34 @@ void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *etdev,
case TRUEPHY_ADV_DUPLEX_FULL:
/* Set Bit 9 */
- usData |= 0x0200;
+ data |= 0x0200;
break;
case TRUEPHY_ADV_DUPLEX_HALF:
/* Set Bit 8 */
- usData |= 0x0100;
+ data |= 0x0100;
break;
case TRUEPHY_ADV_DUPLEX_BOTH:
default:
- usData |= 0x0300;
+ data |= 0x0300;
break;
}
/* Write back advertisement */
- MiWrite(etdev, PHY_1000_CONTROL, usData);
+ MiWrite(etdev, PHY_1000_CONTROL, data);
}
void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *etdev,
uint16_t duplex)
{
- uint16_t usData;
+ uint16_t data;
/* Read the Autonegotiation Register (10/100) */
- MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &usData);
+ MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &data);
/* Clear bits 7,8 */
- usData &= ~0x0180;
+ data &= ~0x0180;
switch (duplex) {
case TRUEPHY_ADV_DUPLEX_NONE:
@@ -1111,35 +1111,35 @@ void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *etdev,
case TRUEPHY_ADV_DUPLEX_FULL:
/* Set Bit 8 */
- usData |= 0x0100;
+ data |= 0x0100;
break;
case TRUEPHY_ADV_DUPLEX_HALF:
/* Set Bit 7 */
- usData |= 0x0080;
+ data |= 0x0080;
break;
case TRUEPHY_ADV_DUPLEX_BOTH:
default:
/* Set Bits 7,8 */
- usData |= 0x0180;
+ data |= 0x0180;
break;
}
/* Write back advertisement */
- MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, usData);
+ MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, data);
}
void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *etdev,
uint16_t duplex)
{
- uint16_t usData;
+ uint16_t data;
/* Read the Autonegotiation Register (10/100) */
- MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &usData);
+ MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &data);
/* Clear bits 5,6 */
- usData &= ~0x0060;
+ data &= ~0x0060;
switch (duplex) {
case TRUEPHY_ADV_DUPLEX_NONE:
@@ -1148,75 +1148,75 @@ void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *etdev,
case TRUEPHY_ADV_DUPLEX_FULL:
/* Set Bit 6 */
- usData |= 0x0040;
+ data |= 0x0040;
break;
case TRUEPHY_ADV_DUPLEX_HALF:
/* Set Bit 5 */
- usData |= 0x0020;
+ data |= 0x0020;
break;
case TRUEPHY_ADV_DUPLEX_BOTH:
default:
/* Set Bits 5,6 */
- usData |= 0x0060;
+ data |= 0x0060;
break;
}
/* Write back advertisement */
- MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, usData);
+ MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, data);
}
void ET1310_PhyLinkStatus(struct et131x_adapter *etdev,
- uint8_t *ucLinkStatus,
- uint32_t *uiAutoNeg,
- uint32_t *uiLinkSpeed,
- uint32_t *uiDuplexMode,
- uint32_t *uiMdiMdix,
- uint32_t *uiMasterSlave, uint32_t *uiPolarity)
+ uint8_t *link_status,
+ uint32_t *autoneg,
+ uint32_t *linkspeed,
+ uint32_t *duplex_mode,
+ uint32_t *mdi_mdix,
+ uint32_t *masterslave, uint32_t *polarity)
{
- uint16_t usMiStatus = 0;
- uint16_t us1000BaseT = 0;
- uint16_t usVmiPhyStatus = 0;
- uint16_t usControl = 0;
-
- MiRead(etdev, PHY_STATUS, &usMiStatus);
- MiRead(etdev, PHY_1000_STATUS, &us1000BaseT);
- MiRead(etdev, PHY_PHY_STATUS, &usVmiPhyStatus);
- MiRead(etdev, PHY_CONTROL, &usControl);
-
- if (ucLinkStatus) {
- *ucLinkStatus =
- (unsigned char)((usVmiPhyStatus & 0x0040) ? 1 : 0);
+ uint16_t mistatus = 0;
+ uint16_t is1000BaseT = 0;
+ uint16_t vmi_phystatus = 0;
+ uint16_t control = 0;
+
+ MiRead(etdev, PHY_STATUS, &mistatus);
+ MiRead(etdev, PHY_1000_STATUS, &is1000BaseT);
+ MiRead(etdev, PHY_PHY_STATUS, &vmi_phystatus);
+ MiRead(etdev, PHY_CONTROL, &control);
+
+ if (link_status) {
+ *link_status =
+ (unsigned char)((vmi_phystatus & 0x0040) ? 1 : 0);
}
- if (uiAutoNeg) {
- *uiAutoNeg =
- (usControl & 0x1000) ? ((usVmiPhyStatus & 0x0020) ?
+ if (autoneg) {
+ *autoneg =
+ (control & 0x1000) ? ((vmi_phystatus & 0x0020) ?
TRUEPHY_ANEG_COMPLETE :
TRUEPHY_ANEG_NOT_COMPLETE) :
TRUEPHY_ANEG_DISABLED;
}
- if (uiLinkSpeed)
- *uiLinkSpeed = (usVmiPhyStatus & 0x0300) >> 8;
+ if (linkspeed)
+ *linkspeed = (vmi_phystatus & 0x0300) >> 8;
- if (uiDuplexMode)
- *uiDuplexMode = (usVmiPhyStatus & 0x0080) >> 7;
+ if (duplex_mode)
+ *duplex_mode = (vmi_phystatus & 0x0080) >> 7;
- if (uiMdiMdix)
+ if (mdi_mdix)
/* NOTE: Need to complete this */
- *uiMdiMdix = 0;
+ *mdi_mdix = 0;
- if (uiMasterSlave) {
- *uiMasterSlave =
- (us1000BaseT & 0x4000) ? TRUEPHY_CFG_MASTER :
+ if (masterslave) {
+ *masterslave =
+ (is1000BaseT & 0x4000) ? TRUEPHY_CFG_MASTER :
TRUEPHY_CFG_SLAVE;
}
- if (uiPolarity) {
- *uiPolarity =
- (usVmiPhyStatus & 0x0400) ? TRUEPHY_POLARITY_INVERTED :
+ if (polarity) {
+ *polarity =
+ (vmi_phystatus & 0x0400) ? TRUEPHY_POLARITY_INVERTED :
TRUEPHY_POLARITY_NORMAL;
}
}
diff --git a/drivers/staging/et131x/et1310_phy.h b/drivers/staging/et131x/et1310_phy.h
index 34e08e8..aec0a7b 100644
--- a/drivers/staging/et131x/et1310_phy.h
+++ b/drivers/staging/et131x/et1310_phy.h
@@ -895,12 +895,12 @@ void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *adapter,
void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *adapter,
u16 duplex);
void ET1310_PhyLinkStatus(struct et131x_adapter *adapter,
- u8 *ucLinkStatus,
- u32 *uiAutoNeg,
- u32 *uiLinkSpeed,
- u32 *uiDuplexMode,
- u32 *uiMdiMdix,
- u32 *uiMasterSlave, u32 *uiPolarity);
+ u8 *Link_status,
+ u32 *autoneg,
+ u32 *linkspeed,
+ u32 *duplex_mode,
+ u32 *mdi_mdix,
+ u32 *masterslave, u32 *polarity);
void ET1310_PhyAndOrReg(struct et131x_adapter *adapter,
u16 regnum, u16 andMask, u16 orMask);
void ET1310_PhyAccessMiBit(struct et131x_adapter *adapter,
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index 53efa08..7f36de0 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -680,10 +680,10 @@ void et131x_rfd_resources_free(struct et131x_adapter *adapter, MP_RFD *pMpRfd)
*/
void ConfigRxDmaRegs(struct et131x_adapter *etdev)
{
- struct _RXDMA_t __iomem *pRxDma = &etdev->regs->rxdma;
+ struct _RXDMA_t __iomem *rx_dma = &etdev->regs->rxdma;
struct _rx_ring_t *pRxLocal = &etdev->RxRing;
- PFBR_DESC_t pFbrEntry;
- uint32_t iEntry;
+ PFBR_DESC_t fbr_entry;
+ uint32_t entry;
RXDMA_PSR_NUM_DES_t psr_num_des;
unsigned long flags;
@@ -700,8 +700,8 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
* before storing the adjusted address.
*/
writel((uint32_t) (pRxLocal->RxStatusRealPA >> 32),
- &pRxDma->dma_wb_base_hi);
- writel((uint32_t) pRxLocal->RxStatusRealPA, &pRxDma->dma_wb_base_lo);
+ &rx_dma->dma_wb_base_hi);
+ writel((uint32_t) pRxLocal->RxStatusRealPA, &rx_dma->dma_wb_base_lo);
memset(pRxLocal->pRxStatusVa, 0, sizeof(RX_STATUS_BLOCK_t));
@@ -709,14 +709,14 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
* 1310's registers
*/
writel((uint32_t) (pRxLocal->pPSRingRealPa >> 32),
- &pRxDma->psr_base_hi);
- writel((uint32_t) pRxLocal->pPSRingRealPa, &pRxDma->psr_base_lo);
- writel(pRxLocal->PsrNumEntries - 1, &pRxDma->psr_num_des.value);
- writel(0, &pRxDma->psr_full_offset.value);
+ &rx_dma->psr_base_hi);
+ writel((uint32_t) pRxLocal->pPSRingRealPa, &rx_dma->psr_base_lo);
+ writel(pRxLocal->PsrNumEntries - 1, &rx_dma->psr_num_des.value);
+ writel(0, &rx_dma->psr_full_offset.value);
- psr_num_des.value = readl(&pRxDma->psr_num_des.value);
+ psr_num_des.value = readl(&rx_dma->psr_num_des.value);
writel((psr_num_des.bits.psr_ndes * LO_MARK_PERCENT_FOR_PSR) / 100,
- &pRxDma->psr_min_des.value);
+ &rx_dma->psr_min_des.value);
spin_lock_irqsave(&etdev->RcvLock, flags);
@@ -725,27 +725,27 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
pRxLocal->local_psr_full.bits.psr_full_wrap = 0;
/* Now's the best time to initialize FBR1 contents */
- pFbrEntry = (PFBR_DESC_t) pRxLocal->pFbr1RingVa;
- for (iEntry = 0; iEntry < pRxLocal->Fbr1NumEntries; iEntry++) {
- pFbrEntry->addr_hi = pRxLocal->Fbr[1]->PAHigh[iEntry];
- pFbrEntry->addr_lo = pRxLocal->Fbr[1]->PALow[iEntry];
- pFbrEntry->word2.bits.bi = iEntry;
- pFbrEntry++;
+ fbr_entry = (PFBR_DESC_t) pRxLocal->pFbr1RingVa;
+ for (entry = 0; entry < pRxLocal->Fbr1NumEntries; entry++) {
+ fbr_entry->addr_hi = pRxLocal->Fbr[1]->PAHigh[entry];
+ fbr_entry->addr_lo = pRxLocal->Fbr[1]->PALow[entry];
+ fbr_entry->word2.bits.bi = entry;
+ fbr_entry++;
}
/* Set the address and parameters of Free buffer ring 1 (and 0 if
* required) into the 1310's registers
*/
- writel((uint32_t) (pRxLocal->Fbr1Realpa >> 32), &pRxDma->fbr1_base_hi);
- writel((uint32_t) pRxLocal->Fbr1Realpa, &pRxDma->fbr1_base_lo);
- writel(pRxLocal->Fbr1NumEntries - 1, &pRxDma->fbr1_num_des.value);
+ writel((uint32_t) (pRxLocal->Fbr1Realpa >> 32), &rx_dma->fbr1_base_hi);
+ writel((uint32_t) pRxLocal->Fbr1Realpa, &rx_dma->fbr1_base_lo);
+ writel(pRxLocal->Fbr1NumEntries - 1, &rx_dma->fbr1_num_des.value);
{
DMA10W_t fbr1_full = { 0 };
fbr1_full.bits.val = 0;
fbr1_full.bits.wrap = 1;
- writel(fbr1_full.value, &pRxDma->fbr1_full_offset.value);
+ writel(fbr1_full.value, &rx_dma->fbr1_full_offset.value);
}
/* This variable tracks the free buffer ring 1 full position, so it
@@ -754,28 +754,28 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
pRxLocal->local_Fbr1_full.bits.val = 0;
pRxLocal->local_Fbr1_full.bits.wrap = 1;
writel(((pRxLocal->Fbr1NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
- &pRxDma->fbr1_min_des.value);
+ &rx_dma->fbr1_min_des.value);
#ifdef USE_FBR0
/* Now's the best time to initialize FBR0 contents */
- pFbrEntry = (PFBR_DESC_t) pRxLocal->pFbr0RingVa;
- for (iEntry = 0; iEntry < pRxLocal->Fbr0NumEntries; iEntry++) {
- pFbrEntry->addr_hi = pRxLocal->Fbr[0]->PAHigh[iEntry];
- pFbrEntry->addr_lo = pRxLocal->Fbr[0]->PALow[iEntry];
- pFbrEntry->word2.bits.bi = iEntry;
- pFbrEntry++;
+ fbr_entry = (PFBR_DESC_t) pRxLocal->pFbr0RingVa;
+ for (entry = 0; entry < pRxLocal->Fbr0NumEntries; entry++) {
+ fbr_entry->addr_hi = pRxLocal->Fbr[0]->PAHigh[entry];
+ fbr_entry->addr_lo = pRxLocal->Fbr[0]->PALow[entry];
+ fbr_entry->word2.bits.bi = entry;
+ fbr_entry++;
}
- writel((uint32_t) (pRxLocal->Fbr0Realpa >> 32), &pRxDma->fbr0_base_hi);
- writel((uint32_t) pRxLocal->Fbr0Realpa, &pRxDma->fbr0_base_lo);
- writel(pRxLocal->Fbr0NumEntries - 1, &pRxDma->fbr0_num_des.value);
+ writel((uint32_t) (pRxLocal->Fbr0Realpa >> 32), &rx_dma->fbr0_base_hi);
+ writel((uint32_t) pRxLocal->Fbr0Realpa, &rx_dma->fbr0_base_lo);
+ writel(pRxLocal->Fbr0NumEntries - 1, &rx_dma->fbr0_num_des.value);
{
DMA10W_t fbr0_full = { 0 };
fbr0_full.bits.val = 0;
fbr0_full.bits.wrap = 1;
- writel(fbr0_full.value, &pRxDma->fbr0_full_offset.value);
+ writel(fbr0_full.value, &rx_dma->fbr0_full_offset.value);
}
/* This variable tracks the free buffer ring 0 full position, so it
@@ -784,7 +784,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
pRxLocal->local_Fbr0_full.bits.val = 0;
pRxLocal->local_Fbr0_full.bits.wrap = 1;
writel(((pRxLocal->Fbr0NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
- &pRxDma->fbr0_min_des.value);
+ &rx_dma->fbr0_min_des.value);
#endif
/* Program the number of packets we will receive before generating an
@@ -792,14 +792,14 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
* For version B silicon, this value gets updated once autoneg is
*complete.
*/
- writel(PARM_RX_NUM_BUFS_DEF, &pRxDma->num_pkt_done.value);
+ writel(PARM_RX_NUM_BUFS_DEF, &rx_dma->num_pkt_done.value);
/* The "time_done" is not working correctly to coalesce interrupts
* after a given time period, but rather is giving us an interrupt
* regardless of whether we have received packets.
* This value gets updated once autoneg is complete.
*/
- writel(PARM_RX_TIME_INT_DEF, &pRxDma->max_pkt_time.value);
+ writel(PARM_RX_TIME_INT_DEF, &rx_dma->max_pkt_time.value);
spin_unlock_irqrestore(&etdev->RcvLock, flags);
@@ -815,8 +815,8 @@ void SetRxDmaTimer(struct et131x_adapter *etdev)
/* For version B silicon, we do not use the RxDMA timer for 10 and 100
* Mbits/s line rates. We do not enable and RxDMA interrupt coalescing.
*/
- if ((etdev->uiLinkSpeed == TRUEPHY_SPEED_100MBPS) ||
- (etdev->uiLinkSpeed == TRUEPHY_SPEED_10MBPS)) {
+ if ((etdev->linkspeed == TRUEPHY_SPEED_100MBPS) ||
+ (etdev->linkspeed == TRUEPHY_SPEED_10MBPS)) {
writel(0, &etdev->regs->rxdma.max_pkt_time.value);
writel(1, &etdev->regs->rxdma.num_pkt_done.value);
}
@@ -1032,8 +1032,8 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev)
spin_unlock_irqrestore(&etdev->RcvLock, flags);
- pMpRfd->iBufferIndex = bufferIndex;
- pMpRfd->iRingIndex = ringIndex;
+ pMpRfd->bufferindex = bufferIndex;
+ pMpRfd->ringindex = ringIndex;
/* In V1 silicon, there is a bug which screws up filtering of
* runt packets. Therefore runt packet filtering is disabled
@@ -1289,10 +1289,10 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
*/
void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd)
{
- struct _rx_ring_t *pRxLocal = &etdev->RxRing;
- struct _RXDMA_t __iomem *pRxDma = &etdev->regs->rxdma;
- uint16_t bi = pMpRfd->iBufferIndex;
- uint8_t ri = pMpRfd->iRingIndex;
+ struct _rx_ring_t *rx_local = &etdev->RxRing;
+ struct _RXDMA_t __iomem *rx_dma = &etdev->regs->rxdma;
+ uint16_t bi = pMpRfd->bufferindex;
+ uint8_t ri = pMpRfd->ringindex;
unsigned long flags;
DBG_RX_ENTER(et131x_dbginfo);
@@ -1302,55 +1302,55 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd)
*/
if (
#ifdef USE_FBR0
- (ri == 0 && bi < pRxLocal->Fbr0NumEntries) ||
+ (ri == 0 && bi < rx_local->Fbr0NumEntries) ||
#endif
- (ri == 1 && bi < pRxLocal->Fbr1NumEntries)) {
+ (ri == 1 && bi < rx_local->Fbr1NumEntries)) {
spin_lock_irqsave(&etdev->FbrLock, flags);
if (ri == 1) {
PFBR_DESC_t pNextDesc =
- (PFBR_DESC_t) (pRxLocal->pFbr1RingVa) +
- pRxLocal->local_Fbr1_full.bits.val;
+ (PFBR_DESC_t) (rx_local->pFbr1RingVa) +
+ rx_local->local_Fbr1_full.bits.val;
/* Handle the Free Buffer Ring advancement here. Write
* the PA / Buffer Index for the returned buffer into
* the oldest (next to be freed)FBR entry
*/
- pNextDesc->addr_hi = pRxLocal->Fbr[1]->PAHigh[bi];
- pNextDesc->addr_lo = pRxLocal->Fbr[1]->PALow[bi];
+ pNextDesc->addr_hi = rx_local->Fbr[1]->PAHigh[bi];
+ pNextDesc->addr_lo = rx_local->Fbr[1]->PALow[bi];
pNextDesc->word2.value = bi;
- if (++pRxLocal->local_Fbr1_full.bits.val >
- (pRxLocal->Fbr1NumEntries - 1)) {
- pRxLocal->local_Fbr1_full.bits.val = 0;
- pRxLocal->local_Fbr1_full.bits.wrap ^= 1;
+ if (++rx_local->local_Fbr1_full.bits.val >
+ (rx_local->Fbr1NumEntries - 1)) {
+ rx_local->local_Fbr1_full.bits.val = 0;
+ rx_local->local_Fbr1_full.bits.wrap ^= 1;
}
- writel(pRxLocal->local_Fbr1_full.value,
- &pRxDma->fbr1_full_offset.value);
+ writel(rx_local->local_Fbr1_full.value,
+ &rx_dma->fbr1_full_offset.value);
}
#ifdef USE_FBR0
else {
PFBR_DESC_t pNextDesc =
- (PFBR_DESC_t) pRxLocal->pFbr0RingVa +
- pRxLocal->local_Fbr0_full.bits.val;
+ (PFBR_DESC_t) rx_local->pFbr0RingVa +
+ rx_local->local_Fbr0_full.bits.val;
/* Handle the Free Buffer Ring advancement here. Write
* the PA / Buffer Index for the returned buffer into
* the oldest (next to be freed) FBR entry
*/
- pNextDesc->addr_hi = pRxLocal->Fbr[0]->PAHigh[bi];
- pNextDesc->addr_lo = pRxLocal->Fbr[0]->PALow[bi];
+ pNextDesc->addr_hi = rx_local->Fbr[0]->PAHigh[bi];
+ pNextDesc->addr_lo = rx_local->Fbr[0]->PALow[bi];
pNextDesc->word2.value = bi;
- if (++pRxLocal->local_Fbr0_full.bits.val >
- (pRxLocal->Fbr0NumEntries - 1)) {
- pRxLocal->local_Fbr0_full.bits.val = 0;
- pRxLocal->local_Fbr0_full.bits.wrap ^= 1;
+ if (++rx_local->local_Fbr0_full.bits.val >
+ (rx_local->Fbr0NumEntries - 1)) {
+ rx_local->local_Fbr0_full.bits.val = 0;
+ rx_local->local_Fbr0_full.bits.wrap ^= 1;
}
- writel(pRxLocal->local_Fbr0_full.value,
- &pRxDma->fbr0_full_offset.value);
+ writel(rx_local->local_Fbr0_full.value,
+ &rx_dma->fbr0_full_offset.value);
}
#endif
spin_unlock_irqrestore(&etdev->FbrLock, flags);
@@ -1363,10 +1363,10 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd)
* our list
*/
spin_lock_irqsave(&etdev->RcvLock, flags);
- list_add_tail(&pMpRfd->list_node, &pRxLocal->RecvList);
- pRxLocal->nReadyRecv++;
+ list_add_tail(&pMpRfd->list_node, &rx_local->RecvList);
+ rx_local->nReadyRecv++;
spin_unlock_irqrestore(&etdev->RcvLock, flags);
- DBG_ASSERT(pRxLocal->nReadyRecv <= pRxLocal->NumRfd);
+ DBG_ASSERT(rx_local->nReadyRecv <= rx_local->NumRfd);
DBG_RX_LEAVE(et131x_dbginfo);
}
diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c
index 8472c1b..16aef44 100644
--- a/drivers/staging/et131x/et1310_tx.c
+++ b/drivers/staging/et131x/et1310_tx.c
@@ -246,22 +246,22 @@ void et131x_tx_dma_memory_free(struct et131x_adapter *adapter)
/**
* ConfigTxDmaRegs - Set up the tx dma section of the JAGCore.
- * @adapter: pointer to our private adapter structure
+ * @etdev: pointer to our private adapter structure
*/
void ConfigTxDmaRegs(struct et131x_adapter *etdev)
{
- struct _TXDMA_t __iomem *pTxDma = &etdev->regs->txdma;
+ struct _TXDMA_t __iomem *txdma = &etdev->regs->txdma;
DBG_ENTER(et131x_dbginfo);
/* Load the hardware with the start of the transmit descriptor ring. */
writel((uint32_t) (etdev->TxRing.pTxDescRingAdjustedPa >> 32),
- &pTxDma->pr_base_hi);
+ &txdma->pr_base_hi);
writel((uint32_t) etdev->TxRing.pTxDescRingAdjustedPa,
- &pTxDma->pr_base_lo);
+ &txdma->pr_base_lo);
/* Initialise the transmit DMA engine */
- writel(NUM_DESC_PER_RING_TX - 1, &pTxDma->pr_num_des.value);
+ writel(NUM_DESC_PER_RING_TX - 1, &txdma->pr_num_des.value);
/* Load the completion writeback physical address
*
@@ -270,12 +270,12 @@ void ConfigTxDmaRegs(struct et131x_adapter *etdev)
* are ever returned, make sure the high part is retrieved here before
* storing the adjusted address.
*/
- writel(0, &pTxDma->dma_wb_base_hi);
- writel(etdev->TxRing.pTxStatusPa, &pTxDma->dma_wb_base_lo);
+ writel(0, &txdma->dma_wb_base_hi);
+ writel(etdev->TxRing.pTxStatusPa, &txdma->dma_wb_base_lo);
memset(etdev->TxRing.pTxStatusVa, 0, sizeof(TX_STATUS_BLOCK_t));
- writel(0, &pTxDma->service_request.value);
+ writel(0, &txdma->service_request.value);
etdev->TxRing.txDmaReadyToSend.value = 0;
DBG_LEAVE(et131x_dbginfo);
@@ -461,7 +461,7 @@ static int et131x_send_packet(struct sk_buff *skb,
{
int status = 0;
PMP_TCB pMpTcb = NULL;
- uint16_t *pShBufVa;
+ uint16_t *shbufva;
unsigned long flags;
DBG_TX_ENTER(et131x_dbginfo);
@@ -506,12 +506,12 @@ static int et131x_send_packet(struct sk_buff *skb,
pMpTcb->Packet = skb;
if ((skb->data != NULL) && ((skb->len - skb->data_len) >= 6)) {
- pShBufVa = (uint16_t *) skb->data;
+ shbufva = (uint16_t *) skb->data;
- if ((pShBufVa[0] == 0xffff) &&
- (pShBufVa[1] == 0xffff) && (pShBufVa[2] == 0xffff)) {
+ if ((shbufva[0] == 0xffff) &&
+ (shbufva[1] == 0xffff) && (shbufva[2] == 0xffff)) {
MP_SET_FLAG(pMpTcb, fMP_DEST_BROAD);
- } else if ((pShBufVa[0] & 0x3) == 0x0001) {
+ } else if ((shbufva[0] & 0x3) == 0x0001) {
MP_SET_FLAG(pMpTcb, fMP_DEST_MULTI);
}
}
@@ -558,7 +558,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
uint32_t loopIndex;
TX_DESC_ENTRY_t CurDesc[24];
uint32_t FragmentNumber = 0;
- uint32_t iThisCopy, iRemainder;
+ uint32_t thiscopy, remainder;
struct sk_buff *pPacket = pMpTcb->Packet;
uint32_t FragListCount = skb_shinfo(pPacket)->nr_frags + 1;
struct skb_frag_struct *pFragList = &skb_shinfo(pPacket)->frags[0];
@@ -710,7 +710,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
return -EIO;
}
- if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
+ if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) {
if (++etdev->TxRing.TxPacketsSinceLastinterrupt ==
PARM_TX_NUM_BUFS_DEF) {
CurDesc[FragmentNumber - 1].word3.value = 0x5;
@@ -729,21 +729,21 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
spin_lock_irqsave(&etdev->SendHWLock, flags);
- iThisCopy =
+ thiscopy =
NUM_DESC_PER_RING_TX - etdev->TxRing.txDmaReadyToSend.bits.val;
- if (iThisCopy >= FragmentNumber) {
- iRemainder = 0;
- iThisCopy = FragmentNumber;
+ if (thiscopy >= FragmentNumber) {
+ remainder = 0;
+ thiscopy = FragmentNumber;
} else {
- iRemainder = FragmentNumber - iThisCopy;
+ remainder = FragmentNumber - thiscopy;
}
memcpy(etdev->TxRing.pTxDescRingVa +
etdev->TxRing.txDmaReadyToSend.bits.val, CurDesc,
- sizeof(TX_DESC_ENTRY_t) * iThisCopy);
+ sizeof(TX_DESC_ENTRY_t) * thiscopy);
- etdev->TxRing.txDmaReadyToSend.bits.val += iThisCopy;
+ etdev->TxRing.txDmaReadyToSend.bits.val += thiscopy;
if ((etdev->TxRing.txDmaReadyToSend.bits.val == 0) ||
(etdev->TxRing.txDmaReadyToSend.bits.val ==
@@ -754,12 +754,12 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
etdev->TxRing.txDmaReadyToSend.value = 0x400;
}
- if (iRemainder) {
+ if (remainder) {
memcpy(etdev->TxRing.pTxDescRingVa,
- CurDesc + iThisCopy,
- sizeof(TX_DESC_ENTRY_t) * iRemainder);
+ CurDesc + thiscopy,
+ sizeof(TX_DESC_ENTRY_t) * remainder);
- etdev->TxRing.txDmaReadyToSend.bits.val += iRemainder;
+ etdev->TxRing.txDmaReadyToSend.bits.val += remainder;
}
if (etdev->TxRing.txDmaReadyToSend.bits.val == 0) {
@@ -794,7 +794,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
/* For Gig only, we use Tx Interrupt coalescing. Enable the software
* timer to wake us up if this packet isn't followed by N more.
*/
- if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
+ if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) {
writel(PARM_TX_TIME_INT_DEF * NANO_IN_A_MICRO,
&etdev->regs->global.watchdog_timer);
}
@@ -824,7 +824,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
{
uint32_t loopIndex, fragIndex, loopEnd;
- uint32_t iSplitFirstElement = 0;
+ uint32_t splitfirstelem = 0;
uint32_t SegmentSize = 0;
TX_DESC_ENTRY_t CurDesc;
TX_DESC_ENTRY_t *CurDescPostCopy = NULL;
@@ -857,21 +857,21 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
DBG_TX(et131x_dbginfo,
"pMpTcb->PacketLength: %d\n", pMpTcb->PacketLength);
- if ((etdev->uiDuplexMode == 0)
+ if ((etdev->duplex_mode == 0)
&& (pMpTcb->PacketLength < NIC_MIN_PACKET_SIZE)) {
DBG_TX(et131x_dbginfo,
"HALF DUPLEX mode AND len < MIN_PKT_SIZE\n");
if ((FragListCount & 0x1) == 0) {
DBG_TX(et131x_dbginfo,
"Even number of descs, split 1st elem\n");
- iSplitFirstElement = 1;
+ splitfirstelem = 1;
/* SegmentSize = pFragList[0].size / 2; */
SegmentSize = (pPacket->len - pPacket->data_len) / 2;
}
} else if (FragListCount & 0x1) {
DBG_TX(et131x_dbginfo, "Odd number of descs, split 1st elem\n");
- iSplitFirstElement = 1;
+ splitfirstelem = 1;
/* SegmentSize = pFragList[0].size / 2; */
SegmentSize = (pPacket->len - pPacket->data_len) / 2;
}
@@ -894,26 +894,26 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
etdev->TxRing.txDmaReadyToSend.bits.serv_req;
}
- if ((FragListCount + iSplitFirstElement) > SlotsAvailable) {
+ if ((FragListCount + splitfirstelem) > SlotsAvailable) {
DBG_WARNING(et131x_dbginfo,
"Not Enough Space in Tx Desc Ring\n");
spin_unlock_irqrestore(&etdev->SendHWLock, flags);
return -ENOMEM;
}
- loopEnd = (FragListCount) + iSplitFirstElement;
+ loopEnd = (FragListCount) + splitfirstelem;
fragIndex = 0;
DBG_TX(et131x_dbginfo,
"TCB : 0x%p\n"
"Packet (SKB) : 0x%p\t Packet->len: %d\t Packet->data_len: %d\n"
- "FragListCount : %d\t iSplitFirstElement: %d\t loopEnd:%d\n",
+ "FragListCount : %d\t splitfirstelem: %d\t loopEnd:%d\n",
pMpTcb,
pPacket, pPacket->len, pPacket->data_len,
- FragListCount, iSplitFirstElement, loopEnd);
+ FragListCount, splitfirstelem, loopEnd);
for (loopIndex = 0; loopIndex < loopEnd; loopIndex++) {
- if (loopIndex > iSplitFirstElement)
+ if (loopIndex > splitfirstelem)
fragIndex++;
DBG_TX(et131x_dbginfo,
@@ -945,7 +945,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
CurDesc.word3.value = 0;
if (fragIndex == 0) {
- if (iSplitFirstElement) {
+ if (splitfirstelem) {
DBG_TX(et131x_dbginfo,
"Split first element: YES\n");
@@ -1055,13 +1055,13 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
}
if ((loopIndex == (loopEnd - 1)) &&
- (etdev->uiDuplexMode ||
+ (etdev->duplex_mode ||
(pMpTcb->PacketLength >= NIC_MIN_PACKET_SIZE))) {
/* This is the Last descriptor of the packet */
DBG_TX(et131x_dbginfo,
"THIS is our LAST descriptor\n");
- if (etdev->uiLinkSpeed ==
+ if (etdev->linkspeed ==
TRUEPHY_SPEED_1000MBPS) {
if (++etdev->TxRing.
TxPacketsSinceLastinterrupt >=
@@ -1124,14 +1124,14 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
}
}
- if (etdev->uiDuplexMode == 0 &&
+ if (etdev->duplex_mode == 0 &&
pMpTcb->PacketLength < NIC_MIN_PACKET_SIZE) {
/* NOTE - Same 32/64-bit issue as above... */
CurDesc.DataBufferPtrHigh = 0x0;
CurDesc.DataBufferPtrLow = etdev->TxRing.pTxDummyBlkPa;
CurDesc.word2.value = 0;
- if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
+ if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) {
if (++etdev->TxRing.TxPacketsSinceLastinterrupt >=
PARM_TX_NUM_BUFS_DEF) {
CurDesc.word3.value = 0x5;
@@ -1212,7 +1212,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
/* For Gig only, we use Tx Interrupt coalescing. Enable the software
* timer to wake us up if this packet isn't followed by N more.
*/
- if (etdev->uiLinkSpeed == TRUEPHY_SPEED_1000MBPS) {
+ if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) {
writel(PARM_TX_TIME_INT_DEF * NANO_IN_A_MICRO,
&etdev->regs->global.watchdog_timer);
}
@@ -1339,7 +1339,7 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev,
void et131x_free_busy_send_packets(struct et131x_adapter *etdev)
{
PMP_TCB pMpTcb;
- struct list_head *pEntry;
+ struct list_head *entry;
unsigned long flags;
uint32_t FreeCounter = 0;
@@ -1351,7 +1351,7 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev)
etdev->TxRing.nWaitSend--;
spin_unlock_irqrestore(&etdev->SendWaitLock, flags);
- pEntry = etdev->TxRing.SendWaitQueue.next;
+ entry = etdev->TxRing.SendWaitQueue.next;
}
etdev->TxRing.nWaitSend = 0;
@@ -1496,11 +1496,11 @@ static void et131x_check_send_wait_list(struct et131x_adapter *etdev)
while (!list_empty(&etdev->TxRing.SendWaitQueue) &&
MP_TCB_RESOURCES_AVAILABLE(etdev)) {
- struct list_head *pEntry;
+ struct list_head *entry;
DBG_VERBOSE(et131x_dbginfo, "Tx packets on the wait queue\n");
- pEntry = etdev->TxRing.SendWaitQueue.next;
+ entry = etdev->TxRing.SendWaitQueue.next;
etdev->TxRing.nWaitSend--;
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index 63d7c8a..3ac2343 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -133,8 +133,8 @@ typedef struct _MP_RFD {
struct list_head list_node;
struct sk_buff *Packet;
u32 PacketSize; /* total size of receive frame */
- u16 iBufferIndex;
- u8 iRingIndex;
+ u16 bufferindex;
+ u8 ringindex;
} MP_RFD, *PMP_RFD;
/* Enum for Flow Control */
@@ -214,8 +214,7 @@ struct et131x_adapter {
/* Configuration */
u8 PermanentAddress[ETH_ALEN];
u8 CurrentAddress[ETH_ALEN];
- bool bOverrideAddress;
- bool bEepromPresent;
+ bool has_eeprom;
u8 eepromData[2];
/* Spinlocks */
@@ -234,11 +233,8 @@ struct et131x_adapter {
/* Packet Filter and look ahead size */
u32 PacketFilter;
- u32 ulLookAhead;
- u32 uiLinkSpeed;
- u32 uiDuplexMode;
- u32 uiAutoNegStatus;
- u8 ucLinkStatus;
+ u32 linkspeed;
+ u32 duplex_mode;
/* multicast list */
u32 MCAddressCount;
@@ -275,11 +271,7 @@ struct et131x_adapter {
u8 DriverNoPhyAccess;
/* Minimize init-time */
- bool bQueryPending;
- bool bSetPending;
- bool bResetPending;
struct timer_list ErrorTimer;
- bool bLinkTimerActive;
MP_POWER_MGMT PoMgmt;
INTERRUPT_t CachedMaskValue;
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index 34737d1..a719e90 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -330,14 +330,14 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev)
return -EIO;
} else if (rev == 0x01) {
int32_t nLoop;
- uint8_t ucTemp[4] = { 0xFE, 0x13, 0x10, 0xFF };
+ uint8_t temp[4] = { 0xFE, 0x13, 0x10, 0xFF };
/* Re-write the first 4 bytes if we have an eeprom
* present and the revision id is 1, this fixes the
* corruption seen with 1310 B Silicon
*/
for (nLoop = 0; nLoop < 3; nLoop++) {
- EepromWriteByte(adapter, nLoop, ucTemp[nLoop],
+ EepromWriteByte(adapter, nLoop, temp[nLoop],
0, SINGLE_BYTE);
}
}
@@ -351,14 +351,14 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev)
* information that normally would come from the eeprom, like
* MAC Address
*/
- adapter->bEepromPresent = false;
+ adapter->has_eeprom = 0;
DBG_LEAVE(et131x_dbginfo);
return -EIO;
} else {
DBG_TRACE(et131x_dbginfo, "EEPROM Status Code - 0x%04x\n",
eepromStat);
- adapter->bEepromPresent = true;
+ adapter->has_eeprom = 1;
}
/* Read the EEPROM for information regarding LED behavior. Refer to
@@ -445,7 +445,7 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev)
/* Get MAC address from config space if an eeprom exists, otherwise
* the MAC address there will not be valid
*/
- if (adapter->bEepromPresent) {
+ if (adapter->has_eeprom) {
int i;
for (i = 0; i < ETH_ALEN; i++) {
@@ -520,9 +520,6 @@ void et131x_link_detection_handler(unsigned long data)
struct et131x_adapter *etdev = (struct et131x_adapter *) data;
unsigned long flags;
- /* Let everyone know that we have run */
- etdev->bLinkTimerActive = false;
-
if (etdev->MediaState == 0) {
spin_lock_irqsave(&etdev->Lock, flags);
@@ -532,8 +529,6 @@ void et131x_link_detection_handler(unsigned long data)
spin_unlock_irqrestore(&etdev->Lock, flags);
netif_carrier_off(etdev->netdev);
-
- etdev->bSetPending = false;
}
}
@@ -608,35 +603,32 @@ void et131x_setup_hardware_properties(struct et131x_adapter *adapter)
* EEPROM then we need to generate the last octet and set it on the
* device
*/
- if (!adapter->bOverrideAddress) {
- if (adapter->PermanentAddress[0] == 0x00 &&
- adapter->PermanentAddress[1] == 0x00 &&
- adapter->PermanentAddress[2] == 0x00 &&
- adapter->PermanentAddress[3] == 0x00 &&
- adapter->PermanentAddress[4] == 0x00 &&
- adapter->PermanentAddress[5] == 0x00) {
- /*
- * We need to randomly generate the last octet so we
- * decrease our chances of setting the mac address to
- * same as another one of our cards in the system
- */
- get_random_bytes(&adapter->CurrentAddress[5], 1);
-
- /*
- * We have the default value in the register we are
- * working with so we need to copy the current
- * address into the permanent address
- */
- memcpy(adapter->PermanentAddress,
- adapter->CurrentAddress, ETH_ALEN);
- } else {
- /* We do not have an override address, so set the
- * current address to the permanent address and add
- * it to the device
- */
- memcpy(adapter->CurrentAddress,
- adapter->PermanentAddress, ETH_ALEN);
- }
+ if (adapter->PermanentAddress[0] == 0x00 &&
+ adapter->PermanentAddress[1] == 0x00 &&
+ adapter->PermanentAddress[2] == 0x00 &&
+ adapter->PermanentAddress[3] == 0x00 &&
+ adapter->PermanentAddress[4] == 0x00 &&
+ adapter->PermanentAddress[5] == 0x00) {
+ /*
+ * We need to randomly generate the last octet so we
+ * decrease our chances of setting the mac address to
+ * same as another one of our cards in the system
+ */
+ get_random_bytes(&adapter->CurrentAddress[5], 1);
+ /*
+ * We have the default value in the register we are
+ * working with so we need to copy the current
+ * address into the permanent address
+ */
+ memcpy(adapter->PermanentAddress,
+ adapter->CurrentAddress, ETH_ALEN);
+ } else {
+ /* We do not have an override address, so set the
+ * current address to the permanent address and add
+ * it to the device
+ */
+ memcpy(adapter->CurrentAddress,
+ adapter->PermanentAddress, ETH_ALEN);
}
DBG_LEAVE(et131x_dbginfo);
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 17/26] et131x: continue pruning unused fields
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (15 preceding siblings ...)
2009-08-25 15:00 ` [PATCH 16/26] et131x: de-hungarianise a bit Alan Cox
@ 2009-08-25 15:00 ` Alan Cox
2009-08-25 15:00 ` [PATCH 18/26] et131x: remove unused PCI identifiers Alan Cox
` (8 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 15:00 UTC (permalink / raw)
To: greg, netdev
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_jagcore.h | 19 -------------------
drivers/staging/et131x/et1310_phy.c | 2 +-
drivers/staging/et131x/et131x_adapter.h | 4 ----
3 files changed, 1 insertions(+), 24 deletions(-)
diff --git a/drivers/staging/et131x/et1310_jagcore.h b/drivers/staging/et131x/et1310_jagcore.h
index 78228af..0807a01 100644
--- a/drivers/staging/et131x/et1310_jagcore.h
+++ b/drivers/staging/et131x/et1310_jagcore.h
@@ -65,8 +65,6 @@
#define INTERNAL_MEM_SIZE 0x400 /* 1024 of internal memory */
#define INTERNAL_MEM_RX_OFFSET 0x1FF /* 50% Tx, 50% Rx */
-#define REGS_MAX_ARRAY 4096
-
/*
* For interrupts, normal running is:
* rxdma_xfr_done, phy_interrupt, mac_stat_interrupt,
@@ -85,23 +83,6 @@
#define INT_MASK_ENABLE 0xfffebf17
#define INT_MASK_ENABLE_NO_FLOW 0xfffebfd7
-/* DATA STRUCTURES FOR DIRECT REGISTER ACCESS */
-
-typedef struct {
- u8 bReadWrite;
- u32 nRegCount;
- u32 nData[REGS_MAX_ARRAY];
- u32 nOffsets[REGS_MAX_ARRAY];
-} JAGCORE_ACCESS_REGS, *PJAGCORE_ACCESS_REGS;
-
-typedef struct {
- u8 bReadWrite;
- u32 nDataWidth;
- u32 nRegCount;
- u32 nOffsets[REGS_MAX_ARRAY];
- u32 nData[REGS_MAX_ARRAY];
-} PCI_CFG_SPACE_REGS, *PPCI_CFG_SPACE_REGS;
-
/* Forward declaration of the private adapter structure */
struct et131x_adapter;
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index a16ce16..19ffb65 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -547,7 +547,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
}
etdev->linkspeed = 0;
- etdev->duplexMode = 0;
+ etdev->duplex_mode = 0;
/* Free the packets being actively sent & stopped */
et131x_free_busy_send_packets(etdev);
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index 3ac2343..04bb603 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -284,10 +284,6 @@ struct et131x_adapter {
/* Rx Memory Variables */
RX_RING_t RxRing;
- /* ET1310 register Access */
- JAGCORE_ACCESS_REGS JagCoreRegs;
- PCI_CFG_SPACE_REGS PciCfgRegs;
-
/* Loopback specifics */
u8 ReplicaPhyLoopbk; /* Replica Enable */
u8 ReplicaPhyLoopbkPF; /* Replica Enable Pass/Fail */
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 18/26] et131x: remove unused PCI identifiers
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (16 preceding siblings ...)
2009-08-25 15:00 ` [PATCH 17/26] et131x: continue pruning unused fields Alan Cox
@ 2009-08-25 15:00 ` Alan Cox
2009-08-25 15:00 ` [PATCH 19/26] et131x: eeprom remove features Alan Cox
` (7 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 15:00 UTC (permalink / raw)
To: greg, netdev
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_phy.h | 25 -------------------------
drivers/staging/et131x/et1310_pm.h | 30 ------------------------------
drivers/staging/et131x/et131x_defs.h | 8 --------
3 files changed, 0 insertions(+), 63 deletions(-)
diff --git a/drivers/staging/et131x/et1310_phy.h b/drivers/staging/et131x/et1310_phy.h
index aec0a7b..080656c 100644
--- a/drivers/staging/et131x/et1310_phy.h
+++ b/drivers/staging/et131x/et1310_phy.h
@@ -63,9 +63,6 @@
#define TRUEPHY_SUCCESS 0
#define TRUEPHY_FAILURE 1
-typedef void *TRUEPHY_HANDLE;
-typedef void *TRUEPHY_PLATFORM_HANDLE;
-typedef void *TRUEPHY_OSAL_HANDLE;
/* MI Register Addresses */
#define MI_CONTROL_REG 0
@@ -742,28 +739,6 @@ typedef union _MI_LCR2_t {
/* MI Register 29 - 31: Reserved Reg(0x1D - 0x1E) */
-/* TruePHY headers */
-typedef struct _TRUEPHY_ACCESS_MI_REGS_ {
- TRUEPHY_HANDLE hTruePhy;
- int32_t nPhyId;
- u8 bReadWrite;
- u8 *pbyRegs;
- u8 *pwData;
- int32_t nRegCount;
-} TRUEPHY_ACCESS_MI_REGS, *PTRUEPHY_ACCESS_MI_REGS;
-
-/* TruePHY headers */
-typedef struct _TAG_TPAL_ACCESS_MI_REGS_ {
- u32 nPhyId;
- u8 bReadWrite;
- u32 nRegCount;
- u16 Data[4096];
- u8 Regs[4096];
-} TPAL_ACCESS_MI_REGS, *PTPAL_ACCESS_MI_REGS;
-
-
-typedef TRUEPHY_HANDLE TPAL_HANDLE;
-
/* Forward declaration of the private adapter structure */
struct et131x_adapter;
diff --git a/drivers/staging/et131x/et1310_pm.h b/drivers/staging/et131x/et1310_pm.h
index 8e06039..295f3ab 100644
--- a/drivers/staging/et131x/et1310_pm.h
+++ b/drivers/staging/et131x/et1310_pm.h
@@ -61,54 +61,24 @@
#include "et1310_address_map.h"
-#define MAX_WOL_PACKET_SIZE 0x80
-#define MAX_WOL_MASK_SIZE (MAX_WOL_PACKET_SIZE / 8)
-#define NUM_WOL_PATTERNS 0x5
-#define CRC16_POLY 0x1021
-
typedef struct _MP_POWER_MGMT {
/* variable putting the phy into coma mode when boot up with no cable
* plugged in after 5 seconds
*/
u8 TransPhyComaModeOnBoot;
- /* Array holding the five CRC values that the device is currently
- * using for WOL. This will be queried when a pattern is to be
- * removed.
- */
- u32 localWolAndCrc0;
- u16 WOLPatternList[NUM_WOL_PATTERNS];
- u8 WOLMaskList[NUM_WOL_PATTERNS][MAX_WOL_MASK_SIZE];
- u32 WOLMaskSize[NUM_WOL_PATTERNS];
-
- /* IP address */
- union {
- u32 u32;
- u8 u8[4];
- } IPAddress;
-
- /* Current Power state of the adapter. */
- bool WOLState;
- bool WOLEnabled;
- bool Failed10Half;
- bool bFailedStateTransition;
-
/* Next two used to save power information at power down. This
* information will be used during power up to set up parts of Power
* Management in JAGCore
*/
- u32 tx_en;
- u32 rx_en;
u16 PowerDownSpeed;
u8 PowerDownDuplex;
} MP_POWER_MGMT, *PMP_POWER_MGMT;
/* Forward declaration of the private adapter structure
- * ( IS THERE A WAY TO DO THIS WITH A TYPEDEF??? )
*/
struct et131x_adapter;
-u16 CalculateCCITCRC16(u8 *Pattern, u8 *Mask, u32 MaskSize);
void EnablePhyComa(struct et131x_adapter *adapter);
void DisablePhyComa(struct et131x_adapter *adapter);
diff --git a/drivers/staging/et131x/et131x_defs.h b/drivers/staging/et131x/et131x_defs.h
index 5665c6a..f98dca5 100644
--- a/drivers/staging/et131x/et131x_defs.h
+++ b/drivers/staging/et131x/et131x_defs.h
@@ -61,7 +61,6 @@
/* Packet and header sizes */
#define NIC_MIN_PACKET_SIZE 60
-#define NIC_HEADER_SIZE ETH_HLEN /* 14 */
/* Multicast list size */
#define NIC_MAX_MCAST_LIST 128
@@ -102,20 +101,13 @@
#define fMP_ADAPTER_NOT_READY_MASK 0x3ff00000
/* Some offsets in PCI config space that are actually used. */
-#define ET1310_PCI_PM_CAPABILITY 0x40
-#define ET1310_PCI_PM_CSR 0x44
#define ET1310_PCI_MAX_PYLD 0x4C
-#define ET1310_PCI_DEV_CTRL 0x50
-#define ET1310_PCI_DEV_STAT 0x52
#define ET1310_NMI_DISABLE 0x61
#define ET1310_PCI_MAC_ADDRESS 0xA4
#define ET1310_PCI_EEPROM_STATUS 0xB2
-#define ET1310_PCI_PHY_INDEX_REG 0xB4
#define ET1310_PCI_ACK_NACK 0xC0
#define ET1310_PCI_REPLAY 0xC2
#define ET1310_PCI_L0L1LATENCY 0xCF
-#define ET1310_PCI_SEL_PHY_CTRL 0xE4
-#define ET1310_PCI_ADVANCED_ERR 0x100
/* PCI Vendor/Product IDs */
#define ET131X_PCI_VENDOR_ID 0x11C1 /* Agere Systems */
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 19/26] et131x: eeprom remove features
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (17 preceding siblings ...)
2009-08-25 15:00 ` [PATCH 18/26] et131x: remove unused PCI identifiers Alan Cox
@ 2009-08-25 15:00 ` Alan Cox
2009-08-25 15:00 ` [PATCH 20/26] et131x: sort out the mmc enable routine Alan Cox
` (6 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 15:00 UTC (permalink / raw)
To: greg, netdev
We only read eeprom id 0, in byte mode - so the rest can go away
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_eeprom.c | 20 ++------------------
drivers/staging/et131x/et1310_eeprom.h | 16 ++--------------
drivers/staging/et131x/et131x_config.c | 0
drivers/staging/et131x/et131x_initpci.c | 7 +++----
4 files changed, 7 insertions(+), 36 deletions(-)
delete mode 100644 drivers/staging/et131x/et131x_config.c
diff --git a/drivers/staging/et131x/et1310_eeprom.c b/drivers/staging/et131x/et1310_eeprom.c
index 9453862..7b2e4ea 100644
--- a/drivers/staging/et131x/et1310_eeprom.c
+++ b/drivers/staging/et131x/et1310_eeprom.c
@@ -146,14 +146,10 @@
* @etdev: pointer to our private adapter structure
* @addr: the address to write
* @data: the value to write
- * @eeprom_id: the ID of the EEPROM
- * @addrmode: how the EEPROM is to be accessed
*
* Returns SUCCESS or FAILURE
*/
-int EepromWriteByte(struct et131x_adapter *etdev, u32 addr,
- u8 data, u32 eeprom_id,
- u32 addrmode)
+int EepromWriteByte(struct et131x_adapter *etdev, u32 addr, u8 data)
{
struct pci_dev *pdev = etdev->pdev;
int index;
@@ -238,9 +234,6 @@ int EepromWriteByte(struct et131x_adapter *etdev, u32 addr,
control = 0;
control |= LBCIF_CONTROL_LBCIF_ENABLE | LBCIF_CONTROL_I2C_WRITE;
- if (addrmode == DUAL_BYTE)
- control |= LBCIF_CONTROL_TWO_BYTE_ADDR;
-
if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET,
control)) {
return FAILURE;
@@ -249,8 +242,6 @@ int EepromWriteByte(struct et131x_adapter *etdev, u32 addr,
i2c_wack = 1;
/* Prepare EEPROM address for Step 3 */
- addr |= (addrmode == DUAL_BYTE) ?
- (eeprom_id << 16) : (eeprom_id << 8);
for (retries = 0; retries < MAX_NUM_WRITE_RETRIES; retries++) {
/* Step 3:*/
@@ -357,9 +348,7 @@ int EepromWriteByte(struct et131x_adapter *etdev, u32 addr,
*
* Returns SUCCESS or FAILURE
*/
-int EepromReadByte(struct et131x_adapter *etdev, u32 addr,
- u8 *pdata, u32 eeprom_id,
- u32 addrmode)
+int EepromReadByte(struct et131x_adapter *etdev, u32 addr, u8 *pdata)
{
struct pci_dev *pdev = etdev->pdev;
int index;
@@ -427,17 +416,12 @@ int EepromReadByte(struct et131x_adapter *etdev, u32 addr,
control = 0;
control |= LBCIF_CONTROL_LBCIF_ENABLE;
- if (addrmode == DUAL_BYTE)
- control |= LBCIF_CONTROL_TWO_BYTE_ADDR;
-
if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET,
control)) {
return FAILURE;
}
/* Step 3: */
- addr |= (addrmode == DUAL_BYTE) ?
- (eeprom_id << 16) : (eeprom_id << 8);
if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET,
addr)) {
diff --git a/drivers/staging/et131x/et1310_eeprom.h b/drivers/staging/et131x/et1310_eeprom.h
index 8033743..d8ac9a0 100644
--- a/drivers/staging/et131x/et1310_eeprom.h
+++ b/drivers/staging/et131x/et1310_eeprom.h
@@ -66,24 +66,12 @@
#define FAILURE 1
#endif
-#ifndef READ
-#define READ 0
-#define WRITE 1
-#endif
-
-#ifndef SINGLE_BYTE
-#define SINGLE_BYTE 0
-#define DUAL_BYTE 1
-#endif
-
/* Forward declaration of the private adapter structure */
struct et131x_adapter;
int32_t EepromWriteByte(struct et131x_adapter *adapter, u32 unAddress,
- u8 bData, u32 unEepromId,
- u32 unAddressingMode);
+ u8 bData);
int32_t EepromReadByte(struct et131x_adapter *adapter, u32 unAddress,
- u8 *pbData, u32 unEepromId,
- u32 unAddressingMode);
+ u8 *pbData);
#endif /* _ET1310_EEPROM_H_ */
diff --git a/drivers/staging/et131x/et131x_config.c b/drivers/staging/et131x/et131x_config.c
deleted file mode 100644
index e69de29..0000000
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index a719e90..bea9918 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -337,8 +337,7 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev)
* corruption seen with 1310 B Silicon
*/
for (nLoop = 0; nLoop < 3; nLoop++) {
- EepromWriteByte(adapter, nLoop, temp[nLoop],
- 0, SINGLE_BYTE);
+ EepromWriteByte(adapter, nLoop, temp[nLoop]);
}
}
@@ -364,8 +363,8 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev)
/* Read the EEPROM for information regarding LED behavior. Refer to
* ET1310_phy.c, et131x_xcvr_init(), for its use.
*/
- EepromReadByte(adapter, 0x70, &adapter->eepromData[0], 0, SINGLE_BYTE);
- EepromReadByte(adapter, 0x71, &adapter->eepromData[1], 0, SINGLE_BYTE);
+ EepromReadByte(adapter, 0x70, &adapter->eepromData[0]);
+ EepromReadByte(adapter, 0x71, &adapter->eepromData[1]);
if (adapter->eepromData[0] != 0xcd)
/* Disable all optional features */
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 20/26] et131x: sort out the mmc enable routine
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (18 preceding siblings ...)
2009-08-25 15:00 ` [PATCH 19/26] et131x: eeprom remove features Alan Cox
@ 2009-08-25 15:00 ` Alan Cox
2009-08-25 15:00 ` [PATCH 21/26] et131x: clean up MMC_SRAM_ Alan Cox
` (5 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 15:00 UTC (permalink / raw)
To: greg, netdev
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_address_map.h | 34 +++++++--------------------
drivers/staging/et131x/et1310_jagcore.c | 14 +----------
2 files changed, 10 insertions(+), 38 deletions(-)
diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h
index 388ac40..d2ac26c 100644
--- a/drivers/staging/et131x/et1310_address_map.h
+++ b/drivers/staging/et131x/et1310_address_map.h
@@ -2267,30 +2267,14 @@ typedef struct _MAC_STAT_t { /* Location: */
* structure for Main Memory Controller Control reg in mmc address map.
* located at address 0x7000
*/
-typedef union _MMC_CTRL_t {
- u32 value;
- struct {
-#ifdef _BIT_FIELDS_HTOL
- u32 reserved:25; /* bits 7-31 */
- u32 force_ce:1; /* bit 6 */
- u32 rxdma_disable:1; /* bit 5 */
- u32 txdma_disable:1; /* bit 4 */
- u32 txmac_disable:1; /* bit 3 */
- u32 rxmac_disable:1; /* bit 2 */
- u32 arb_disable:1; /* bit 1 */
- u32 mmc_enable:1; /* bit 0 */
-#else
- u32 mmc_enable:1; /* bit 0 */
- u32 arb_disable:1; /* bit 1 */
- u32 rxmac_disable:1; /* bit 2 */
- u32 txmac_disable:1; /* bit 3 */
- u32 txdma_disable:1; /* bit 4 */
- u32 rxdma_disable:1; /* bit 5 */
- u32 force_ce:1; /* bit 6 */
- u32 reserved:25; /* bits 7-31 */
-#endif
- } bits;
-} MMC_CTRL_t, *PMMC_CTRL_t;
+
+#define ET_MMC_ENABLE 1
+#define ET_MMC_ARB_DISABLE 2
+#define ET_MMC_RXMAC_DISABLE 4
+#define ET_MMC_TXMAC_DISABLE 8
+#define ET_MMC_TXDMA_DISABLE 16
+#define ET_MMC_RXDMA_DISABLE 32
+#define ET_MMC_FORCE_CE 64
/*
* structure for Main Memory Controller Host Memory Access Address reg in mmc
@@ -2329,7 +2313,7 @@ typedef union _MMC_SRAM_ACCESS_t {
* Memory Control Module of JAGCore Address Mapping
*/
typedef struct _MMC_t { /* Location: */
- MMC_CTRL_t mmc_ctrl; /* 0x7000 */
+ u32 mmc_ctrl; /* 0x7000 */
MMC_SRAM_ACCESS_t sram_access; /* 0x7004 */
u32 sram_word1; /* 0x7008 */
u32 sram_word2; /* 0x700C */
diff --git a/drivers/staging/et131x/et1310_jagcore.c b/drivers/staging/et131x/et1310_jagcore.c
index 5c847ad..2767e4d 100644
--- a/drivers/staging/et131x/et1310_jagcore.c
+++ b/drivers/staging/et131x/et1310_jagcore.c
@@ -175,21 +175,9 @@ void ConfigGlobalRegs(struct et131x_adapter *etdev)
*/
void ConfigMMCRegs(struct et131x_adapter *etdev)
{
- MMC_CTRL_t mmc_ctrl = { 0 };
-
DBG_ENTER(et131x_dbginfo);
-
/* All we need to do is initialize the Memory Control Register */
- mmc_ctrl.bits.force_ce = 0x0;
- mmc_ctrl.bits.rxdma_disable = 0x0;
- mmc_ctrl.bits.txdma_disable = 0x0;
- mmc_ctrl.bits.txmac_disable = 0x0;
- mmc_ctrl.bits.rxmac_disable = 0x0;
- mmc_ctrl.bits.arb_disable = 0x0;
- mmc_ctrl.bits.mmc_enable = 0x1;
-
- writel(mmc_ctrl.value, &etdev->regs->mmc.mmc_ctrl.value);
-
+ writel(ET_MMC_ENABLE, &etdev->regs->mmc.mmc_ctrl);
DBG_LEAVE(et131x_dbginfo);
}
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 21/26] et131x: clean up MMC_SRAM_
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (19 preceding siblings ...)
2009-08-25 15:00 ` [PATCH 20/26] et131x: sort out the mmc enable routine Alan Cox
@ 2009-08-25 15:00 ` Alan Cox
2009-08-25 15:01 ` [PATCH 22/26] et131x: quick tidy of the debug code Alan Cox
` (4 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 15:00 UTC (permalink / raw)
To: greg, netdev
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_address_map.h | 34 ++++++---------------------
drivers/staging/et131x/et131x_debug.c | 12 ++++------
2 files changed, 13 insertions(+), 33 deletions(-)
diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h
index d2ac26c..01c990c 100644
--- a/drivers/staging/et131x/et1310_address_map.h
+++ b/drivers/staging/et131x/et1310_address_map.h
@@ -2264,7 +2264,7 @@ typedef struct _MAC_STAT_t { /* Location: */
/* START OF MMC REGISTER ADDRESS MAP */
/*
- * structure for Main Memory Controller Control reg in mmc address map.
+ * Main Memory Controller Control reg in mmc address map.
* located at address 0x7000
*/
@@ -2277,31 +2277,13 @@ typedef struct _MAC_STAT_t { /* Location: */
#define ET_MMC_FORCE_CE 64
/*
- * structure for Main Memory Controller Host Memory Access Address reg in mmc
- * address map. Located at address 0x7004
+ * Main Memory Controller Host Memory Access Address reg in mmc
+ * address map. Located at address 0x7004. Top 16 bits hold the address bits
*/
-typedef union _MMC_SRAM_ACCESS_t {
- u32 value;
- struct {
-#ifdef _BIT_FIELDS_HTOL
- u32 byte_enable:16; /* bits 16-31 */
- u32 reserved2:2; /* bits 14-15 */
- u32 req_addr:10; /* bits 4-13 */
- u32 reserved1:1; /* bit 3 */
- u32 is_ctrl_word:1; /* bit 2 */
- u32 wr_access:1; /* bit 1 */
- u32 req_access:1; /* bit 0 */
-#else
- u32 req_access:1; /* bit 0 */
- u32 wr_access:1; /* bit 1 */
- u32 is_ctrl_word:1; /* bit 2 */
- u32 reserved1:1; /* bit 3 */
- u32 req_addr:10; /* bits 4-13 */
- u32 reserved2:2; /* bits 14-15 */
- u32 byte_enable:16; /* bits 16-31 */
-#endif
- } bits;
-} MMC_SRAM_ACCESS_t, *PMMC_SRAM_ACCESS_t;
+
+#define ET_SRAM_REQ_ACCESS 1
+#define ET_SRAM_WR_ACCESS 2
+#define ET_SRAM_IS_CTRL 4
/*
* structure for Main Memory Controller Host Memory Access Data reg in mmc
@@ -2314,7 +2296,7 @@ typedef union _MMC_SRAM_ACCESS_t {
*/
typedef struct _MMC_t { /* Location: */
u32 mmc_ctrl; /* 0x7000 */
- MMC_SRAM_ACCESS_t sram_access; /* 0x7004 */
+ u32 sram_access; /* 0x7004 */
u32 sram_word1; /* 0x7008 */
u32 sram_word2; /* 0x700C */
u32 sram_word3; /* 0x7010 */
diff --git a/drivers/staging/et131x/et131x_debug.c b/drivers/staging/et131x/et131x_debug.c
index 4346c82..61203c1 100644
--- a/drivers/staging/et131x/et131x_debug.c
+++ b/drivers/staging/et131x/et131x_debug.c
@@ -115,18 +115,16 @@ void DumpTxQueueContents(int dbgLvl, struct et131x_adapter *etdev)
if (DBG_FLAGS(et131x_dbginfo) & dbgLvl) {
for (TxQueueAddr = 0x200; TxQueueAddr < 0x3ff; TxQueueAddr++) {
- MMC_SRAM_ACCESS_t sram_access;
-
- sram_access.value = readl(&mmc->sram_access.value);
- sram_access.bits.req_addr = TxQueueAddr;
- sram_access.bits.req_access = 1;
- writel(sram_access.value, &mmc->sram_access.value);
+ u32 sram_access = readl(&mmc->sram_access);
+ sram_access &= 0xFFFF;
+ sram_access |= (TxQueueAddr << 16) | ET_SRAM_REQ_ACCESS;
+ writel(sram_access, &mmc->sram_access);
DBG_PRINT("Addr 0x%x, Access 0x%08x\t"
"Value 1 0x%08x, Value 2 0x%08x, "
"Value 3 0x%08x, Value 4 0x%08x, \n",
TxQueueAddr,
- readl(&mmc->sram_access.value),
+ readl(&mmc->sram_access),
readl(&mmc->sram_word1),
readl(&mmc->sram_word2),
readl(&mmc->sram_word3),
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 22/26] et131x: quick tidy of the debug code
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (20 preceding siblings ...)
2009-08-25 15:00 ` [PATCH 21/26] et131x: clean up MMC_SRAM_ Alan Cox
@ 2009-08-25 15:01 ` Alan Cox
2009-08-25 15:01 ` [PATCH 23/26] et131x: kill the Q_ADDR struct Alan Cox
` (3 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 15:01 UTC (permalink / raw)
To: greg, netdev
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et131x_debug.c | 85 +++++++++++++++------------------
1 files changed, 38 insertions(+), 47 deletions(-)
diff --git a/drivers/staging/et131x/et131x_debug.c b/drivers/staging/et131x/et131x_debug.c
index 61203c1..779130b 100644
--- a/drivers/staging/et131x/et131x_debug.c
+++ b/drivers/staging/et131x/et131x_debug.c
@@ -1,4 +1,3 @@
-/*
* Agere Systems Inc.
* 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
*
@@ -108,22 +107,22 @@ extern dbg_info_t *et131x_dbginfo;
* DumpTxQueueContents - Dump out the tx queue and the shadow pointers
* @etdev: pointer to our adapter structure
*/
-void DumpTxQueueContents(int dbgLvl, struct et131x_adapter *etdev)
+void DumpTxQueueContents(int debug, struct et131x_adapter *etdev)
{
MMC_t __iomem *mmc = &etdev->regs->mmc;
- uint32_t TxQueueAddr;
+ u32 txq_addr;
- if (DBG_FLAGS(et131x_dbginfo) & dbgLvl) {
- for (TxQueueAddr = 0x200; TxQueueAddr < 0x3ff; TxQueueAddr++) {
+ if (DBG_FLAGS(et131x_dbginfo) & debug) {
+ for (txq_addr = 0x200; txq_addr < 0x3ff; txq_addr++) {
u32 sram_access = readl(&mmc->sram_access);
sram_access &= 0xFFFF;
- sram_access |= (TxQueueAddr << 16) | ET_SRAM_REQ_ACCESS;
+ sram_access |= (txq_addr << 16) | ET_SRAM_REQ_ACCESS;
writel(sram_access, &mmc->sram_access);
DBG_PRINT("Addr 0x%x, Access 0x%08x\t"
"Value 1 0x%08x, Value 2 0x%08x, "
"Value 3 0x%08x, Value 4 0x%08x, \n",
- TxQueueAddr,
+ txq_addr,
readl(&mmc->sram_access),
readl(&mmc->sram_word1),
readl(&mmc->sram_word2),
@@ -136,6 +135,12 @@ void DumpTxQueueContents(int dbgLvl, struct et131x_adapter *etdev)
}
}
+static const char *BlockNames[NUM_BLOCKS] = {
+ "Global", "Tx DMA", "Rx DMA", "Tx MAC",
+ "Rx MAC", "MAC", "MAC Stat", "MMC"
+};
+
+
/**
* DumpDeviceBlock
* @etdev: pointer to our adapter
@@ -144,30 +149,23 @@ void DumpTxQueueContents(int dbgLvl, struct et131x_adapter *etdev)
* mapped to a new page, each page is 4096 bytes).
*/
#define NUM_BLOCKS 8
-void DumpDeviceBlock(int dbgLvl, struct et131x_adapter *etdev,
- uint32_t Block)
+void DumpDeviceBlock(int debug, struct et131x_adapter *etdev,
+ u32 block)
{
- uint32_t Address1, Address2;
- uint32_t __iomem *BigDevicePointer =
- (uint32_t __iomem *) etdev->regs;
- const char *BlockNames[NUM_BLOCKS] = {
- "Global", "Tx DMA", "Rx DMA", "Tx MAC",
- "Rx MAC", "MAC", "MAC Stat", "MMC"
- };
+ u32 addr1, addr2;
+ u32 __iomem *regs = (u32 __iomem *) etdev->regs;
/* Output the debug counters to the debug terminal */
- if (DBG_FLAGS(et131x_dbginfo) & dbgLvl) {
- DBG_PRINT("%s block\n", BlockNames[Block]);
- BigDevicePointer += Block * 1024;
- for (Address1 = 0; Address1 < 8; Address1++) {
- for (Address2 = 0; Address2 < 8; Address2++) {
- if (Block == 0 &&
- (Address1 * 8 + Address2) == 6) {
+ if (DBG_FLAGS(et131x_dbginfo) & debug) {
+ DBG_PRINT("%s block\n", BlockNames[block]);
+ regs += block * 1024;
+ for (addr1 = 0; addr1 < 8; addr1++) {
+ for (addr2 = 0; addr2 < 8; addr2++) {
+ if (block == 0 &&
+ (addr1 * 8 + addr2) == 6)
DBG_PRINT(" ISR , ");
- } else {
- DBG_PRINT("0x%08x, ",
- readl(BigDevicePointer++));
- }
+ else
+ DBG_PRINT("0x%08x, ", readl(regs++));
}
DBG_PRINT("\n");
}
@@ -182,29 +180,22 @@ void DumpDeviceBlock(int dbgLvl, struct et131x_adapter *etdev,
* Dumps the first 64 regs of each block of the et-1310 (each block is
* mapped to a new page, each page is 4096 bytes).
*/
-void DumpDeviceReg(int dbgLvl, struct et131x_adapter *etdev)
+void DumpDeviceReg(int debug, struct et131x_adapter *etdev)
{
- uint32_t Address1, Address2;
- uint32_t Block;
- uint32_t __iomem *BigDevicePointer =
- (uint32_t __iomem *) etdev->regs;
- uint32_t __iomem *Pointer;
- const char *BlockNames[NUM_BLOCKS] = {
- "Global", "Tx DMA", "Rx DMA", "Tx MAC",
- "Rx MAC", "MAC", "MAC Stat", "MMC"
- };
+ u32 addr1, addr2;
+ u32 block;
+ u32 __iomem *regs = (u32 __iomem *)etdev->regs;
+ u32 __iomem *p;
/* Output the debug counters to the debug terminal */
- if (DBG_FLAGS(et131x_dbginfo) & dbgLvl) {
- for (Block = 0; Block < NUM_BLOCKS; Block++) {
- DBG_PRINT("%s block\n", BlockNames[Block]);
- Pointer = BigDevicePointer + (Block * 1024);
-
- for (Address1 = 0; Address1 < 8; Address1++) {
- for (Address2 = 0; Address2 < 8; Address2++) {
- DBG_PRINT("0x%08x, ",
- readl(Pointer++));
- }
+ if (DBG_FLAGS(et131x_dbginfo) & debug) {
+ for (block = 0; block < NUM_BLOCKS; block++) {
+ DBG_PRINT("%s block\n", BlockNames[block]);
+ p = regs + block * 1024;
+
+ for (addr1 = 0; addr1 < 8; addr1++) {
+ for (addr2 = 0; addr2 < 8; addr2++)
+ DBG_PRINT("0x%08x, ", readl(p++));
DBG_PRINT("\n");
}
DBG_PRINT("\n");
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 23/26] et131x: kill the Q_ADDR struct
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (21 preceding siblings ...)
2009-08-25 15:01 ` [PATCH 22/26] et131x: quick tidy of the debug code Alan Cox
@ 2009-08-25 15:01 ` Alan Cox
2009-08-25 15:01 ` [PATCH 24/26] et131x: clean up PM_CSR_t Alan Cox
` (2 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 15:01 UTC (permalink / raw)
To: greg, netdev
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_address_map.h | 48 ++++++---------------------
drivers/staging/et131x/et1310_jagcore.c | 41 ++++++++++-------------
drivers/staging/et131x/et131x_debug.c | 4 ++
3 files changed, 30 insertions(+), 63 deletions(-)
diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h
index 01c990c..7f6baa3 100644
--- a/drivers/staging/et131x/et1310_address_map.h
+++ b/drivers/staging/et131x/et1310_address_map.h
@@ -61,41 +61,13 @@
/* START OF GLOBAL REGISTER ADDRESS MAP */
-typedef union _Q_ADDR_t {
- u32 value;
- struct {
-#ifdef _BIT_FIELDS_HTOL
- u32 unused:22; /* bits 10-31 */
- u32 addr:10; /* bits 0-9 */
-#else
- u32 addr:10; /* bits 0-9 */
- u32 unused:22; /* bits 10-31 */
-#endif
- } bits;
-} Q_ADDR_t, *PQ_ADDR_t;
-
/*
- * structure for tx queue start address reg in global address map
- * located at address 0x0000
- * Defined earlier (Q_ADDR_t)
- */
-
-/*
- * structure for tx queue end address reg in global address map
- * located at address 0x0004
- * Defined earlier (Q_ADDR_t)
- */
-
-/*
- * structure for rx queue start address reg in global address map
- * located at address 0x0008
- * Defined earlier (Q_ADDR_t)
- */
-
-/*
- * structure for rx queue end address reg in global address map
- * located at address 0x000C
- * Defined earlier (Q_ADDR_t)
+ * 10bit registers
+ *
+ * Tx queue start address reg in global address map at address 0x0000
+ * tx queue end address reg in global address map at address 0x0004
+ * rx queue start address reg in global address map at address 0x0008
+ * rx queue end address reg in global address map at address 0x000C
*/
/*
@@ -295,10 +267,10 @@ typedef union _LOOPBACK_t {
* Located at address 0x0000
*/
typedef struct _GLOBAL_t { /* Location: */
- Q_ADDR_t txq_start_addr; /* 0x0000 */
- Q_ADDR_t txq_end_addr; /* 0x0004 */
- Q_ADDR_t rxq_start_addr; /* 0x0008 */
- Q_ADDR_t rxq_end_addr; /* 0x000C */
+ u32 txq_start_addr; /* 0x0000 */
+ u32 txq_end_addr; /* 0x0004 */
+ u32 rxq_start_addr; /* 0x0008 */
+ u32 rxq_end_addr; /* 0x000C */
PM_CSR_t pm_csr; /* 0x0010 */
u32 unused; /* 0x0014 */
INTERRUPT_t int_status; /* 0x0018 */
diff --git a/drivers/staging/et131x/et1310_jagcore.c b/drivers/staging/et131x/et1310_jagcore.c
index 2767e4d..47089bf 100644
--- a/drivers/staging/et131x/et1310_jagcore.c
+++ b/drivers/staging/et131x/et1310_jagcore.c
@@ -112,33 +112,26 @@ void ConfigGlobalRegs(struct et131x_adapter *etdev)
* and Rx as it desires. Our default is to split it
* 50/50:
*/
- writel(0, &pGbl->rxq_start_addr.value);
- writel(PARM_RX_MEM_END_DEF,
- &pGbl->rxq_end_addr.value);
- writel(PARM_RX_MEM_END_DEF + 1,
- &pGbl->txq_start_addr.value);
- writel(INTERNAL_MEM_SIZE - 1,
- &pGbl->txq_end_addr.value);
+ writel(0, &pGbl->rxq_start_addr);
+ writel(PARM_RX_MEM_END_DEF, &pGbl->rxq_end_addr);
+ writel(PARM_RX_MEM_END_DEF + 1, &pGbl->txq_start_addr);
+ writel(INTERNAL_MEM_SIZE - 1, &pGbl->txq_end_addr);
} else if (etdev->RegistryJumboPacket < 8192) {
/* For jumbo packets > 2k but < 8k, split 50-50. */
- writel(0, &pGbl->rxq_start_addr.value);
- writel(INTERNAL_MEM_RX_OFFSET,
- &pGbl->rxq_end_addr.value);
- writel(INTERNAL_MEM_RX_OFFSET + 1,
- &pGbl->txq_start_addr.value);
- writel(INTERNAL_MEM_SIZE - 1,
- &pGbl->txq_end_addr.value);
+ writel(0, &pGbl->rxq_start_addr);
+ writel(INTERNAL_MEM_RX_OFFSET, &pGbl->rxq_end_addr);
+ writel(INTERNAL_MEM_RX_OFFSET + 1, &pGbl->txq_start_addr);
+ writel(INTERNAL_MEM_SIZE - 1, &pGbl->txq_end_addr);
} else {
/* 9216 is the only packet size greater than 8k that
* is available. The Tx buffer has to be big enough
* for one whole packet on the Tx side. We'll make
* the Tx 9408, and give the rest to Rx
*/
- writel(0x0000, &pGbl->rxq_start_addr.value);
- writel(0x01b3, &pGbl->rxq_end_addr.value);
- writel(0x01b4, &pGbl->txq_start_addr.value);
- writel(INTERNAL_MEM_SIZE - 1,
- &pGbl->txq_end_addr.value);
+ writel(0x0000, &pGbl->rxq_start_addr);
+ writel(0x01b3, &pGbl->rxq_end_addr);
+ writel(0x01b4, &pGbl->txq_start_addr);
+ writel(INTERNAL_MEM_SIZE - 1,&pGbl->txq_end_addr);
}
/* Initialize the loopback register. Disable all loopbacks. */
@@ -149,13 +142,13 @@ void ConfigGlobalRegs(struct et131x_adapter *etdev)
* RxMAC will write data into the space, and the TxMAC will
* read it out.
*/
- writel(0, &pGbl->rxq_start_addr.value);
- writel(INTERNAL_MEM_SIZE - 1, &pGbl->rxq_end_addr.value);
- writel(0, &pGbl->txq_start_addr.value);
- writel(INTERNAL_MEM_SIZE - 1, &pGbl->txq_end_addr.value);
+ writel(0, &pGbl->rxq_start_addr);
+ writel(INTERNAL_MEM_SIZE - 1, &pGbl->rxq_end_addr);
+ writel(0, &pGbl->txq_start_addr);
+ writel(INTERNAL_MEM_SIZE - 1, &pGbl->txq_end_addr);
/* Initialize the loopback register (MAC loopback). */
- writel(1, &pGbl->loopback.value);
+ writel(1, &pGbl->loopback);
}
/* MSI Register */
diff --git a/drivers/staging/et131x/et131x_debug.c b/drivers/staging/et131x/et131x_debug.c
index 779130b..945b4b5 100644
--- a/drivers/staging/et131x/et131x_debug.c
+++ b/drivers/staging/et131x/et131x_debug.c
@@ -1,3 +1,4 @@
+/*
* Agere Systems Inc.
* 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
*
@@ -135,6 +136,8 @@ void DumpTxQueueContents(int debug, struct et131x_adapter *etdev)
}
}
+#define NUM_BLOCKS 8
+
static const char *BlockNames[NUM_BLOCKS] = {
"Global", "Tx DMA", "Rx DMA", "Tx MAC",
"Rx MAC", "MAC", "MAC Stat", "MMC"
@@ -148,7 +151,6 @@ static const char *BlockNames[NUM_BLOCKS] = {
* Dumps the first 64 regs of each block of the et-1310 (each block is
* mapped to a new page, each page is 4096 bytes).
*/
-#define NUM_BLOCKS 8
void DumpDeviceBlock(int debug, struct et131x_adapter *etdev,
u32 block)
{
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 24/26] et131x: clean up PM_CSR_t
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (22 preceding siblings ...)
2009-08-25 15:01 ` [PATCH 23/26] et131x: kill the Q_ADDR struct Alan Cox
@ 2009-08-25 15:01 ` Alan Cox
2009-08-25 15:01 ` [PATCH 25/26] et131x: clean up DMA10/DMA4 types Alan Cox
2009-08-25 15:01 ` [PATCH 26/26] et131x: clean up MP_FLAG macros Alan Cox
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 15:01 UTC (permalink / raw)
To: greg, netdev
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_address_map.h | 45 ++++++++-------------------
drivers/staging/et131x/et1310_mac.c | 12 ++++---
drivers/staging/et131x/et1310_pm.c | 27 +++++++---------
drivers/staging/et131x/et131x_initpci.c | 20 ++++--------
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 7f6baa3..f4867f5 100644
--- a/drivers/staging/et131x/et1310_address_map.h
+++ b/drivers/staging/et131x/et1310_address_map.h
@@ -73,37 +73,20 @@
/*
* structure for power management control status reg in global address map
* located at address 0x0010
+ * jagcore_rx_rdy bit 9
+ * jagcore_tx_rdy bit 8
+ * phy_lped_en bit 7
+ * phy_sw_coma bit 6
+ * rxclk_gate bit 5
+ * txclk_gate bit 4
+ * sysclk_gate bit 3
+ * jagcore_rx_en bit 2
+ * jagcore_tx_en bit 1
+ * gigephy_en bit 0
*/
-typedef union _PM_CSR_t {
- u32 value;
- struct {
-#ifdef _BIT_FIELDS_HTOL
- u32 unused:22; /* bits 10-31 */
- u32 pm_jagcore_rx_rdy:1; /* bit 9 */
- u32 pm_jagcore_tx_rdy:1; /* bit 8 */
- u32 pm_phy_lped_en:1; /* bit 7 */
- u32 pm_phy_sw_coma:1; /* bit 6 */
- u32 pm_rxclk_gate:1; /* bit 5 */
- u32 pm_txclk_gate:1; /* bit 4 */
- u32 pm_sysclk_gate:1; /* bit 3 */
- u32 pm_jagcore_rx_en:1; /* bit 2 */
- u32 pm_jagcore_tx_en:1; /* bit 1 */
- u32 pm_gigephy_en:1; /* bit 0 */
-#else
- u32 pm_gigephy_en:1; /* bit 0 */
- u32 pm_jagcore_tx_en:1; /* bit 1 */
- u32 pm_jagcore_rx_en:1; /* bit 2 */
- u32 pm_sysclk_gate:1; /* bit 3 */
- u32 pm_txclk_gate:1; /* bit 4 */
- u32 pm_rxclk_gate:1; /* bit 5 */
- u32 pm_phy_sw_coma:1; /* bit 6 */
- u32 pm_phy_lped_en:1; /* bit 7 */
- u32 pm_jagcore_tx_rdy:1; /* bit 8 */
- u32 pm_jagcore_rx_rdy:1; /* bit 9 */
- u32 unused:22; /* bits 10-31 */
-#endif
- } bits;
-} PM_CSR_t, *PPM_CSR_t;
+
+#define ET_PM_PHY_SW_COMA 0x40
+#define ET_PMCSR_INIT 0x38
/*
* structure for interrupt status reg in global address map
@@ -271,7 +254,7 @@ typedef struct _GLOBAL_t { /* Location: */
u32 txq_end_addr; /* 0x0004 */
u32 rxq_start_addr; /* 0x0008 */
u32 rxq_end_addr; /* 0x000C */
- PM_CSR_t pm_csr; /* 0x0010 */
+ u32 pm_csr; /* 0x0010 */
u32 unused; /* 0x0014 */
INTERRUPT_t int_status; /* 0x0018 */
INTERRUPT_t int_mask; /* 0x001C */
diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index b2123d0..a27d815 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)
uint32_t hash2 = 0;
uint32_t hash3 = 0;
uint32_t hash4 = 0;
- PM_CSR_t pm_csr;
+ u32 pm_csr;
DBG_ENTER(et131x_dbginfo);
@@ -718,8 +718,8 @@ void SetupDeviceForMulticast(struct et131x_adapter *etdev)
}
/* Write out the new hash to the device */
- pm_csr.value = readl(&etdev->regs->global.pm_csr.value);
- if (pm_csr.bits.pm_phy_sw_coma == 0) {
+ pm_csr = readl(&etdev->regs->global.pm_csr);
+ if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) {
writel(hash1, &rxmac->multi_hash1);
writel(hash2, &rxmac->multi_hash2);
writel(hash3, &rxmac->multi_hash3);
@@ -735,7 +735,7 @@ void SetupDeviceForUnicast(struct et131x_adapter *etdev)
RXMAC_UNI_PF_ADDR1_t uni_pf1;
RXMAC_UNI_PF_ADDR2_t uni_pf2;
RXMAC_UNI_PF_ADDR3_t uni_pf3;
- PM_CSR_t pm_csr;
+ u32 pm_csr;
DBG_ENTER(et131x_dbginfo);
@@ -763,8 +763,8 @@ void SetupDeviceForUnicast(struct et131x_adapter *etdev)
uni_pf1.bits.addr1_5 = etdev->CurrentAddress[4];
uni_pf1.bits.addr1_6 = etdev->CurrentAddress[5];
- pm_csr.value = readl(&etdev->regs->global.pm_csr.value);
- if (pm_csr.bits.pm_phy_sw_coma == 0) {
+ pm_csr = readl(&etdev->regs->global.pm_csr);
+ if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) {
writel(uni_pf1.value, &rxmac->uni_pf_addr1.value);
writel(uni_pf2.value, &rxmac->uni_pf_addr2.value);
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 846c80b..ea186a8 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;
void EnablePhyComa(struct et131x_adapter *etdev)
{
unsigned long flags;
- PM_CSR_t GlobalPmCSR;
- int32_t LoopCounter = 10;
+ u32 GlobalPmCSR;
DBG_ENTER(et131x_dbginfo);
- GlobalPmCSR.value = readl(&etdev->regs->global.pm_csr.value);
+ GlobalPmCSR = readl(&etdev->regs->global.pm_csr);
/* Save the GbE PHY speed and duplex modes. Need to restore this
* when cable is plugged back in
@@ -141,14 +140,12 @@ void EnablePhyComa(struct et131x_adapter *etdev)
/* Wait for outstanding Receive packets */
/* Gate off JAGCore 3 clock domains */
- GlobalPmCSR.bits.pm_sysclk_gate = 0;
- GlobalPmCSR.bits.pm_txclk_gate = 0;
- GlobalPmCSR.bits.pm_rxclk_gate = 0;
- writel(GlobalPmCSR.value, &etdev->regs->global.pm_csr.value);
+ GlobalPmCSR &= ~ET_PMCSR_INIT;
+ writel(GlobalPmCSR, &etdev->regs->global.pm_csr);
/* Program gigE PHY in to Coma mode */
- GlobalPmCSR.bits.pm_phy_sw_coma = 1;
- writel(GlobalPmCSR.value, &etdev->regs->global.pm_csr.value);
+ GlobalPmCSR |= ET_PM_PHY_SW_COMA;
+ writel(GlobalPmCSR, &etdev->regs->global.pm_csr);
DBG_LEAVE(et131x_dbginfo);
}
@@ -159,18 +156,16 @@ void EnablePhyComa(struct et131x_adapter *etdev)
*/
void DisablePhyComa(struct et131x_adapter *etdev)
{
- PM_CSR_t GlobalPmCSR;
+ u32 GlobalPmCSR;
DBG_ENTER(et131x_dbginfo);
- GlobalPmCSR.value = readl(&etdev->regs->global.pm_csr.value);
+ GlobalPmCSR = readl(&etdev->regs->global.pm_csr);
/* Disable phy_sw_coma register and re-enable JAGCore clocks */
- GlobalPmCSR.bits.pm_sysclk_gate = 1;
- GlobalPmCSR.bits.pm_txclk_gate = 1;
- GlobalPmCSR.bits.pm_rxclk_gate = 1;
- GlobalPmCSR.bits.pm_phy_sw_coma = 0;
- writel(GlobalPmCSR.value, &etdev->regs->global.pm_csr.value);
+ GlobalPmCSR |= ET_PMCSR_INIT;
+ GlobalPmCSR &= ~ET_PM_PHY_SW_COMA;
+ writel(GlobalPmCSR, &etdev->regs->global.pm_csr);
/* Restore the GbE PHY speed and duplex modes;
* 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 bea9918..d7a1b34 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)
void et131x_error_timer_handler(unsigned long data)
{
struct et131x_adapter *etdev = (struct et131x_adapter *) data;
- PM_CSR_t pm_csr;
+ u32 pm_csr;
- pm_csr.value = readl(&etdev->regs->global.pm_csr.value);
+ pm_csr = readl(&etdev->regs->global.pm_csr);
- if (pm_csr.bits.pm_phy_sw_coma == 0)
+ if ((pm_csr & ET_PM_PHY_SW_COMA) == 0)
UpdateMacStatHostCounters(etdev);
else
DBG_VERBOSE(et131x_dbginfo,
"No interrupts, in PHY coma, pm_csr = 0x%x\n",
- pm_csr.value);
+ pm_csr);
if (!etdev->Bmsr.bits.link_status &&
etdev->RegistryPhyComa &&
@@ -494,7 +494,7 @@ void et131x_error_timer_handler(unsigned long data)
if (etdev->PoMgmt.TransPhyComaModeOnBoot == 10) {
if (!etdev->Bmsr.bits.link_status
&& etdev->RegistryPhyComa) {
- if (pm_csr.bits.pm_phy_sw_coma == 0) {
+ if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) {
/* NOTE - This was originally a 'sync with
* interrupt'. How to do that under Linux?
*/
@@ -1002,15 +1002,7 @@ int __devinit et131x_pci_setup(struct pci_dev *pdev,
/* Perform device-specific initialization here (See code below) */
/* If Phy COMA mode was enabled when we went down, disable it here. */
- {
- PM_CSR_t GlobalPmCSR = { 0 };
-
- GlobalPmCSR.bits.pm_sysclk_gate = 1;
- GlobalPmCSR.bits.pm_txclk_gate = 1;
- GlobalPmCSR.bits.pm_rxclk_gate = 1;
- writel(GlobalPmCSR.value,
- &adapter->regs->global.pm_csr.value);
- }
+ writel(ET_PMCSR_INIT, &adapter->regs->global.pm_csr);
/* Issue a global reset to the et1310 */
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 478569f..00b815a 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)
*/
if (etdev->FlowControl == TxOnly ||
etdev->FlowControl == Both) {
- PM_CSR_t pm_csr;
+ u32 pm_csr;
/* Tell the device to send a pause packet via
* the back pressure register
*/
- pm_csr.value =
- readl(&iomem->global.pm_csr.value);
- if (pm_csr.bits.pm_phy_sw_coma == 0) {
+ pm_csr = readl(&iomem->global.pm_csr);
+ if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) {
TXMAC_BP_CTRL_t bp_ctrl = { 0 };
bp_ctrl.bits.bp_req = 1;
@@ -351,7 +350,7 @@ void et131x_isr_handler(struct work_struct *work)
/* Handle the PHY interrupt */
if (GlobStatus.bits.phy_interrupt) {
- PM_CSR_t pm_csr;
+ u32 pm_csr;
MI_BMSR_t BmsrInts, BmsrData;
MI_ISR_t myIsr;
@@ -360,8 +359,8 @@ void et131x_isr_handler(struct work_struct *work)
/* If we are in coma mode when we get this interrupt,
* we need to disable it.
*/
- pm_csr.value = readl(&iomem->global.pm_csr.value);
- if (pm_csr.bits.pm_phy_sw_coma == 1) {
+ pm_csr = readl(&iomem->global.pm_csr);
+ if (pm_csr & ET_PM_PHY_SW_COMA) {
/*
* Check to see if we are in coma mode and if
* so, disable it because we will not be able
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 25/26] et131x: clean up DMA10/DMA4 types
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (23 preceding siblings ...)
2009-08-25 15:01 ` [PATCH 24/26] et131x: clean up PM_CSR_t Alan Cox
@ 2009-08-25 15:01 ` Alan Cox
2009-08-25 15:01 ` [PATCH 26/26] et131x: clean up MP_FLAG macros Alan Cox
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 15:01 UTC (permalink / raw)
To: greg, netdev
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_address_map.h | 150 +++++++++------------------
drivers/staging/et131x/et1310_rx.c | 60 ++++-------
drivers/staging/et131x/et1310_rx.h | 4 -
drivers/staging/et131x/et1310_tx.c | 93 +++++++----------
drivers/staging/et131x/et1310_tx.h | 6 +
drivers/staging/et131x/et131x_netdev.c | 8 +
6 files changed, 120 insertions(+), 201 deletions(-)
diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h
index f4867f5..7d1bdc8 100644
--- a/drivers/staging/et131x/et1310_address_map.h
+++ b/drivers/staging/et131x/et1310_address_map.h
@@ -329,94 +329,40 @@ typedef union _TXDMA_PR_NUM_DES_t {
} TXDMA_PR_NUM_DES_t, *PTXDMA_PR_NUM_DES_t;
-typedef union _DMA10W_t {
- u32 value;
- struct {
-#ifdef _BIT_FIELDS_HTOL
- u32 unused:21; /* bits 11-31 */
- u32 wrap:1; /* bit 10 */
- u32 val:10; /* bits 0-9 */
-#else
- u32 val:10; /* bits 0-9 */
- u32 wrap:1; /* bit 10 */
- u32 unused:21; /* bits 11-31 */
-#endif
- } bits;
-} DMA10W_t, *PDMA10W_t;
-
-/*
- * structure for txdma tx queue write address reg in txdma address map
- * located at address 0x1010
- * Defined earlier (DMA10W_t)
- */
-
-/*
- * structure for txdma tx queue write address external reg in txdma address map
- * located at address 0x1014
- * Defined earlier (DMA10W_t)
- */
-
-/*
- * structure for txdma tx queue read address reg in txdma address map
- * located at address 0x1018
- * Defined earlier (DMA10W_t)
- */
-
-/*
- * structure for txdma status writeback address hi reg in txdma address map
- * located at address 0x101C
- * Defined earlier (u32)
- */
-
-/*
- * structure for txdma status writeback address lo reg in txdma address map
- * located at address 0x1020
- * Defined earlier (u32)
- */
-
-/*
- * structure for txdma service request reg in txdma address map
- * located at address 0x1024
- * Defined earlier (DMA10W_t)
- */
+#define ET_DMA10_MASK 0x3FF /* 10 bit mask for DMA10W types */
+#define ET_DMA10_WRAP 0x400
+#define ET_DMA4_MASK 0x00F /* 4 bit mask for DMA4W types */
+#define ET_DMA4_WRAP 0x010
-/*
- * structure for txdma service complete reg in txdma address map
- * located at address 0x1028
- * Defined earlier (DMA10W_t)
- */
+#define INDEX10(x) ((x) & ET_DMA10_MASK)
+#define INDEX4(x) ((x) & ET_DMA4_MASK)
-typedef union _DMA4W_t {
- u32 value;
- struct {
-#ifdef _BIT_FIELDS_HTOL
- u32 unused:27; /* bits 5-31 */
- u32 wrap:1; /* bit 4 */
- u32 val:4; /* bit 0-3 */
-#else
- u32 val:4; /* bits 0-3 */
- u32 wrap:1; /* bit 4 */
- u32 unused:27; /* bits 5-31 */
-#endif
- } bits;
-} DMA4W_t, *PDMA4W_t;
+extern inline void add_10bit(u32 *v, int n)
+{
+ *v = INDEX10(*v + n);
+}
/*
- * structure for txdma tx descriptor cache read index reg in txdma address map
- * located at address 0x102C
- * Defined earlier (DMA4W_t)
- */
-
-/*
- * structure for txdma tx descriptor cache write index reg in txdma address map
- * located at address 0x1030
- * Defined earlier (DMA4W_t)
+ * 10bit DMA with wrap
+ * txdma tx queue write address reg in txdma address map at 0x1010
+ * txdma tx queue write address external reg in txdma address map at 0x1014
+ * txdma tx queue read address reg in txdma address map at 0x1018
+ *
+ * u32
+ * txdma status writeback address hi reg in txdma address map at0x101C
+ * txdma status writeback address lo reg in txdma address map at 0x1020
+ *
+ * 10bit DMA with wrap
+ * txdma service request reg in txdma address map at 0x1024
+ * structure for txdma service complete reg in txdma address map at 0x1028
+ *
+ * 4bit DMA with wrap
+ * txdma tx descriptor cache read index reg in txdma address map at 0x102C
+ * txdma tx descriptor cache write index reg in txdma address map at 0x1030
+ *
+ * txdma error reg in txdma address map at address 0x1034
*/
-/*
- * structure for txdma error reg in txdma address map
- * located at address 0x1034
- */
typedef union _TXDMA_ERROR_t {
u32 value;
struct {
@@ -453,15 +399,15 @@ typedef struct _TXDMA_t { /* Location: */
u32 pr_base_hi; /* 0x1004 */
u32 pr_base_lo; /* 0x1008 */
TXDMA_PR_NUM_DES_t pr_num_des; /* 0x100C */
- DMA10W_t txq_wr_addr; /* 0x1010 */
- DMA10W_t txq_wr_addr_ext; /* 0x1014 */
- DMA10W_t txq_rd_addr; /* 0x1018 */
+ u32 txq_wr_addr; /* 0x1010 */
+ u32 txq_wr_addr_ext; /* 0x1014 */
+ u32 txq_rd_addr; /* 0x1018 */
u32 dma_wb_base_hi; /* 0x101C */
u32 dma_wb_base_lo; /* 0x1020 */
- DMA10W_t service_request; /* 0x1024 */
- DMA10W_t service_complete; /* 0x1028 */
- DMA4W_t cache_rd_index; /* 0x102C */
- DMA4W_t cache_wr_index; /* 0x1030 */
+ u32 service_request; /* 0x1024 */
+ u32 service_complete; /* 0x1028 */
+ u32 cache_rd_index; /* 0x102C */
+ u32 cache_wr_index; /* 0x1030 */
TXDMA_ERROR_t TxDmaError; /* 0x1034 */
u32 DescAbortCount; /* 0x1038 */
u32 PayloadAbortCnt; /* 0x103c */
@@ -473,7 +419,7 @@ typedef struct _TXDMA_t { /* Location: */
u32 PayloadErrorCnt; /* 0x1054 */
u32 WriteBackErrorCnt; /* 0x1058 */
u32 DroppedTLPCount; /* 0x105c */
- DMA10W_t NewServiceComplete; /* 0x1060 */
+ u32 NewServiceComplete; /* 0x1060 */
u32 EthernetPacketCount; /* 0x1064 */
} TXDMA_t, *PTXDMA_t;
@@ -574,19 +520,19 @@ typedef union _RXDMA_MAX_PKT_TIME_t {
/*
* structure for rx queue read address reg in rxdma address map
* located at address 0x2014
- * Defined earlier (DMA10W_t)
+ * Defined earlier (u32)
*/
/*
* structure for rx queue read address external reg in rxdma address map
* located at address 0x2018
- * Defined earlier (DMA10W_t)
+ * Defined earlier (u32)
*/
/*
* structure for rx queue write address reg in rxdma address map
* located at address 0x201C
- * Defined earlier (DMA10W_t)
+ * Defined earlier (u32)
*/
/*
@@ -722,13 +668,13 @@ typedef union _RXDMA_FBR_NUM_DES_t {
/*
* structure for free buffer ring 0 available offset reg in rxdma address map
* located at address 0x2048
- * Defined earlier (DMA10W_t)
+ * Defined earlier (u32)
*/
/*
* structure for free buffer ring 0 full offset reg in rxdma address map
* located at address 0x204C
- * Defined earlier (DMA10W_t)
+ * Defined earlier (u32)
*/
/*
@@ -811,9 +757,9 @@ typedef struct _RXDMA_t { /* Location: */
u32 dma_wb_base_hi; /* 0x2008 */
RXDMA_NUM_PKT_DONE_t num_pkt_done; /* 0x200C */
RXDMA_MAX_PKT_TIME_t max_pkt_time; /* 0x2010 */
- DMA10W_t rxq_rd_addr; /* 0x2014 */
- DMA10W_t rxq_rd_addr_ext; /* 0x2018 */
- DMA10W_t rxq_wr_addr; /* 0x201C */
+ u32 rxq_rd_addr; /* 0x2014 */
+ u32 rxq_rd_addr_ext; /* 0x2018 */
+ u32 rxq_wr_addr; /* 0x201C */
u32 psr_base_lo; /* 0x2020 */
u32 psr_base_hi; /* 0x2024 */
RXDMA_PSR_NUM_DES_t psr_num_des; /* 0x2028 */
@@ -824,15 +770,15 @@ typedef struct _RXDMA_t { /* Location: */
u32 fbr0_base_lo; /* 0x203C */
u32 fbr0_base_hi; /* 0x2040 */
RXDMA_FBR_NUM_DES_t fbr0_num_des; /* 0x2044 */
- DMA10W_t fbr0_avail_offset; /* 0x2048 */
- DMA10W_t fbr0_full_offset; /* 0x204C */
+ u32 fbr0_avail_offset; /* 0x2048 */
+ u32 fbr0_full_offset; /* 0x204C */
RXDMA_FBC_RD_INDEX_t fbr0_rd_index; /* 0x2050 */
RXDMA_FBR_MIN_DES_t fbr0_min_des; /* 0x2054 */
u32 fbr1_base_lo; /* 0x2058 */
u32 fbr1_base_hi; /* 0x205C */
RXDMA_FBR_NUM_DES_t fbr1_num_des; /* 0x2060 */
- DMA10W_t fbr1_avail_offset; /* 0x2064 */
- DMA10W_t fbr1_full_offset; /* 0x2068 */
+ u32 fbr1_avail_offset; /* 0x2064 */
+ u32 fbr1_full_offset; /* 0x2068 */
RXDMA_FBC_RD_INDEX_t fbr1_rd_index; /* 0x206C */
RXDMA_FBR_MIN_DES_t fbr1_min_des; /* 0x2070 */
} RXDMA_t, *PRXDMA_t;
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index 7f36de0..757a8cd 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -739,20 +739,12 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
writel((uint32_t) (pRxLocal->Fbr1Realpa >> 32), &rx_dma->fbr1_base_hi);
writel((uint32_t) pRxLocal->Fbr1Realpa, &rx_dma->fbr1_base_lo);
writel(pRxLocal->Fbr1NumEntries - 1, &rx_dma->fbr1_num_des.value);
-
- {
- DMA10W_t fbr1_full = { 0 };
-
- fbr1_full.bits.val = 0;
- fbr1_full.bits.wrap = 1;
- writel(fbr1_full.value, &rx_dma->fbr1_full_offset.value);
- }
+ writel(ET_DMA10_WRAP, &rx_dma->fbr1_full_offset);
/* This variable tracks the free buffer ring 1 full position, so it
* has to match the above.
*/
- pRxLocal->local_Fbr1_full.bits.val = 0;
- pRxLocal->local_Fbr1_full.bits.wrap = 1;
+ pRxLocal->local_Fbr1_full = ET_DMA10_WRAP;
writel(((pRxLocal->Fbr1NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
&rx_dma->fbr1_min_des.value);
@@ -769,20 +761,12 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
writel((uint32_t) (pRxLocal->Fbr0Realpa >> 32), &rx_dma->fbr0_base_hi);
writel((uint32_t) pRxLocal->Fbr0Realpa, &rx_dma->fbr0_base_lo);
writel(pRxLocal->Fbr0NumEntries - 1, &rx_dma->fbr0_num_des.value);
-
- {
- DMA10W_t fbr0_full = { 0 };
-
- fbr0_full.bits.val = 0;
- fbr0_full.bits.wrap = 1;
- writel(fbr0_full.value, &rx_dma->fbr0_full_offset.value);
- }
+ writel(ET_DMA10_WRAP, &rx_dma->fbr0_full_offset);
/* This variable tracks the free buffer ring 0 full position, so it
* has to match the above.
*/
- pRxLocal->local_Fbr0_full.bits.val = 0;
- pRxLocal->local_Fbr0_full.bits.wrap = 1;
+ pRxLocal->local_Fbr0_full = ET_DMA10_WRAP;
writel(((pRxLocal->Fbr0NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
&rx_dma->fbr0_min_des.value);
#endif
@@ -1282,6 +1266,16 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
DBG_RX_LEAVE(et131x_dbginfo);
}
+static inline u32 bump_fbr(u32 *fbr, u32 limit)
+{
+ u32 v = *fbr;
+ add_10bit(&v, 1);
+ if (v > limit)
+ v = (*fbr & ~ET_DMA10_MASK) ^ ET_DMA10_WRAP;
+ *fbr = v;
+ return v;
+}
+
/**
* NICReturnRFD - Recycle a RFD and put it back onto the receive list
* @etdev: pointer to our adapter
@@ -1310,7 +1304,7 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd)
if (ri == 1) {
PFBR_DESC_t pNextDesc =
(PFBR_DESC_t) (rx_local->pFbr1RingVa) +
- rx_local->local_Fbr1_full.bits.val;
+ INDEX10(rx_local->local_Fbr1_full);
/* Handle the Free Buffer Ring advancement here. Write
* the PA / Buffer Index for the returned buffer into
@@ -1320,20 +1314,15 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd)
pNextDesc->addr_lo = rx_local->Fbr[1]->PALow[bi];
pNextDesc->word2.value = bi;
- if (++rx_local->local_Fbr1_full.bits.val >
- (rx_local->Fbr1NumEntries - 1)) {
- rx_local->local_Fbr1_full.bits.val = 0;
- rx_local->local_Fbr1_full.bits.wrap ^= 1;
- }
-
- writel(rx_local->local_Fbr1_full.value,
- &rx_dma->fbr1_full_offset.value);
+ writel(bump_fbr(&rx_local->local_Fbr1_full,
+ rx_local->Fbr1NumEntries - 1),
+ &rx_dma->fbr1_full_offset);
}
#ifdef USE_FBR0
else {
PFBR_DESC_t pNextDesc =
(PFBR_DESC_t) rx_local->pFbr0RingVa +
- rx_local->local_Fbr0_full.bits.val;
+ INDEX10(rx_local->local_Fbr0_full);
/* Handle the Free Buffer Ring advancement here. Write
* the PA / Buffer Index for the returned buffer into
@@ -1343,14 +1332,9 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd)
pNextDesc->addr_lo = rx_local->Fbr[0]->PALow[bi];
pNextDesc->word2.value = bi;
- if (++rx_local->local_Fbr0_full.bits.val >
- (rx_local->Fbr0NumEntries - 1)) {
- rx_local->local_Fbr0_full.bits.val = 0;
- rx_local->local_Fbr0_full.bits.wrap ^= 1;
- }
-
- writel(rx_local->local_Fbr0_full.value,
- &rx_dma->fbr0_full_offset.value);
+ writel(bump_fbr(&rx_local->local_Fbr0_full,
+ rx_local->Fbr0NumEntries - 1),
+ &rx_dma->fbr0_full_offset);
}
#endif
spin_unlock_irqrestore(&etdev->FbrLock, flags);
diff --git a/drivers/staging/et131x/et1310_rx.h b/drivers/staging/et131x/et1310_rx.h
index 3bfabd8..72a5229 100644
--- a/drivers/staging/et131x/et1310_rx.h
+++ b/drivers/staging/et131x/et1310_rx.h
@@ -302,7 +302,7 @@ typedef struct _rx_ring_t {
dma_addr_t Fbr0MemPa[MAX_DESC_PER_RING_RX / FBR_CHUNKS];
uint64_t Fbr0Realpa;
uint64_t Fbr0offset;
- DMA10W_t local_Fbr0_full;
+ u32 local_Fbr0_full;
u32 Fbr0NumEntries;
u32 Fbr0BufferSize;
#endif
@@ -313,7 +313,7 @@ typedef struct _rx_ring_t {
uint64_t Fbr1Realpa;
uint64_t Fbr1offset;
FBRLOOKUPTABLE *Fbr[2];
- DMA10W_t local_Fbr1_full;
+ u32 local_Fbr1_full;
u32 Fbr1NumEntries;
u32 Fbr1BufferSize;
diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c
index 16aef44..dd79975 100644
--- a/drivers/staging/et131x/et1310_tx.c
+++ b/drivers/staging/et131x/et1310_tx.c
@@ -275,8 +275,8 @@ void ConfigTxDmaRegs(struct et131x_adapter *etdev)
memset(etdev->TxRing.pTxStatusVa, 0, sizeof(TX_STATUS_BLOCK_t));
- writel(0, &txdma->service_request.value);
- etdev->TxRing.txDmaReadyToSend.value = 0;
+ writel(0, &txdma->service_request);
+ etdev->TxRing.txDmaReadyToSend = 0;
DBG_LEAVE(et131x_dbginfo);
}
@@ -601,8 +601,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
"filling desc entry %d, "
"TCB: 0x%p\n",
(pPacket->len - pPacket->data_len),
- etdev->TxRing.txDmaReadyToSend.bits.
- val, pMpTcb);
+ etdev->TxRing.txDmaReadyToSend, pMpTcb);
CurDesc[FragmentNumber].DataBufferPtrHigh = 0;
@@ -630,8 +629,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
"filling desc entry %d, "
"TCB: 0x%p\n",
(pPacket->len - pPacket->data_len),
- etdev->TxRing.txDmaReadyToSend.bits.
- val, pMpTcb);
+ etdev->TxRing.txDmaReadyToSend, pMpTcb);
CurDesc[FragmentNumber].DataBufferPtrHigh = 0;
@@ -682,7 +680,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
"filling desc entry %d\n"
"TCB: 0x%p\n",
pFragList[loopIndex].size,
- etdev->TxRing.txDmaReadyToSend.bits.val,
+ etdev->TxRing.txDmaReadyToSend,
pMpTcb);
CurDesc[FragmentNumber].DataBufferPtrHigh = 0;
@@ -729,8 +727,8 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
spin_lock_irqsave(&etdev->SendHWLock, flags);
- thiscopy =
- NUM_DESC_PER_RING_TX - etdev->TxRing.txDmaReadyToSend.bits.val;
+ thiscopy = NUM_DESC_PER_RING_TX -
+ INDEX10(etdev->TxRing.txDmaReadyToSend);
if (thiscopy >= FragmentNumber) {
remainder = 0;
@@ -740,18 +738,15 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
}
memcpy(etdev->TxRing.pTxDescRingVa +
- etdev->TxRing.txDmaReadyToSend.bits.val, CurDesc,
+ INDEX10(etdev->TxRing.txDmaReadyToSend), CurDesc,
sizeof(TX_DESC_ENTRY_t) * thiscopy);
- etdev->TxRing.txDmaReadyToSend.bits.val += thiscopy;
+ add_10bit(&etdev->TxRing.txDmaReadyToSend, thiscopy);
- if ((etdev->TxRing.txDmaReadyToSend.bits.val == 0) ||
- (etdev->TxRing.txDmaReadyToSend.bits.val ==
- NUM_DESC_PER_RING_TX)) {
- if (etdev->TxRing.txDmaReadyToSend.bits.wrap)
- etdev->TxRing.txDmaReadyToSend.value = 0;
- else
- etdev->TxRing.txDmaReadyToSend.value = 0x400;
+ if (INDEX10(etdev->TxRing.txDmaReadyToSend)== 0 ||
+ INDEX10(etdev->TxRing.txDmaReadyToSend) == NUM_DESC_PER_RING_TX) {
+ etdev->TxRing.txDmaReadyToSend &= ~ET_DMA10_MASK;
+ etdev->TxRing.txDmaReadyToSend ^= ET_DMA10_WRAP;
}
if (remainder) {
@@ -759,18 +754,16 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
CurDesc + thiscopy,
sizeof(TX_DESC_ENTRY_t) * remainder);
- etdev->TxRing.txDmaReadyToSend.bits.val += remainder;
+ add_10bit(&etdev->TxRing.txDmaReadyToSend, remainder);
}
- if (etdev->TxRing.txDmaReadyToSend.bits.val == 0) {
- if (etdev->TxRing.txDmaReadyToSend.value)
- pMpTcb->WrIndex.value = NUM_DESC_PER_RING_TX - 1;
+ if (INDEX10(etdev->TxRing.txDmaReadyToSend) == 0) {
+ if (etdev->TxRing.txDmaReadyToSend)
+ pMpTcb->WrIndex = NUM_DESC_PER_RING_TX - 1;
else
- pMpTcb->WrIndex.value =
- 0x400 | (NUM_DESC_PER_RING_TX - 1);
+ pMpTcb->WrIndex= ET_DMA10_WRAP | (NUM_DESC_PER_RING_TX - 1);
} else
- pMpTcb->WrIndex.value =
- etdev->TxRing.txDmaReadyToSend.value - 1;
+ pMpTcb->WrIndex = etdev->TxRing.txDmaReadyToSend - 1;
spin_lock(&etdev->TCBSendQLock);
@@ -788,8 +781,8 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
spin_unlock(&etdev->TCBSendQLock);
/* Write the new write pointer back to the device. */
- writel(etdev->TxRing.txDmaReadyToSend.value,
- &etdev->regs->txdma.service_request.value);
+ writel(etdev->TxRing.txDmaReadyToSend,
+ &etdev->regs->txdma.service_request);
/* For Gig only, we use Tx Interrupt coalescing. Enable the software
* timer to wake us up if this packet isn't followed by N more.
@@ -1258,23 +1251,18 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev,
"TCB : 0x%p\n"
"TCB Next : 0x%p\n"
"TCB PacketLength : %d\n"
- "TCB WrIndex.value : 0x%08x\n"
- "TCB WrIndex.bits.val : %d\n"
- "TCB WrIndex.value : 0x%08x\n"
- "TCB WrIndex.bits.val : %d\n",
+ "TCB WrIndexS.value : 0x%08x\n"
+ "TCB WrIndex.value : 0x%08x\n",
pMpTcb,
pMpTcb->Next,
pMpTcb->PacketLength,
- pMpTcb->WrIndexStart.value,
- pMpTcb->WrIndexStart.bits.val,
- pMpTcb->WrIndex.value,
- pMpTcb->WrIndex.bits.val);
+ pMpTcb->WrIndexStart,
+ pMpTcb->WrIndex);
do {
desc =
- (TX_DESC_ENTRY_t *) (etdev->TxRing.
- pTxDescRingVa +
- pMpTcb->WrIndexStart.bits.val);
+ (TX_DESC_ENTRY_t *) (etdev->TxRing.pTxDescRingVa +
+ INDEX10(pMpTcb->WrIndexStart));
DBG_TX(et131x_dbginfo,
"CURRENT DESCRIPTOR\n"
@@ -1293,15 +1281,14 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev,
desc->DataBufferPtrLow,
desc->word2.value, PCI_DMA_TODEVICE);
- if (++pMpTcb->WrIndexStart.bits.val >=
+ add_10bit(&pMpTcb->WrIndexStart, 1);
+ if (INDEX10(pMpTcb->WrIndexStart) >=
NUM_DESC_PER_RING_TX) {
- if (pMpTcb->WrIndexStart.bits.wrap)
- pMpTcb->WrIndexStart.value = 0;
- else
- pMpTcb->WrIndexStart.value = 0x400;
+ pMpTcb->WrIndexStart &= ~ET_DMA10_MASK;
+ pMpTcb->WrIndexStart ^= ET_DMA10_WRAP;
}
} while (desc != (etdev->TxRing.pTxDescRingVa +
- pMpTcb->WrIndex.bits.val));
+ INDEX10(pMpTcb->WrIndex)));
DBG_TX(et131x_dbginfo,
"Free Packet (SKB) : 0x%p\n", pMpTcb->Packet);
@@ -1431,11 +1418,12 @@ void et131x_handle_send_interrupt(struct et131x_adapter *etdev)
static void et131x_update_tcb_list(struct et131x_adapter *etdev)
{
unsigned long flags;
- DMA10W_t ServiceComplete;
+ u32 ServiceComplete;
PMP_TCB pMpTcb;
+ u32 index;
- ServiceComplete.value =
- readl(&etdev->regs->txdma.NewServiceComplete.value);
+ ServiceComplete = readl(&etdev->regs->txdma.NewServiceComplete);
+ index = INDEX10(ServiceComplete);
/* Has the ring wrapped? Process any descriptors that do not have
* the same "wrap" indicator as the current completion indicator
@@ -1443,9 +1431,10 @@ static void et131x_update_tcb_list(struct et131x_adapter *etdev)
spin_lock_irqsave(&etdev->TCBSendQLock, flags);
pMpTcb = etdev->TxRing.CurrSendHead;
+
while (pMpTcb &&
- ServiceComplete.bits.wrap != pMpTcb->WrIndex.bits.wrap &&
- ServiceComplete.bits.val < pMpTcb->WrIndex.bits.val) {
+ ((ServiceComplete ^ pMpTcb->WrIndex) & ET_DMA10_WRAP) &&
+ index < INDEX10(pMpTcb->WrIndex)) {
etdev->TxRing.nBusySend--;
etdev->TxRing.CurrSendHead = pMpTcb->Next;
if (pMpTcb->Next == NULL)
@@ -1459,8 +1448,8 @@ static void et131x_update_tcb_list(struct et131x_adapter *etdev)
pMpTcb = etdev->TxRing.CurrSendHead;
}
while (pMpTcb &&
- ServiceComplete.bits.wrap == pMpTcb->WrIndex.bits.wrap &&
- ServiceComplete.bits.val > pMpTcb->WrIndex.bits.val) {
+ !((ServiceComplete ^ pMpTcb->WrIndex) & ET_DMA10_WRAP)
+ && index > (pMpTcb->WrIndex & ET_DMA10_MASK)) {
etdev->TxRing.nBusySend--;
etdev->TxRing.CurrSendHead = pMpTcb->Next;
if (pMpTcb->Next == NULL)
diff --git a/drivers/staging/et131x/et1310_tx.h b/drivers/staging/et131x/et1310_tx.h
index 1072928..ad03721 100644
--- a/drivers/staging/et131x/et1310_tx.h
+++ b/drivers/staging/et131x/et1310_tx.h
@@ -166,8 +166,8 @@ typedef struct _MP_TCB {
u32 PacketStaleCount;
struct sk_buff *Packet;
u32 PacketLength;
- DMA10W_t WrIndex;
- DMA10W_t WrIndexStart;
+ u32 WrIndex;
+ u32 WrIndexStart;
} MP_TCB, *PMP_TCB;
/* Structure to hold the skb's in a list */
@@ -206,7 +206,7 @@ typedef struct _tx_ring_t {
uint64_t TxDescOffset;
/* ReadyToSend indicates where we last wrote to in the descriptor ring. */
- DMA10W_t txDmaReadyToSend;
+ u32 txDmaReadyToSend;
/* The location of the write-back status block */
PTX_STATUS_BLOCK_t pTxStatusVa;
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index fec3f86..62febe9 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -648,14 +648,14 @@ void et131x_tx_timeout(struct net_device *netdev)
*(etdev->TxRing.pTxStatusVa);
PTX_DESC_ENTRY_t pDesc =
etdev->TxRing.pTxDescRingVa +
- pMpTcb->WrIndex.bits.val;
+ INDEX10(pMpTcb->WrIndex);
#endif
TX_DESC_ENTRY_t StuckDescriptors[10];
- if (pMpTcb->WrIndex.bits.val > 7) {
+ if (INDEX10(pMpTcb->WrIndex) > 7) {
memcpy(StuckDescriptors,
etdev->TxRing.pTxDescRingVa +
- pMpTcb->WrIndex.bits.val - 6,
+ INDEX10(pMpTcb->WrIndex) - 6,
sizeof(TX_DESC_ENTRY_t) * 10);
}
@@ -664,7 +664,7 @@ void et131x_tx_timeout(struct net_device *netdev)
DBG_WARNING(et131x_dbginfo,
"Send stuck - reset. pMpTcb->WrIndex %x, Flags 0x%08x\n",
- pMpTcb->WrIndex.bits.val,
+ pMpTcb->WrIndex,
pMpTcb->Flags);
DBG_WARNING(et131x_dbginfo,
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH 26/26] et131x: clean up MP_FLAG macros
2009-08-25 14:57 [PATCH 00/26] et131x cleanups - phase 1 Alan Cox
` (24 preceding siblings ...)
2009-08-25 15:01 ` [PATCH 25/26] et131x: clean up DMA10/DMA4 types Alan Cox
@ 2009-08-25 15:01 ` Alan Cox
25 siblings, 0 replies; 28+ messages in thread
From: Alan Cox @ 2009-08-25 15:01 UTC (permalink / raw)
To: greg, netdev
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_mac.c | 2 +-
drivers/staging/et131x/et1310_phy.c | 8 +++-----
drivers/staging/et131x/et1310_pm.c | 4 ++--
drivers/staging/et131x/et1310_rx.c | 12 ++++++------
drivers/staging/et131x/et1310_tx.c | 8 ++++----
drivers/staging/et131x/et131x_adapter.h | 13 -------------
drivers/staging/et131x/et131x_initpci.c | 2 +-
drivers/staging/et131x/et131x_netdev.c | 14 +++++++-------
8 files changed, 24 insertions(+), 39 deletions(-)
diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c
index a27d815..c94d661 100644
--- a/drivers/staging/et131x/et1310_mac.c
+++ b/drivers/staging/et131x/et1310_mac.c
@@ -272,7 +272,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
writel(ctl.value, &etdev->regs->txmac.ctl.value);
/* Ready to start the RXDMA/TXDMA engine */
- if (!MP_TEST_FLAG(etdev, fMP_ADAPTER_LOWER_POWER)) {
+ if (etdev->Flags & fMP_ADAPTER_LOWER_POWER) {
et131x_rx_dma_enable(etdev);
et131x_tx_dma_enable(etdev);
} else {
diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c
index 19ffb65..f856381 100644
--- a/drivers/staging/et131x/et1310_phy.c
+++ b/drivers/staging/et131x/et1310_phy.c
@@ -498,7 +498,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
spin_lock_irqsave(&etdev->Lock, flags);
etdev->MediaState = NETIF_STATUS_MEDIA_CONNECT;
- MP_CLEAR_FLAG(etdev, fMP_ADAPTER_LINK_DETECTION);
+ etdev->Flags &= ~fMP_ADAPTER_LINK_DETECTION);
spin_unlock_irqrestore(&etdev->Lock, flags);
@@ -529,10 +529,8 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
* Timer expires, we can report disconnected (handled
* in the LinkDetectionDPC).
*/
- if ((MP_IS_FLAG_CLEAR
- (etdev, fMP_ADAPTER_LINK_DETECTION))
- || (etdev->MediaState ==
- NETIF_STATUS_MEDIA_DISCONNECT)) {
+ if (!(etdev->Flags & fMP_ADAPTER_LINK_DETECTION) ||
+ (etdev->MediaState == NETIF_STATUS_MEDIA_DISCONNECT)) {
spin_lock_irqsave(&etdev->Lock, flags);
etdev->MediaState =
NETIF_STATUS_MEDIA_DISCONNECT;
diff --git a/drivers/staging/et131x/et1310_pm.c b/drivers/staging/et131x/et1310_pm.c
index ea186a8..f4c942c 100644
--- a/drivers/staging/et131x/et1310_pm.c
+++ b/drivers/staging/et131x/et1310_pm.c
@@ -134,7 +134,7 @@ void EnablePhyComa(struct et131x_adapter *etdev)
/* Stop sending packets. */
spin_lock_irqsave(&etdev->SendHWLock, flags);
- MP_SET_FLAG(etdev, fMP_ADAPTER_LOWER_POWER);
+ etdev->Flags |= fMP_ADAPTER_LOWER_POWER;
spin_unlock_irqrestore(&etdev->SendHWLock, flags);
/* Wait for outstanding Receive packets */
@@ -189,7 +189,7 @@ void DisablePhyComa(struct et131x_adapter *etdev)
et131x_adapter_setup(etdev);
/* Allow Tx to restart */
- MP_CLEAR_FLAG(etdev, fMP_ADAPTER_LOWER_POWER);
+ etdev->Flags &= ~fMP_ADAPTER_LOWER_POWER;
/* Need to re-enable Rx. */
et131x_rx_dma_enable(etdev);
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index 757a8cd..54a7ecf 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -415,7 +415,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
SLAB_HWCACHE_ALIGN,
NULL);
- MP_SET_FLAG(adapter, fMP_ADAPTER_RECV_LOOKASIDE);
+ adapter->Flags |= fMP_ADAPTER_RECV_LOOKASIDE;
/* The RFDs are going to be put on lists later on, so initialize the
* lists now.
@@ -569,9 +569,9 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
/* Free receive packet pool */
/* Destroy the lookaside (RFD) pool */
- if (MP_TEST_FLAG(adapter, fMP_ADAPTER_RECV_LOOKASIDE)) {
+ if (adapter->Flags & fMP_ADAPTER_RECV_LOOKASIDE) {
kmem_cache_destroy(rx_ring->RecvLookaside);
- MP_CLEAR_FLAG(adapter, fMP_ADAPTER_RECV_LOOKASIDE);
+ adapter->Flags &= ~fMP_ADAPTER_RECV_LOOKASIDE;
}
/* Free the FBR Lookup Table */
@@ -1223,9 +1223,9 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
* If length is zero, return the RFD in order to advance the
* Free buffer ring.
*/
- if ((!etdev->PacketFilter) ||
- (!MP_LINK_DETECTED(etdev)) ||
- (pMpRfd->PacketSize == 0)) {
+ if (!etdev->PacketFilter ||
+ !(etdev->Flags & fMP_ADAPTER_LINK_DETECTION) ||
+ pMpRfd->PacketSize == 0) {
continue;
}
diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c
index dd79975..4a0108f 100644
--- a/drivers/staging/et131x/et1310_tx.c
+++ b/drivers/staging/et131x/et1310_tx.c
@@ -510,9 +510,9 @@ static int et131x_send_packet(struct sk_buff *skb,
if ((shbufva[0] == 0xffff) &&
(shbufva[1] == 0xffff) && (shbufva[2] == 0xffff)) {
- MP_SET_FLAG(pMpTcb, fMP_DEST_BROAD);
+ pMpTcb->Flags |= fMP_DEST_BROAD;
} else if ((shbufva[0] & 0x3) == 0x0001) {
- MP_SET_FLAG(pMpTcb, fMP_DEST_MULTI);
+ pMpTcb->Flags |= fMP_DEST_MULTI;
}
}
@@ -1232,9 +1232,9 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev,
TX_DESC_ENTRY_t *desc = NULL;
struct net_device_stats *stats = &etdev->net_stats;
- if (MP_TEST_FLAG(pMpTcb, fMP_DEST_BROAD))
+ if (pMpTcb->Flags & fMP_DEST_BROAD))
atomic_inc(&etdev->Stats.brdcstxmt);
- else if (MP_TEST_FLAG(pMpTcb, fMP_DEST_MULTI))
+ else if (pMpTcb->Flags & fMP_DEST_MULTI))
atomic_inc(&etdev->Stats.multixmt);
else
atomic_inc(&etdev->Stats.unixmt);
diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h
index 04bb603..05388eb 100644
--- a/drivers/staging/et131x/et131x_adapter.h
+++ b/drivers/staging/et131x/et131x_adapter.h
@@ -100,24 +100,11 @@
#define LO_MARK_PERCENT_FOR_PSR 15
#define LO_MARK_PERCENT_FOR_RX 15
-/* Macros for flag and ref count operations */
-#define MP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F))
-#define MP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F))
-#define MP_CLEAR_FLAGS(_M) ((_M)->Flags = 0)
-#define MP_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0)
-#define MP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F))
-#define MP_IS_FLAG_CLEAR(_M, _F) (((_M)->Flags & (_F)) == 0)
-
/* Macros specific to the private adapter structure */
#define MP_TCB_RESOURCES_AVAILABLE(_M) ((_M)->TxRing.nBusySend < NUM_TCB)
#define MP_TCB_RESOURCES_NOT_AVAILABLE(_M) ((_M)->TxRing.nBusySend >= NUM_TCB)
#define MP_SHOULD_FAIL_SEND(_M) ((_M)->Flags & fMP_ADAPTER_FAIL_SEND_MASK)
-#define MP_IS_NOT_READY(_M) ((_M)->Flags & fMP_ADAPTER_NOT_READY_MASK)
-#define MP_IS_READY(_M) (!((_M)->Flags & fMP_ADAPTER_NOT_READY_MASK))
-
-#define MP_HAS_CABLE(_M) (!((_M)->Flags & fMP_ADAPTER_NO_CABLE))
-#define MP_LINK_DETECTED(_M) (!((_M)->Flags & fMP_ADAPTER_LINK_DETECTION))
/* Counters for error rate monitoring */
typedef struct _MP_ERR_COUNTERS {
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index d7a1b34..0a3464a 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -523,7 +523,7 @@ void et131x_link_detection_handler(unsigned long data)
spin_lock_irqsave(&etdev->Lock, flags);
etdev->MediaState = NETIF_STATUS_MEDIA_DISCONNECT;
- MP_CLEAR_FLAG(etdev, fMP_ADAPTER_LINK_DETECTION);
+ etdev->Flags &= ~fMP_ADAPTER_LINK_DETECTION;
spin_unlock_irqrestore(&etdev->Lock, flags);
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index 62febe9..2a4b9ac 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -253,7 +253,7 @@ int et131x_open(struct net_device *netdev)
/* Enable device interrupts */
et131x_enable_interrupts(adapter);
- MP_SET_FLAG(adapter, fMP_ADAPTER_INTERRUPT_IN_USE);
+ adapter->Flags |= fMP_ADAPTER_INTERRUPT_IN_USE;
/* We're ready to move some data, so start the queue */
netif_start_queue(netdev);
@@ -285,7 +285,7 @@ int et131x_close(struct net_device *netdev)
et131x_disable_interrupts(adapter);
/* Deregistering ISR */
- MP_CLEAR_FLAG(adapter, fMP_ADAPTER_INTERRUPT_IN_USE);
+ adapter->Flags &= ~fMP_ADAPTER_INTERRUPT_IN_USE;
DBG_TRACE(et131x_dbginfo, "Deregistering ISR...\n");
free_irq(netdev->irq, netdev);
@@ -615,7 +615,7 @@ void et131x_tx_timeout(struct net_device *netdev)
DBG_WARNING(et131x_dbginfo, "TX TIMEOUT\n");
/* Just skip this part if the adapter is doing link detection */
- if (MP_TEST_FLAG(etdev, fMP_ADAPTER_LINK_DETECTION)) {
+ if (etdev->Flags & fMP_ADAPTER_LINK_DETECTION) {
DBG_ERROR(et131x_dbginfo, "Still doing link detection\n");
return;
}
@@ -623,13 +623,13 @@ void et131x_tx_timeout(struct net_device *netdev)
/* Any nonrecoverable hardware error?
* Checks adapter->flags for any failure in phy reading
*/
- if (MP_TEST_FLAG(etdev, fMP_ADAPTER_NON_RECOVER_ERROR)) {
+ if (etdev->Flags & fMP_ADAPTER_NON_RECOVER_ERROR) {
DBG_WARNING(et131x_dbginfo, "Non recoverable error - remove\n");
return;
}
/* Hardware failure? */
- if (MP_TEST_FLAG(etdev, fMP_ADAPTER_HARDWARE_ERROR)) {
+ if (etdev->Flags & fMP_ADAPTER_HARDWARE_ERROR) {
DBG_WARNING(et131x_dbginfo, "hardware error - reset\n");
return;
}
@@ -751,7 +751,7 @@ int et131x_change_mtu(struct net_device *netdev, int new_mtu)
et131x_adapter_setup(adapter);
/* Enable interrupts */
- if (MP_TEST_FLAG(adapter, fMP_ADAPTER_INTERRUPT_IN_USE))
+ if (adapter->Flags & fMP_ADAPTER_INTERRUPT_IN_USE)
et131x_enable_interrupts(adapter);
/* Restart the Tx and Rx DMA engines */
@@ -847,7 +847,7 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac)
et131x_adapter_setup(adapter);
/* Enable interrupts */
- if (MP_TEST_FLAG(adapter, fMP_ADAPTER_INTERRUPT_IN_USE))
+ if (adapter->Flags & fMP_ADAPTER_INTERRUPT_IN_USE)
et131x_enable_interrupts(adapter);
/* Restart the Tx and Rx DMA engines */
^ permalink raw reply related [flat|nested] 28+ messages in thread