Skip to content

Commit

Permalink
smsc911x: enforce read-after-write timing restriction on eeprom access
Browse files Browse the repository at this point in the history
The LAN911x datasheet specifies a minimum delay of 45ns between a write
of E2P_DATA and any read.  This patch adds a single dummy read of
BYTE_TEST to enforce this timing constraint.

Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Steve Glendinning authored and David S. Miller committed Mar 27, 2009
1 parent 54dc79f commit 58add9f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/smsc911x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1680,6 +1680,7 @@ static int smsc911x_eeprom_write_location(struct smsc911x_data *pdata,
u8 address, u8 data)
{
u32 op = E2P_CMD_EPC_CMD_ERASE_ | address;
u32 temp;
int ret;

SMSC_TRACE(DRV, "address 0x%x, data 0x%x", address, data);
Expand All @@ -1688,6 +1689,10 @@ static int smsc911x_eeprom_write_location(struct smsc911x_data *pdata,
if (!ret) {
op = E2P_CMD_EPC_CMD_WRITE_ | address;
smsc911x_reg_write(pdata, E2P_DATA, (u32)data);

/* Workaround for hardware read-after-write restriction */
temp = smsc911x_reg_read(pdata, BYTE_TEST);

ret = smsc911x_eeprom_send_cmd(pdata, op);
}

Expand Down

0 comments on commit 58add9f

Please sign in to comment.