Skip to contentSkip to conversation

b43: fix logic in GPIO configuration

PATCH New Rafał Miłecki 3 participants 9 messages Mar 6, 2012 – Mar 10, 2012 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 b43: fix logic in GPIO configuration

By using reverted mask we were taking over pins we were not supporsed to touch. After fixing this workaround for BCM5354 should not be needed anymore.

---
 drivers/net/wireless/b43/main.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/b43/main.c +2 -4
index 1d633f3..8a89885 100644
@@ -2706,8 +2706,6 @@ static int b43_gpio_init(struct b43_wldev *dev)
 		mask |= 0x0060;
 		set |= 0x0060;
 	}
-	if (dev->dev->chip_id == 0x5354)
-		set &= 0xff02;
 	if (0 /* FIXME: conditional unknown */ ) {
 		b43_write16(dev, B43_MMIO_GPIO_MASK,
 			    b43_read16(dev, B43_MMIO_GPIO_MASK)
@@ -2730,7 +2728,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
 	case B43_BUS_BCMA:
 		bcma_cc_write32(&dev->dev->bdev->bus->drv_cc, BCMA_CC_GPIOCTL,
 				(bcma_cc_read32(&dev->dev->bdev->bus->drv_cc,
-					BCMA_CC_GPIOCTL) & mask) | set);
+					BCMA_CC_GPIOCTL) & ~mask) | set);
 		break;
 #endif
 #ifdef CONFIG_B43_SSB
@@ -2739,7 +2737,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
 		if (gpiodev)
 			ssb_write32(gpiodev, B43_GPIO_CONTROL,
 				    (ssb_read32(gpiodev, B43_GPIO_CONTROL)
-				    & mask) | set);
+				    & ~mask) | set);
 		break;
 #endif
 	}
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 1/1 b43: fix logic in GPIO configuration

Quoted 32 lines · On Tue, 6 Mar 2012 23:11:38 +0100 Rafa? Mi?ecki <[email protected]> wrote:

By using reverted mask we were taking over pins we were not supporsed to touch. After fixing this workaround for BCM5354 should not be needed anymore.

---
 drivers/net/wireless/b43/main.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/b43/main.c +1 -3
index 1d633f3..8a89885 100644
@@ -2706,8 +2706,6 @@ static int b43_gpio_init(struct b43_wldev *dev)
 		mask |= 0x0060;
 		set |= 0x0060;
 	}
-	if (dev->dev->chip_id == 0x5354)
-		set &= 0xff02;
 	if (0 /* FIXME: conditional unknown */ ) {
 		b43_write16(dev, B43_MMIO_GPIO_MASK,
 			    b43_read16(dev, B43_MMIO_GPIO_MASK)
@@ -2730,7 +2728,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
 	case B43_BUS_BCMA:
 		bcma_cc_write32(&dev->dev->bdev->bus->drv_cc, BCMA_CC_GPIOCTL,
 				(bcma_cc_read32(&dev->dev->bdev->bus->drv_cc,
-					BCMA_CC_GPIOCTL) & mask) | set);
+					BCMA_CC_GPIOCTL) & ~mask) | set);
 		break;
 #endif
 #ifdef CONFIG_B43_SSB

drivers/net/wireless/b43/main.c static int b43_gpio_init(struct b43_wldev *dev) · line 2743

Quoted 8 lines
drivers/net/wireless/b43/main.c +1 -1
@@ -2739,7 +2737,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
 		if (gpiodev)
 			ssb_write32(gpiodev, B43_GPIO_CONTROL,
 				    (ssb_read32(gpiodev, B43_GPIO_CONTROL)
-				    & mask) | set);
+				    & ~mask) | set);
 		break;
 #endif
 	}

This patch makes sense. Can you also check b43legacy? I guess it has the same problem.

And while we're at it, you could also remove these two lines:

2737 if (dev->dev->core_rev >= 2)
2738 mask |= 0x0010; /* FIXME: This is redundant. */

because core_rev is always >= 2 in b43 and as the FIXME says the bit is already set.

Also, take a look at b43_gpio_cleanup() (in b43 and b43legacy).
It always forces all bits to zero. This clearly is wrong, too. It is supposed to revert the changes done in the b43 GPIO setup. It seems too complicated to fixup the code to actually do this, though. I think we should simply get rid of b43_gpio_cleanup() completely and simply leave the GPIOs as-is. No kittens will be hurt by doing so; so it's ok.

Signature · 10 lines
Greetings, Michael.

