Skip to content

Commit aa550fa

Browse files
committed
NRF71 Hard reset support
Hard Reset support for NRF71. Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
1 parent 10df184 commit aa550fa

File tree

13 files changed

+260
-155
lines changed

13 files changed

+260
-155
lines changed

bus_if/bal/inc/bal_api.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ void nrf_wifi_bal_write_block(void *ctx,
127127
unsigned long dest_addr_offset,
128128
const void *src_addr,
129129
size_t len);
130-
131130
/**
132131
* @brief Map a virtual address to a physical address for DMA transfer.
133132
*

bus_if/bal/inc/bal_ops.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ struct nrf_wifi_bal_ops {
142142
unsigned long phy_addr,
143143
size_t len,
144144
enum nrf_wifi_osal_dma_dir dma_dir);
145-
146145
#if defined(NRF_WIFI_LOW_POWER) || defined(__DOXYGEN__)
147146
/**
148147
* @brief Put the device into power-saving sleep mode.

bus_if/bus/pcie/src/pcie.c

Lines changed: 43 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ int nrf_wifi_bus_pcie_irq_handler(void *data)
2828
}
2929

3030
void *nrf_wifi_bus_pcie_dev_add(void *bus_priv,
31-
void *bal_dev_ctx)
31+
void *bal_dev_ctx)
3232
{
3333
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
3434
struct nrf_wifi_bus_pcie_priv *pcie_priv = NULL;
@@ -79,12 +79,10 @@ void *nrf_wifi_bus_pcie_dev_add(void *bus_priv,
7979
pcie_dev_ctx->addr_pktram_base = pcie_priv->cfg_params.addr_pktram_base;
8080
#endif /* INLINE_BB_MODE */
8181
#ifdef OFFLINE_MODE
82-
pcie_dev_ctx->addr_pktram_base = ((unsigned long)pcie_dev_ctx->iomem_addr_base +
83-
pcie_priv->cfg_params.addr_pktram_base);
82+
pcie_dev_ctx->addr_pktram_base =
83+
((unsigned long)pcie_dev_ctx->iomem_addr_base +
84+
pcie_priv->cfg_params.addr_pktram_base);
8485
#endif /* OFFLINE_MODE */
85-
#ifdef INLINE_RX
86-
pcie_dev_ctx->addr_hostram_base_inline_rx = pcie_priv->cfg_params.addr_hostram_base_inline_rx;
87-
#endif
8886

8987
status = nrf_wifi_osal_bus_pcie_dev_intr_reg(
9088
pcie_dev_ctx->os_pcie_dev_ctx,
@@ -166,7 +164,7 @@ void nrf_wifi_bus_pcie_dev_deinit(void *bus_dev_ctx)
166164
}
167165

168166
void *nrf_wifi_bus_pcie_init(void *params,
169-
int (*intr_callbk_fn)(void *bal_dev_ctx))
167+
int (*intr_callbk_fn)(void *bal_dev_ctx))
170168
{
171169
struct nrf_wifi_bus_pcie_priv *pcie_priv = NULL;
172170

@@ -181,10 +179,9 @@ void *nrf_wifi_bus_pcie_init(void *params,
181179
goto out;
182180
}
183181

184-
nrf_wifi_osal_mem_cpy(
185-
&pcie_priv->cfg_params,
186-
params,
187-
sizeof(pcie_priv->cfg_params));
182+
nrf_wifi_osal_mem_cpy(&pcie_priv->cfg_params,
183+
params,
184+
sizeof(pcie_priv->cfg_params));
188185

189186
pcie_priv->intr_callbk_fn = intr_callbk_fn;
190187

@@ -201,8 +198,7 @@ void *nrf_wifi_bus_pcie_init(void *params,
201198
"%s: Unable to register PCIe driver",
202199
__func__);
203200

204-
nrf_wifi_osal_mem_free(
205-
pcie_priv);
201+
nrf_wifi_osal_mem_free(pcie_priv);
206202

207203
pcie_priv = NULL;
208204

@@ -218,15 +214,13 @@ void nrf_wifi_bus_pcie_deinit(void *bus_priv)
218214

219215
pcie_priv = bus_priv;
220216

221-
nrf_wifi_osal_bus_pcie_deinit(
222-
pcie_priv->os_pcie_priv);
217+
nrf_wifi_osal_bus_pcie_deinit(pcie_priv->os_pcie_priv);
223218

224-
nrf_wifi_osal_mem_free(
225-
pcie_priv);
219+
nrf_wifi_osal_mem_free(pcie_priv);
226220
}
227221

