[OpenWrt-Devel] [PATCH]V2 b43: Module option added to change the GPIO LED mask. Backfire branch.

openwrt at simong.net openwrt at simong.net
Wed Sep 1 08:31:00 CEST 2010


From: Simon G <openwrt at simong.net>

Thanks for the comments Jo-Philipp.

Changed the patch after some comments by "Jo-Philipp Wich" <xm at subsignal.org>

This patch exposes the GPIO mask as a module option. This
makes it possible to limit the GPIO lines used by the b43 module.
Useful for those using the GPIO lines for other things like mmc over GPIO.

It is helpful to those not able / interested in recompiling OpenWRT themselves. 
The default action is the same as before, that is 0xf gpiomask.

Signed-off-by: Simon Gaynor <openwrt at simong.net>

---

This patch could also be a solution to the following tickets ...

https://dev.openwrt.org/ticket/5153	[brcm47] conflict kmod-mmc-over-gpio and b43

https://dev.openwrt.org/ticket/4274	B43 driver takes over GPIO ports

I have sucessfully tested it on my Linksys WRT54 GL with the mmc over GPIO hardware mod.

A quick HOWTO is included below.

The SVN patch is included inline and is against ...

URL: svn://svn.openwrt.org/openwrt/branches/backfire
revision 22657

The actual added file (a patch) is also available here should this e-mail become corrupt ...

http://www.simong.net/openwrt/patches/800-b43-gpio-mask-module-option.patch

Download it and place it here in the backfire tree ...

cp 800-b43-gpio-mask-module-option.patch backfire/package/mac80211/patches/

A compiled Kernel module with this patch is available here ...

http://www.simong.net/openwrt/bin/brcm47xx/packages/kmod-b43_2.6.32.10+2010-07-06-1_brcm47xx.ipk


HOWTO:
------
The gpiomask is 0xf if the kernel module option is not specified.
To change the gpiomask ...

vi /etc/modules.d/30-b43 

Change the line "b43" to "b43 gpiomask=0x1" or something else.
Reload the b43 kernel module or reboot.

You should see a similar message in the kernel logs (dmesg) to this ...

Broadcom 43xx driver loaded [ Features: PL, GPIO LED Mask: 0x1 Patch,Firmware-ID: FW13 ]

Showing the GPIO LED Mask, in this case 0x1


SVN backfire PATCH:

---

Index: package/mac80211/patches/800-b43-gpio-mask-module-option.patch
===================================================================
--- package/mac80211/patches/800-b43-gpio-mask-module-option.patch	(revision 0)
+++ package/mac80211/patches/800-b43-gpio-mask-module-option.patch	(revision 0)
@@ -0,0 +1,61 @@
+diff -urN a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
+--- a/drivers/net/wireless/b43/b43.h	2010-07-07 18:34:29.000000000 +0200
++++ b/drivers/net/wireless/b43/b43.h	2010-08-12 00:57:50.972287659 +0200
+@@ -704,6 +704,7 @@
+ 	bool qos_enabled;		/* TRUE, if QoS is used. */
+ 	bool hwcrypto_enabled;		/* TRUE, if HW crypto acceleration is enabled. */
+ 	bool use_pio;			/* TRUE if next init should use PIO */
++	int gpiomask;			/* GPIO LED mask as a module parameter */
+ 
+ 	/* PHY/Radio device. */
+ 	struct b43_phy phy;
+diff -urN a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
+--- a/drivers/net/wireless/b43/main.c	2010-07-07 18:34:29.000000000 +0200
++++ b/drivers/net/wireless/b43/main.c	2010-08-12 00:57:50.986285294 +0200
+@@ -65,6 +65,7 @@
+ MODULE_AUTHOR("Stefano Brivio");
+ MODULE_AUTHOR("Michael Buesch");
+ MODULE_AUTHOR("Gábor Stefanik");
+ MODULE_LICENSE("GPL");
+ 
+ MODULE_FIRMWARE(B43_SUPPORTED_FIRMWARE_ID);
+@@ -75,6 +76,11 @@
+ MODULE_FIRMWARE("b43/ucode5.fw");
+ MODULE_FIRMWARE("b43/ucode9.fw");
+ 
++static int modparam_gpiomask = 0x000F;
++module_param_named(gpiomask, modparam_gpiomask, int, 0444);
++MODULE_PARM_DESC(gpiomask, 
++		"GPIO mask for LED control (default 0x000F)");
++
+ static int modparam_bad_frames_preempt;
+ module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444);
+ MODULE_PARM_DESC(bad_frames_preempt,
+@@ -2529,10 +2535,11 @@
+ 		    & ~B43_MACCTL_GPOUTSMSK);
+ 
+ 	b43_write16(dev, B43_MMIO_GPIO_MASK, b43_read16(dev, B43_MMIO_GPIO_MASK)
+-		    | 0x000F);
++		    | modparam_gpiomask );
+ 
+ 	mask = 0x0000001F;
+-	set = 0x0000000F;
++	set = modparam_gpiomask;
+ 	if (dev->dev->bus->chip_id == 0x4301) {
+ 		mask |= 0x0060;
+ 		set |= 0x0060;
+@@ -5084,10 +5091,10 @@
+ 	feat_sdio = "S";
+ #endif
+ 	printk(KERN_INFO "Broadcom 43xx driver loaded "
+-	       "[ Features: %s%s%s%s%s, Firmware-ID: "
++	       "[ Features: %s%s%s%s%s, GPIO LED Mask: 0x%04x, Firmware-ID: "
+ 	       B43_SUPPORTED_FIRMWARE_ID " ]\n",
+ 	       feat_pci, feat_pcmcia, feat_nphy,
+-	       feat_leds, feat_sdio);
++	       feat_leds, feat_sdio, modparam_gpiomask);
+ }
+ 
+ static int __init b43_init(void)




More information about the openwrt-devel mailing list