PGP encryption is encouraged / 908D8B0E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/b43-dev/attachments/20120306/68cb7f1b/attachment.sig>
#2 lore raw

PATCH 1/1 b43: fix logic in GPIO configuration

In reply to Rafał Miłecki
Quoted 32 lines · Rafa? Mi?ecki

By using reverted mask we were taking over pins we were not supporsed to touch. After fixing this workaround for BCM5354 should not be needed anymore.

---
 drivers/net/wireless/b43/main.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/b43/main.c +1 -3
index 1d633f3..8a89885 100644
@@ -2706,8 +2706,6 @@ static int b43_gpio_init(struct b43_wldev *dev)
 		mask |= 0x0060;
 		set |= 0x0060;
 	}
-	if (dev->dev->chip_id == 0x5354)
-		set &= 0xff02;
 	if (0 /* FIXME: conditional unknown */ ) {
 		b43_write16(dev, B43_MMIO_GPIO_MASK,
 			    b43_read16(dev, B43_MMIO_GPIO_MASK)
@@ -2730,7 +2728,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
 	case B43_BUS_BCMA:
 		bcma_cc_write32(&dev->dev->bdev->bus->drv_cc, BCMA_CC_GPIOCTL,
 				(bcma_cc_read32(&dev->dev->bdev->bus->drv_cc,
-					BCMA_CC_GPIOCTL) & mask) | set);
+					BCMA_CC_GPIOCTL) & ~mask) | set);
 		break;
 #endif
 #ifdef CONFIG_B43_SSB

drivers/net/wireless/b43/main.c static int b43_gpio_init(struct b43_wldev *dev) · line 2743

Quoted 8 lines
drivers/net/wireless/b43/main.c +1 -1
@@ -2739,7 +2737,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
 		if (gpiodev)
 			ssb_write32(gpiodev, B43_GPIO_CONTROL,
 				    (ssb_read32(gpiodev, B43_GPIO_CONTROL)
-				    & mask) | set);
+				    & ~mask) | set);
 		break;
 #endif
 	}

Hi,

This patch did not helped fixing my problem. The ucode still takes over the GPIOs of the buttons with firmware version 666.2. I am getting the following messages:

[   83.620000] b43-phy0: Loading firmware version 666.2 (2011-02-23
01:15:07)
[   83.624000] Init value of B43_GPIO_CONTROL: 0x0
[   83.632000] b43-phy0 debug: b2062: Using crystal tab entry 19200 kHz.
[   83.640000] hotplug_button: action: pressed, name: reset, seen: 17179652
[   83.644000] hotplug_button: action: pressed, name: ses, seen: 17179652
[   89.404000] b43-phy0 debug: Chip initialized
#3 lore raw

PATCH 1/1 b43: fix logic in GPIO configuration

Quoted 7 lines · On Tue, 06 Mar 2012 23:55:08 +0100 Hauke Mehrtens <[email protected]> wrote:

This patch did not helped fixing my problem. The ucode still takes over the GPIOs of the buttons with firmware version 666.2. I am getting the following messages:

[   83.620000] b43-phy0: Loading firmware version 666.2 (2011-02-23
01:15:07)
[   83.624000] Init value of B43_GPIO_CONTROL: 0x0

I think this is caused by b43_gpio_cleanup. Can you try removing that function (or just returning early, for the time being.)

Signature · 10 lines
Greetings, Michael.

PGP encryption is encouraged / 908D8B0E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/b43-dev/attachments/20120307/8834d02e/attachment.sig>
#4 lore raw

PATCH 1/1 b43: fix logic in GPIO configuration

2012/3/7 Michael B?sch <[email protected]>:

Quoted 7 lines
Quoted 4 lines · On Tue, 06 Mar 2012 23:55:08 +0100 Hauke Mehrtens <[email protected]> wrote:

This patch did not helped fixing my problem. The ucode still takes over the GPIOs of the buttons with firmware version 666.2. I am getting the following messages:

Quoted 6 lines
Quoted 3 lines

[ ? 83.620000] b43-phy0: Loading firmware version 666.2 (2011-02-23 01:15:07)
[ ? 83.624000] Init value of B43_GPIO_CONTROL: 0x0

I think this is caused by b43_gpio_cleanup. Can you try removing that function (or just returning early, for the time being.)

B43_GPIO_CONTROL is zero by default (after boot), so AFAIU setting it back to zero in b43_gpio_cleanup shouldn't break anything.

