public
Last active

Fix SD WLAN to compile against new kernels (2.6.35 - 3.1)

  • Download Gist
sd_wlan-linux-3.1.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
diff -Naur a/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/Makefile b/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/Makefile
--- a/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/Makefile 2010-07-13 22:08:32.000000000 +0200
+++ b/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/Makefile 2011-11-10 11:11:37.288408994 +0100
@@ -89,7 +89,7 @@
# ARCH specifies the architecture of the target processor, this kernel
# module will run.
# ARCH can be set on the command line
-# make ARCH=<arm/i386>
+# make ARCH=<arm/x86>
# Alternatively ARCH can be set in the environment
# Default values of ARCH for specific platform are set below.
ARCH ?= arm
diff -Naur a/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_drv.h b/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_drv.h
--- a/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_drv.h 2010-07-13 22:08:32.000000000 +0200
+++ b/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_drv.h 2011-11-10 11:11:37.288408994 +0100
@@ -727,11 +727,12 @@
wlan_copy_mcast_addr(wlan_adapter * Adapter, struct net_device *dev)
{
int i = 0;
- struct dev_mc_list *mcptr = dev->mc_list;
+ struct netdev_hw_addr *ha;
- for (i = 0; i < dev->mc_count; i++) {
- memcpy(&Adapter->MulticastList[i], mcptr->dmi_addr, ETH_ALEN);
- mcptr = mcptr->next;
+ netdev_for_each_mc_addr(ha, dev)
+ {
+ memcpy(&Adapter->MulticastList[i], ha->addr, ETH_ALEN);
+ i++;
}
return i;
diff -Naur a/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_headers.h b/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_headers.h
--- a/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_headers.h 2010-07-13 22:08:32.000000000 +0200
+++ b/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_headers.h 2011-11-10 11:12:58.048412861 +0100
@@ -53,6 +53,7 @@
#include <linux/proc_fs.h>
#include <linux/ptrace.h>
#include <linux/string.h>
+#include <linux/hardirq.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
#include <linux/config.h>
diff -Naur a/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_linux.h b/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_linux.h
--- a/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_linux.h 2010-07-13 22:08:32.000000000 +0200
+++ b/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_linux.h 2011-11-10 11:20:28.178434424 +0100
@@ -304,7 +304,11 @@
#define MODULE_PUT module_put(THIS_MODULE)
#endif
-#define OS_INIT_SEMAPHORE(x) init_MUTEX(x)
+#ifndef init_MUTEX
+#define OS_INIT_SEMAPHORE(x) sema_init(x, 1)
+#else
+#define OS_INIT_SEMAPHORE(x) init_MUTEX(x)
+#endif
#define OS_ACQ_SEMAPHORE_BLOCK(x) down_interruptible(x)
#define OS_ACQ_SEMAPHORE_NOBLOCK(x) down_trylock(x)
#define OS_REL_SEMAPHORE(x) up(x)
diff -Naur a/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_main.c b/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_main.c
--- a/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_main.c 2010-07-13 22:08:32.000000000 +0200
+++ b/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_main.c 2011-11-10 11:11:37.288408994 +0100
@@ -663,7 +663,7 @@
/* Multicast */
Adapter->CurrentPacketFilter &= ~HostCmd_ACT_MAC_PROMISCUOUS_ENABLE;
- if (dev->flags & IFF_ALLMULTI || dev->mc_count >
+ if (dev->flags & IFF_ALLMULTI || netdev_mc_count(dev) >
MRVDRV_MAX_MULTICAST_LIST_SIZE) {
PRINTM(INFO, "Enabling All Multicast!\n");
Adapter->CurrentPacketFilter |=
@@ -672,7 +672,7 @@
Adapter->CurrentPacketFilter &=
~HostCmd_ACT_MAC_ALL_MULTICAST_ENABLE;
- if (!dev->mc_count) {
+ if (!netdev_mc_count(dev)) {
PRINTM(INFO, "No multicast addresses - "
"disabling multicast!\n");
@@ -684,7 +684,7 @@
PRINTM(INFO, "Multicast addresses: %d\n", dev->mc_count);
- for (i = 0; i < dev->mc_count; i++) {
+ for (i = 0; i < netdev_mc_count(dev); i++) {
PRINTM(INFO, "Multicast address %d:"
"%x %x %x %x %x %x\n", i,
Adapter->MulticastList[i][0],
diff -Naur a/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_proc.c b/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_proc.c
--- a/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_proc.c 2010-07-13 22:08:32.000000000 +0200
+++ b/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_proc.c 2011-11-10 11:11:37.288408994 +0100
@@ -72,7 +72,7 @@
int i;
char *p = page;
struct net_device *netdev = data;
- struct dev_mc_list *mcptr = netdev->mc_list;
+ struct netdev_hw_addr *ha;
char fmt[64];
wlan_private *priv = (wlan_private *) netdev_priv(netdev);
wlan_adapter *Adapter = priv->adapter;
@@ -97,7 +97,7 @@
netdev->dev_addr[2], netdev->dev_addr[3],
netdev->dev_addr[4], netdev->dev_addr[5]);
- p += sprintf(p, "MCCount=\"%d\"\n", netdev->mc_count);
+ p += sprintf(p, "MCCount=\"%d\"\n", netdev_mc_count(netdev));
p += sprintf(p, "ESSID=\"%s\"\n",
(u8 *) Adapter->CurBssParams.BSSDescriptor.Ssid.Ssid);
p += sprintf(p, "Channel=\"%d\"\n",
@@ -107,15 +107,16 @@
/*
* Put out the multicast list
*/
- for (i = 0; i < netdev->mc_count; i++) {
+ i = 0;
+ netdev_for_each_mc_addr(ha, netdev) {
p += sprintf(p,
"MCAddr[%d]=\"%02x:%02x:%02x:%02x:%02x:%02x\"\n",
i,
- mcptr->dmi_addr[0], mcptr->dmi_addr[1],
- mcptr->dmi_addr[2], mcptr->dmi_addr[3],
- mcptr->dmi_addr[4], mcptr->dmi_addr[5]);
+ ha->addr[0], ha->addr[1],
+ ha->addr[2], ha->addr[3],
+ ha->addr[4], ha->addr[5]);
- mcptr = mcptr->next;
+ i++;
}
p += sprintf(p, "num_tx_bytes = %lu\n", priv->stats.tx_bytes);
p += sprintf(p, "num_rx_bytes = %lu\n", priv->stats.rx_bytes);

Compiles fine against a 2.6.38 kernel on i686 and arm targets

Hey Fleger, I get the following problem

voltagex@osiris:~/src$ patch -p1 < sd_wlan_2.6.35.diff
patching file SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/Makefile
patching file SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_drv.h
patching file SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_linux.h
Hunk #1 FAILED at 304.
1 out of 1 hunk FAILED -- saving rejects to file SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_linux.h.rej
patching file SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_main.c
patching file SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_proc.c

I uploaded a new version of the patch. Could you try again?

Looks good!

voltagex@osiris:~/src$ patch -p1 < sd_wlan_2.6.35.diff
patching file SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/Makefile
patching file SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_drv.h
patching file SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_linux.h
patching file SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_main.c
patching file SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src/wlan/wlan_proc.c

voltagex@osiris:~/src/SD_WLAN/SD-WLAN-BT-8688-LINUX2625-SAAR-10.49.3.p70-26609.P64_B1/wlan_src$ /sbin/modinfo sd8xxx.ko && /sbin/modinfo mcypt.ko
filename: sd8xxx.ko
license: GPL
version: 26609.p64
author: Marvell International Ltd.
description: M-WLAN Driver
srcversion: D79BE81C86CCA1E11D463BA
depends: mcypt
vermagic: 2.6.39.3 preempt mod_unload ARMv5
parm: helper_name:Helper name (charp)
parm: fw_name:Firmware name (charp)
parm: mfgmode:0: Download normal firmware; 1: Download MFG firmware (int)
filename: mcypt.ko
license: Marvell Proprietary
version: mcrypt_v001
srcversion: E394968F45642D312B87BF6
depends:

vermagic: 2.6.39.3 preempt mod_unload ARMv5

Looks like my firmware is incorrect now, thanks anyway >.<

You can get the right firmware from:
http://farcaster.zapto.org/alarm/dreamplug/arm/sd8688-firmware-20110710-1-any.pkg.tar.xz
The relevant files are lib/firmware/mrvl/sd8688.bin and lib/firmware/mrvl/helper_sd.bin.
Good luck.

root@dream:/usr/src# wget
http://farcaster.zapto.org/alarm/dreamplug/arm/sd8688-firmware-20110710-1-any.pkg.tar.xz
--2011-08-03 07:41:42--
http://farcaster.zapto.org/alarm/dreamplug/arm/sd8688-firmware-20110710-1-any.pkg.tar.xz
Resolving farcaster.zapto.org... 90.23.236.178
Connecting to farcaster.zapto.org|90.23.236.178|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 261932 (256K) [application/x-xz]
Saving to: `sd8688-firmware-20110710-1-any.pkg.tar.xz'

100%[======================================>] 261,932 89.5K/s in 2.9s

2011-08-03 07:41:46 (89.5 KB/s) -
`sd8688-firmware-20110710-1-any.pkg.tar.xz' saved [261932/261932]

root@dream:/usr/src# tar axf sd8688-firmware-20110710-1-any.pkg.tar.xz
xz: (stdin): Compressed data is corrupt
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now

Curious. It works fine here (MD5: 261f11b45e7a9395104bde26ef28fb0b).
Maybe a buggy version of xz?
Alternatively, you can get the firmware from the Debian or Ubuntu image here:
http://code.google.com/p/dreamplug/downloads/list

Buggy version of wget - seriously.
Tried it with wget and got different MD5s, tried it with curl and it worked.

For future reference, people with this driver need the following files:
43bbe1c1f003e50f2cb0daccedadbf8f /lib/firmware/mrvl/helper_sd.bin
52cd8f8296b9a7e1d3835d57416256b2 /lib/firmware/mrvl/sd8688_ap.bin
9df502bcc129ac4b453ffeecbcaa9152 /lib/firmware/mrvl/sd8688.bin

On Wed, Aug 3, 2011 at 3:27 PM, fleger
reply@reply.github.com
wrote:

Curious. It works fine here (MD5: 261f11b45e7a9395104bde26ef28fb0b).
Maybe a buggy version of xz?
Alternatively, you can get the firmware from the Debian or Ubuntu image here:
http://code.google.com/p/dreamplug/downloads/list

Reply to this email directly or view it on GitHub:
https://gist.github.com/961478

Patch updated to work against linux 3.1. Note that it breaks compatibility with pre 2.6.35 kernels.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.