]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.32.12/b43-fall-back-gracefully-to-pio-mode-after-fatal-dma-errors.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.12 / b43-fall-back-gracefully-to-pio-mode-after-fatal-dma-errors.patch
CommitLineData
3ababc44
GKH
1From 9e3bd9190800e8209b4a3e1d724c35f0738dcad2 Mon Sep 17 00:00:00 2001
2From: Linus Torvalds <torvalds@linux-foundation.org>
3Date: Fri, 26 Feb 2010 10:34:27 -0800
4Subject: b43: fall back gracefully to PIO mode after fatal DMA errors
5
6From: Linus Torvalds <torvalds@linux-foundation.org>
7
8commit 9e3bd9190800e8209b4a3e1d724c35f0738dcad2 upstream.
9
10This makes the b43 driver just automatically fall back to PIO mode when
11DMA doesn't work.
12
13The driver already told the user to do it, so rather than have the user
14reload the module with a new flag, just make the driver do it
15automatically. We keep the message as an indication that something is
16wrong, but now just automatically fall back to the hopefully working PIO
17case.
18
19(Some post-2.6.33 merge fixups by Larry Finger <Larry.Finger@lwfinger.net>
20and yours truly... -- JWL)
21
22Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
23Signed-off-by: John W. Linville <linville@tuxdriver.com>
24Cc: maximilian attems <max@stro.at>
25Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
26
27---
28 drivers/net/wireless/b43/Kconfig | 19 +++++++++++++++++--
29 drivers/net/wireless/b43/b43.h | 7 +++++++
30 drivers/net/wireless/b43/main.c | 14 ++++++++------
31 3 files changed, 32 insertions(+), 8 deletions(-)
32
33--- a/drivers/net/wireless/b43/Kconfig
34+++ b/drivers/net/wireless/b43/Kconfig
35@@ -3,7 +3,6 @@ config B43
36 depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 && HAS_DMA
37 select SSB
38 select FW_LOADER
39- select SSB_BLOCKIO
40 ---help---
41 b43 is a driver for the Broadcom 43xx series wireless devices.
42
43@@ -79,6 +78,14 @@ config B43_SDIO
44
45 If unsure, say N.
46
47+#Data transfers to the device via PIO. We want it as a fallback even
48+# if we can do DMA.
49+config B43_PIO
50+ bool
51+ depends on B43
52+ select SSB_BLOCKIO
53+ default y
54+
55 config B43_NPHY
56 bool "Pre IEEE 802.11n support (BROKEN)"
57 depends on B43 && EXPERIMENTAL && BROKEN
58@@ -130,4 +137,12 @@ config B43_DEBUG
59 for production use.
60 Only say Y, if you are debugging a problem in the b43 driver sourcecode.
61
62-
63+config B43_FORCE_PIO
64+ bool "Force usage of PIO instead of DMA"
65+ depends on B43 && B43_DEBUG
66+ ---help---
67+ This will disable DMA and always enable PIO instead.
68+
69+ Say N!
70+ This is only for debugging the PIO engine code. You do
71+ _NOT_ want to enable this.
72--- a/drivers/net/wireless/b43/b43.h
73+++ b/drivers/net/wireless/b43/b43.h
74@@ -696,6 +696,7 @@ struct b43_wldev {
75 bool radio_hw_enable; /* saved state of radio hardware enabled state */
76 bool qos_enabled; /* TRUE, if QoS is used. */
77 bool hwcrypto_enabled; /* TRUE, if HW crypto acceleration is enabled. */
78+ bool use_pio; /* TRUE if next init should use PIO */
79
80 /* PHY/Radio device. */
81 struct b43_phy phy;
82@@ -890,6 +891,12 @@ static inline bool b43_using_pio_transfe
83 return dev->__using_pio_transfers;
84 }
85
86+#ifdef CONFIG_B43_FORCE_PIO
87+# define B43_PIO_DEFAULT 1
88+#else
89+# define B43_PIO_DEFAULT 0
90+#endif
91+
92 /* Message printing */
93 void b43info(struct b43_wl *wl, const char *fmt, ...)
94 __attribute__ ((format(printf, 2, 3)));
95--- a/drivers/net/wireless/b43/main.c
96+++ b/drivers/net/wireless/b43/main.c
97@@ -102,9 +102,9 @@ int b43_modparam_verbose = B43_VERBOSITY
98 module_param_named(verbose, b43_modparam_verbose, int, 0644);
99 MODULE_PARM_DESC(verbose, "Log message verbosity: 0=error, 1=warn, 2=info(default), 3=debug");
100
101-static int modparam_pio;
102-module_param_named(pio, modparam_pio, int, 0444);
103-MODULE_PARM_DESC(pio, "enable(1) / disable(0) PIO mode");
104+int b43_modparam_pio = B43_PIO_DEFAULT;
105+module_param_named(pio, b43_modparam_pio, int, 0644);
106+MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO");
107
108 static const struct ssb_device_id b43_ssb_tbl[] = {
109 SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 5),
110@@ -1793,8 +1793,9 @@ static void b43_do_interrupt_thread(stru
111 dma_reason[4], dma_reason[5]);
112 b43err(dev->wl, "This device does not support DMA "
113 "on your system. Please use PIO instead.\n");
114- b43err(dev->wl, "Unload the b43 module and reload "
115- "with 'pio=1'\n");
116+ /* Fall back to PIO transfers if we get fatal DMA errors! */
117+ dev->use_pio = 1;
118+ b43_controller_restart(dev, "DMA error");
119 return;
120 }
121 if (merged_dma_reason & B43_DMAIRQ_NONFATALMASK) {
122@@ -4361,7 +4362,7 @@ static int b43_wireless_core_init(struct
123
124 if ((dev->dev->bus->bustype == SSB_BUSTYPE_PCMCIA) ||
125 (dev->dev->bus->bustype == SSB_BUSTYPE_SDIO) ||
126- modparam_pio) {
127+ dev->use_pio) {
128 dev->__using_pio_transfers = 1;
129 err = b43_pio_init(dev);
130 } else {
131@@ -4829,6 +4830,7 @@ static int b43_one_core_attach(struct ss
132 if (!wldev)
133 goto out;
134
135+ wldev->use_pio = b43_modparam_pio;
136 wldev->dev = dev;
137 wldev->wl = wl;
138 b43_set_status(wldev, B43_STAT_UNINIT);