Commit 10f00a49 authored by Mark Einon's avatar Mark Einon Committed by Greg Kroah-Hartman

staging: et131x: Rename var name 'etdev' to 'adapter' throughout module

Used regex (from vim) :%s/\<etdev\>/adapter/g

Changed because:
* 'etdev' is easily confused as a misspelling of 'netdev'
* 'adapter' is more widely used for this struct type in net drivers. This
change made comparing code with other drivers much easier.
Signed-off-by: default avatarMark Einon <mark.einon@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent bc8585fc
...@@ -150,15 +150,15 @@ static int eeprom_wait_ready(struct pci_dev *pdev, u32 *status) ...@@ -150,15 +150,15 @@ static int eeprom_wait_ready(struct pci_dev *pdev, u32 *status)
/** /**
* eeprom_write - Write a byte to the ET1310's EEPROM * eeprom_write - Write a byte to the ET1310's EEPROM
* @etdev: pointer to our private adapter structure * @adapter: pointer to our private adapter structure
* @addr: the address to write * @addr: the address to write
* @data: the value to write * @data: the value to write
* *
* Returns 1 for a successful write. * Returns 1 for a successful write.
*/ */
static int eeprom_write(struct et131x_adapter *etdev, u32 addr, u8 data) static int eeprom_write(struct et131x_adapter *adapter, u32 addr, u8 data)
{ {
struct pci_dev *pdev = etdev->pdev; struct pci_dev *pdev = adapter->pdev;
int index = 0; int index = 0;
int retries; int retries;
int err = 0; int err = 0;
...@@ -222,7 +222,7 @@ static int eeprom_write(struct et131x_adapter *etdev, u32 addr, u8 data) ...@@ -222,7 +222,7 @@ static int eeprom_write(struct et131x_adapter *etdev, u32 addr, u8 data)
* 1, this is so we do a blind write for load bug. * 1, this is so we do a blind write for load bug.
*/ */
if ((status & LBCIF_STATUS_GENERAL_ERROR) if ((status & LBCIF_STATUS_GENERAL_ERROR)
&& etdev->pdev->revision == 0) && adapter->pdev->revision == 0)
break; break;
/* /*
...@@ -280,7 +280,7 @@ static int eeprom_write(struct et131x_adapter *etdev, u32 addr, u8 data) ...@@ -280,7 +280,7 @@ static int eeprom_write(struct et131x_adapter *etdev, u32 addr, u8 data)
/** /**
* eeprom_read - Read a byte from the ET1310's EEPROM * eeprom_read - Read a byte from the ET1310's EEPROM
* @etdev: pointer to our private adapter structure * @adapter: pointer to our private adapter structure
* @addr: the address from which to read * @addr: the address from which to read
* @pdata: a pointer to a byte in which to store the value of the read * @pdata: a pointer to a byte in which to store the value of the read
* @eeprom_id: the ID of the EEPROM * @eeprom_id: the ID of the EEPROM
...@@ -288,9 +288,9 @@ static int eeprom_write(struct et131x_adapter *etdev, u32 addr, u8 data) ...@@ -288,9 +288,9 @@ static int eeprom_write(struct et131x_adapter *etdev, u32 addr, u8 data)
* *
* Returns 1 for a successful read * Returns 1 for a successful read
*/ */
static int eeprom_read(struct et131x_adapter *etdev, u32 addr, u8 *pdata) static int eeprom_read(struct et131x_adapter *adapter, u32 addr, u8 *pdata)
{ {
struct pci_dev *pdev = etdev->pdev; struct pci_dev *pdev = adapter->pdev;
int err; int err;
u32 status; u32 status;
...@@ -337,9 +337,9 @@ static int eeprom_read(struct et131x_adapter *etdev, u32 addr, u8 *pdata) ...@@ -337,9 +337,9 @@ static int eeprom_read(struct et131x_adapter *etdev, u32 addr, u8 *pdata)
return (status & LBCIF_STATUS_ACK_ERROR) ? -EIO : 0; return (status & LBCIF_STATUS_ACK_ERROR) ? -EIO : 0;
} }
int et131x_init_eeprom(struct et131x_adapter *etdev) int et131x_init_eeprom(struct et131x_adapter *adapter)
{ {
struct pci_dev *pdev = etdev->pdev; struct pci_dev *pdev = adapter->pdev;
u8 eestatus; u8 eestatus;
/* We first need to check the EEPROM Status code located at offset /* We first need to check the EEPROM Status code located at offset
...@@ -374,7 +374,7 @@ int et131x_init_eeprom(struct et131x_adapter *etdev) ...@@ -374,7 +374,7 @@ int et131x_init_eeprom(struct et131x_adapter *etdev)
* corruption seen with 1310 B Silicon * corruption seen with 1310 B Silicon
*/ */
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
if (eeprom_write(etdev, i, eedata[i]) < 0) if (eeprom_write(adapter, i, eedata[i]) < 0)
write_failed = 1; write_failed = 1;
} }
if (pdev->revision != 0x01 || write_failed) { if (pdev->revision != 0x01 || write_failed) {
...@@ -387,21 +387,21 @@ int et131x_init_eeprom(struct et131x_adapter *etdev) ...@@ -387,21 +387,21 @@ int et131x_init_eeprom(struct et131x_adapter *etdev)
* gather additional information that normally would * gather additional information that normally would
* come from the eeprom, like MAC Address * come from the eeprom, like MAC Address
*/ */
etdev->has_eeprom = 0; adapter->has_eeprom = 0;
return -EIO; return -EIO;
} }
} }
etdev->has_eeprom = 1; adapter->has_eeprom = 1;
/* Read the EEPROM for information regarding LED behavior. Refer to /* Read the EEPROM for information regarding LED behavior. Refer to
* ET1310_phy.c, et131x_xcvr_init(), for its use. * ET1310_phy.c, et131x_xcvr_init(), for its use.
*/ */
eeprom_read(etdev, 0x70, &etdev->eeprom_data[0]); eeprom_read(adapter, 0x70, &adapter->eeprom_data[0]);
eeprom_read(etdev, 0x71, &etdev->eeprom_data[1]); eeprom_read(adapter, 0x71, &adapter->eeprom_data[1]);
if (etdev->eeprom_data[0] != 0xcd) if (adapter->eeprom_data[0] != 0xcd)
/* Disable all optional features */ /* Disable all optional features */
etdev->eeprom_data[1] = 0x00; adapter->eeprom_data[1] = 0x00;
return 0; return 0;
} }
This diff is collapsed.
This diff is collapsed.
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
/** /**
* et1310_enable_phy_coma - called when network cable is unplugged * et1310_enable_phy_coma - called when network cable is unplugged
* @etdev: pointer to our adapter structure * @adapter: pointer to our adapter structure
* *
* driver receive an phy status change interrupt while in D0 and check that * driver receive an phy status change interrupt while in D0 and check that
* phy_status is down. * phy_status is down.
...@@ -106,75 +106,75 @@ ...@@ -106,75 +106,75 @@
* indicating linkup status, call the MPDisablePhyComa routine to * indicating linkup status, call the MPDisablePhyComa routine to
* restore JAGCore and gigE PHY * restore JAGCore and gigE PHY
*/ */
void et1310_enable_phy_coma(struct et131x_adapter *etdev) void et1310_enable_phy_coma(struct et131x_adapter *adapter)
{ {
unsigned long flags; unsigned long flags;
u32 pmcsr; u32 pmcsr;
pmcsr = readl(&etdev->regs->global.pm_csr); pmcsr = readl(&adapter->regs->global.pm_csr);
/* Save the GbE PHY speed and duplex modes. Need to restore this /* Save the GbE PHY speed and duplex modes. Need to restore this
* when cable is plugged back in * when cable is plugged back in
*/ */
etdev->pdown_speed = etdev->ai_force_speed; adapter->pdown_speed = adapter->ai_force_speed;
etdev->pdown_duplex = etdev->ai_force_duplex; adapter->pdown_duplex = adapter->ai_force_duplex;
/* Stop sending packets. */ /* Stop sending packets. */
spin_lock_irqsave(&etdev->send_hw_lock, flags); spin_lock_irqsave(&adapter->send_hw_lock, flags);
etdev->flags |= fMP_ADAPTER_LOWER_POWER; adapter->flags |= fMP_ADAPTER_LOWER_POWER;
spin_unlock_irqrestore(&etdev->send_hw_lock, flags); spin_unlock_irqrestore(&adapter->send_hw_lock, flags);
/* Wait for outstanding Receive packets */ /* Wait for outstanding Receive packets */
/* Gate off JAGCore 3 clock domains */ /* Gate off JAGCore 3 clock domains */
pmcsr &= ~ET_PMCSR_INIT; pmcsr &= ~ET_PMCSR_INIT;
writel(pmcsr, &etdev->regs->global.pm_csr); writel(pmcsr, &adapter->regs->global.pm_csr);
/* Program gigE PHY in to Coma mode */ /* Program gigE PHY in to Coma mode */
pmcsr |= ET_PM_PHY_SW_COMA; pmcsr |= ET_PM_PHY_SW_COMA;
writel(pmcsr, &etdev->regs->global.pm_csr); writel(pmcsr, &adapter->regs->global.pm_csr);
} }
/** /**
* et1310_disable_phy_coma - Disable the Phy Coma Mode * et1310_disable_phy_coma - Disable the Phy Coma Mode
* @etdev: pointer to our adapter structure * @adapter: pointer to our adapter structure
*/ */
void et1310_disable_phy_coma(struct et131x_adapter *etdev) void et1310_disable_phy_coma(struct et131x_adapter *adapter)
{ {
u32 pmcsr; u32 pmcsr;
pmcsr = readl(&etdev->regs->global.pm_csr); pmcsr = readl(&adapter->regs->global.pm_csr);
/* Disable phy_sw_coma register and re-enable JAGCore clocks */ /* Disable phy_sw_coma register and re-enable JAGCore clocks */
pmcsr |= ET_PMCSR_INIT; pmcsr |= ET_PMCSR_INIT;
pmcsr &= ~ET_PM_PHY_SW_COMA; pmcsr &= ~ET_PM_PHY_SW_COMA;
writel(pmcsr, &etdev->regs->global.pm_csr); writel(pmcsr, &adapter->regs->global.pm_csr);
/* Restore the GbE PHY speed and duplex modes; /* Restore the GbE PHY speed and duplex modes;
* Reset JAGCore; re-configure and initialize JAGCore and gigE PHY * Reset JAGCore; re-configure and initialize JAGCore and gigE PHY
*/ */
etdev->ai_force_speed = etdev->pdown_speed; adapter->ai_force_speed = adapter->pdown_speed;
etdev->ai_force_duplex = etdev->pdown_duplex; adapter->ai_force_duplex = adapter->pdown_duplex;
/* Re-initialize the send structures */ /* Re-initialize the send structures */
et131x_init_send(etdev); et131x_init_send(adapter);
/* Reset the RFD list and re-start RU */ /* Reset the RFD list and re-start RU */
et131x_reset_recv(etdev); et131x_reset_recv(adapter);
/* Bring the device back to the state it was during init prior to /* Bring the device back to the state it was during init prior to
* autonegotiation being complete. This way, when we get the auto-neg * autonegotiation being complete. This way, when we get the auto-neg
* complete interrupt, we can complete init by calling ConfigMacREGS2. * complete interrupt, we can complete init by calling ConfigMacREGS2.
*/ */
et131x_soft_reset(etdev); et131x_soft_reset(adapter);
/* setup et1310 as per the documentation ?? */ /* setup et1310 as per the documentation ?? */
et131x_adapter_setup(etdev); et131x_adapter_setup(adapter);
/* Allow Tx to restart */ /* Allow Tx to restart */
etdev->flags &= ~fMP_ADAPTER_LOWER_POWER; adapter->flags &= ~fMP_ADAPTER_LOWER_POWER;
/* Need to re-enable Rx. */ /* Need to re-enable Rx. */
et131x_rx_dma_enable(etdev); et131x_rx_dma_enable(adapter);
} }
This diff is collapsed.
This diff is collapsed.
...@@ -263,38 +263,38 @@ static int et131x_pci_init(struct et131x_adapter *adapter, ...@@ -263,38 +263,38 @@ static int et131x_pci_init(struct et131x_adapter *adapter,
*/ */
void et131x_error_timer_handler(unsigned long data) void et131x_error_timer_handler(unsigned long data)
{ {
struct et131x_adapter *etdev = (struct et131x_adapter *) data; struct et131x_adapter *adapter = (struct et131x_adapter *) data;
u32 pm_csr; u32 pm_csr;
pm_csr = readl(&etdev->regs->global.pm_csr); pm_csr = readl(&adapter->regs->global.pm_csr);
if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) if ((pm_csr & ET_PM_PHY_SW_COMA) == 0)
et1310_update_macstat_host_counters(etdev); et1310_update_macstat_host_counters(adapter);
else else
dev_err(&etdev->pdev->dev, dev_err(&adapter->pdev->dev,
"No interrupts, in PHY coma, pm_csr = 0x%x\n", pm_csr); "No interrupts, in PHY coma, pm_csr = 0x%x\n", pm_csr);
if (!(etdev->bmsr & MI_BMSR_LINK_STATUS) && if (!(adapter->bmsr & MI_BMSR_LINK_STATUS) &&
etdev->registry_phy_coma && adapter->registry_phy_coma &&
etdev->boot_coma < 11) { adapter->boot_coma < 11) {
etdev->boot_coma++; adapter->boot_coma++;
} }
if (etdev->boot_coma == 10) { if (adapter->boot_coma == 10) {
if (!(etdev->bmsr & MI_BMSR_LINK_STATUS) if (!(adapter->bmsr & MI_BMSR_LINK_STATUS)
&& etdev->registry_phy_coma) { && adapter->registry_phy_coma) {
if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) { if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) {
/* NOTE - This was originally a 'sync with /* NOTE - This was originally a 'sync with
* interrupt'. How to do that under Linux? * interrupt'. How to do that under Linux?
*/ */
et131x_enable_interrupts(etdev); et131x_enable_interrupts(adapter);
et1310_enable_phy_coma(etdev); et1310_enable_phy_coma(adapter);
} }
} }
} }
/* This is a periodic timer, so reschedule */ /* This is a periodic timer, so reschedule */
mod_timer(&etdev->error_timer, jiffies + mod_timer(&adapter->error_timer, jiffies +
TX_ERROR_PERIOD * HZ / 1000); TX_ERROR_PERIOD * HZ / 1000);
} }
...@@ -305,34 +305,34 @@ void et131x_error_timer_handler(unsigned long data) ...@@ -305,34 +305,34 @@ void et131x_error_timer_handler(unsigned long data)
*/ */
void et131x_link_detection_handler(unsigned long data) void et131x_link_detection_handler(unsigned long data)
{ {
struct et131x_adapter *etdev = (struct et131x_adapter *) data; struct et131x_adapter *adapter = (struct et131x_adapter *) data;
unsigned long flags; unsigned long flags;
if (etdev->media_state == 0) { if (adapter->media_state == 0) {
spin_lock_irqsave(&etdev->lock, flags); spin_lock_irqsave(&adapter->lock, flags);
etdev->media_state = NETIF_STATUS_MEDIA_DISCONNECT; adapter->media_state = NETIF_STATUS_MEDIA_DISCONNECT;
spin_unlock_irqrestore(&etdev->lock, flags); spin_unlock_irqrestore(&adapter->lock, flags);
netif_carrier_off(etdev->netdev); netif_carrier_off(adapter->netdev);
} }
} }
/** /**
* et131x_configure_global_regs - configure JAGCore global regs * et131x_configure_global_regs - configure JAGCore global regs
* @etdev: pointer to our adapter structure * @adapter: pointer to our adapter structure
* *
* Used to configure the global registers on the JAGCore * Used to configure the global registers on the JAGCore
*/ */
void et131x_configure_global_regs(struct et131x_adapter *etdev) void et131x_configure_global_regs(struct et131x_adapter *adapter)
{ {
struct global_regs __iomem *regs = &etdev->regs->global; struct global_regs __iomem *regs = &adapter->regs->global;
writel(0, &regs->rxq_start_addr); writel(0, &regs->rxq_start_addr);
writel(INTERNAL_MEM_SIZE - 1, &regs->txq_end_addr); writel(INTERNAL_MEM_SIZE - 1, &regs->txq_end_addr);
if (etdev->registry_jumbo_packet < 2048) { if (adapter->registry_jumbo_packet < 2048) {
/* Tx / RxDMA and Tx/Rx MAC interfaces have a 1k word /* Tx / RxDMA and Tx/Rx MAC interfaces have a 1k word
* block of RAM that the driver can split between Tx * block of RAM that the driver can split between Tx
* and Rx as it desires. Our default is to split it * and Rx as it desires. Our default is to split it
...@@ -340,7 +340,7 @@ void et131x_configure_global_regs(struct et131x_adapter *etdev) ...@@ -340,7 +340,7 @@ void et131x_configure_global_regs(struct et131x_adapter *etdev)
*/ */
writel(PARM_RX_MEM_END_DEF, &regs->rxq_end_addr); writel(PARM_RX_MEM_END_DEF, &regs->rxq_end_addr);
writel(PARM_RX_MEM_END_DEF + 1, &regs->txq_start_addr); writel(PARM_RX_MEM_END_DEF + 1, &regs->txq_start_addr);
} else if (etdev->registry_jumbo_packet < 8192) { } else if (adapter->registry_jumbo_packet < 8192) {
/* For jumbo packets > 2k but < 8k, split 50-50. */ /* For jumbo packets > 2k but < 8k, split 50-50. */
writel(INTERNAL_MEM_RX_OFFSET, &regs->rxq_end_addr); writel(INTERNAL_MEM_RX_OFFSET, &regs->rxq_end_addr);
writel(INTERNAL_MEM_RX_OFFSET + 1, &regs->txq_start_addr); writel(INTERNAL_MEM_RX_OFFSET + 1, &regs->txq_start_addr);
...@@ -368,59 +368,59 @@ void et131x_configure_global_regs(struct et131x_adapter *etdev) ...@@ -368,59 +368,59 @@ void et131x_configure_global_regs(struct et131x_adapter *etdev)
/** /**
* et131x_adapter_setup - Set the adapter up as per cassini+ documentation * et131x_adapter_setup - Set the adapter up as per cassini+ documentation
* @etdev: pointer to our private adapter structure * @adapter: pointer to our private adapter structure
* *
* Returns 0 on success, errno on failure (as defined in errno.h) * Returns 0 on success, errno on failure (as defined in errno.h)
*/ */
int et131x_adapter_setup(struct et131x_adapter *etdev) int et131x_adapter_setup(struct et131x_adapter *adapter)
{ {
int status = 0; int status = 0;
/* Configure the JAGCore */ /* Configure the JAGCore */
et131x_configure_global_regs(etdev); et131x_configure_global_regs(adapter);
et1310_config_mac_regs1(etdev); et1310_config_mac_regs1(adapter);
/* Configure the MMC registers */ /* Configure the MMC registers */
/* All we need to do is initialize the Memory Control Register */ /* All we need to do is initialize the Memory Control Register */
writel(ET_MMC_ENABLE, &etdev->regs->mmc.mmc_ctrl); writel(ET_MMC_ENABLE, &adapter->regs->mmc.mmc_ctrl);
et1310_config_rxmac_regs(etdev); et1310_config_rxmac_regs(adapter);
et1310_config_txmac_regs(etdev); et1310_config_txmac_regs(adapter);
et131x_config_rx_dma_regs(etdev); et131x_config_rx_dma_regs(adapter);
et131x_config_tx_dma_regs(etdev); et131x_config_tx_dma_regs(adapter);
et1310_config_macstat_regs(etdev); et1310_config_macstat_regs(adapter);
/* Move the following code to Timer function?? */ /* Move the following code to Timer function?? */
status = et131x_xcvr_find(etdev); status = et131x_xcvr_find(adapter);
if (status != 0) if (status != 0)
dev_warn(&etdev->pdev->dev, "Could not find the xcvr\n"); dev_warn(&adapter->pdev->dev, "Could not find the xcvr\n");
/* Prepare the TRUEPHY library. */ /* Prepare the TRUEPHY library. */
et1310_phy_init(etdev); et1310_phy_init(adapter);
/* Reset the phy now so changes take place */ /* Reset the phy now so changes take place */
et1310_phy_reset(etdev); et1310_phy_reset(adapter);
/* Power down PHY */ /* Power down PHY */
et1310_phy_power_down(etdev, 1); et1310_phy_power_down(adapter, 1);
/* /*
* We need to turn off 1000 base half dulplex, the mac does not * 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 * support it. For the 10/100 part, turn off all gig advertisement
*/ */
if (etdev->pdev->device != ET131X_PCI_DEVICE_ID_FAST) if (adapter->pdev->device != ET131X_PCI_DEVICE_ID_FAST)
et1310_phy_advertise_1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL); et1310_phy_advertise_1000BaseT(adapter, TRUEPHY_ADV_DUPLEX_FULL);
else else
et1310_phy_advertise_1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); et1310_phy_advertise_1000BaseT(adapter, TRUEPHY_ADV_DUPLEX_NONE);
/* Power up PHY */ /* Power up PHY */
et1310_phy_power_down(etdev, 0); et1310_phy_power_down(adapter, 0);
et131x_setphy_normal(etdev); et131x_setphy_normal(adapter);
return status; return status;
} }
...@@ -518,7 +518,7 @@ void et131x_adapter_memory_free(struct et131x_adapter *adapter) ...@@ -518,7 +518,7 @@ void et131x_adapter_memory_free(struct et131x_adapter *adapter)
/** /**
* et131x_adapter_init * et131x_adapter_init
* @etdev: pointer to the private adapter struct * @adapter: pointer to the private adapter struct
* @pdev: pointer to the PCI device * @pdev: pointer to the PCI device
* *
* Initialize the data structures for the et131x_adapter object and link * Initialize the data structures for the et131x_adapter object and link
...@@ -531,41 +531,41 @@ static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev, ...@@ -531,41 +531,41 @@ static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev,
static const u8 duplex[] = { 0, 1, 2, 1, 2, 2 }; static const u8 duplex[] = { 0, 1, 2, 1, 2, 2 };
static const u16 speed[] = { 0, 10, 10, 100, 100, 1000 }; static const u16 speed[] = { 0, 10, 10, 100, 100, 1000 };
struct et131x_adapter *etdev; struct et131x_adapter *adapter;
/* Setup the fundamental net_device and private adapter structure /* Setup the fundamental net_device and private adapter structure
* elements */ * elements */
SET_NETDEV_DEV(netdev, &pdev->dev); SET_NETDEV_DEV(netdev, &pdev->dev);
/* Allocate private adapter struct and copy in relevant information */ /* Allocate private adapter struct and copy in relevant information */
etdev = netdev_priv(netdev); adapter = netdev_priv(netdev);
etdev->pdev = pci_dev_get(pdev); adapter->pdev = pci_dev_get(pdev);
etdev->netdev = netdev; adapter->netdev = netdev;
/* Do the same for the netdev struct */ /* Do the same for the netdev struct */
netdev->irq = pdev->irq; netdev->irq = pdev->irq;
netdev->base_addr = pci_resource_start(pdev, 0); netdev->base_addr = pci_resource_start(pdev, 0);
/* Initialize spinlocks here */ /* Initialize spinlocks here */
spin_lock_init(&etdev->lock); spin_lock_init(&adapter->lock);
spin_lock_init(&etdev->tcb_send_qlock); spin_lock_init(&adapter->tcb_send_qlock);
spin_lock_init(&etdev->tcb_ready_qlock); spin_lock_init(&adapter->tcb_ready_qlock);
spin_lock_init(&etdev->send_hw_lock); spin_lock_init(&adapter->send_hw_lock);
spin_lock_init(&etdev->rcv_lock); spin_lock_init(&adapter->rcv_lock);
spin_lock_init(&etdev->rcv_pend_lock); spin_lock_init(&adapter->rcv_pend_lock);
spin_lock_init(&etdev->fbr_lock); spin_lock_init(&adapter->fbr_lock);
spin_lock_init(&etdev->phy_lock); spin_lock_init(&adapter->phy_lock);
/* Parse configuration parameters into the private adapter struct */ /* Parse configuration parameters into the private adapter struct */
if (et131x_speed_set) if (et131x_speed_set)
dev_info(&etdev->pdev->dev, dev_info(&adapter->pdev->dev,
"Speed set manually to : %d\n", et131x_speed_set); "Speed set manually to : %d\n", et131x_speed_set);
etdev->speed_duplex = et131x_speed_set; adapter->speed_duplex = et131x_speed_set;
etdev->registry_jumbo_packet = 1514; /* 1514-9216 */ adapter->registry_jumbo_packet = 1514; /* 1514-9216 */
/* Set the MAC address to a default */ /* Set the MAC address to a default */
memcpy(etdev->addr, default_mac, ETH_ALEN); memcpy(adapter->addr, default_mac, ETH_ALEN);
/* Decode speed_duplex /* Decode speed_duplex
* *
...@@ -575,14 +575,14 @@ static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev, ...@@ -575,14 +575,14 @@ static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev,
* 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. * knock it down to 100 full.
*/ */
if (etdev->pdev->device == ET131X_PCI_DEVICE_ID_FAST && if (adapter->pdev->device == ET131X_PCI_DEVICE_ID_FAST &&
etdev->speed_duplex == 5) adapter->speed_duplex == 5)
etdev->speed_duplex = 4; adapter->speed_duplex = 4;
etdev->ai_force_speed = speed[etdev->speed_duplex]; adapter->ai_force_speed = speed[adapter->speed_duplex];
etdev->ai_force_duplex = duplex[etdev->speed_duplex]; /* Auto FDX */ adapter->ai_force_duplex = duplex[adapter->speed_duplex]; /* Auto FDX */
return etdev; return adapter;
} }
/** /**
......
...@@ -242,10 +242,10 @@ irqreturn_t et131x_isr(int irq, void *dev_id) ...@@ -242,10 +242,10 @@ irqreturn_t et131x_isr(int irq, void *dev_id)
*/ */
void et131x_isr_handler(struct work_struct *work) void et131x_isr_handler(struct work_struct *work)
{ {
struct et131x_adapter *etdev = struct et131x_adapter *adapter =
container_of(work, struct et131x_adapter, task); container_of(work, struct et131x_adapter, task);
u32 status = etdev->stats.interrupt_status; u32 status = adapter->stats.interrupt_status;
struct address_map __iomem *iomem = etdev->regs; struct address_map __iomem *iomem = adapter->regs;
/* /*
* These first two are by far the most common. Once handled, we clear * These first two are by far the most common. Once handled, we clear
...@@ -254,11 +254,11 @@ void et131x_isr_handler(struct work_struct *work) ...@@ -254,11 +254,11 @@ void et131x_isr_handler(struct work_struct *work)
*/ */
/* Handle all the completed Transmit interrupts */ /* Handle all the completed Transmit interrupts */
if (status & ET_INTR_TXDMA_ISR) if (status & ET_INTR_TXDMA_ISR)
et131x_handle_send_interrupt(etdev); et131x_handle_send_interrupt(adapter);
/* Handle all the completed Receives interrupts */ /* Handle all the completed Receives interrupts */
if (status & ET_INTR_RXDMA_XFR_DONE) if (status & ET_INTR_RXDMA_XFR_DONE)
et131x_handle_recv_interrupt(etdev); et131x_handle_recv_interrupt(adapter);
status &= 0xffffffd7; status &= 0xffffffd7;
...@@ -270,7 +270,7 @@ void et131x_isr_handler(struct work_struct *work) ...@@ -270,7 +270,7 @@ void et131x_isr_handler(struct work_struct *work)
/* Following read also clears the register (COR) */ /* Following read also clears the register (COR) */
txdma_err = readl(&iomem->txdma.tx_dma_error); txdma_err = readl(&iomem->txdma.tx_dma_error);
dev_warn(&etdev->pdev->dev, dev_warn(&adapter->pdev->dev,
"TXDMA_ERR interrupt, error = %d\n", "TXDMA_ERR interrupt, error = %d\n",
txdma_err); txdma_err);
} }
...@@ -295,8 +295,8 @@ void et131x_isr_handler(struct work_struct *work) ...@@ -295,8 +295,8 @@ void et131x_isr_handler(struct work_struct *work)
/* If the user has flow control on, then we will /* If the user has flow control on, then we will
* send a pause packet, otherwise just exit * send a pause packet, otherwise just exit
*/ */
if (etdev->flowcontrol == FLOW_TXONLY || if (adapter->flowcontrol == FLOW_TXONLY ||
etdev->flowcontrol == FLOW_BOTH) { adapter->flowcontrol == FLOW_BOTH) {
u32 pm_csr; u32 pm_csr;
/* Tell the device to send a pause packet via /* Tell the device to send a pause packet via
...@@ -345,7 +345,7 @@ void et131x_isr_handler(struct work_struct *work) ...@@ -345,7 +345,7 @@ void et131x_isr_handler(struct work_struct *work)
*/ */
/* TRAP();*/ /* TRAP();*/
dev_warn(&etdev->pdev->dev, dev_warn(&adapter->pdev->dev,
"RxDMA_ERR interrupt, error %x\n", "RxDMA_ERR interrupt, error %x\n",
readl(&iomem->txmac.tx_test)); readl(&iomem->txmac.tx_test));
} }
...@@ -359,7 +359,7 @@ void et131x_isr_handler(struct work_struct *work) ...@@ -359,7 +359,7 @@ void et131x_isr_handler(struct work_struct *work)
* message when we are in DBG mode, otherwise we * message when we are in DBG mode, otherwise we
* will ignore it. * will ignore it.
*/ */
dev_err(&etdev->pdev->dev, "WAKE_ON_LAN interrupt\n"); dev_err(&adapter->pdev->dev, "WAKE_ON_LAN interrupt\n");
} }
/* Handle the PHY interrupt */ /* Handle the PHY interrupt */
...@@ -379,26 +379,26 @@ void et131x_isr_handler(struct work_struct *work) ...@@ -379,26 +379,26 @@ void et131x_isr_handler(struct work_struct *work)
* so, disable it because we will not be able * so, disable it because we will not be able
* to read PHY values until we are out. * to read PHY values until we are out.
*/ */
et1310_disable_phy_coma(etdev); et1310_disable_phy_coma(adapter);
} }
/* Read the PHY ISR to clear the reason for the /* Read the PHY ISR to clear the reason for the
* interrupt. * interrupt.
*/ */
et131x_mii_read(etdev, et131x_mii_read(adapter,
(uint8_t) offsetof(struct mi_regs, isr), (uint8_t) offsetof(struct mi_regs, isr),
&myisr); &myisr);
if (!etdev->replica_phy_loopbk) { if (!adapter->replica_phy_loopbk) {
et131x_mii_read(etdev, et131x_mii_read(adapter,
(uint8_t) offsetof(struct mi_regs, bmsr), (uint8_t) offsetof(struct mi_regs, bmsr),
&bmsr_data); &bmsr_data);
bmsr_ints = etdev->bmsr ^ bmsr_data; bmsr_ints = adapter->bmsr ^ bmsr_data;
etdev->bmsr = bmsr_data; adapter->bmsr = bmsr_data;
/* Do all the cable in / cable out stuff */ /* Do all the cable in / cable out stuff */
et131x_mii_check(etdev, bmsr_data, bmsr_ints); et131x_mii_check(adapter, bmsr_data, bmsr_ints);
} }
} }
...@@ -416,7 +416,7 @@ void et131x_isr_handler(struct work_struct *work) ...@@ -416,7 +416,7 @@ void et131x_isr_handler(struct work_struct *work)
* a nutshell, the whole Tx path will have to be reset * a nutshell, the whole Tx path will have to be reset
* and re-configured afterwards. * and re-configured afterwards.
*/ */
dev_warn(&etdev->pdev->dev, dev_warn(&adapter->pdev->dev,
"TXMAC interrupt, error 0x%08x\n", "TXMAC interrupt, error 0x%08x\n",
err); err);
...@@ -434,14 +434,14 @@ void et131x_isr_handler(struct work_struct *work) ...@@ -434,14 +434,14 @@ void et131x_isr_handler(struct work_struct *work)
* set the flag to cause us to reset so we can solve * set the flag to cause us to reset so we can solve
* this issue. * this issue.
*/ */
/* MP_SET_FLAG( etdev, /* MP_SET_FLAG( adapter,
fMP_ADAPTER_HARDWARE_ERROR); */ fMP_ADAPTER_HARDWARE_ERROR); */
dev_warn(&etdev->pdev->dev, dev_warn(&adapter->pdev->dev,
"RXMAC interrupt, error 0x%08x. Requesting reset\n", "RXMAC interrupt, error 0x%08x. Requesting reset\n",
readl(&iomem->rxmac.err_reg)); readl(&iomem->rxmac.err_reg));
dev_warn(&etdev->pdev->dev, dev_warn(&adapter->pdev->dev,
"Enable 0x%08x, Diag 0x%08x\n", "Enable 0x%08x, Diag 0x%08x\n",
readl(&iomem->rxmac.ctrl), readl(&iomem->rxmac.ctrl),
readl(&iomem->rxmac.rxq_diag)); readl(&iomem->rxmac.rxq_diag));
...@@ -461,7 +461,7 @@ void et131x_isr_handler(struct work_struct *work) ...@@ -461,7 +461,7 @@ void et131x_isr_handler(struct work_struct *work)
* to maintain the top, software managed bits of the * to maintain the top, software managed bits of the
* counter(s). * counter(s).
*/ */
et1310_handle_macstat_interrupt(etdev); et1310_handle_macstat_interrupt(adapter);
} }
/* Handle SLV Timeout Interrupt */ /* Handle SLV Timeout Interrupt */
...@@ -477,5 +477,5 @@ void et131x_isr_handler(struct work_struct *work) ...@@ -477,5 +477,5 @@ void et131x_isr_handler(struct work_struct *work)
*/ */
} }
} }
et131x_enable_interrupts(etdev); et131x_enable_interrupts(adapter);
} }
...@@ -212,19 +212,19 @@ int et131x_close(struct net_device *netdev) ...@@ -212,19 +212,19 @@ int et131x_close(struct net_device *netdev)
int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd) int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
{ {
int status = 0; int status = 0;
struct et131x_adapter *etdev = netdev_priv(netdev); struct et131x_adapter *adapter = netdev_priv(netdev);
struct mii_ioctl_data *data = if_mii(reqbuf); struct mii_ioctl_data *data = if_mii(reqbuf);
switch (cmd) { switch (cmd) {
case SIOCGMIIPHY: case SIOCGMIIPHY:
data->phy_id = etdev->stats.xcvr_addr; data->phy_id = adapter->stats.xcvr_addr;
break; break;
case SIOCGMIIREG: case SIOCGMIIREG:
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
status = -EPERM; status = -EPERM;
else else
status = et131x_mii_read(etdev, status = et131x_mii_read(adapter,
data->reg_num, &data->val_out); data->reg_num, &data->val_out);
break; break;
...@@ -232,7 +232,7 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd) ...@@ -232,7 +232,7 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
status = -EPERM; status = -EPERM;
else else
status = et131x_mii_write(etdev, data->reg_num, status = et131x_mii_write(adapter, data->reg_num,
data->val_in); data->val_in);
break; break;
...@@ -445,35 +445,35 @@ int et131x_tx(struct sk_buff *skb, struct net_device *netdev) ...@@ -445,35 +445,35 @@ int et131x_tx(struct sk_buff *skb, struct net_device *netdev)
*/ */
void et131x_tx_timeout(struct net_device *netdev) void et131x_tx_timeout(struct net_device *netdev)
{ {
struct et131x_adapter *etdev = netdev_priv(netdev); struct et131x_adapter *adapter = netdev_priv(netdev);
struct tcb *tcb; struct tcb *tcb;
unsigned long flags; unsigned long flags;
/* Any nonrecoverable hardware error? /* Any nonrecoverable hardware error?
* Checks adapter->flags for any failure in phy reading * Checks adapter->flags for any failure in phy reading
*/ */
if (etdev->flags & fMP_ADAPTER_NON_RECOVER_ERROR) if (adapter->flags & fMP_ADAPTER_NON_RECOVER_ERROR)
return; return;
/* Hardware failure? */ /* Hardware failure? */
if (etdev->flags & fMP_ADAPTER_HARDWARE_ERROR) { if (adapter->flags & fMP_ADAPTER_HARDWARE_ERROR) {
dev_err(&etdev->pdev->dev, "hardware error - reset\n"); dev_err(&adapter->pdev->dev, "hardware error - reset\n");
return; return;
} }
/* Is send stuck? */ /* Is send stuck? */
spin_lock_irqsave(&etdev->tcb_send_qlock, flags); spin_lock_irqsave(&adapter->tcb_send_qlock, flags);
tcb = etdev->tx_ring.send_head; tcb = adapter->tx_ring.send_head;
if (tcb != NULL) { if (tcb != NULL) {
tcb->count++; tcb->count++;
if (tcb->count > NIC_SEND_HANG_THRESHOLD) { if (tcb->count > NIC_SEND_HANG_THRESHOLD) {
spin_unlock_irqrestore(&etdev->tcb_send_qlock, spin_unlock_irqrestore(&adapter->tcb_send_qlock,
flags); flags);
dev_warn(&etdev->pdev->dev, dev_warn(&adapter->pdev->dev,
"Send stuck - reset. tcb->WrIndex %x, flags 0x%08x\n", "Send stuck - reset. tcb->WrIndex %x, flags 0x%08x\n",
tcb->index, tcb->index,
tcb->flags); tcb->flags);
...@@ -485,7 +485,7 @@ void et131x_tx_timeout(struct net_device *netdev) ...@@ -485,7 +485,7 @@ void et131x_tx_timeout(struct net_device *netdev)
} }
} }
spin_unlock_irqrestore(&etdev->tcb_send_qlock, flags); spin_unlock_irqrestore(&adapter->tcb_send_qlock, flags);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment