[PATCH] bcm43xx: fix unexpected LED control values in BCM4303 sprom

The bcm43xx driver uses 4 locations in the devices sprom to determine
the behavior of the leds. Certain defaults are assigned if all bits are
set in those locations. On at least one BCM4303 chip, the sprom contains
values other than the default, which executes an assertion placed in the
default case of a following switch statement. This patch makes the leds
on the above mentioned interface behave correctly. In addition, it limits
the number of logged messages to 20 for the case of unexpected values in
the sprom locations.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Larry Finger 2006-10-17 23:38:26 -05:00 committed by John W. Linville
parent 81e171b95d
commit df6d7c94b0
2 changed files with 12 additions and 1 deletions

View File

@ -189,20 +189,24 @@ void bcm43xx_leds_update(struct bcm43xx_private *bcm, int activity)
case BCM43xx_LED_INACTIVE: case BCM43xx_LED_INACTIVE:
continue; continue;
case BCM43xx_LED_OFF: case BCM43xx_LED_OFF:
case BCM43xx_LED_BCM4303_3:
break; break;
case BCM43xx_LED_ON: case BCM43xx_LED_ON:
turn_on = 1; turn_on = 1;
break; break;
case BCM43xx_LED_ACTIVITY: case BCM43xx_LED_ACTIVITY:
case BCM43xx_LED_BCM4303_0:
turn_on = activity; turn_on = activity;
break; break;
case BCM43xx_LED_RADIO_ALL: case BCM43xx_LED_RADIO_ALL:
turn_on = radio->enabled; turn_on = radio->enabled;
break; break;
case BCM43xx_LED_RADIO_A: case BCM43xx_LED_RADIO_A:
case BCM43xx_LED_BCM4303_2:
turn_on = (radio->enabled && phy->type == BCM43xx_PHYTYPE_A); turn_on = (radio->enabled && phy->type == BCM43xx_PHYTYPE_A);
break; break;
case BCM43xx_LED_RADIO_B: case BCM43xx_LED_RADIO_B:
case BCM43xx_LED_BCM4303_1:
turn_on = (radio->enabled && turn_on = (radio->enabled &&
(phy->type == BCM43xx_PHYTYPE_B || (phy->type == BCM43xx_PHYTYPE_B ||
phy->type == BCM43xx_PHYTYPE_G)); phy->type == BCM43xx_PHYTYPE_G));
@ -257,7 +261,8 @@ void bcm43xx_leds_update(struct bcm43xx_private *bcm, int activity)
continue; continue;
#endif /* CONFIG_BCM43XX_DEBUG */ #endif /* CONFIG_BCM43XX_DEBUG */
default: default:
assert(0); dprintkl(KERN_INFO PFX "Bad value in leds_update,"
" led->behaviour: 0x%x\n", led->behaviour);
}; };
if (led->activelow) if (led->activelow)

View File

@ -46,6 +46,12 @@ enum { /* LED behaviour values */
BCM43xx_LED_TEST_BLINKSLOW, BCM43xx_LED_TEST_BLINKSLOW,
BCM43xx_LED_TEST_BLINKMEDIUM, BCM43xx_LED_TEST_BLINKMEDIUM,
BCM43xx_LED_TEST_BLINKFAST, BCM43xx_LED_TEST_BLINKFAST,
/* Misc values for BCM4303 */
BCM43xx_LED_BCM4303_0 = 0x2B,
BCM43xx_LED_BCM4303_1 = 0x78,
BCM43xx_LED_BCM4303_2 = 0x2E,
BCM43xx_LED_BCM4303_3 = 0x19,
}; };
int bcm43xx_leds_init(struct bcm43xx_private *bcm); int bcm43xx_leds_init(struct bcm43xx_private *bcm);