Skip to content

Commit 9122a63

Browse files
committed
drivers: wifi: Add support for testing NRF71
Add support for testing NRF71. Signed-off-by: Ajay Parida <[email protected]>
1 parent bc6d4d7 commit 9122a63

File tree

13 files changed

+135
-9
lines changed

13 files changed

+135
-9
lines changed

boards/nordic/nrf7002dk/nrf5340_cpuapp_common_pinctrl.dtsi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@
5757
<NRF_PSEL(QSPI_IO1, 0, 14)>,
5858
<NRF_PSEL(QSPI_IO2, 0, 15)>,
5959
<NRF_PSEL(QSPI_IO3, 0, 16)>;
60+
nordic,drive-mode = <NRF_DRIVE_E0E1>;
6061
bias-pull-down;
6162
};
6263
group2 {
6364
psels = <NRF_PSEL(QSPI_CSN, 0, 18)>;
65+
nordic,drive-mode = <NRF_DRIVE_E0E1>;
6466
bias-pull-up;
6567
};
6668
};
@@ -72,10 +74,12 @@
7274
<NRF_PSEL(QSPI_IO1, 0, 14)>,
7375
<NRF_PSEL(QSPI_IO2, 0, 15)>,
7476
<NRF_PSEL(QSPI_IO3, 0, 16)>;
77+
nordic,drive-mode = <NRF_DRIVE_E0E1>;
7578
bias-pull-down;
7679
};
7780
group2 {
7881
psels = <NRF_PSEL(QSPI_CSN, 0, 18)>;
82+
nordic,drive-mode = <NRF_DRIVE_E0E1>;
7983
bias-pull-up;
8084
};
8185
low-power-enable;

