Skip to content

Commit 798b737

Browse files
praveenCYpelwell
authored andcommitted
non-upstream: support DS1 exit firmware re-download
In deep sleep mode (DS1) ARM is off and once exit trigger comes than mailbox Interrupt comes to host and whole reinitiation should be done in the ARM to start TX/RX. Also fix below issus for DS1 exit: 1. Sent Tx Control frame only after firmware redownload complete (check F2 Ready before sending Tx Control frame to Firmware) 2. intermittent High DS1 TX Exit latency time (almost 3sec) ==> This is fixed by skipping host Mailbox interrupt Multiple times (ulp state mechanism) 3. RX GlOM save/restore in Firmware 4. Add ULP event enable & event_msgs_ext iovar configuration in FMAC 5. Add ULP_EVENT_RECV state machine for sbwad support 6. Support 2 Byte Shared memory read for DS1 Exit HUDI implementation Signed-off-by: Praveen Babu C <[email protected]> Signed-off-by: Naveen Gupta <[email protected]> [Merge from 4.14.77 to 5.4.18; set BRCMF_SDIO_MAX_ACCESS_ERRORS to 20] Signed-off-by: Chi-hsien Lin <[email protected]> JIRA: SWWLAN-135583 JIRA: SWWLAN-136577
1 parent 2ccc332 commit 798b737

File tree

10 files changed

+442
-17
lines changed

10 files changed

+442
-17
lines changed

drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ void brcmf_rx_event(struct device *dev, struct sk_buff *rxp);
298298

299299
int brcmf_alloc(struct device *dev, struct brcmf_mp_device *settings);
300300
/* Indication from bus module regarding presence/insertion of dongle. */
301-
int brcmf_attach(struct device *dev);
301+
int brcmf_attach(struct device *dev, bool start_bus);
302302
/* Indication from bus module regarding removal/absence of dongle */
303303
void brcmf_detach(struct device *dev);
304304
void brcmf_free(struct device *dev);

drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include "of.h"
2121
#include "firmware.h"
2222
#include "chip.h"
23+
#include "fweh.h"
24+
#include <brcm_hw_ids.h>
2325

2426
MODULE_AUTHOR("Broadcom Corporation");
2527
MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
@@ -274,6 +276,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
274276
char *clmver;
275277
char *ptr;
276278
s32 err;
279+
struct eventmsgs_ext *eventmask_msg = NULL;
280+
u8 msglen;
277281

278282
if (is_valid_ether_addr(ifp->mac_addr)) {
279283
/* set mac address */
@@ -427,6 +431,41 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
427431
goto done;
428432
}
429433

434+
/* Enable event_msg_ext specific to 43012 chip */
435+
if (bus->chip == CY_CC_43012_CHIP_ID) {
436+
/* Program event_msg_ext to support event larger than 128 */
437+
msglen = (roundup(BRCMF_E_LAST, NBBY) / NBBY) +
438+
EVENTMSGS_EXT_STRUCT_SIZE;
439+
/* Allocate buffer for eventmask_msg */
440+
eventmask_msg = kzalloc(msglen, GFP_KERNEL);
441+
if (!eventmask_msg) {
442+
err = -ENOMEM;
443+
goto done;
444+
}
445+
446+
/* Read the current programmed event_msgs_ext */
447+
eventmask_msg->ver = EVENTMSGS_VER;
448+
eventmask_msg->len = roundup(BRCMF_E_LAST, NBBY) / NBBY;
449+
err = brcmf_fil_iovar_data_get(ifp, "event_msgs_ext",
450+
eventmask_msg,
451+
msglen);
452+
453+
/* Enable ULP event */
454+
brcmf_dbg(EVENT, "enable event ULP\n");
455+
setbit(eventmask_msg->mask, BRCMF_E_ULP);
456+
457+
/* Write updated Event mask */
458+
eventmask_msg->ver = EVENTMSGS_VER;
459+
eventmask_msg->command = EVENTMSGS_SET_MASK;
460+
eventmask_msg->len = (roundup(BRCMF_E_LAST, NBBY) / NBBY);
461+
462+
err = brcmf_fil_iovar_data_set(ifp, "event_msgs_ext",
463+
eventmask_msg, msglen);
464+
if (err) {
465+
brcmf_err("Set event_msgs_ext error (%d)\n", err);
466+
goto done;
467+
}
468+
}
430469
/* Setup default scan channel time */
431470
err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
432471
BRCMF_DEFAULT_SCAN_CHANNEL_TIME);

drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@ int brcmf_alloc(struct device *dev, struct brcmf_mp_device *settings)
13181318
return 0;
13191319
}
13201320

1321-
int brcmf_attach(struct device *dev)
1321+
int brcmf_attach(struct device *dev, bool start_bus)
13221322
{
13231323
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
13241324
struct brcmf_pub *drvr = bus_if->drvr;
@@ -1355,10 +1355,13 @@ int brcmf_attach(struct device *dev)
13551355
/* attach firmware event handler */
13561356
brcmf_fweh_attach(drvr);
13571357

1358-
ret = brcmf_bus_started(drvr, drvr->ops);
1359-
if (ret != 0) {
1360-
bphy_err(drvr, "dongle is not responding: err=%d\n", ret);
1361-
goto fail;
1358+
if (start_bus) {
1359+
ret = brcmf_bus_started(drvr, drvr->ops);
1360+
if (ret != 0) {
1361+
bphy_err(drvr, "dongle is not responding: err=%d\n",
1362+
ret);
1363+
goto fail;
1364+
}
13621365
}
13631366

13641367
return 0;

drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#define BRCMF_MSGBUF_VAL 0x00040000
3030
#define BRCMF_PCIE_VAL 0x00080000
3131
#define BRCMF_FWCON_VAL 0x00100000
32+
#define BRCMF_ULP_VAL 0x00200000
3233

3334
/* set default print format */
3435
#undef pr_fmt

drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ struct brcmf_cfg80211_info;
9090
BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) \
9191
BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75) \
9292
BRCMF_ENUM_DEF(TDLS_PEER_EVENT, 92) \
93-
BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127)
93+
BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127) \
94+
BRCMF_ENUM_DEF(ULP, 146)
9495

9596
#define BRCMF_ENUM_DEF(id, val) \
9697
BRCMF_E_##id = (val),
@@ -102,7 +103,7 @@ enum brcmf_fweh_event_code {
102103
* minimum length check in device firmware so it is
103104
* hard-coded here.
104105
*/
105-
BRCMF_E_LAST = 139
106+
BRCMF_E_LAST = 147
106107
};
107108
#undef BRCMF_ENUM_DEF
108109

@@ -283,6 +284,28 @@ struct brcmf_if_event {
283284
u8 role;
284285
};
285286

287+
enum event_msgs_ext_command {
288+
EVENTMSGS_NONE = 0,
289+
EVENTMSGS_SET_BIT = 1,
290+
EVENTMSGS_RESET_BIT = 2,
291+
EVENTMSGS_SET_MASK = 3
292+
};
293+
294+
#define EVENTMSGS_VER 1
295+
#define EVENTMSGS_EXT_STRUCT_SIZE offsetof(struct eventmsgs_ext, mask[0])
296+
297+
/* len- for SET it would be mask size from the application to the firmware */
298+
/* for GET it would be actual firmware mask size */
299+
/* maxgetsize - is only used for GET. indicate max mask size that the */
300+
/* application can read from the firmware */
301+
struct eventmsgs_ext {
302+
u8 ver;
303+
u8 command;
304+
u8 len;
305+
u8 maxgetsize;
306+
u8 mask[1];
307+
};
308+
286309
typedef int (*brcmf_fweh_handler_t)(struct brcmf_if *ifp,
287310
const struct brcmf_event_msg *evtmsg,
288311
void *data);

drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2207,7 +2207,7 @@ static void brcmf_pcie_setup(struct device *dev, int ret,
22072207

22082208
init_waitqueue_head(&devinfo->mbdata_resp_wait);
22092209

2210-
ret = brcmf_attach(&devinfo->pdev->dev);
2210+
ret = brcmf_attach(&devinfo->pdev->dev, true);
22112211
if (ret)
22122212
goto fail;
22132213

0 commit comments

Comments
 (0)