aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/et131x/et1310_eeprom.c20
-rw-r--r--drivers/staging/et131x/et1310_eeprom.h16
-rw-r--r--drivers/staging/et131x/et131x_initpci.c7
3 files changed, 7 insertions, 36 deletions
diff --git a/drivers/staging/et131x/et1310_eeprom.c b/drivers/staging/et131x/et1310_eeprom.c
index 94538624c103..7b2e4ea2ad09 100644
--- a/drivers/staging/et131x/et1310_eeprom.c
+++ b/drivers/staging/et131x/et1310_eeprom.c
@@ -146,14 +146,10 @@
146 * @etdev: pointer to our private adapter structure 146 * @etdev: pointer to our private adapter structure
147 * @addr: the address to write 147 * @addr: the address to write
148 * @data: the value to write 148 * @data: the value to write
149 * @eeprom_id: the ID of the EEPROM
150 * @addrmode: how the EEPROM is to be accessed
151 * 149 *
152 * Returns SUCCESS or FAILURE 150 * Returns SUCCESS or FAILURE
153 */ 151 */
154int EepromWriteByte(struct et131x_adapter *etdev, u32 addr, 152int EepromWriteByte(struct et131x_adapter *etdev, u32 addr, u8 data)
155 u8 data, u32 eeprom_id,
156 u32 addrmode)
157{ 153{
158 struct pci_dev *pdev = etdev->pdev; 154 struct pci_dev *pdev = etdev->pdev;
159 int index; 155 int index;
@@ -238,9 +234,6 @@ int EepromWriteByte(struct et131x_adapter *etdev, u32 addr,
238 control = 0; 234 control = 0;
239 control |= LBCIF_CONTROL_LBCIF_ENABLE | LBCIF_CONTROL_I2C_WRITE; 235 control |= LBCIF_CONTROL_LBCIF_ENABLE | LBCIF_CONTROL_I2C_WRITE;
240 236
241 if (addrmode == DUAL_BYTE)
242 control |= LBCIF_CONTROL_TWO_BYTE_ADDR;
243
244 if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, 237 if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET,
245 control)) { 238 control)) {
246 return FAILURE; 239 return FAILURE;
@@ -249,8 +242,6 @@ int EepromWriteByte(struct et131x_adapter *etdev, u32 addr,
249 i2c_wack = 1; 242 i2c_wack = 1;
250 243
251 /* Prepare EEPROM address for Step 3 */ 244 /* Prepare EEPROM address for Step 3 */
252 addr |= (addrmode == DUAL_BYTE) ?
253 (eeprom_id << 16) : (eeprom_id << 8);
254 245
255 for (retries = 0; retries < MAX_NUM_WRITE_RETRIES; retries++) { 246 for (retries = 0; retries < MAX_NUM_WRITE_RETRIES; retries++) {
256 /* Step 3:*/ 247 /* Step 3:*/
@@ -357,9 +348,7 @@ int EepromWriteByte(struct et131x_adapter *etdev, u32 addr,
357 * 348 *
358 * Returns SUCCESS or FAILURE 349 * Returns SUCCESS or FAILURE
359 */ 350 */
360int EepromReadByte(struct et131x_adapter *etdev, u32 addr, 351int EepromReadByte(struct et131x_adapter *etdev, u32 addr, u8 *pdata)
361 u8 *pdata, u32 eeprom_id,
362 u32 addrmode)
363{ 352{
364 struct pci_dev *pdev = etdev->pdev; 353 struct pci_dev *pdev = etdev->pdev;
365 int index; 354 int index;
@@ -427,17 +416,12 @@ int EepromReadByte(struct et131x_adapter *etdev, u32 addr,
427 control = 0; 416 control = 0;
428 control |= LBCIF_CONTROL_LBCIF_ENABLE; 417 control |= LBCIF_CONTROL_LBCIF_ENABLE;
429 418
430 if (addrmode == DUAL_BYTE)
431 control |= LBCIF_CONTROL_TWO_BYTE_ADDR;
432
433 if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, 419 if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET,
434 control)) { 420 control)) {
435 return FAILURE; 421 return FAILURE;
436 } 422 }
437 423
438 /* Step 3: */ 424 /* Step 3: */
439 addr |= (addrmode == DUAL_BYTE) ?
440 (eeprom_id << 16) : (eeprom_id << 8);
441 425
442 if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET, 426 if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET,
443 addr)) { 427 addr)) {
diff --git a/drivers/staging/et131x/et1310_eeprom.h b/drivers/staging/et131x/et1310_eeprom.h
index 8033743e888e..d8ac9a0439e2 100644
--- a/drivers/staging/et131x/et1310_eeprom.h
+++ b/drivers/staging/et131x/et1310_eeprom.h
@@ -66,24 +66,12 @@
66#define FAILURE 1 66#define FAILURE 1
67#endif 67#endif
68 68
69#ifndef READ
70#define READ 0
71#define WRITE 1
72#endif
73
74#ifndef SINGLE_BYTE
75#define SINGLE_BYTE 0
76#define DUAL_BYTE 1
77#endif
78
79/* Forward declaration of the private adapter structure */ 69/* Forward declaration of the private adapter structure */
80struct et131x_adapter; 70struct et131x_adapter;
81 71
82int32_t EepromWriteByte(struct et131x_adapter *adapter, u32 unAddress, 72int32_t EepromWriteByte(struct et131x_adapter *adapter, u32 unAddress,
83 u8 bData, u32 unEepromId, 73 u8 bData);
84 u32 unAddressingMode);
85int32_t EepromReadByte(struct et131x_adapter *adapter, u32 unAddress, 74int32_t EepromReadByte(struct et131x_adapter *adapter, u32 unAddress,
86 u8 *pbData, u32 unEepromId, 75 u8 *pbData);
87 u32 unAddressingMode);
88 76
89#endif /* _ET1310_EEPROM_H_ */ 77#endif /* _ET1310_EEPROM_H_ */
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index a719e903eed9..bea9918d1686 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)
337 * corruption seen with 1310 B Silicon 337 * corruption seen with 1310 B Silicon
338 */ 338 */
339 for (nLoop = 0; nLoop < 3; nLoop++) { 339 for (nLoop = 0; nLoop < 3; nLoop++) {
340 EepromWriteByte(adapter, nLoop, temp[nLoop], 340 EepromWriteByte(adapter, nLoop, temp[nLoop]);
341 0, SINGLE_BYTE);
342 } 341 }
343 } 342 }
344 343
@@ -364,8 +363,8 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev)
364 /* Read the EEPROM for information regarding LED behavior. Refer to 363 /* Read the EEPROM for information regarding LED behavior. Refer to
365 * ET1310_phy.c, et131x_xcvr_init(), for its use. 364 * ET1310_phy.c, et131x_xcvr_init(), for its use.
366 */ 365 */
367 EepromReadByte(adapter, 0x70, &adapter->eepromData[0], 0, SINGLE_BYTE); 366 EepromReadByte(adapter, 0x70, &adapter->eepromData[0]);
368 EepromReadByte(adapter, 0x71, &adapter->eepromData[1], 0, SINGLE_BYTE); 367 EepromReadByte(adapter, 0x71, &adapter->eepromData[1]);
369 368
370 if (adapter->eepromData[0] != 0xcd) 369 if (adapter->eepromData[0] != 0xcd)
371 /* Disable all optional features */ 370 /* Disable all optional features */