b43: fix logic in GPIO init

Add some comments by the way

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Rafał Miłecki 2012-07-23 22:57:01 +02:00 committed by John W. Linville
parent c263c2c1ad
commit 828afd26fe
1 changed files with 13 additions and 8 deletions

View File

@ -2719,32 +2719,37 @@ static int b43_gpio_init(struct b43_wldev *dev)
if (dev->dev->chip_id == 0x4301) { if (dev->dev->chip_id == 0x4301) {
mask |= 0x0060; mask |= 0x0060;
set |= 0x0060; set |= 0x0060;
} else if (dev->dev->chip_id == 0x5354) {
/* Don't allow overtaking buttons GPIOs */
set &= 0x2; /* 0x2 is LED GPIO on BCM5354 */
} }
if (dev->dev->chip_id == 0x5354)
set &= 0xff02;
if (0 /* FIXME: conditional unknown */ ) { if (0 /* FIXME: conditional unknown */ ) {
b43_write16(dev, B43_MMIO_GPIO_MASK, b43_write16(dev, B43_MMIO_GPIO_MASK,
b43_read16(dev, B43_MMIO_GPIO_MASK) b43_read16(dev, B43_MMIO_GPIO_MASK)
| 0x0100); | 0x0100);
mask |= 0x0180; /* BT Coexistance Input */
set |= 0x0180; mask |= 0x0080;
set |= 0x0080;
/* BT Coexistance Out */
mask |= 0x0100;
set |= 0x0100;
} }
if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL) { if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL) {
/* PA is controlled by gpio 9, let ucode handle it */
b43_write16(dev, B43_MMIO_GPIO_MASK, b43_write16(dev, B43_MMIO_GPIO_MASK,
b43_read16(dev, B43_MMIO_GPIO_MASK) b43_read16(dev, B43_MMIO_GPIO_MASK)
| 0x0200); | 0x0200);
mask |= 0x0200; mask |= 0x0200;
set |= 0x0200; set |= 0x0200;
} }
if (dev->dev->core_rev >= 2)
mask |= 0x0010; /* FIXME: This is redundant. */
switch (dev->dev->bus_type) { switch (dev->dev->bus_type) {
#ifdef CONFIG_B43_BCMA #ifdef CONFIG_B43_BCMA
case B43_BUS_BCMA: case B43_BUS_BCMA:
bcma_cc_write32(&dev->dev->bdev->bus->drv_cc, BCMA_CC_GPIOCTL, bcma_cc_write32(&dev->dev->bdev->bus->drv_cc, BCMA_CC_GPIOCTL,
(bcma_cc_read32(&dev->dev->bdev->bus->drv_cc, (bcma_cc_read32(&dev->dev->bdev->bus->drv_cc,
BCMA_CC_GPIOCTL) & mask) | set); BCMA_CC_GPIOCTL) & ~mask) | set);
break; break;
#endif #endif
#ifdef CONFIG_B43_SSB #ifdef CONFIG_B43_SSB
@ -2753,7 +2758,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
if (gpiodev) if (gpiodev)
ssb_write32(gpiodev, B43_GPIO_CONTROL, ssb_write32(gpiodev, B43_GPIO_CONTROL,
(ssb_read32(gpiodev, B43_GPIO_CONTROL) (ssb_read32(gpiodev, B43_GPIO_CONTROL)
& mask) | set); & ~mask) | set);
break; break;
#endif #endif
} }