diff options
author | Michael Buesch <mbuesch@freenet.de> | 2006-03-18 15:28:46 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-03-27 11:19:40 -0500 |
commit | 714eece7c7c300bbc5e8285890e7374958ca37f4 (patch) | |
tree | 7a589f5aa916eb5463dbc5d420ee9c161456695e /drivers/net/wireless/bcm43xx/bcm43xx_main.c | |
parent | 4a1821e4c7a84569f788b7667affe2743317b63f (diff) |
[PATCH] bcm43xx: fix some gpio register trashing (hopefully :D)
Signed-off-by: Michael Buesch <mbuesch@freenet.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/bcm43xx/bcm43xx_main.c')
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_main.c | 71 |
1 files changed, 33 insertions, 38 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index 6a877df2ecf0..eb8fca8279f4 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
@@ -2182,13 +2182,10 @@ static int switch_to_gpio_core(struct bcm43xx_private *bcm) | |||
2182 | if (unlikely(err == -ENODEV)) { | 2182 | if (unlikely(err == -ENODEV)) { |
2183 | printk(KERN_ERR PFX "gpio error: " | 2183 | printk(KERN_ERR PFX "gpio error: " |
2184 | "Neither ChipCommon nor PCI core available!\n"); | 2184 | "Neither ChipCommon nor PCI core available!\n"); |
2185 | return -ENODEV; | 2185 | } |
2186 | } else if (unlikely(err != 0)) | 2186 | } |
2187 | return -ENODEV; | ||
2188 | } else if (unlikely(err != 0)) | ||
2189 | return -ENODEV; | ||
2190 | 2187 | ||
2191 | return 0; | 2188 | return err; |
2192 | } | 2189 | } |
2193 | 2190 | ||
2194 | /* Initialize the GPIOs | 2191 | /* Initialize the GPIOs |
@@ -2198,45 +2195,48 @@ static int bcm43xx_gpio_init(struct bcm43xx_private *bcm) | |||
2198 | { | 2195 | { |
2199 | struct bcm43xx_coreinfo *old_core; | 2196 | struct bcm43xx_coreinfo *old_core; |
2200 | int err; | 2197 | int err; |
2201 | u32 mask, value; | 2198 | u32 mask, set; |
2202 | 2199 | ||
2203 | value = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD); | 2200 | bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, |
2204 | value &= ~0xc000; | 2201 | bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD) |
2205 | bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, value); | 2202 | & 0xFFFF3FFF); |
2206 | 2203 | ||
2207 | mask = 0x0000001F; | 2204 | bcm43xx_leds_switch_all(bcm, 0); |
2208 | value = 0x0000000F; | ||
2209 | bcm43xx_write16(bcm, BCM43xx_MMIO_GPIO_CONTROL, | ||
2210 | bcm43xx_read16(bcm, BCM43xx_MMIO_GPIO_CONTROL) & 0xFFF0); | ||
2211 | bcm43xx_write16(bcm, BCM43xx_MMIO_GPIO_MASK, | 2205 | bcm43xx_write16(bcm, BCM43xx_MMIO_GPIO_MASK, |
2212 | bcm43xx_read16(bcm, BCM43xx_MMIO_GPIO_MASK) | 0x000F); | 2206 | bcm43xx_read16(bcm, BCM43xx_MMIO_GPIO_MASK) | 0x000F); |
2213 | 2207 | ||
2214 | old_core = bcm->current_core; | 2208 | mask = 0x0000001F; |
2215 | 2209 | set = 0x0000000F; | |
2216 | err = switch_to_gpio_core(bcm); | ||
2217 | if (err) | ||
2218 | return err; | ||
2219 | |||
2220 | if (bcm->current_core->rev >= 2){ | ||
2221 | mask |= 0x10; | ||
2222 | value |= 0x10; | ||
2223 | } | ||
2224 | if (bcm->chip_id == 0x4301) { | 2210 | if (bcm->chip_id == 0x4301) { |
2225 | mask |= 0x60; | 2211 | mask |= 0x0060; |
2226 | value |= 0x60; | 2212 | set |= 0x0060; |
2213 | } | ||
2214 | if (0 /* FIXME: conditional unknown */) { | ||
2215 | bcm43xx_write16(bcm, BCM43xx_MMIO_GPIO_MASK, | ||
2216 | bcm43xx_read16(bcm, BCM43xx_MMIO_GPIO_MASK) | ||
2217 | | 0x0100); | ||
2218 | mask |= 0x0180; | ||
2219 | set |= 0x0180; | ||
2227 | } | 2220 | } |
2228 | if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) { | 2221 | if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) { |
2229 | mask |= 0x200; | 2222 | bcm43xx_write16(bcm, BCM43xx_MMIO_GPIO_MASK, |
2230 | value |= 0x200; | 2223 | bcm43xx_read16(bcm, BCM43xx_MMIO_GPIO_MASK) |
2224 | | 0x0200); | ||
2225 | mask |= 0x0200; | ||
2226 | set |= 0x0200; | ||
2231 | } | 2227 | } |
2228 | if (bcm->current_core->rev >= 2) | ||
2229 | mask |= 0x0010; /* FIXME: This is redundant. */ | ||
2232 | 2230 | ||
2231 | old_core = bcm->current_core; | ||
2232 | err = switch_to_gpio_core(bcm); | ||
2233 | if (err) | ||
2234 | goto out; | ||
2233 | bcm43xx_write32(bcm, BCM43xx_GPIO_CONTROL, | 2235 | bcm43xx_write32(bcm, BCM43xx_GPIO_CONTROL, |
2234 | (bcm43xx_read32(bcm, BCM43xx_GPIO_CONTROL) & mask) | value); | 2236 | (bcm43xx_read32(bcm, BCM43xx_GPIO_CONTROL) & mask) | set); |
2235 | |||
2236 | err = bcm43xx_switch_core(bcm, old_core); | 2237 | err = bcm43xx_switch_core(bcm, old_core); |
2237 | assert(err == 0); | 2238 | out: |
2238 | 2239 | return err; | |
2239 | return 0; | ||
2240 | } | 2240 | } |
2241 | 2241 | ||
2242 | /* Turn off all GPIO stuff. Call this on module unload, for example. */ | 2242 | /* Turn off all GPIO stuff. Call this on module unload, for example. */ |
@@ -2384,11 +2384,6 @@ static int bcm43xx_chip_init(struct bcm43xx_private *bcm) | |||
2384 | goto err_gpio_cleanup; | 2384 | goto err_gpio_cleanup; |
2385 | bcm43xx_radio_turn_on(bcm); | 2385 | bcm43xx_radio_turn_on(bcm); |
2386 | 2386 | ||
2387 | if (modparam_noleds) | ||
2388 | bcm43xx_leds_turn_off(bcm); | ||
2389 | else | ||
2390 | bcm43xx_leds_update(bcm, 0); | ||
2391 | |||
2392 | bcm43xx_write16(bcm, 0x03E6, 0x0000); | 2387 | bcm43xx_write16(bcm, 0x03E6, 0x0000); |
2393 | err = bcm43xx_phy_init(bcm); | 2388 | err = bcm43xx_phy_init(bcm); |
2394 | if (err) | 2389 | if (err) |