]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
tg3: Fix NVRAM page writes on newer devices
authorMatt Carlson <mcarlson@broadcom.com>
Mon, 13 Feb 2012 15:20:11 +0000 (15:20 +0000)
committerJoe Jin <joe.jin@oracle.com>
Tue, 28 Aug 2012 07:21:33 +0000 (15:21 +0800)
On newer devices, the hardware expects the NVRAM address register
to be written only once per NVRAM page.  To do otherwise causes NVRAM
corruption.  This patch fixes the problem.

(cherry picked from commit 422782249927e887a4c032d1d7e1f59de281ecbb)
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
drivers/net/tg3.c

index 5236c87a944aa9af6727bd4f1b2081d88e543dd7..f373d12972c8ccc986d12b624f0108718cca6cb8 100644 (file)
@@ -3144,8 +3144,6 @@ static int tg3_nvram_write_block_buffered(struct tg3 *tp, u32 offset, u32 len,
 
                phy_addr = tg3_nvram_phys_addr(tp, offset);
 
-               tw32(NVRAM_ADDR, phy_addr);
-
                nvram_cmd = NVRAM_CMD_GO | NVRAM_CMD_DONE | NVRAM_CMD_WR;
 
                if (page_off == 0 || i == 0)
@@ -3156,6 +3154,11 @@ static int tg3_nvram_write_block_buffered(struct tg3 *tp, u32 offset, u32 len,
                if (i == (len - 4))
                        nvram_cmd |= NVRAM_CMD_LAST;
 
+               if ((nvram_cmd & NVRAM_CMD_FIRST) ||
+                   !tg3_flag(tp, FLASH) ||
+                   !tg3_flag(tp, 57765_PLUS))
+                       tw32(NVRAM_ADDR, phy_addr);
+
                if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5752 &&
                    !tg3_flag(tp, 5755_PLUS) &&
                    (tp->nvram_jedecnum == JEDEC_ST) &&