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

Staging: et131x: tidy eeprom code up

Turn this one into something resembling a clean Linux driver
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 53f8aeef
This diff is collapsed.
...@@ -61,12 +61,46 @@ ...@@ -61,12 +61,46 @@
#include "et1310_address_map.h" #include "et1310_address_map.h"
/*
* EEPROM Defines
*/
/* LBCIF Register Groups (addressed via 32-bit offsets) */
#define LBCIF_DWORD0_GROUP 0xAC
#define LBCIF_DWORD1_GROUP 0xB0
/* LBCIF Registers (addressed via 8-bit offsets) */
#define LBCIF_ADDRESS_REGISTER 0xAC
#define LBCIF_DATA_REGISTER 0xB0
#define LBCIF_CONTROL_REGISTER 0xB1
#define LBCIF_STATUS_REGISTER 0xB2
/* LBCIF Control Register Bits */
#define LBCIF_CONTROL_SEQUENTIAL_READ 0x01
#define LBCIF_CONTROL_PAGE_WRITE 0x02
#define LBCIF_CONTROL_EEPROM_RELOAD 0x08
#define LBCIF_CONTROL_TWO_BYTE_ADDR 0x20
#define LBCIF_CONTROL_I2C_WRITE 0x40
#define LBCIF_CONTROL_LBCIF_ENABLE 0x80
/* LBCIF Status Register Bits */
#define LBCIF_STATUS_PHY_QUEUE_AVAIL 0x01
#define LBCIF_STATUS_I2C_IDLE 0x02
#define LBCIF_STATUS_ACK_ERROR 0x04
#define LBCIF_STATUS_GENERAL_ERROR 0x08
#define LBCIF_STATUS_CHECKSUM_ERROR 0x40
#define LBCIF_STATUS_EEPROM_PRESENT 0x80
/* Miscellaneous Constraints */
#define MAX_NUM_REGISTER_POLLS 1000
#define MAX_NUM_WRITE_RETRIES 2
/* Forward declaration of the private adapter structure */ /* Forward declaration of the private adapter structure */
struct et131x_adapter; struct et131x_adapter;
int EepromWriteByte(struct et131x_adapter *adapter, u32 unAddress, int eeprom_write(struct et131x_adapter *adapter, u32 unAddress,
u8 bData); u8 bData);
int EepromReadByte(struct et131x_adapter *adapter, u32 unAddress, int eeprom_read(struct et131x_adapter *adapter, u32 unAddress,
u8 *pbData); u8 *pbData);
#endif /* _ET1310_EEPROM_H_ */ #endif /* _ET1310_EEPROM_H_ */
...@@ -199,7 +199,7 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) ...@@ -199,7 +199,7 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev)
* 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, temp[nLoop]); eeprom_write(adapter, nLoop, temp[nLoop]);
} }
} }
...@@ -219,8 +219,8 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) ...@@ -219,8 +219,8 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev)
/* 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.
*/ */
EepromReadByte(adapter, 0x70, &adapter->eepromData[0]); eeprom_read(adapter, 0x70, &adapter->eepromData[0]);
EepromReadByte(adapter, 0x71, &adapter->eepromData[1]); eeprom_read(adapter, 0x71, &adapter->eepromData[1]);
if (adapter->eepromData[0] != 0xcd) if (adapter->eepromData[0] != 0xcd)
/* Disable all optional features */ /* Disable all optional features */
......
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