Signature · 1 line
Rafa?
#5 lore raw

PATCH 1/1 b43: fix logic in GPIO configuration

In reply to Hauke Mehrtens

W dniu 6 marca 2012 23:55 u?ytkownik Hauke Mehrtens <[email protected]> napisa?:

Quoted 48 lines · Rafa? Mi?ecki
Quoted 38 lines

By using reverted mask we were taking over pins we were not supporsed to touch. After fixing this workaround for BCM5354 should not be needed anymore.

---
?drivers/net/wireless/b43/main.c | ? ?6 ++----
?1 files changed, 2 insertions(+), 4 deletions(-)

drivers/net/wireless/b43/main.c +0 -2
index 1d633f3..8a89885 100644
@@ -2706,8 +2706,6 @@ static int b43_gpio_init(struct b43_wldev *dev)
 ? ? ? ? ? ? ? mask |= 0x0060;
 ? ? ? ? ? ? ? set |= 0x0060;
 ? ? ? }
- ? ? if (dev->dev->chip_id == 0x5354)
- ? ? ? ? ? ? set &= 0xff02;
 ? ? ? if (0 /* FIXME: conditional unknown */ ) {
 ? ? ? ? ? ? ? b43_write16(dev, B43_MMIO_GPIO_MASK,
 ? ? ? ? ? ? ? ? ? ? ? ? ? b43_read16(dev, B43_MMIO_GPIO_MASK)
@@ -2730,7 +2728,7 @@ static int b43_gpio_init(struct b43_wldev *dev)

? ? ? case B43_BUS_BCMA:
? ? ? ? ? ? ? bcma_cc_write32(&dev->dev->bdev->bus->drv_cc, BCMA_CC_GPIOCTL, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (bcma_cc_read32(&dev->dev->bdev->bus->drv_cc,
- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BCMA_CC_GPIOCTL) & mask) | set);
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BCMA_CC_GPIOCTL) & ~mask) | set); ? ? ? ? ? ? ? break;
?#endif
?#ifdef CONFIG_B43_SSB

drivers/net/wireless/b43/main.c +1 -1
@@ -2739,7 +2737,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
 ? ? ? ? ? ? ? if (gpiodev)
 ? ? ? ? ? ? ? ? ? ? ? ssb_write32(gpiodev, B43_GPIO_CONTROL,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (ssb_read32(gpiodev, B43_GPIO_CONTROL)
- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? & mask) | set);
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? & ~mask) | set);
 ? ? ? ? ? ? ? break;
Quoted 2 lines

?#endif
? ? ? }

Hi,

This patch did not helped fixing my problem. The ucode still takes over the GPIOs of the buttons with firmware version 666.2. I am getting the following messages:

Quoted 7 lines

[ ? 83.620000] b43-phy0: Loading firmware version 666.2 (2011-02-23 01:15:07)
[ ? 83.624000] Init value of B43_GPIO_CONTROL: 0x0
[ ? 83.632000] b43-phy0 debug: b2062: Using crystal tab entry 19200 kHz. [ ? 83.640000] hotplug_button: action: pressed, name: reset, seen: 17179652 [ ? 83.644000] hotplug_button: action: pressed, name: ses, seen: 17179652 [ ? 89.404000] b43-phy0 debug: Chip initialized

Interesting/weird. I suspected there are some bits set in B43_GPIO_CONTROL we should not clean. And you just adjusted "set" to keep them set. But now it seems B43_GPIO_CONTROL is *zero* at the beginning and we actually have to *set* 0xFF00 to stop firmware touching them? Really tricky, I didn't suspect we may need to change default state of non-b43-related GPIOs.

Signature · 1 line
Rafa?
#6 lore raw

PATCH 1/1 b43: fix logic in GPIO configuration

W dniu 7 marca 2012 07:52 u?ytkownik Rafa? Mi?ecki <[email protected]> napisa?:

Quoted 57 lines

W dniu 6 marca 2012 23:55 u?ytkownik Hauke Mehrtens <[email protected]> napisa?:

Quoted 48 lines · Rafa? Mi?ecki
Quoted 38 lines

By using reverted mask we were taking over pins we were not supporsed to touch. After fixing this workaround for BCM5354 should not be needed anymore.

---
?drivers/net/wireless/b43/main.c | ? ?6 ++----
?1 files changed, 2 insertions(+), 4 deletions(-)

