aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 6a736dda3ee2..201be425643a 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -2190,7 +2190,14 @@ static int tg3_nvram_read_using_eeprom(struct tg3 *tp,
2190 if (!(tmp & EEPROM_ADDR_COMPLETE)) 2190 if (!(tmp & EEPROM_ADDR_COMPLETE))
2191 return -EBUSY; 2191 return -EBUSY;
2192 2192
2193 *val = tr32(GRC_EEPROM_DATA); 2193 tmp = tr32(GRC_EEPROM_DATA);
2194
2195 /*
2196 * The data will always be opposite the native endian
2197 * format. Perform a blind byteswap to compensate.
2198 */
2199 *val = swab32(tmp);
2200
2194 return 0; 2201 return 0;
2195} 2202}
2196 2203
@@ -10663,7 +10670,13 @@ static int tg3_nvram_write_block_using_eeprom(struct tg3 *tp,
10663 10670
10664 memcpy(&data, buf + i, 4); 10671 memcpy(&data, buf + i, 4);
10665 10672
10666 tw32(GRC_EEPROM_DATA, be32_to_cpu(data)); 10673 /*
10674 * The SEEPROM interface expects the data to always be opposite
10675 * the native endian format. We accomplish this by reversing
10676 * all the operations that would have been performed on the
10677 * data from a call to tg3_nvram_read_be32().
10678 */
10679 tw32(GRC_EEPROM_DATA, swab32(be32_to_cpu(data)));
10667 10680
10668 val = tr32(GRC_EEPROM_ADDR); 10681 val = tr32(GRC_EEPROM_ADDR);
10669 tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE); 10682 tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE);