Skip to contentSkip to conversation

rt{2860,2870}sta: Use request_firmware() to load firmware

PATCH In review Ben Hutchings 2 participants 2 messages Jan 18, 2010 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 rt{2860,2870}sta: Use request_firmware() to load firmware

When originally introduced into staging, these drivers had custom firmware-loading code which checked a version number and CRC at the end of each blob. This reintroduces those checks, using crc-ccitt instead of custom code.

The removed firmware will be added to the linux-firmware.git repository.

Based on work by Darren Salt <[email protected]>.

---
Firmware has been converted as follows:
- rt2860/common/firmware.h : rt2860.bin
- rt3070/firmware.h [first image] : rt2870.bin
- rt3070/firmware.h [second image] : discarded as unused
- rt2860/common/firmware_3070.h [first image] : rt3070.bin
- rt2860/common/firmware_3070.h [second image] : rt3071.bin
- rt3090/firmware.h : rt3090.bin

Changes since the previously-posted version of this patch:
- RT2870 and RT3070 are given different images
- Both 4K and 8K versions of rt2870.bin are accepted; the second image will be ignored
- RT3090/RT3390 are handled
- Minimum firmware versions are set to the versions being removed
- Version field is assumed to be 1 byte in all firmware
- Firmware is cached per-device and should not be requested again on resume

Ben.

 drivers/staging/rt2860/Kconfig                |    2 +
 drivers/staging/rt2860/common/firmware.h      |  558 -------------------------
 drivers/staging/rt2860/common/firmware_3070.h |  517 -----------------------
 drivers/staging/rt2860/common/rtmp_mcu.c      |  165 +++++---
 drivers/staging/rt2860/rt_linux.c             |    3 +
 drivers/staging/rt2860/rtmp.h                 |    1 +
 drivers/staging/rt2870/Kconfig                |    2 +
 drivers/staging/rt3070/firmware.h             |  558 -------------------------
 drivers/staging/rt3090/firmware.h             |  517 -----------------------
 9 files changed, 113 insertions(+), 2210 deletions(-)
 delete mode 100644 drivers/staging/rt2860/common/firmware.h
 delete mode 100644 drivers/staging/rt2860/common/firmware_3070.h
 delete mode 100644 drivers/staging/rt3070/firmware.h
 delete mode 100644 drivers/staging/rt3090/firmware.h
drivers/staging/rt2860/Kconfig +2 -0
index f9962b6..f3a7e47 100644
@@ -3,6 +3,8 @@ config RT2860
 	depends on PCI && X86 && WLAN
 	select WIRELESS_EXT
 	select WEXT_PRIV
+	select CRC_CCITT
+	select FW_LOADER
 	---help---
 	  This is an experimental driver for the Ralink 2860 and 3090
 	  wireless chips.
drivers/staging/rt2860/common/firmware.h deleted +0 -558

558 lines not on this page · raw message

drivers/staging/rt2860/common/firmware_3070.h deleted +0 -517

517 lines not on this page · raw message

drivers/staging/rt2860/common/rtmp_mcu.c +105 -60

192 lines not on this page · raw message

drivers/staging/rt2860/rt_linux.c +3 -0
index 9357fb2..cd76505 100644
@@ -25,6 +25,7 @@
  *************************************************************************
  */
 
+#include <linux/firmware.h>
 #include <linux/sched.h>
 #include "rt_config.h"
 
@@ -260,6 +261,8 @@ void RTMPFreeAdapter(struct rt_rtmp_adapter *pAd)
 
 	NdisFreeSpinLock(&pAd->irq_lock);
 
+	release_firmware(pAd->firmware);
+
 	vfree(pAd);		/* pci_free_consistent(os_cookie->pci_dev,sizeof(struct rt_rtmp_adapter),pAd,os_cookie->pAd_pa); */
 	if (os_cookie)
 		kfree(os_cookie);
drivers/staging/rt2860/rtmp.h +1 -0
index 6c6503d..4401a55 100644
@@ -1719,6 +1719,7 @@ struct rt_rtmp_adapter {
 	void *OS_Cookie;	/* save specific structure relative to OS */
 	struct net_device *net_dev;
 	unsigned long VirtualIfCnt;
+	const struct firmware *firmware;
 
 	struct rt_rtmp_chip_op chipOps;
 	u16 ThisTbttNumToNextWakeUp;
drivers/staging/rt2870/Kconfig +2 -0
index fd3ba3a..6ea172b 100644
@@ -3,5 +3,7 @@ config RT2870
 	depends on USB && X86 && WLAN
 	select WIRELESS_EXT
 	select WEXT_PRIV
+	select CRC_CCITT
+	select FW_LOADER
 	---help---
 	  This is an experimental driver for the Ralink xx70 wireless chips.
drivers/staging/rt3070/firmware.h deleted +0 -558

558 lines not on this page · raw message

drivers/staging/rt3090/firmware.h deleted +0 -517

517 lines not on this page · raw message

Signature · 1 line
1.6.6
Tested-by on v1 2/2
#1 lore raw

I demand that Ben Hutchings may or may not have written...

Quoted 10 lines

When originally introduced into staging, these drivers had custom firmware-loading code which checked a version number and CRC at the end of each blob. This reintroduces those checks, using crc-ccitt instead of custom code.

The removed firmware will be added to the linux-firmware.git repository.

Based on work by Darren Salt <[email protected]>.

Signature · 5 lines
| Darren Salt            | linux at youmustbejoking | nr. Ashington, | Doon
| using Debian GNU/Linux | or ds    ,demon,co,uk    | Northumberland | Army
| + http://wiki.debian.org/DebianEeePC/

Pentium: Produces Erroneous Numbers Thru' Inadequate Understanding of Maths.