diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2011-05-17 12:57:27 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-05-19 13:54:08 -0400 |
commit | c4a2a08165dd5a58e24eb342902839dca78887b8 (patch) | |
tree | 523125e9a4ce466f6b2ccdc2e5ec0b0d769ff8a1 /drivers/net | |
parent | 05100a29cb65b7473bc0c71282df3e31b460b728 (diff) |
b43: add helper for finding GPIO device
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/b43/main.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index fcbf67063c3a..7b3b3f743825 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -2556,10 +2556,20 @@ out: | |||
2556 | /* Initialize the GPIOs | 2556 | /* Initialize the GPIOs |
2557 | * http://bcm-specs.sipsolutions.net/GPIO | 2557 | * http://bcm-specs.sipsolutions.net/GPIO |
2558 | */ | 2558 | */ |
2559 | static int b43_gpio_init(struct b43_wldev *dev) | 2559 | static struct ssb_device *b43_ssb_gpio_dev(struct b43_wldev *dev) |
2560 | { | 2560 | { |
2561 | struct ssb_bus *bus = dev->sdev->bus; | 2561 | struct ssb_bus *bus = dev->sdev->bus; |
2562 | struct ssb_device *gpiodev, *pcidev = NULL; | 2562 | |
2563 | #ifdef CONFIG_SSB_DRIVER_PCICORE | ||
2564 | return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev); | ||
2565 | #else | ||
2566 | return bus->chipco.dev; | ||
2567 | #endif | ||
2568 | } | ||
2569 | |||
2570 | static int b43_gpio_init(struct b43_wldev *dev) | ||
2571 | { | ||
2572 | struct ssb_device *gpiodev; | ||
2563 | u32 mask, set; | 2573 | u32 mask, set; |
2564 | 2574 | ||
2565 | b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL) | 2575 | b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL) |
@@ -2591,15 +2601,11 @@ static int b43_gpio_init(struct b43_wldev *dev) | |||
2591 | if (dev->sdev->id.revision >= 2) | 2601 | if (dev->sdev->id.revision >= 2) |
2592 | mask |= 0x0010; /* FIXME: This is redundant. */ | 2602 | mask |= 0x0010; /* FIXME: This is redundant. */ |
2593 | 2603 | ||
2594 | #ifdef CONFIG_SSB_DRIVER_PCICORE | 2604 | gpiodev = b43_ssb_gpio_dev(dev); |
2595 | pcidev = bus->pcicore.dev; | 2605 | if (gpiodev) |
2596 | #endif | 2606 | ssb_write32(gpiodev, B43_GPIO_CONTROL, |
2597 | gpiodev = bus->chipco.dev ? : pcidev; | 2607 | (ssb_read32(gpiodev, B43_GPIO_CONTROL) |
2598 | if (!gpiodev) | 2608 | & mask) | set); |
2599 | return 0; | ||
2600 | ssb_write32(gpiodev, B43_GPIO_CONTROL, | ||
2601 | (ssb_read32(gpiodev, B43_GPIO_CONTROL) | ||
2602 | & mask) | set); | ||
2603 | 2609 | ||
2604 | return 0; | 2610 | return 0; |
2605 | } | 2611 | } |
@@ -2607,16 +2613,11 @@ static int b43_gpio_init(struct b43_wldev *dev) | |||
2607 | /* Turn off all GPIO stuff. Call this on module unload, for example. */ | 2613 | /* Turn off all GPIO stuff. Call this on module unload, for example. */ |
2608 | static void b43_gpio_cleanup(struct b43_wldev *dev) | 2614 | static void b43_gpio_cleanup(struct b43_wldev *dev) |
2609 | { | 2615 | { |
2610 | struct ssb_bus *bus = dev->sdev->bus; | 2616 | struct ssb_device *gpiodev; |
2611 | struct ssb_device *gpiodev, *pcidev = NULL; | ||
2612 | 2617 | ||
2613 | #ifdef CONFIG_SSB_DRIVER_PCICORE | 2618 | gpiodev = b43_ssb_gpio_dev(dev); |
2614 | pcidev = bus->pcicore.dev; | 2619 | if (gpiodev) |
2615 | #endif | 2620 | ssb_write32(gpiodev, B43_GPIO_CONTROL, 0); |
2616 | gpiodev = bus->chipco.dev ? : pcidev; | ||
2617 | if (!gpiodev) | ||
2618 | return; | ||
2619 | ssb_write32(gpiodev, B43_GPIO_CONTROL, 0); | ||
2620 | } | 2621 | } |
2621 | 2622 | ||
2622 | /* http://bcm-specs.sipsolutions.net/EnableMac */ | 2623 | /* http://bcm-specs.sipsolutions.net/EnableMac */ |