-
Notifications
You must be signed in to change notification settings - Fork 31
/
5002-brcmfmac-Add-ability-to-manually-specify-FW-rambase-.patch
224 lines (200 loc) · 9.09 KB
/
5002-brcmfmac-Add-ability-to-manually-specify-FW-rambase-.patch
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
From 26c44d268ac1d328ef4cbd35a2a1a3d703346903 Mon Sep 17 00:00:00 2001
From: Aun-Ali Zaidi <[email protected]>
Date: Fri, 10 Jan 2020 19:41:21 -0600
Subject: [PATCH 2/2] brcmfmac: Add ability to manually specify FW rambase
address
This commit introduces the ability to manually pass the rambase address
for the brcmfmac chip as a kernel module option. The existing
brcmf_chip_tcm_rambase() function is bypassed when this option is
supplied. This is very useful when debugging support for newer chipsets
that are not provided by the aforementioned function.
Tested-by: Aun-Ali Zaidi <[email protected]>
Signed-off-by: Aun-Ali Zaidi <[email protected]>
---
.../broadcom/brcm80211/brcmfmac/chip.c | 19 ++++++++++++-------
.../broadcom/brcm80211/brcmfmac/chip.h | 7 +++++--
.../broadcom/brcm80211/brcmfmac/common.c | 5 +++++
.../broadcom/brcm80211/brcmfmac/common.h | 1 -
.../broadcom/brcm80211/brcmfmac/pcie.c | 4 ++--
.../broadcom/brcm80211/brcmfmac/sdio.c | 2 +-
.../broadcom/brcm80211/brcmfmac/settings.h | 4 ++++
7 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
index a3a257089696..039dcf7853a6 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
@@ -733,7 +733,7 @@ static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci)
return 0;
}
-int brcmf_chip_get_raminfo(struct brcmf_chip *pub)
+int brcmf_chip_get_raminfo(struct brcmf_chip *pub, struct brcmf_mp_device *settings)
{
struct brcmf_chip_priv *ci = container_of(pub, struct brcmf_chip_priv,
pub);
@@ -744,7 +744,9 @@ int brcmf_chip_get_raminfo(struct brcmf_chip *pub)
if (mem) {
mem_core = container_of(mem, struct brcmf_core_priv, pub);
ci->pub.ramsize = brcmf_chip_tcm_ramsize(mem_core);
- ci->pub.rambase = brcmf_chip_tcm_rambase(ci);
+ ci->pub.rambase = (settings &&
+ settings->rambase_addr > 0) ? settings->rambase_addr
+ : brcmf_chip_tcm_rambase(ci);
if (!ci->pub.rambase) {
brcmf_err("RAM base not provided with ARM CR4 core\n");
return -EINVAL;
@@ -755,7 +757,9 @@ int brcmf_chip_get_raminfo(struct brcmf_chip *pub)
mem_core = container_of(mem, struct brcmf_core_priv,
pub);
ci->pub.ramsize = brcmf_chip_sysmem_ramsize(mem_core);
- ci->pub.rambase = brcmf_chip_tcm_rambase(ci);
+ ci->pub.rambase = (settings &&
+ settings->rambase_addr > 0) ? settings->rambase_addr
+ : brcmf_chip_tcm_rambase(ci);
if (!ci->pub.rambase) {
brcmf_err("RAM base not provided with ARM CA7 core\n");
return -EINVAL;
@@ -941,7 +945,7 @@ int brcmf_chip_dmp_erom_scan(struct brcmf_chip_priv *ci)
return 0;
}
-static int brcmf_chip_recognition(struct brcmf_chip_priv *ci)
+static int brcmf_chip_recognition(struct brcmf_chip_priv *ci, struct brcmf_mp_device *settings)
{
struct brcmf_core *core;
u32 regdata;
@@ -1014,7 +1018,7 @@ static int brcmf_chip_recognition(struct brcmf_chip_priv *ci)
brcmf_chip_set_passive(&ci->pub);
}
- return brcmf_chip_get_raminfo(&ci->pub);
+ return brcmf_chip_get_raminfo(&ci->pub, settings);
}
static void brcmf_chip_disable_arm(struct brcmf_chip_priv *chip, u16 id)
@@ -1088,7 +1092,8 @@ static int brcmf_chip_setup(struct brcmf_chip_priv *chip)
}
struct brcmf_chip *brcmf_chip_attach(void *ctx,
- const struct brcmf_buscore_ops *ops)
+ const struct brcmf_buscore_ops *ops,
+ struct brcmf_mp_device *settings)
{
struct brcmf_chip_priv *chip;
int err = 0;
@@ -1117,7 +1122,7 @@ struct brcmf_chip *brcmf_chip_attach(void *ctx,
if (err < 0)
goto fail;
- err = brcmf_chip_recognition(chip);
+ err = brcmf_chip_recognition(chip, settings);
if (err < 0)
goto fail;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
index 8fa38658e727..7da0ef3129a0 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
@@ -7,6 +7,8 @@
#include <linux/types.h>
+#include "settings.h"
+
#define CORE_CC_REG(base, field) \
(base + offsetof(struct chipcregs, field))
@@ -69,9 +71,10 @@ struct brcmf_buscore_ops {
void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
};
-int brcmf_chip_get_raminfo(struct brcmf_chip *pub);
+int brcmf_chip_get_raminfo(struct brcmf_chip *pub, struct brcmf_mp_device *settings);
struct brcmf_chip *brcmf_chip_attach(void *ctx,
- const struct brcmf_buscore_ops *ops);
+ const struct brcmf_buscore_ops *ops,
+ struct brcmf_mp_device *settings);
void brcmf_chip_detach(struct brcmf_chip *chip);
struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid);
struct brcmf_core *brcmf_chip_get_d11core(struct brcmf_chip *pub, u8 unit);
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
index e3758bd86acf..46a525278848 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -67,6 +67,10 @@ static int brcmf_iapp_enable;
module_param_named(iapp, brcmf_iapp_enable, int, 0);
MODULE_PARM_DESC(iapp, "Enable partial support for the obsoleted Inter-Access Point Protocol");
+static uint brcmf_rambase_addr;
+module_param_named(rambase_addr, brcmf_rambase_addr, uint, 0);
+MODULE_PARM_DESC(rambase_addr, "Manually specify FW shared rambase address");
+
#ifdef DEBUG
/* always succeed brcmf_bus_started() */
static int brcmf_ignore_probe_fail;
@@ -416,6 +420,7 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
#ifdef DEBUG
settings->ignore_probe_fail = !!brcmf_ignore_probe_fail;
#endif
+ settings->rambase_addr = brcmf_rambase_addr;
if (bus_type == BRCMF_BUSTYPE_SDIO)
settings->bus.sdio.txglomsz = brcmf_sdiod_txglomsz;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
index 6cde5ee13e7a..0da7eeeb7768 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
@@ -6,7 +6,6 @@
#define BRCMFMAC_COMMON_H
#include <linux/platform_device.h>
-#include <linux/platform_data/brcmfmac.h>
#include "fwil_types.h"
#include "settings.h"
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index 39381cbde89e..a9575ae8add1 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -1772,7 +1772,7 @@ static void brcmf_pcie_setup(struct device *dev, int ret,
nvram_len = fwreq->items[BRCMF_PCIE_FW_NVRAM].nv_data.len;
kfree(fwreq);
- ret = brcmf_chip_get_raminfo(devinfo->ci);
+ ret = brcmf_chip_get_raminfo(devinfo->ci, devinfo->settings);
if (ret) {
brcmf_err(bus, "Failed to get RAM info\n");
goto fail;
@@ -1884,7 +1884,7 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
devinfo->pdev = pdev;
pcie_bus_dev = NULL;
- devinfo->ci = brcmf_chip_attach(devinfo, &brcmf_pcie_buscore_ops);
+ devinfo->ci = brcmf_chip_attach(devinfo, &brcmf_pcie_buscore_ops, devinfo->settings);
if (IS_ERR(devinfo->ci)) {
ret = PTR_ERR(devinfo->ci);
devinfo->ci = NULL;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index ac3ee93a2378..d4bf1c7e3c81 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -3962,7 +3962,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdio *bus)
goto fail;
}
- bus->ci = brcmf_chip_attach(sdiodev, &brcmf_sdio_buscore_ops);
+ bus->ci = brcmf_chip_attach(sdiodev, &brcmf_sdio_buscore_ops, sdiodev->settings);
if (IS_ERR(bus->ci)) {
brcmf_err("brcmf_chip_attach failed!\n");
bus->ci = NULL;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/settings.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/settings.h
index 7bab0d362cdd..160e32f32bd8 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/settings.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/settings.h
@@ -4,6 +4,8 @@
#ifndef BRCMFMAC_SETTINGS_H
#define BRCMFMAC_SETTINGS_H
+#include <linux/platform_data/brcmfmac.h>
+
/* Definition for the device specific settings are defined here. One struct
* is used called brcmf_mp_device. The device specific settings is part of
* the drvr struct and should be initialized on every brcmf_attach.
@@ -19,6 +21,7 @@
* @ignore_probe_fail: Ignore probe failure.
* @country_codes: If available, pointer to struct for translating country codes
* @bus: Bus specific platform data. Only SDIO at the mmoment.
+ * @rambase_addr: Manually specified FW shared rambase address.
*/
struct brcmf_mp_device {
bool p2p_enable;
@@ -32,6 +35,7 @@ struct brcmf_mp_device {
union {
struct brcmfmac_sdio_pd sdio;
} bus;
+ u32 rambase_addr;
};
#endif /* BRCMFMAC_SETTINGS_H */
--
2.30.0