228222
unsigned int nrf_wifi_bus_pcie_read_word(void *dev_ctx,
229-
unsigned long addr_offset)
223+
unsigned long addr_offset)
230224
{
231225
struct nrf_wifi_bus_pcie_dev_ctx *pcie_dev_ctx = NULL;
232226
void *mmap_addr = NULL;
@@ -236,15 +230,14 @@ unsigned int nrf_wifi_bus_pcie_read_word(void *dev_ctx,
236230

237231
mmap_addr = pcie_dev_ctx->iomem_addr_base + addr_offset;
238232

239-
val = nrf_wifi_osal_iomem_read_reg32(
240-
mmap_addr);
233+
val = nrf_wifi_osal_iomem_read_reg32(mmap_addr);
241234

242235
return val;
243236
}
244237

245238
void nrf_wifi_bus_pcie_write_word(void *dev_ctx,
246-
unsigned long addr_offset,
247-
unsigned int val)
239+
unsigned long addr_offset,
240+
unsigned int val)
248241
{
249242
struct nrf_wifi_bus_pcie_dev_ctx *pcie_dev_ctx = NULL;
250243
void *mmap_addr = NULL;
@@ -253,15 +246,13 @@ void nrf_wifi_bus_pcie_write_word(void *dev_ctx,
253246

254247
mmap_addr = pcie_dev_ctx->iomem_addr_base + addr_offset;
255248

256-
nrf_wifi_osal_iomem_write_reg32(
257-
mmap_addr,
258-
val);
249+
nrf_wifi_osal_iomem_write_reg32(mmap_addr, val);
259250
}
260251

261252
void nrf_wifi_bus_pcie_read_block(void *dev_ctx,
262-
void *dest_addr,
263-
unsigned long src_addr_offset,
264-
size_t len)
253+
void *dest_addr,
254+
unsigned long src_addr_offset,
255+
size_t len)
265256
{
266257
struct nrf_wifi_bus_pcie_dev_ctx *pcie_dev_ctx = NULL;
267258
void *mmap_addr = NULL;
@@ -270,16 +261,13 @@ void nrf_wifi_bus_pcie_read_block(void *dev_ctx,
270261

271262
mmap_addr = pcie_dev_ctx->iomem_addr_base + src_addr_offset;
272263

273-
nrf_wifi_osal_iomem_cpy_from(
274-
dest_addr,
275-
mmap_addr,
276-
len);
264+
nrf_wifi_osal_iomem_cpy_from(dest_addr, mmap_addr, len);
277265
}
278266

279267
void nrf_wifi_bus_pcie_write_block(void *dev_ctx,
280-
unsigned long dest_addr_offset,
281-
const void *src_addr,
282-
size_t len)
268+
unsigned long dest_addr_offset,
269+
const void *src_addr,
270+
size_t len)
283271
{
284272
struct nrf_wifi_bus_pcie_dev_ctx *pcie_dev_ctx = NULL;
285273
void *mmap_addr = NULL;
@@ -288,43 +276,14 @@ void nrf_wifi_bus_pcie_write_block(void *dev_ctx,
288276

289277
mmap_addr = pcie_dev_ctx->iomem_addr_base + dest_addr_offset;
290278

291-
nrf_wifi_osal_iomem_cpy_to(
292-
mmap_addr,
293-
src_addr,
294-
len);
279+
nrf_wifi_osal_iomem_cpy_to(mmap_addr, src_addr, len);
295280
}
296-
#ifdef SOC_WEZEN
297-
#ifdef INLINE_RX
298-
unsigned long nrf_wifi_bus_pcie_dma_map_inline_rx(void *dev_ctx,
299-
unsigned long virt_addr,
300-
size_t len,
301-
enum nrf_wifi_osal_dma_dir dma_dir)
302-
{
303-
struct nrf_wifi_bus_pcie_dev_ctx *pcie_dev_ctx = NULL;
304-
unsigned long phy_addr = 0;
305281

306-
pcie_dev_ctx = (struct nrf_wifi_bus_pcie_dev_ctx *)dev_ctx;
307-
phy_addr = SOC_HOST_DATA_RAM_BASE + (virt_addr - pcie_dev_ctx->addr_hostram_base_inline_rx);
308-
return phy_addr;
309-
}
310-
unsigned long nrf_wifi_bus_pcie_dma_unmap_inline_rx(void *dev_ctx,
311-
unsigned long phy_addr,
312-
size_t len,
313-
enum nrf_wifi_osal_dma_dir dma_dir)
314-
{
315-
struct nrf_wifi_bus_pcie_dev_ctx *pcie_dev_ctx = NULL;
316-
unsigned long virt_addr = 0;
317-
pcie_dev_ctx = (struct nrf_wifi_bus_pcie_dev_ctx *)dev_ctx;
318-
virt_addr = pcie_dev_ctx->addr_hostram_base_inline_rx + (phy_addr - SOC_HOST_DATA_RAM_BASE);
319-
return virt_addr;
320-
}
321-
#endif
322-
#endif
323282

324283
unsigned long nrf_wifi_bus_pcie_dma_map(void *dev_ctx,
325-
unsigned long virt_addr,
326-
size_t len,
327-
enum nrf_wifi_osal_dma_dir dma_dir)
284+
unsigned long virt_addr,
285+
size_t len,
286+
enum nrf_wifi_osal_dma_dir dma_dir)
328287
{
329288
struct nrf_wifi_bus_pcie_dev_ctx *pcie_dev_ctx = NULL;
330289
unsigned long phy_addr = 0;
@@ -342,16 +301,17 @@ unsigned long nrf_wifi_bus_pcie_dma_map(void *dev_ctx,
342301
phy_addr = SOC_HOST_PKTRAM_BASE + (virt_addr - pcie_dev_ctx->addr_pktram_base);
343302
#endif /* INLINE_BB_MODE */
344303
#ifdef OFFLINE_MODE
345-
phy_addr = (unsigned long)pcie_dev_ctx->iomem_addr_base + (virt_addr - pcie_dev_ctx->addr_pktram_base);
304+
phy_addr = (unsigned long)pcie_dev_ctx->iomem_addr_base +
305+
(virt_addr - pcie_dev_ctx->addr_pktram_base);
346306
#endif /* OFFLINE_MODE */
347307

348308
return phy_addr;
349309
}
350310

351311
unsigned long nrf_wifi_bus_pcie_dma_unmap(void *dev_ctx,
352-
unsigned long phy_addr,
353-
size_t len,
354-
enum nrf_wifi_osal_dma_dir dma_dir)
312+
unsigned long phy_addr,
313+
size_t len,
314+
enum nrf_wifi_osal_dma_dir dma_dir)
355315
{
356316
struct nrf_wifi_bus_pcie_dev_ctx *pcie_dev_ctx = NULL;
357317
unsigned long virt_addr = 0;
@@ -372,16 +332,14 @@ unsigned long nrf_wifi_bus_pcie_dma_unmap(void *dev_ctx,
372332
virt_addr = pcie_dev_ctx->addr_pktram_base + (phy_addr - SOC_HOST_PKTRAM_BASE);
373333
#endif /* INLINE_BB_MODE */
374334
#ifdef OFFLINE_MODE
375-
#ifdef SOC_WEZEN
376-
status = pal_rpu_addr_offset_get(
377-
RPU_ADDR_DATA_RAM_START + phy_addr,
378-
&virt_addr,
379-
RPU_ADDR_DATA_RAM_START);
335+
#ifdef WIFI_NRF71
336+
status = pal_rpu_addr_offset_get(RPU_ADDR_DATA_RAM_START + phy_addr,
337+
&virt_addr,
338+
RPU_ADDR_DATA_RAM_START);
380339
#else
381-
status = pal_rpu_addr_offset_get(
382-
RPU_ADDR_PKTRAM_START + phy_addr,
383-
&virt_addr,
384-
RPU_ADDR_PKTRAM_START);
340+
status = pal_rpu_addr_offset_get(RPU_ADDR_PKTRAM_START + phy_addr,
341+
&virt_addr,
342+
RPU_ADDR_PKTRAM_START);
385343
#endif
386344
if (status != NRF_WIFI_STATUS_SUCCESS)
387345
nrf_wifi_osal_log_err(
@@ -400,13 +358,11 @@ void nrf_wifi_bus_pcie_rpu_ps_sleep(void *bus_dev_ctx)
400358
reg_addr = pal_rpu_ps_ctrl_reg_addr_get();
401359

402360
reg_val = nrf_wifi_bus_pcie_read_word(bus_dev_ctx,
403-
reg_addr);
361+
reg_addr);
404362

405363
reg_val &= (~(1 << RPU_REG_BIT_PS_CTRL));
406364

407-
nrf_wifi_bus_pcie_write_word(bus_dev_ctx,
408-
reg_addr,
409-
reg_val);
365+
nrf_wifi_bus_pcie_write_word(bus_dev_ctx, reg_addr, reg_val);
410366
}
411367

412368
void nrf_wifi_bus_pcie_rpu_ps_wake(void *bus_dev_ctx)
@@ -418,9 +374,7 @@ void nrf_wifi_bus_pcie_rpu_ps_wake(void *bus_dev_ctx)
418374

419375
reg_val = (1 << RPU_REG_BIT_PS_CTRL);
420376

421-
nrf_wifi_bal_write_word(bus_dev_ctx,
422-
reg_addr,
423-
reg_val);
377+
nrf_wifi_bal_write_word(bus_dev_ctx, reg_addr, reg_val);
424378
}
425379