drivers/net/wireless/b43/main.c +0 -2
index 1d633f3..8a89885 100644
@@ -2706,8 +2706,6 @@ static int b43_gpio_init(struct b43_wldev *dev)
 ? ? ? ? ? ? ? mask |= 0x0060;
 ? ? ? ? ? ? ? set |= 0x0060;
 ? ? ? }
- ? ? if (dev->dev->chip_id == 0x5354)
- ? ? ? ? ? ? set &= 0xff02;
 ? ? ? if (0 /* FIXME: conditional unknown */ ) {
 ? ? ? ? ? ? ? b43_write16(dev, B43_MMIO_GPIO_MASK,
 ? ? ? ? ? ? ? ? ? ? ? ? ? b43_read16(dev, B43_MMIO_GPIO_MASK)
@@ -2730,7 +2728,7 @@ static int b43_gpio_init(struct b43_wldev *dev)

? ? ? case B43_BUS_BCMA:
? ? ? ? ? ? ? bcma_cc_write32(&dev->dev->bdev->bus->drv_cc, BCMA_CC_GPIOCTL, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (bcma_cc_read32(&dev->dev->bdev->bus->drv_cc,
- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BCMA_CC_GPIOCTL) & mask) | set);
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BCMA_CC_GPIOCTL) & ~mask) | set); ? ? ? ? ? ? ? break;
?#endif
?#ifdef CONFIG_B43_SSB

drivers/net/wireless/b43/main.c +1 -1
@@ -2739,7 +2737,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
 ? ? ? ? ? ? ? if (gpiodev)
 ? ? ? ? ? ? ? ? ? ? ? ssb_write32(gpiodev, B43_GPIO_CONTROL,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (ssb_read32(gpiodev, B43_GPIO_CONTROL)
- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? & mask) | set);
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? & ~mask) | set);
 ? ? ? ? ? ? ? break;
Quoted 2 lines

?#endif
? ? ? }

Hi,

This patch did not helped fixing my problem. The ucode still takes over the GPIOs of the buttons with firmware version 666.2. I am getting the following messages:

Quoted 7 lines

[ ? 83.620000] b43-phy0: Loading firmware version 666.2 (2011-02-23 01:15:07)
[ ? 83.624000] Init value of B43_GPIO_CONTROL: 0x0
[ ? 83.632000] b43-phy0 debug: b2062: Using crystal tab entry 19200 kHz. [ ? 83.640000] hotplug_button: action: pressed, name: reset, seen: 17179652 [ ? 83.644000] hotplug_button: action: pressed, name: ses, seen: 17179652 [ ? 89.404000] b43-phy0 debug: Chip initialized

Quoted 6 lines

Interesting/weird. I suspected there are some bits set in B43_GPIO_CONTROL we should not clean. And you just adjusted "set" to keep them set. But now it seems B43_GPIO_CONTROL is *zero* at the beginning and we actually have to *set* 0xFF00 to stop firmware touching them? Really tricky, I didn't suspect we may need to change default state of non-b43-related GPIOs.

Ahh, sorry. For all the time I believed the code you added was:
set |= 0xff02;

However the code you *really* added is:
set &= 0xff02;

Sorry for messing. OK, let's short analyze that. By default we set "set" to:
set = 0x0000000F;
so you code basically makes it
set = 0x00000002;

0x2 (BIT 1) is wlan led on your device. So you let firmware use wlan led, but you stop it from touching power led (0x1), reset button (0x4) and ses button (0x8). OK, it makes sense.

In the brcm80211 code there was unused si_gpioreserve function. I guess it used to be called in some way like:
if (dev->dev->chip_id == 0x5354)
si_gpioreserve(sih, 0x2, 1+)

Signature · 1 line
Rafa?
#7 lore raw

PATCH 1/1 b43: fix logic in GPIO configuration

Quoted 71 lines · Rafa? Mi?ecki

W dniu 7 marca 2012 07:52 u?ytkownik Rafa? Mi?ecki <[email protected]> napisa?:

Quoted 57 lines

W dniu 6 marca 2012 23:55 u?ytkownik Hauke Mehrtens <[email protected]> napisa?:

Quoted 48 lines · Rafa? Mi?ecki
Quoted 32 lines

By using reverted mask we were taking over pins we were not supporsed to touch. After fixing this workaround for BCM5354 should not be needed anymore.

---
 drivers/net/wireless/b43/main.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/b43/main.c +1 -3
index 1d633f3..8a89885 100644
@@ -2706,8 +2706,6 @@ static int b43_gpio_init(struct b43_wldev *dev)
              mask |= 0x0060;
              set |= 0x0060;
      }