drivers/wifi/nrf_wifi/src/fmac_main.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ BUILD_ASSERT(CONFIG_NRF70_MAX_TX_AGGREGATION <= 15,
6969
"Max TX aggregation is 15");
7070
BUILD_ASSERT(CONFIG_NRF70_RX_NUM_BUFS >= 1,
7171
"At least one RX buffer is required");
72+
#ifdef CONFIG_WIFI_NRF71
73+
BUILD_ASSERT(RPU_DATA_RAM_SIZE - TOTAL_RX_SIZE >= TOTAL_TX_SIZE,
74+
#else
7275
BUILD_ASSERT(RPU_PKTRAM_SIZE - TOTAL_RX_SIZE >= TOTAL_TX_SIZE,
76+
#endif /* CONFGI_WIFI_NRF71 */
7377
"Packet RAM overflow: not enough memory for TX");
7478

7579
BUILD_ASSERT(CONFIG_NRF70_TX_MAX_DATA_SIZE >= MAX_TX_FRAME_SIZE,
@@ -631,21 +635,32 @@ enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv
631635
}
632636

633637
rpu_ctx_zep->rpu_ctx = rpu_ctx;
634-
638+
#ifdef CONFIG_WIFI_NRF71
639+
/** Block the loading of firmware as
640+
* it has to be done from codescape for NRF71 case.
641+
*/
642+
/** Check if frimware loaded properly */
643+
status = nrf_wifi_fmac_fw_boot(rpu_ctx);
644+
if (status != NRF_WIFI_STATUS_SUCCESS) {
645+
LOG_ERR("%s: nrf_wifi_fw_boot failed", __func__);
646+
goto err;
647+
} else {
648+
printf("Boot check passed\n");
649+
}
650+
#else
635651
status = nrf_wifi_fw_load(rpu_ctx);
636652
if (status != NRF_WIFI_STATUS_SUCCESS) {
637653
LOG_ERR("%s: nrf_wifi_fw_load failed", __func__);
638654
goto err;
639655
}
640-
656+
#endif /* CONFIG_WIFI_NRF71 */
641657
status = nrf_wifi_fmac_ver_get(rpu_ctx,
642658
&fw_ver);
643659

644660
if (status != NRF_WIFI_STATUS_SUCCESS) {
645661
LOG_ERR("%s: FW version read failed", __func__);
646662
goto err;
647663
}
648-
649664
LOG_DBG("Firmware (v%d.%d.%d.%d) booted successfully",
650665
NRF_WIFI_UMAC_VER(fw_ver),
651666
NRF_WIFI_UMAC_VER_MAJ(fw_ver),
@@ -833,7 +848,11 @@ static int nrf_wifi_drv_main_zep(const struct device *dev)
833848

834849
sys_fpriv = wifi_fmac_priv(rpu_drv_priv_zep.fmac_priv);
835850
sys_fpriv->max_ampdu_len_per_token =
851+
#ifdef CONFIG_WIFI_NRF71
852+
(RPU_DATA_RAM_SIZE - (CONFIG_NRF70_RX_NUM_BUFS * CONFIG_NRF70_RX_MAX_DATA_SIZE)) /
853+
#else
836854
(RPU_PKTRAM_SIZE - (CONFIG_NRF70_RX_NUM_BUFS * CONFIG_NRF70_RX_MAX_DATA_SIZE)) /
855+
#endif /* CONFIG_WIFI_NRF71 */
837856
CONFIG_NRF70_MAX_TX_TOKENS;
838857
/* Align to 4-byte */
839858
sys_fpriv->max_ampdu_len_per_token &= ~0x3;

drivers/wifi/nrf_wifi/src/wifi_mgmt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,13 @@ void nrf_wifi_event_proc_get_power_save_info(void *vif_ctx,
393393
vif_ctx_zep->ps_info->ps_params.timeout_ms = ps_info->ps_timeout;
394394
vif_ctx_zep->ps_info->ps_params.listen_interval = ps_info->listen_interval;
395395
vif_ctx_zep->ps_info->ps_params.wakeup_mode = ps_info->extended_ps;
396+
#ifndef CONFIG_WIFI_NRF71
396397
if (ps_info->ps_exit_strategy == EVERY_TIM) {
397398
vif_ctx_zep->ps_info->ps_params.exit_strategy = WIFI_PS_EXIT_EVERY_TIM;
398399
} else if (ps_info->ps_exit_strategy == INT_PS) {
399400
vif_ctx_zep->ps_info->ps_params.exit_strategy = WIFI_PS_EXIT_CUSTOM_ALGO;
400401
}
401-
402+
#endif /* !CONFIG_WIFI_NRF71 */
402403
for (int i = 0; i < ps_info->num_twt_flows; i++) {
403404
struct twt_interval_float twt_interval_fp;
404405
struct wifi_twt_flow_info *twt_zep = &vif_ctx_zep->ps_info->twt_flows[i];

include/zephyr/drivers/wifi/nrf_wifi/bus/rpu_hw_if.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@
1616
#include <stdlib.h>
1717
#include <zephyr/drivers/gpio.h>
1818

19+
#ifdef CONFIG_WIFI_NRF71
20+
enum {
21+
WIFIMCU_REG = 0,
22+
RAM0,
23+
RAM1,
24+
DATARAM,
25+
CODERAM,
26+
RAM2,
27+
BELLBOARD,
28+
GRTC,
29+
WICR,
30+
SECURERAM,
31+
NUM_MEM_BLOCKS
32+
};
33+
#else /* CONFIG_WIFI_NRF71 */
1934
enum {
2035
SYSBUS = 0,
2136
EXT_SYS_BUS,
@@ -30,6 +45,7 @@ enum {
3045
UMAC_SRC_RAM,
3146
NUM_MEM_BLOCKS
3247
};
48+
#endif /* !CONFIG_WIFI_NRF71 */
3349

3450
/* Keeping it higher to avoid changing it ofter, but modify this value
3551
* if rpu_7002_memmap is changed.
@@ -63,4 +79,9 @@ int sr_ant_switch(unsigned int ant_switch);
6379
int sr_gpio_remove(void);
6480
int sr_gpio_config(void);
6581
#endif /* CONFIG_NRF70_SR_COEX_RF_SWITCH */
82+
#ifdef CONFIG_WIFI_NRF71
83+
int rpu_validate_addr(uint32_t start_addr, uint32_t len, bool *hl_flag);
84+
int rpu_pwron(void);
85+
int rpu_gpio_config(void);
86+
#endif /* CONFIG_WIFI_NRF71 */
6687
#endif /* __RPU_HW_IF_H_ */

modules/nrf_wifi/bus/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,7 @@ if (CONFIG_NRF70_BUSLIB)
5858
ipc_service.c
5959
spsc_qm.c
6060
)
61+
zephyr_library_include_directories_ifdef(CONFIG_WIFI_NRF71
62+
${NRF_WIFI_DIR}/bus_if/bus/qspi/inc
63+
)
6164
endif()

modules/nrf_wifi/bus/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,9 @@ config NRF70_LOG_VERBOSE
5353
bool "Maintains the verbosity of information in logs"
5454
default y
5555

56+
config WIFI_NRF71
57+
bool "For nrf71 testing with fpga"
58+
select EXPERIMENTAL
59+
help
60+
Enable to do system testn with nrf71 and fpga
5661
endif # NRF70_BUSLIB

modules/nrf_wifi/bus/device.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ struct qspi_config *qspi_defconfig(void)
6060
config.test_name = "QSPI TEST";
6161
config.test_hlread = false;
6262
config.test_iteration = 0;
63-
6463
config.qspi_slave_latency = 0;
65-
64+
#ifdef CONFIG_WIFI_NRF71
65+
config.qspi_slave_latency = 1;
66+
#endif /* CONFIG_WIFI_NRF71 */
6667
config.encryption = config.CMD_CNONCE = false;
6768

6869
#if defined(CONFIG_NRF70_ON_QSPI) && (NRF_QSPI_HAS_XIP_ENC || NRF_QSPI_HAS_DMA_ENC)

modules/nrf_wifi/bus/qspi_if.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,9 +1243,11 @@ void qspi_update_nonce(unsigned int addr, int len, int hlread)
12431243
void qspi_addr_check(unsigned int addr, const void *data, unsigned int len)
12441244
{
12451245
if ((addr % 4 != 0) || (((unsigned int)data) % 4 != 0) || (len % 4 != 0)) {
1246+
#ifndef CONFIG_WIFI_NRF71
12461247
LOG_ERR("%s : Unaligned address %x %x %d %x %x", __func__, addr,
12471248
(unsigned int)data, (addr % 4 != 0), (((unsigned int)data) % 4 != 0),
12481249
(len % 4 != 0));
1250+
#endif /* !CONFIG_WIFI_NRF71 */
12491251
}
12501252
}
12511253

modules/nrf_wifi/bus/rpu_hw_if.c

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,23 @@ GPIO_DT_SPEC_GET(NRF7002_NODE, iovdd_ctrl_gpios);
3535
static const struct gpio_dt_spec bucken_spec =
3636
GPIO_DT_SPEC_GET(NRF7002_NODE, bucken_gpios);
3737

38+
#ifdef CONFIG_WIFI_NRF71
39+
char blk_name[][15] = { "WIFIMCU_REG", "RAM0", "RAM1", "DATARAM",
40+
"CODERAM", "RAM2", "BELLBOARD", "GRTC", "WICR", "SECURERAM"};
41+
42+
uint32_t rpu_7002_memmap[][3] = {
43+
{ 0x000000, 0x0FFFFF, 1 },
44+
{ 0x100000, 0x17FFFF, 1 }, /* RAM0 is LMAC Memory */
45+
{ 0x180000, 0x1FFFFF, 1 }, /* RAM1 is UMAC Memory */
46+
{ 0x200000, 0x2FFFFF, 0 }, /* PKTRAM is DATARAM */
47+
{ 0x300000, 0x37FFFF, 1 }, /* CODERAM is ROM (LMAC & UMAC) */
48+
{ 0x3C0000, 0x3DFFFF, 2 }, /* RAM2 is GRAM */
49+
{ 0x380000, 0x38FFFF, 1 }, /* BELLBOARD */
50+
{ 0x392000, 0x393FFF, 1 }, /* GRTC */
51+
{ 0x3B0000, 0x3BFFFF, 1 }, /* WICR */
52+
{ 0x3e0000, 0x3FFFFB, 1 } /* Secure RAM */
53+
};
54+
#else
3855
char blk_name[][15] = { "SysBus", "ExtSysBus", "PBus", "PKTRAM",
3956
"GRAM", "LMAC_ROM", "LMAC_RET_RAM", "LMAC_SRC_RAM",
4057
"UMAC_ROM", "UMAC_RET_RAM", "UMAC_SRC_RAM" };
@@ -52,6 +69,7 @@ uint32_t rpu_7002_memmap[][3] = {
5269
{ 0x280000, 0x2A4000, 1 },
5370
{ 0x300000, 0x338000, 1 }
5471
};
72+
#endif /* CONFIG_WIFI_NRF71 */
5573

5674
static const struct qspi_dev *qdev;
5775
static struct qspi_config *cfg;
@@ -66,7 +84,11 @@ static int validate_addr_blk(uint32_t start_addr,
6684

6785
if (((start_addr >= block_map[0]) && (start_addr <= block_map[1])) &&
6886
((end_addr >= block_map[0]) && (end_addr <= block_map[1]))) {
87+
#ifdef CONFIG_WIFI_NRF71
88+
if (block_no == DATARAM) {
89+
#else
6990
if (block_no == PKTRAM) {
91+
#endif /* CONFIG_WIFI_NRF71 */
7092
*hl_flag = 0;
7193
}
7294
*selected_blk = block_no;
@@ -76,7 +98,11 @@ static int validate_addr_blk(uint32_t start_addr,
7698
return -1;
7799
}
78100

101+
#ifdef CONFIG_WIFI_NRF71
102+
int rpu_validate_addr(uint32_t start_addr, uint32_t len, bool *hl_flag)
103+
#else /* CONFIG_WIFI_NRF71 */
79104
static int rpu_validate_addr(uint32_t start_addr, uint32_t len, bool *hl_flag)
105+
#endif /* !CONFIG_WIFI_NRF71 */
80106
{
81107
int ret = 0, i;
82108
uint32_t end_addr;
@@ -97,8 +123,11 @@ static int rpu_validate_addr(uint32_t start_addr, uint32_t len, bool *hl_flag)
97123
LOG_ERR("Address validation failed - pls check memmory map and re-try");
98124
return -1;
99125
}
100-
126+
#ifdef CONFIG_WIFI_NRF71
127+
if (selected_blk == CODERAM) {
128+
#else /* CONFIG_WIFI_NRF71 */
101129
if ((selected_blk == LMAC_ROM) || (selected_blk == UMAC_ROM)) {
130+
#endif /* !CONFIG_WIFI_NRF71 */
102131
LOG_ERR("Error: Cannot write to ROM blocks");
103132
return -1;
104133
}
@@ -168,8 +197,11 @@ int rpu_irq_remove(struct gpio_callback *irq_callback_data)
168197
out:
169198
return ret;
170199
}
171-
200+
#ifdef CONFIG_WIFI_NRF71
201+
int rpu_gpio_config(void)
202+
#else /* CONFIG_WIFI_NRF71 */
172203
static int rpu_gpio_config(void)
204+
#endif /* !CONFIG_WIFI_NRF71 */
173205
{
174206
int ret;
175207

@@ -221,7 +253,11 @@ static int rpu_gpio_remove(void)
221253
return ret;
222254
}
223255

256+
#ifdef CONFIG_WIFI_NRF71
257+
int rpu_pwron(void)
258+
#else /* CONFIG_WIFI_NRF71 */
224259
static int rpu_pwron(void)
260+
#endif /* !CONFIG_WIFI_NRF71 */
225261
{
226262
int ret;
227263

@@ -487,12 +523,14 @@ int rpu_enable(void)
487523
* successfully before it can be called. So, disable this for
488524
* nrf70_buslib only usage.
489525
*/
526+
#ifndef CONFIG_WIFI_NRF71
490527
#ifdef CONFIG_WIFI_NRF70
491528
ret = rpu_validate_comms();
492529
if (ret) {
493530
goto rpu_pwroff;
494531
}
495532
#endif
533+
#endif /* !CONFIG_WIFI_NRF71 */
496534
return 0;
497535
rpu_pwroff:
498536
rpu_pwroff();

modules/nrf_wifi/os/shim.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ static unsigned int zep_shim_qspi_read_reg32(void *priv, unsigned long addr)
156156

157157
dev = qspi_priv->qspi_dev;
158158

159+
#ifdef CONFIG_WIFI_NRF71
160+
if (addr < 0x200000) {
161+
#else
159162
if (addr < 0x0C0000) {
163+
#endif /* CONFIG_WIFI_NRF71 */
160164
dev->hl_read(addr, &val, 4);
161165
} else {
162166
dev->read(addr, &val, 4);
@@ -182,8 +186,11 @@ static void zep_shim_qspi_cpy_from(void *priv, void *dest, unsigned long addr, s
182186
size_t count_aligned = ROUND_UP(count, 4);
183187

184188
dev = qspi_priv->qspi_dev;
185-
189+
#ifdef CONFIG_WIFI_NRF71
190+
if (addr < 0x200000) {
191+
#else
186192
if (addr < 0x0C0000) {
193+
#endif /* CONFIG_WIFI_NRF71 */
187194
dev->hl_read(addr, dest, count_aligned);
188195
} else {
189196
dev->read(addr, dest, count_aligned);

0 commit comments

Comments
 (0)