Re: [PATCH] mwl8k: Add 0x2a02 PCI device-id (Marvell 88W8361)

Sedat Dilek
2012-05-01T13:54:52Z

[-- Attachment #1: Type: text/plain, Size: 2490 bytes --]

On Tue, May 1, 2012 at 2:51 PM, Lennert Buytenhek
<buytenh@wantstofly.org> wrote:
> On Sun, Apr 29, 2012 at 12:25:21AM +0200, Sedat Dilek wrote:
>
>> > On 1st sight, logs look fine:
>> >
>> > [21:52:52] <lautriv> [    6.050967] ieee80211 phy0: 88w8361p v4,
>> > 00173f3bdde3, STA firmware 2.1.4.25
>> >
>> > But WLAN connection is not that fast and stable as lautriv reports
>> > (several abnormalities were observed).
>> >
>> > I requested a tarball which includes:
>> > * dmesg (Linux-3.3.3)
>> > * e_n_a (/etc/network/interfaces)
>> > * ifconfig output
>> > * iwconfig output
>> > * iw_phy output
>> > * ps_axu (WPA) output
>> >
>> > lautriv will be so kind to be around on #linux-wireless/Freenode the
>> > next days (UTC+2: German/Swiss local-time).
>> > Just ping him.
>> >
>> > Hope you have fun, together!
>> >
>> > - Sedat -
>>
>> A new tarball from lautriv with same outputs as before, but now tested
>> with Linux-3.4-rc4.

[ CC hauke (OpenWrt) and Ben Hutchings (linux-firmware maintainer) ]

> The output looks good enough for me to ACK adding the PCI ID.
>
> Can the firmware being used here be submitted to the linux-firmware
> git tree?

I can't say much about the firmware [1] inclusion or the procedure of
it into linux-firmware [2].
Maybe, Ben can explain the procedure and what has to be considered
before inclusion in linux-firmware.
The original firmware and helper images were extracted from a Netgear
Windows driver [1].

>From what I read in the OpenWrt forum posting [3]: You wanted to care
for inclusion:

"Firmware isn't included in the kernel tree anymore, there's the
linux-firmware git tree for that these days. I will contact some
people at Marvell to ask whether 8361P firmware can be included
there."

Some more concerns...
Dunno, if [4] is really correct and how to use one and same device-id
for 8363 ***and*** 8361P:
...
{ PCI_VDEVICE(MARVELL, 0x2a02), .driver_data = MWL8363, },
...
Curious about a statement from hauke...

Adding the device-id in case of 8361P is not enough (see attached patch)

I am looking forward to having support for 8361P soon.

- Sedat -

P.S.: I have re-added Readme and patch as there are new CCs.

[1] ftp://downloads.netgear.com/files/wn311t_4_2_setup.exe
[2] http://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git;a=summary
[3] https://forum.openwrt.org/viewtopic.php?pid=110039#p110039
[4] https://dev.openwrt.org/changeset/21167

[-- Attachment #2: mwl8k_extract_firmware_v2.txt --]
[-- Type: text/plain, Size: 1347 bytes --]

##### HOWTO: Extract the firmware for the mwl8k Linux WLAN driver #####

### HELP-1: https://forum.openwrt.org/viewtopic.php?pid=103243#p103243
### HELP-2: https://forum.openwrt.org/viewtopic.php?pid=110004#p110004
### THREAD: http://marc.info/?t=133551792600004&r=1&w=2

### Install some tools to inspect file containing firmware blob

sudo apt-get install cabextract unshield

### Working directory

mkdir mwl8k
cd mwl8k

### Download c-file (extract firmware) and Windows setup file (incl. firmware)

mkdir files
cd files
wget -O mrv8k_extract_fw.c 'http://marc.info/?l=linux-wireless&m=126540674419330&q=p3'
wget ftp://downloads.netgear.com/files/wn311t_4_2_setup.exe

### Extract firmware blob

mkdir .tmp ../firmware
cabextract -F Disk1/data*.* -d .tmp wn311t_4_2_setup.exe
unshield -g Driver -d .tmp x .tmp/Disk1/data1.cab
gcc -o mrv8k_extract_fw mrv8k_extract_fw.c
./mrv8k_extract_fw .tmp/Driver/netmw145.sys
mv *.fw ../firmware/
rm -r -f .tmp

### Check MD5SUM and rename firmware/helper image files for 8361P/8363

[ Known MD5SUMS for 8361P ]
48c79b085f7f5a590d3dbc15647e519f *fmimage_8XX0.fw
0fe11f415adbbd5e8ca03641705c4a6c *helper_8XX0.fw

cd ../firmware
md5sum -b *.fw
mv fmimage_8XX0.fw fmimage_8361p.fw
mv helper_8XX0.fw helper_8361p.fw
mv fmimage_8XX1.fw fmimage_8363.fw
mv helper_8XX1.fw helper_8363.fw

-dileks // 27-Apr-2012

[-- Attachment #3: 0001-mwl8k-Add-support-for-MWL8361P.patch --]
[-- Type: application/octet-stream, Size: 2171 bytes --]

From 1a586a1f21f820de0ea06c5382a69191d93d80fe Mon Sep 17 00:00:00 2001
From: Sedat Dilek <sedat.dilek@gmail.com>
Date: Fri, 27 Apr 2012 13:46:02 +0200
Subject: [PATCH] mwl8k: Add support for MWL8361P

Follow discussion in [1] for more details about adding driver
support and howto extract firmware files.

$ sudo modinfo mwl8k | egrep -i '8361p|2a02'
firmware: mwl8k/fmimage_8361p.fw
firmware: mwl8k/helper_8361p.fw
alias: pci:v000011ABd00002A02sv*sd*bc*sc*i*

Compile-tested against Linux-3.4-rc4+.

[1] http://marc.info/?t=133551792600004&r=1&w=2

Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
---
drivers/net/wireless/mwl8k.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index b48674b..3ea9b8e 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -5225,6 +5225,7 @@ static void mwl8k_finalize_join_worker(struct work_struct *work)
}

enum {
+ MWL8361P = 0,
MWL8363 = 0,
MWL8687,
MWL8366,
@@ -5235,6 +5236,11 @@ enum {
#define MWL8K_8366_AP_FW(api) _MWL8K_8366_AP_FW(api)

static struct mwl8k_device_info mwl8k_info_tbl[] __devinitdata = {
+ [MWL8361P] = {
+ .part_name = "88w8361p",
+ .helper_image = "mwl8k/helper_8361p.fw",
+ .fw_image_sta = "mwl8k/fmimage_8361p.fw",
+ },
[MWL8363] = {
.part_name = "88w8363",
.helper_image = "mwl8k/helper_8363.fw",
@@ -5255,6 +5261,8 @@ static struct mwl8k_device_info mwl8k_info_tbl[] __devinitdata = {
},
};

+MODULE_FIRMWARE("mwl8k/helper_8361p.fw");
+MODULE_FIRMWARE("mwl8k/fmimage_8361p.fw");
MODULE_FIRMWARE("mwl8k/helper_8363.fw");
MODULE_FIRMWARE("mwl8k/fmimage_8363.fw");
MODULE_FIRMWARE("mwl8k/helper_8687.fw");
@@ -5264,6 +5272,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw");
MODULE_FIRMWARE(MWL8K_8366_AP_FW(MWL8K_8366_AP_FW_API));

static DEFINE_PCI_DEVICE_TABLE(mwl8k_pci_id_table) = {
+ { PCI_VDEVICE(MARVELL, 0x2a02), .driver_data = MWL8361P, },
{ PCI_VDEVICE(MARVELL, 0x2a0a), .driver_data = MWL8363, },
{ PCI_VDEVICE(MARVELL, 0x2a0c), .driver_data = MWL8363, },
{ PCI_VDEVICE(MARVELL, 0x2a24), .driver_data = MWL8363, },
--
1.7.9.5