-     if (dev->dev->chip_id == 0x5354)
-             set &= 0xff02;
      if (0 /* FIXME: conditional unknown */ ) {
              b43_write16(dev, B43_MMIO_GPIO_MASK,
                          b43_read16(dev, B43_MMIO_GPIO_MASK)
@@ -2730,7 +2728,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
      case B43_BUS_BCMA:
              bcma_cc_write32(&dev->dev->bdev->bus->drv_cc, BCMA_CC_GPIOCTL,
                              (bcma_cc_read32(&dev->dev->bdev->bus->drv_cc,
-                                     BCMA_CC_GPIOCTL) & mask) | set);
+                                     BCMA_CC_GPIOCTL) & ~mask) | set);
              break;
 #endif
 #ifdef CONFIG_B43_SSB

drivers/net/wireless/b43/main.c static int b43_gpio_init(struct b43_wldev *dev) · line 2743

Quoted 8 lines
drivers/net/wireless/b43/main.c +1 -1
@@ -2739,7 +2737,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
              if (gpiodev)
                      ssb_write32(gpiodev, B43_GPIO_CONTROL,
                                  (ssb_read32(gpiodev, B43_GPIO_CONTROL)
-                                 & mask) | set);
+                                 & ~mask) | set);
              break;
 #endif
      }

Hi,

This patch did not helped fixing my problem. The ucode still takes over the GPIOs of the buttons with firmware version 666.2. I am getting the following messages:

Quoted 7 lines
[   83.620000] b43-phy0: Loading firmware version 666.2 (2011-02-23
01:15:07)
[   83.624000] Init value of B43_GPIO_CONTROL: 0x0
[   83.632000] b43-phy0 debug: b2062: Using crystal tab entry 19200 kHz.
[   83.640000] hotplug_button: action: pressed, name: reset, seen: 17179652
[   83.644000] hotplug_button: action: pressed, name: ses, seen: 17179652
[   89.404000] b43-phy0 debug: Chip initialized
Quoted 6 lines

Interesting/weird. I suspected there are some bits set in B43_GPIO_CONTROL we should not clean. And you just adjusted "set" to keep them set. But now it seems B43_GPIO_CONTROL is *zero* at the beginning and we actually have to *set* 0xFF00 to stop firmware touching them? Really tricky, I didn't suspect we may need to change default state of non-b43-related GPIOs.

Ahh, sorry. For all the time I believed the code you added was:
set |= 0xff02;

However the code you *really* added is:
set &= 0xff02;

Quoted 8 lines

Sorry for messing. OK, let's short analyze that. By default we set "set" to:
set = 0x0000000F;
so you code basically makes it
set = 0x00000002;

0x2 (BIT 1) is wlan led on your device. So you let firmware use wlan led, but you stop it from touching power led (0x1), reset button (0x4) and ses button (0x8). OK, it makes sense.

Yes
It used the GPIO pins with the bit numbers set to 1, at least for the first 4 ones. I just made it just use the GPIO for the wlan LED. Should I still test some patches on the device?

Quoted 5 lines

In the brcm80211 code there was unused si_gpioreserve function. I guess it used to be called in some way like:
if (dev->dev->chip_id == 0x5354)
si_gpioreserve(sih, 0x2, 1+)

Where did you find this code? I was unable to find any code adding some special gpio handling for the bcm5354 in my sources.

Hauke

#8 lore raw

PATCH 1/1 b43: fix logic in GPIO configuration

W dniu 10 marca 2012 00:17 u?ytkownik Hauke Mehrtens <[email protected]> napisa?:

Quoted 85 lines · Rafa? Mi?ecki
Quoted 71 lines

W dniu 7 marca 2012 07:52 u?ytkownik Rafa? Mi?ecki <[email protected]> napisa?:

Quoted 57 lines

W dniu 6 marca 2012 23:55 u?ytkownik Hauke Mehrtens <[email protected]> napisa?:

Quoted 48 lines · Rafa? Mi?ecki
Quoted 38 lines

By using reverted mask we were taking over pins we were not supporsed to touch. After fixing this workaround for BCM5354 should not be needed anymore.

---
?drivers/net/wireless/b43/main.c | ? ?6 ++----
?1 files changed, 2 insertions(+), 4 deletions(-)

