: Add missing wait in bnx2_init_5709_context().
Subsystems (2)
PATCH 2/5 : Add missing wait in bnx2_init_5709_context().
[BNX2]: Add missing wait in bnx2_init_5709_context().
For correctness, we need to wait for the MEM_INIT bit to be cleared in the BNX2_CTX_COMMAND register before proceeding.
drivers/net/bnx2.c +6 -0
@@ -1778,6 +1778,12 @@ bnx2_init_5709_context(struct bnx2 *bp) val =BNX2_CTX_COMMAND_ENABLED |BNX2_CTX_COMMAND_MEM_INIT | (1 <<12 ); val |= (BCM_PAGE_BITS -8 ) <<16 ;REG_WR (bp,BNX2_CTX_COMMAND , val); +for (i =0 ; i <10 ; i++) { + val =REG_RD (bp,BNX2_CTX_COMMAND ); +if (!(val &BNX2_CTX_COMMAND_MEM_INIT )) +break ; +udelay (2 ); + }for (i =0 ; i < bp->ctx_pages; i++) {int j;
Quoted 13 lines · Michael Chan
[BNX2]: Add missing wait in
bnx2_init_5709_context().For correctness, we need to wait for the
MEM_INITbit to be cleared in theBNX2_CTX_COMMANDregister before proceeding.Signed-off-by Michael Chan <[email protected]>drivers/net/bnx2.c +0
-0@@ -1778,6 +1778,12 @@ bnx2_init_5709_context(struct bnx2 *bp) val =BNX2_CTX_COMMAND_ENABLED |BNX2_CTX_COMMAND_MEM_INIT | (1 <<12 );
drivers/net/bnx2.c bnx2_init_5709_context(struct bnx2 *bp) · line 1788
Quoted 10 lines
drivers/net/bnx2.c +6
-0val |= (BCM_PAGE_BITS -8 ) <<16 ;REG_WR (bp,BNX2_CTX_COMMAND , val); +for (i =0 ; i <10 ; i++) { + val =REG_RD (bp,BNX2_CTX_COMMAND ); +if (!(val &BNX2_CTX_COMMAND_MEM_INIT )) +break ; +udelay (2 ); + }for (i =0 ; i < bp->ctx_pages; i++) {int j;
If the bit does not clear after 10 loops, it seems to me you should complain or somehow otherwise make note of the failure.
Jeff
[BNX2]: Add missing wait in bnx2_init_5709_context().
For correctness, we need to wait for the MEM_INIT bit to be cleared in the BNX2_CTX_COMMAND register before proceeding.
[Added return -EBUSY when the MEM_INIT bit doesn't clear, suggested by Jeff Garzik.]
drivers/net/bnx2.c +14 -3
@@ -1778,6 +1778,15 @@ bnx2_init_5709_context(struct bnx2 *bp) val =BNX2_CTX_COMMAND_ENABLED |BNX2_CTX_COMMAND_MEM_INIT | (1 <<12 ); val |= (BCM_PAGE_BITS -8 ) <<16 ;REG_WR (bp,BNX2_CTX_COMMAND , val); +for (i =0 ; i <10 ; i++) { + val =REG_RD (bp,BNX2_CTX_COMMAND ); +if (!(val &BNX2_CTX_COMMAND_MEM_INIT )) +break ; +udelay (2 ); + } +if (val &BNX2_CTX_COMMAND_MEM_INIT ) +return -EBUSY ; +for (i =0 ; i < bp->ctx_pages; i++) {int j;
@@ -3696,9 +3705,11 @@ bnx2_init_chip(struct bnx2 *bp)/* Initialize context mapping and zero out the quick contexts. The * context block must have already been enabled. */ -if (CHIP_NUM (bp) ==CHIP_NUM_5709 ) -bnx2_init_5709_context (bp); -else +if (CHIP_NUM (bp) ==CHIP_NUM_5709 ) { + rc =bnx2_init_5709_context (bp); +if (rc) +return rc; + }else bnx2_init_context (bp);if ((rc =bnx2_init_cpus (bp)) !=0 )
Quoted 9 lines · Michael Chan
[BNX2]: Add missing wait in
bnx2_init_5709_context().For correctness, we need to wait for the
MEM_INITbit to be cleared in theBNX2_CTX_COMMANDregister before proceeding.[Added return
-EBUSYwhen theMEM_INITbit doesn't clear, suggested by Jeff Garzik.]Signed-off-by Michael Chan <[email protected]>
ACK
From: Jeff Garzik <[email protected]>
Date: Mon, 4 Jun 2007 21:23:51 -0400
Quoted 6 lines · Michael Chan
Quoted 5 lines
[BNX2]: Add missing wait in
bnx2_init_5709_context().For correctness, we need to wait for the
MEM_INITbit to be cleared in theBNX2_CTX_COMMANDregister before proceeding.
Quoted 6 lines
Quoted 4 lines
[Added return
-EBUSYwhen theMEM_INITbit doesn't clear, suggested by Jeff Garzik.]Signed-off-by Michael Chan <[email protected]>ACK
Applied, thanks.