Commit 9fa81099 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

Staging: et131x: de-hungarianise a bit

bOverrideAddress is write only so kill it rather than fix it
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8c5f20f3
...@@ -137,34 +137,34 @@ ...@@ -137,34 +137,34 @@
* Define macros that allow individual register values to be extracted from a * Define macros that allow individual register values to be extracted from a
* DWORD1 register grouping * DWORD1 register grouping
*/ */
#define EXTRACT_DATA_REGISTER(x) (uint8_t)(x & 0xFF) #define EXTRACT_DATA_REGISTER(x) (u8)(x & 0xFF)
#define EXTRACT_STATUS_REGISTER(x) (uint8_t)((x >> 16) & 0xFF) #define EXTRACT_STATUS_REGISTER(x) (u8)((x >> 16) & 0xFF)
#define EXTRACT_CONTROL_REG(x) (uint8_t)((x >> 8) & 0xFF) #define EXTRACT_CONTROL_REG(x) (u8)((x >> 8) & 0xFF)
/** /**
* EepromWriteByte - Write a byte to the ET1310's EEPROM * EepromWriteByte - Write a byte to the ET1310's EEPROM
* @etdev: pointer to our private adapter structure * @etdev: pointer to our private adapter structure
* @unAddress: the address to write * @addr: the address to write
* @bData: the value to write * @data: the value to write
* @unEepronId: the ID of the EEPROM * @eeprom_id: the ID of the EEPROM
* @unAddressingMode: how the EEPROM is to be accessed * @addrmode: how the EEPROM is to be accessed
* *
* Returns SUCCESS or FAILURE * Returns SUCCESS or FAILURE
*/ */
int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress, int EepromWriteByte(struct et131x_adapter *etdev, u32 addr,
uint8_t bData, uint32_t unEepromId, u8 data, u32 eeprom_id,
uint32_t unAddressingMode) u32 addrmode)
{ {
struct pci_dev *pdev = etdev->pdev; struct pci_dev *pdev = etdev->pdev;
int32_t nIndex; int index;
int32_t nRetries; int retries;
int32_t nError = false; int err = 0;
int32_t nI2CWriteActive = 0; int i2c_wack = 0;
int32_t nWriteSuccessful = 0; int writeok = 0;
uint8_t bControl; u8 control;
uint8_t bStatus = 0; u8 status = 0;
uint32_t unDword1 = 0; u32 dword1 = 0;
uint32_t unData = 0; u32 val = 0;
/* /*
* The following excerpt is from "Serial EEPROM HW Design * The following excerpt is from "Serial EEPROM HW Design
...@@ -215,89 +215,89 @@ int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress, ...@@ -215,89 +215,89 @@ int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress,
*/ */
/* Step 1: */ /* 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 */ /* Read registers grouped in DWORD1 */
if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET, if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET,
&unDword1)) { &dword1)) {
nError = 1; err = 1;
break; break;
} }
bStatus = EXTRACT_STATUS_REGISTER(unDword1); status = EXTRACT_STATUS_REGISTER(dword1);
if (bStatus & LBCIF_STATUS_PHY_QUEUE_AVAIL && if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL &&
bStatus & LBCIF_STATUS_I2C_IDLE) status & LBCIF_STATUS_I2C_IDLE)
/* bits 1:0 are equal to 1 */ /* bits 1:0 are equal to 1 */
break; break;
} }
if (nError || (nIndex >= MAX_NUM_REGISTER_POLLS)) if (err || (index >= MAX_NUM_REGISTER_POLLS))
return FAILURE; return FAILURE;
/* Step 2: */ /* Step 2: */
bControl = 0; control = 0;
bControl |= LBCIF_CONTROL_LBCIF_ENABLE | LBCIF_CONTROL_I2C_WRITE; control |= LBCIF_CONTROL_LBCIF_ENABLE | LBCIF_CONTROL_I2C_WRITE;
if (unAddressingMode == DUAL_BYTE) if (addrmode == DUAL_BYTE)
bControl |= LBCIF_CONTROL_TWO_BYTE_ADDR; control |= LBCIF_CONTROL_TWO_BYTE_ADDR;
if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET,
bControl)) { control)) {
return FAILURE; return FAILURE;
} }
nI2CWriteActive = 1; i2c_wack = 1;
/* Prepare EEPROM address for Step 3 */ /* Prepare EEPROM address for Step 3 */
unAddress |= (unAddressingMode == DUAL_BYTE) ? addr |= (addrmode == DUAL_BYTE) ?
(unEepromId << 16) : (unEepromId << 8); (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:*/ /* Step 3:*/
if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET, if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET,
unAddress)) { addr)) {
break; break;
} }
/* Step 4: */ /* Step 4: */
if (pci_write_config_byte(pdev, LBCIF_DATA_REGISTER_OFFSET, if (pci_write_config_byte(pdev, LBCIF_DATA_REGISTER_OFFSET,
bData)) { data)) {
break; break;
} }
/* Step 5: */ /* 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 */ /* Read registers grouped in DWORD1 */
if (pci_read_config_dword(pdev, if (pci_read_config_dword(pdev,
LBCIF_DWORD1_GROUP_OFFSET, LBCIF_DWORD1_GROUP_OFFSET,
&unDword1)) { &dword1)) {
nError = 1; err = 1;
break; break;
} }
bStatus = EXTRACT_STATUS_REGISTER(unDword1); status = EXTRACT_STATUS_REGISTER(dword1);
if (bStatus & LBCIF_STATUS_PHY_QUEUE_AVAIL && if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL &&
bStatus & LBCIF_STATUS_I2C_IDLE) { status & LBCIF_STATUS_I2C_IDLE) {
/* I2C write complete */ /* I2C write complete */
break; break;
} }
} }
if (nError || (nIndex >= MAX_NUM_REGISTER_POLLS)) if (err || (index >= MAX_NUM_REGISTER_POLLS))
break; break;
/* /*
* Step 6: Don't break here if we are revision 1, this is * Step 6: Don't break here if we are revision 1, this is
* so we do a blind write for load bug. * 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) { && etdev->pdev->revision == 0) {
break; break;
} }
/* Step 7 */ /* Step 7 */
if (bStatus & LBCIF_STATUS_ACK_ERROR) { if (status & LBCIF_STATUS_ACK_ERROR) {
/* /*
* This could be due to an actual hardware failure * This could be due to an actual hardware failure
* or the EEPROM may still be in its internal write * or the EEPROM may still be in its internal write
...@@ -308,19 +308,19 @@ int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress, ...@@ -308,19 +308,19 @@ int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress,
continue; continue;
} }
nWriteSuccessful = 1; writeok = 1;
break; break;
} }
/* Step 8: */ /* Step 8: */
udelay(10); udelay(10);
nIndex = 0; index = 0;
while (nI2CWriteActive) { while (i2c_wack) {
bControl &= ~LBCIF_CONTROL_I2C_WRITE; control &= ~LBCIF_CONTROL_I2C_WRITE;
if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET,
bControl)) { control)) {
nWriteSuccessful = 0; writeok = 0;
} }
/* Do read until internal ACK_ERROR goes away meaning write /* Do read until internal ACK_ERROR goes away meaning write
...@@ -329,44 +329,44 @@ int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress, ...@@ -329,44 +329,44 @@ int32_t EepromWriteByte(struct et131x_adapter *etdev, uint32_t unAddress,
do { do {
pci_write_config_dword(pdev, pci_write_config_dword(pdev,
LBCIF_ADDRESS_REGISTER_OFFSET, LBCIF_ADDRESS_REGISTER_OFFSET,
unAddress); addr);
do { do {
pci_read_config_dword(pdev, pci_read_config_dword(pdev,
LBCIF_DATA_REGISTER_OFFSET, &unData); LBCIF_DATA_REGISTER_OFFSET, &val);
} while ((unData & 0x00010000) == 0); } while ((val & 0x00010000) == 0);
} while (unData & 0x00040000); } while (val & 0x00040000);
bControl = EXTRACT_CONTROL_REG(unData); control = EXTRACT_CONTROL_REG(val);
if (bControl != 0xC0 || nIndex == 10000) if (control != 0xC0 || index == 10000)
break; break;
nIndex++; index++;
} }
return nWriteSuccessful ? SUCCESS : FAILURE; return writeok ? SUCCESS : FAILURE;
} }
/** /**
* EepromReadByte - Read a byte from the ET1310's EEPROM * EepromReadByte - Read a byte from the ET1310's EEPROM
* @etdev: pointer to our private adapter structure * @etdev: pointer to our private adapter structure
* @unAddress: the address from which to read * @addr: the address from which to read
* @pbData: 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
* @unEepronId: the ID of the EEPROM * @eeprom_id: the ID of the EEPROM
* @unAddressingMode: how the EEPROM is to be accessed * @addrmode: how the EEPROM is to be accessed
* *
* Returns SUCCESS or FAILURE * Returns SUCCESS or FAILURE
*/ */
int32_t EepromReadByte(struct et131x_adapter *etdev, uint32_t unAddress, int EepromReadByte(struct et131x_adapter *etdev, u32 addr,
uint8_t *pbData, uint32_t unEepromId, u8 *pdata, u32 eeprom_id,
uint32_t unAddressingMode) u32 addrmode)
{ {
struct pci_dev *pdev = etdev->pdev; struct pci_dev *pdev = etdev->pdev;
int32_t nIndex; int index;
int32_t nError = 0; int err = 0;
uint8_t bControl; u8 control;
uint8_t bStatus = 0; u8 status = 0;
uint32_t unDword1 = 0; u32 dword1 = 0;
/* /*
* The following excerpt is from "Serial EEPROM HW Design * The following excerpt is from "Serial EEPROM HW Design
...@@ -403,70 +403,70 @@ int32_t EepromReadByte(struct et131x_adapter *etdev, uint32_t unAddress, ...@@ -403,70 +403,70 @@ int32_t EepromReadByte(struct et131x_adapter *etdev, uint32_t unAddress,
*/ */
/* Step 1: */ /* 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 */ /* Read registers grouped in DWORD1 */
if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET, if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET,
&unDword1)) { &dword1)) {
nError = 1; err = 1;
break; break;
} }
bStatus = EXTRACT_STATUS_REGISTER(unDword1); status = EXTRACT_STATUS_REGISTER(dword1);
if (bStatus & LBCIF_STATUS_PHY_QUEUE_AVAIL && if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL &&
bStatus & LBCIF_STATUS_I2C_IDLE) { status & LBCIF_STATUS_I2C_IDLE) {
/* bits 1:0 are equal to 1 */ /* bits 1:0 are equal to 1 */
break; break;
} }
} }
if (nError || (nIndex >= MAX_NUM_REGISTER_POLLS)) if (err || (index >= MAX_NUM_REGISTER_POLLS))
return FAILURE; return FAILURE;
/* Step 2: */ /* Step 2: */
bControl = 0; control = 0;
bControl |= LBCIF_CONTROL_LBCIF_ENABLE; control |= LBCIF_CONTROL_LBCIF_ENABLE;
if (unAddressingMode == DUAL_BYTE) if (addrmode == DUAL_BYTE)
bControl |= LBCIF_CONTROL_TWO_BYTE_ADDR; control |= LBCIF_CONTROL_TWO_BYTE_ADDR;
if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET,
bControl)) { control)) {
return FAILURE; return FAILURE;
} }
/* Step 3: */ /* Step 3: */
unAddress |= (unAddressingMode == DUAL_BYTE) ? addr |= (addrmode == DUAL_BYTE) ?
(unEepromId << 16) : (unEepromId << 8); (eeprom_id << 16) : (eeprom_id << 8);
if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET, if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET,
unAddress)) { addr)) {
return FAILURE; return FAILURE;
} }
/* Step 4: */ /* 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 */ /* Read registers grouped in DWORD1 */
if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET, if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET,
&unDword1)) { &dword1)) {
nError = 1; err = 1;
break; break;
} }
bStatus = EXTRACT_STATUS_REGISTER(unDword1); status = EXTRACT_STATUS_REGISTER(dword1);
if (bStatus & LBCIF_STATUS_PHY_QUEUE_AVAIL if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL
&& bStatus & LBCIF_STATUS_I2C_IDLE) { && status & LBCIF_STATUS_I2C_IDLE) {
/* I2C read complete */ /* I2C read complete */
break; break;
} }
} }
if (nError || (nIndex >= MAX_NUM_REGISTER_POLLS)) if (err || (index >= MAX_NUM_REGISTER_POLLS))
return FAILURE; return FAILURE;
/* Step 6: */ /* 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;
} }
...@@ -195,7 +195,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev) ...@@ -195,7 +195,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
cfg2.value = readl(&pMac->cfg2.value); cfg2.value = readl(&pMac->cfg2.value);
ifctrl.value = readl(&pMac->if_ctrl.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; cfg2.bits.if_mode = 0x2;
ifctrl.bits.phy_mode = 0x0; ifctrl.bits.phy_mode = 0x0;
} else { } else {
...@@ -241,8 +241,8 @@ void ConfigMACRegs2(struct et131x_adapter *etdev) ...@@ -241,8 +241,8 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
} }
/* 1 - full duplex, 0 - half-duplex */ /* 1 - full duplex, 0 - half-duplex */
cfg2.bits.full_duplex = etdev->uiDuplexMode; cfg2.bits.full_duplex = etdev->duplex_mode;
ifctrl.bits.ghd_mode = !etdev->uiDuplexMode; ifctrl.bits.ghd_mode = !etdev->duplex_mode;
writel(ifctrl.value, &pMac->if_ctrl.value); writel(ifctrl.value, &pMac->if_ctrl.value);
writel(cfg2.value, &pMac->cfg2.value); writel(cfg2.value, &pMac->cfg2.value);
...@@ -262,7 +262,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev) ...@@ -262,7 +262,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
DBG_TRACE(et131x_dbginfo, DBG_TRACE(et131x_dbginfo,
"Speed %d, Dup %d, CFG1 0x%08x, CFG2 0x%08x, if_ctrl 0x%08x\n", "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->cfg1.value), readl(&pMac->cfg2.value),
readl(&pMac->if_ctrl.value)); readl(&pMac->if_ctrl.value));
...@@ -408,7 +408,7 @@ void ConfigRxMacRegs(struct et131x_adapter *etdev) ...@@ -408,7 +408,7 @@ void ConfigRxMacRegs(struct et131x_adapter *etdev)
* bit 16: Receive frame truncated. * bit 16: Receive frame truncated.
* bit 17: Drop packet enable * bit 17: Drop packet enable
*/ */
if (etdev->uiLinkSpeed == TRUEPHY_SPEED_100MBPS) if (etdev->linkspeed == TRUEPHY_SPEED_100MBPS)
writel(0x30038, &pRxMac->mif_ctrl.value); writel(0x30038, &pRxMac->mif_ctrl.value);
else else
writel(0x30030, &pRxMac->mif_ctrl.value); writel(0x30030, &pRxMac->mif_ctrl.value);
...@@ -540,7 +540,7 @@ void ConfigMacStatRegs(struct et131x_adapter *etdev) ...@@ -540,7 +540,7 @@ void ConfigMacStatRegs(struct et131x_adapter *etdev)
void ConfigFlowControl(struct et131x_adapter *etdev) void ConfigFlowControl(struct et131x_adapter *etdev)
{ {
if (etdev->uiDuplexMode == 0) { if (etdev->duplex_mode == 0) {
etdev->FlowControl = None; etdev->FlowControl = None;
} else { } else {
char RemotePause, RemoteAsyncPause; char RemotePause, RemoteAsyncPause;
......
This diff is collapsed.
...@@ -895,12 +895,12 @@ void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *adapter, ...@@ -895,12 +895,12 @@ void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *adapter,
void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *adapter, void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *adapter,
u16 duplex); u16 duplex);
void ET1310_PhyLinkStatus(struct et131x_adapter *adapter, void ET1310_PhyLinkStatus(struct et131x_adapter *adapter,
u8 *ucLinkStatus, u8 *Link_status,
u32 *uiAutoNeg, u32 *autoneg,
u32 *uiLinkSpeed, u32 *linkspeed,
u32 *uiDuplexMode, u32 *duplex_mode,
u32 *uiMdiMdix, u32 *mdi_mdix,
u32 *uiMasterSlave, u32 *uiPolarity); u32 *masterslave, u32 *polarity);
void ET1310_PhyAndOrReg(struct et131x_adapter *adapter, void ET1310_PhyAndOrReg(struct et131x_adapter *adapter,
u16 regnum, u16 andMask, u16 orMask); u16 regnum, u16 andMask, u16 orMask);
void ET1310_PhyAccessMiBit(struct et131x_adapter *adapter, void ET1310_PhyAccessMiBit(struct et131x_adapter *adapter,
......
This diff is collapsed.
This diff is collapsed.
...@@ -133,8 +133,8 @@ typedef struct _MP_RFD { ...@@ -133,8 +133,8 @@ typedef struct _MP_RFD {
struct list_head list_node; struct list_head list_node;
struct sk_buff *Packet; struct sk_buff *Packet;
u32 PacketSize; /* total size of receive frame */ u32 PacketSize; /* total size of receive frame */
u16 iBufferIndex; u16 bufferindex;
u8 iRingIndex; u8 ringindex;
} MP_RFD, *PMP_RFD; } MP_RFD, *PMP_RFD;
/* Enum for Flow Control */ /* Enum for Flow Control */
...@@ -214,8 +214,7 @@ struct et131x_adapter { ...@@ -214,8 +214,7 @@ struct et131x_adapter {
/* Configuration */ /* Configuration */
u8 PermanentAddress[ETH_ALEN]; u8 PermanentAddress[ETH_ALEN];
u8 CurrentAddress[ETH_ALEN]; u8 CurrentAddress[ETH_ALEN];
bool bOverrideAddress; bool has_eeprom;
bool bEepromPresent;
u8 eepromData[2]; u8 eepromData[2];
/* Spinlocks */ /* Spinlocks */
...@@ -234,11 +233,8 @@ struct et131x_adapter { ...@@ -234,11 +233,8 @@ struct et131x_adapter {
/* Packet Filter and look ahead size */ /* Packet Filter and look ahead size */
u32 PacketFilter; u32 PacketFilter;
u32 ulLookAhead; u32 linkspeed;
u32 uiLinkSpeed; u32 duplex_mode;
u32 uiDuplexMode;
u32 uiAutoNegStatus;
u8 ucLinkStatus;
/* multicast list */ /* multicast list */
u32 MCAddressCount; u32 MCAddressCount;
...@@ -275,11 +271,7 @@ struct et131x_adapter { ...@@ -275,11 +271,7 @@ struct et131x_adapter {
u8 DriverNoPhyAccess; u8 DriverNoPhyAccess;
/* Minimize init-time */ /* Minimize init-time */
bool bQueryPending;
bool bSetPending;
bool bResetPending;
struct timer_list ErrorTimer; struct timer_list ErrorTimer;
bool bLinkTimerActive;
MP_POWER_MGMT PoMgmt; MP_POWER_MGMT PoMgmt;
INTERRUPT_t CachedMaskValue; INTERRUPT_t CachedMaskValue;
......
...@@ -330,14 +330,14 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) ...@@ -330,14 +330,14 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev)
return -EIO; return -EIO;
} else if (rev == 0x01) { } else if (rev == 0x01) {
int32_t nLoop; 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 /* Re-write the first 4 bytes if we have an eeprom
* present and the revision id is 1, this fixes the * present and the revision id is 1, this fixes the
* corruption seen with 1310 B Silicon * corruption seen with 1310 B Silicon
*/ */
for (nLoop = 0; nLoop < 3; nLoop++) { for (nLoop = 0; nLoop < 3; nLoop++) {
EepromWriteByte(adapter, nLoop, ucTemp[nLoop], EepromWriteByte(adapter, nLoop, temp[nLoop],
0, SINGLE_BYTE); 0, SINGLE_BYTE);
} }
} }
...@@ -351,14 +351,14 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) ...@@ -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 * information that normally would come from the eeprom, like
* MAC Address * MAC Address
*/ */
adapter->bEepromPresent = false; adapter->has_eeprom = 0;
DBG_LEAVE(et131x_dbginfo); DBG_LEAVE(et131x_dbginfo);
return -EIO; return -EIO;
} else { } else {
DBG_TRACE(et131x_dbginfo, "EEPROM Status Code - 0x%04x\n", DBG_TRACE(et131x_dbginfo, "EEPROM Status Code - 0x%04x\n",
eepromStat); eepromStat);
adapter->bEepromPresent = true; adapter->has_eeprom = 1;
} }
/* Read the EEPROM for information regarding LED behavior. Refer to /* 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) ...@@ -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 /* Get MAC address from config space if an eeprom exists, otherwise
* the MAC address there will not be valid * the MAC address there will not be valid
*/ */
if (adapter->bEepromPresent) { if (adapter->has_eeprom) {
int i; int i;
for (i = 0; i < ETH_ALEN; i++) { for (i = 0; i < ETH_ALEN; i++) {
...@@ -520,9 +520,6 @@ void et131x_link_detection_handler(unsigned long data) ...@@ -520,9 +520,6 @@ void et131x_link_detection_handler(unsigned long data)
struct et131x_adapter *etdev = (struct et131x_adapter *) data; struct et131x_adapter *etdev = (struct et131x_adapter *) data;
unsigned long flags; unsigned long flags;
/* Let everyone know that we have run */
etdev->bLinkTimerActive = false;
if (etdev->MediaState == 0) { if (etdev->MediaState == 0) {
spin_lock_irqsave(&etdev->Lock, flags); spin_lock_irqsave(&etdev->Lock, flags);
...@@ -532,8 +529,6 @@ void et131x_link_detection_handler(unsigned long data) ...@@ -532,8 +529,6 @@ void et131x_link_detection_handler(unsigned long data)
spin_unlock_irqrestore(&etdev->Lock, flags); spin_unlock_irqrestore(&etdev->Lock, flags);
netif_carrier_off(etdev->netdev); netif_carrier_off(etdev->netdev);
etdev->bSetPending = false;
} }
} }
...@@ -608,35 +603,32 @@ void et131x_setup_hardware_properties(struct et131x_adapter *adapter) ...@@ -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 * EEPROM then we need to generate the last octet and set it on the
* device * device
*/ */
if (!adapter->bOverrideAddress) { if (adapter->PermanentAddress[0] == 0x00 &&
if (adapter->PermanentAddress[0] == 0x00 && adapter->PermanentAddress[1] == 0x00 &&
adapter->PermanentAddress[1] == 0x00 && adapter->PermanentAddress[2] == 0x00 &&
adapter->PermanentAddress[2] == 0x00 && adapter->PermanentAddress[3] == 0x00 &&
adapter->PermanentAddress[3] == 0x00 && adapter->PermanentAddress[4] == 0x00 &&
adapter->PermanentAddress[4] == 0x00 && adapter->PermanentAddress[5] == 0x00) {
adapter->PermanentAddress[5] == 0x00) { /*
/* * We need to randomly generate the last octet so we
* We need to randomly generate the last octet so we * decrease our chances of setting the mac address to
* decrease our chances of setting the mac address to * same as another one of our cards in the system
* same as another one of our cards in the system */
*/ get_random_bytes(&adapter->CurrentAddress[5], 1);
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
* We have the default value in the register we are * address into the permanent address
* working with so we need to copy the current */
* address into the permanent address memcpy(adapter->PermanentAddress,
*/ adapter->CurrentAddress, ETH_ALEN);
memcpy(adapter->PermanentAddress, } else {
adapter->CurrentAddress, ETH_ALEN); /* We do not have an override address, so set the
} else { * current address to the permanent address and add
/* We do not have an override address, so set the * it to the device
* current address to the permanent address and add */
* it to the device memcpy(adapter->CurrentAddress,
*/ adapter->PermanentAddress, ETH_ALEN);
memcpy(adapter->CurrentAddress,
adapter->PermanentAddress, ETH_ALEN);
}
} }
DBG_LEAVE(et131x_dbginfo); DBG_LEAVE(et131x_dbginfo);
......
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