426380
int nrf_wifi_bus_pcie_rpu_ps_status(void *bus_dev_ctx)
@@ -429,8 +383,7 @@ int nrf_wifi_bus_pcie_rpu_ps_status(void *bus_dev_ctx)
429383

430384
reg_addr = pal_rpu_ps_ctrl_reg_addr_get();
431385

432-
return nrf_wifi_bus_pcie_read_word(bus_dev_ctx,
433-
reg_addr);
386+
return nrf_wifi_bus_pcie_read_word(bus_dev_ctx, reg_addr);
434387
}
435388
#endif /* NRF_WIFI_LOW_POWER */
436389

@@ -447,12 +400,6 @@ struct nrf_wifi_bal_ops nrf_wifi_bus_pcie_ops = {
447400
.write_block = &nrf_wifi_bus_pcie_write_block,
448401
.dma_map = &nrf_wifi_bus_pcie_dma_map,
449402
.dma_unmap = &nrf_wifi_bus_pcie_dma_unmap,
450-
#ifdef SOC_WEZEN
451-
#ifdef INLINE_RX
452-
.dma_map_inline_rx = &nrf_wifi_bus_pcie_dma_map_inline_rx,
453-
.dma_unmap_inline_rx = &nrf_wifi_bus_pcie_dma_unmap_inline_rx,
454-
#endif
455-
#endif
456403
#ifdef NRF_WIFI_LOW_POWER
457404
.rpu_ps_sleep = &nrf_wifi_bus_pcie_rpu_ps_sleep,
458405
.rpu_ps_wake = &nrf_wifi_bus_pcie_rpu_ps_wake,

fw_if/umac_if/inc/fw/host_rpu_sys_if.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ struct umac_rx_dbg_params {
340340
unsigned int null_skb_pointer_from_lmac;
341341
/** Number of unexpected management packets received in coalesce event */
342342
unsigned int unexpected_mgmt_pkt;
343-
344343
} __NRF_WIFI_PKD;
345344

346345
/**
@@ -847,7 +846,7 @@ enum op_band {
847846
/** All bands */
848847
BAND_ALL,
849848
/** 2.4Ghz band */
850-
BAND_24G
849+
BAND_24G,
851850
};
852851