drivers/net/wireless/b43/main.c +0 -2
index 1d633f3..8a89885 100644
@@ -2706,8 +2706,6 @@ static int b43_gpio_init(struct b43_wldev *dev)
 ? ? ? ? ? ? ? mask |= 0x0060;
 ? ? ? ? ? ? ? set |= 0x0060;
 ? ? ? }
- ? ? if (dev->dev->chip_id == 0x5354)
- ? ? ? ? ? ? set &= 0xff02;
 ? ? ? if (0 /* FIXME: conditional unknown */ ) {
 ? ? ? ? ? ? ? b43_write16(dev, B43_MMIO_GPIO_MASK,
 ? ? ? ? ? ? ? ? ? ? ? ? ? b43_read16(dev, B43_MMIO_GPIO_MASK)
@@ -2730,7 +2728,7 @@ static int b43_gpio_init(struct b43_wldev *dev)

? ? ? case B43_BUS_BCMA:
? ? ? ? ? ? ? bcma_cc_write32(&dev->dev->bdev->bus->drv_cc, BCMA_CC_GPIOCTL, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (bcma_cc_read32(&dev->dev->bdev->bus->drv_cc,
- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BCMA_CC_GPIOCTL) & mask) | set);
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BCMA_CC_GPIOCTL) & ~mask) | set); ? ? ? ? ? ? ? break;
?#endif
?#ifdef CONFIG_B43_SSB

drivers/net/wireless/b43/main.c +1 -1
@@ -2739,7 +2737,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
 ? ? ? ? ? ? ? if (gpiodev)
 ? ? ? ? ? ? ? ? ? ? ? ssb_write32(gpiodev, B43_GPIO_CONTROL,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (ssb_read32(gpiodev, B43_GPIO_CONTROL)
- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? & mask) | set);
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? & ~mask) | set);
 ? ? ? ? ? ? ? break;
Quoted 2 lines

?#endif
? ? ? }

Hi,

This patch did not helped fixing my problem. The ucode still takes over the GPIOs of the buttons with firmware version 666.2. I am getting the following messages:

Quoted 7 lines

[ ? 83.620000] b43-phy0: Loading firmware version 666.2 (2011-02-23 01:15:07)
[ ? 83.624000] Init value of B43_GPIO_CONTROL: 0x0
[ ? 83.632000] b43-phy0 debug: b2062: Using crystal tab entry 19200 kHz. [ ? 83.640000] hotplug_button: action: pressed, name: reset, seen: 17179652 [ ? 83.644000] hotplug_button: action: pressed, name: ses, seen: 17179652 [ ? 89.404000] b43-phy0 debug: Chip initialized

Quoted 6 lines

Interesting/weird. I suspected there are some bits set in B43_GPIO_CONTROL we should not clean. And you just adjusted "set" to keep them set. But now it seems B43_GPIO_CONTROL is *zero* at the beginning and we actually have to *set* 0xFF00 to stop firmware touching them? Really tricky, I didn't suspect we may need to change default state of non-b43-related GPIOs.

Ahh, sorry. For all the time I believed the code you added was:
set |= 0xff02;

However the code you *really* added is:
set &= 0xff02;

Quoted 8 lines

Sorry for messing. OK, let's short analyze that. By default we set "set" to:
set = 0x0000000F;
so you code basically makes it
set = 0x00000002;

0x2 (BIT 1) is wlan led on your device. So you let firmware use wlan led, but you stop it from touching power led (0x1), reset button (0x4) and ses button (0x8). OK, it makes sense.

Yes
It used the GPIO pins with the bit numbers set to 1, at least for the first 4 ones. I just made it just use the GPIO for the wlan LED. Should I still test some patches on the device?

Quoted 1 line
Quoted 7 lines
Quoted 4 lines

In the brcm80211 code there was unused si_gpioreserve function. I guess it used to be called in some way like:
if (dev->dev->chip_id == 0x5354)
si_gpioreserve(sih, 0x2, 1+)

Where did you find this code? I was unable to find any code adding some special gpio handling for the bcm5354 in my sources.

As I said, I've found only si_gpioreserve function. I didn't find special handling of BCM5354, I only guess something like that was used internally at Broadcom in their wl. Nothing like that was released with brcm80211.

If you wish to see si_gpioreserve function, take a look at

commit a9533e7ea3c410fed2f4cd8b3e1e213e48529b75

Author: Henry Ptasinski <[email protected]>
Date:   Wed Sep 8 21:04:42 2010 -0700

Staging: Add initial release of brcm80211 - Broadcom 802.11n
wireless LAN driver.

Signature · 1 line
Rafa?