aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNithin Sujir <nsujir@broadcom.com>2013-06-12 14:08:59 -0400
committerDavid S. Miller <davem@davemloft.net>2013-06-13 05:41:51 -0400
commitdf465abfe06f7dc4f33f4a96d17f096e9e8ac917 (patch)
treea6ed8d59f635bf3337c9f4295a15fd59188294f4
parenta6f79d0f26704214b5b702bbac525cb72997f984 (diff)
tg3: Wait for boot code to finish after power on
Some systems that don't need wake-on-lan may choose to power down the chip on system standby. Upon resume, the power on causes the boot code to startup and initialize the hardware. On one new platform, this is causing the device to go into a bad state due to a race between the driver and boot code, once every several hundred resumes. The same race exists on open since we come up from a power on. This patch adds a wait for boot code signature at the beginning of tg3_init_hw() which is common to both cases. If there has not been a power-off or the boot code has already completed, the signature will be present and poll_fw() returns immediately. Also return immediately if the device does not have firmware. Cc: stable@vger.kernel.org Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 0f493c8dc28b..c777b9013164 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -1800,6 +1800,9 @@ static int tg3_poll_fw(struct tg3 *tp)
1800 int i; 1800 int i;
1801 u32 val; 1801 u32 val;
1802 1802
1803 if (tg3_flag(tp, NO_FWARE_REPORTED))
1804 return 0;
1805
1803 if (tg3_flag(tp, IS_SSB_CORE)) { 1806 if (tg3_flag(tp, IS_SSB_CORE)) {
1804 /* We don't use firmware. */ 1807 /* We don't use firmware. */
1805 return 0; 1808 return 0;
@@ -10404,6 +10407,13 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy)
10404 */ 10407 */
10405static int tg3_init_hw(struct tg3 *tp, bool reset_phy) 10408static int tg3_init_hw(struct tg3 *tp, bool reset_phy)
10406{ 10409{
10410 /* Chip may have been just powered on. If so, the boot code may still
10411 * be running initialization. Wait for it to finish to avoid races in
10412 * accessing the hardware.
10413 */
10414 tg3_enable_register_access(tp);
10415 tg3_poll_fw(tp);
10416
10407 tg3_switch_clocks(tp); 10417 tg3_switch_clocks(tp);
10408 10418
10409 tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); 10419 tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0);