853852
/**

fw_if/umac_if/src/system/fmac_api.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "system/fmac_bb.h"
2525
#include "util.h"
2626

27-
2827
static unsigned char nrf_wifi_fmac_vif_idx_get(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx)
2928
{
3029
unsigned char i = 0;
@@ -371,7 +370,6 @@ struct nrf_wifi_fmac_dev_ctx *nrf_wifi_sys_fmac_dev_add(struct nrf_wifi_fmac_pri
371370
return fmac_dev_ctx;
372371
}
373372

374-
375373
enum nrf_wifi_status nrf_wifi_sys_fmac_dev_init(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
376374
#ifdef NRF_WIFI_LOW_POWER
377375
int sleep_type,
@@ -387,8 +385,8 @@ enum nrf_wifi_status nrf_wifi_sys_fmac_dev_init(struct nrf_wifi_fmac_dev_ctx *fm
387385
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
388386
#ifndef NRF71_ON_IPC
389387
struct nrf_wifi_fmac_otp_info otp_info;
390-
#endif /* !NRF71_ON_IPC */
391388
struct nrf_wifi_phy_rf_params phy_rf_params;
389+
#endif /* !NRF71_ON_IPC */
392390

393391
if (!fmac_dev_ctx) {
394392
nrf_wifi_osal_log_err("%s: Invalid device context",
@@ -3401,10 +3399,12 @@ static int nrf_wifi_sys_fmac_phy_rf_params_init(struct nrf_wifi_phy_rf_params *p
34013399
{
34023400
int ret = -1;
34033401
unsigned int rf_param_offset = BAND_2G_LW_ED_BKF_DSSS_OFST - NRF_WIFI_RF_PARAMS_CONF_SIZE;
3402+
34043403
/* Initilaize reserved bytes */
34053404
nrf_wifi_osal_mem_set(prf,
34063405
0x0,
34073406
sizeof(prf));
3407+
34083408
/* Initialize PD adjust values for MCS7. Currently these 4 bytes are not being used */
34093409
prf->pd_adjust_val.pd_adjt_lb_chan = PD_ADJUST_VAL;
34103410
prf->pd_adjust_val.pd_adjt_hb_low_chan = PD_ADJUST_VAL;
@@ -3578,30 +3578,29 @@ enum nrf_wifi_status nrf_wifi_sys_fmac_rf_params_get(struct nrf_wifi_fmac_dev_ct
35783578
__func__);
35793579
goto out;
35803580
}
3581-
#ifndef WIFI_NRF71
3581+
35823582
status = nrf_wifi_hal_otp_pack_info_get(fmac_dev_ctx->hal_dev_ctx,
35833583
&package_info);
35843584
if (status != NRF_WIFI_STATUS_SUCCESS) {
35853585
nrf_wifi_osal_log_err("%s: Fetching of Package info failed",
35863586
__func__);
35873587
goto out;
35883588
}
3589-
#endif /* !WIFI_NRF71 */
3589+
35903590
ret = nrf_wifi_sys_fmac_phy_rf_params_init(phy_rf_params,
35913591
package_info,
35923592
NRF_WIFI_SYS_DEF_RF_PARAMS);
3593-
35943593
if (ret == -1) {
35953594
nrf_wifi_osal_log_err("%s: Initialization of RF params with default values failed",
35963595
__func__);
35973596
status = NRF_WIFI_STATUS_FAIL;
35983597
goto out;
35993598
}
3599+
36003600
if (!(otp_info.flags & (~CALIB_XO_FLAG_MASK))) {
36013601
nrf_wifi_osal_mem_cpy(&phy_rf_params->xo_offset.xo_freq_offset,
36023602
(char *)otp_info.info.calib + OTP_OFF_CALIB_XO,
36033603
OTP_SZ_CALIB_XO);
3604-
36053604
}
36063605

36073606
ft_prog_ver = (ft_prog_ver & FT_PROG_VER_MASK) >> 16;

0 commit comments

Comments
 (0)