Skip to content

Commit 4872e85

Browse files
lopeztelcarlescufi
authored andcommitted
softperipheral: rev ad238bfc1d4c93a5fee8e802ac3026ab77740c4d
Holding transfers not supported. Enforcing data swap and reordering units to match. Alternative deactivation and uninit sequence for nRF54H20. Signed-off-by: Luis David Lopez <[email protected]>
1 parent 08eea6e commit 4872e85

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

softperipheral/sQSPI/include/nrf54h20/sqspi_firmware_v0.1.0.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ const uint8_t sqspi_firmware_bin[] = {
800800
0xf5, 0xff, 0xb7, 0x07, 0x00, 0x10, 0x73, 0xb0, 0x57, 0x7e, 0x82, 0x80,
801801
0xb7, 0x47, 0x89, 0x2f, 0x05, 0x47, 0x23, 0xac, 0xe7, 0xe2, 0x1c, 0x41,
802802
0xed, 0x8f, 0x99, 0xc7, 0xb7, 0x07, 0x00, 0x10, 0x73, 0xa0, 0x27, 0x7e,
803-
0x73, 0xb0, 0x57, 0x7e, 0x82, 0x80, 0x73, 0xd0, 0x17, 0x7c, 0x73, 0x60,
803+
0x73, 0xb0, 0x57, 0x7e, 0x82, 0x80, 0x73, 0xd0, 0x12, 0x7c, 0x73, 0x60,
804804
0x04, 0x30, 0x73, 0x00, 0x50, 0x10, 0x01, 0x00, 0x01, 0x00, 0x82, 0x80,
805805
0x37, 0x17, 0x00, 0xf0, 0x3c, 0x53, 0xb7, 0x06, 0x00, 0x01, 0x93, 0xe7,
806806
0x07, 0x10, 0x3c, 0xd3, 0x73, 0x90, 0x16, 0x7e, 0x82, 0x80, 0x37, 0x17,

softperipheral/sQSPI/src/nrfx_qspi2.c

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,22 +117,15 @@ nrfx_err_t nrfx_qspi2_init(const nrfx_qspi2_t * p_qspi, const nrfx_qspi2_cfg_t *
117117
p_cb->transfer_in_progress = false;
118118
p_cb->prepared_pending = false;
119119

120-
//Formatting default values
121120
//Formatting default values
122121
p_cb->conf.format.pixels = 0;
123122
p_cb->conf.format.dfs = 7;
124123
p_cb->conf.ctrlr0.dfs = 7;
125-
p_cb->conf.format.bpp = 0;
124+
p_cb->conf.format.bpp = 8;
126125
p_cb->conf.format.padding = 0;
127126
p_cb->conf.format.bitorder = 0;
128127
p_cb->conf.format.cilen = 0;
129128

130-
nrf_qspi2_format_dfs(p_qspi->p_reg, (uint8_t)(p_cb->conf.format.dfs - 1U));
131-
nrf_qspi2_core_dr_x(p_qspi->p_reg, (uint32_t)(32 - p_cb->conf.format.dfs), 22); //Hijacking DR[22] as red_dfs
132-
nrf_qspi2_format_bpp(p_qspi->p_reg, (uint8_t)(p_cb->conf.format.bpp));
133-
nrf_qspi2_format_bitorder(p_qspi->p_reg, (int)p_cb->conf.format.bitorder,
134-
(int)p_cb->conf.format.bitorder);
135-
136129
// Set all pins to unused.
137130
for (int i = 0; i < 6; i++)
138131
{
@@ -241,6 +234,12 @@ nrfx_err_t nrfx_qspi2_init(const nrfx_qspi2_t * p_qspi, const nrfx_qspi2_cfg_t *
241234
}
242235
}
243236

237+
nrf_qspi2_format_dfs(p_qspi->p_reg, (uint8_t)(p_cb->conf.format.dfs));
238+
nrf_qspi2_core_dr_x(p_qspi->p_reg, (uint32_t)(32 - p_cb->conf.format.padding), 22); //Hijacking DR[22] as red_dfs
239+
nrf_qspi2_format_bpp(p_qspi->p_reg, (uint8_t)(p_cb->conf.format.bpp));
240+
nrf_qspi2_format_bitorder(p_qspi->p_reg, (int)p_cb->conf.format.bitorder,
241+
(int)p_cb->conf.format.bitorder);
242+
244243
NRFX_IRQ_PRIORITY_SET(SP_VPR_IRQn, 1);
245244
NRFX_IRQ_ENABLE(SP_VPR_IRQn);
246245

@@ -298,6 +297,19 @@ void nrfx_qspi2_uninit(const nrfx_qspi2_t * p_qspi)
298297

299298
// Stop VPR.
300299
nrf_vpr_cpurun_set(NRF_VPR, false);
300+
#if defined(NRF54H20_XXAA)
301+
// Reset VPR.
302+
nrf_vpr_debugif_dmcontrol_mask_set(NRF_VPR,
303+
(VPR_DEBUGIF_DMCONTROL_NDMRESET_Active
304+
<< VPR_DEBUGIF_DMCONTROL_NDMRESET_Pos |
305+
VPR_DEBUGIF_DMCONTROL_DMACTIVE_Enabled
306+
<< VPR_DEBUGIF_DMCONTROL_DMACTIVE_Pos));
307+
nrf_vpr_debugif_dmcontrol_mask_set(NRF_VPR,
308+
(VPR_DEBUGIF_DMCONTROL_NDMRESET_Inactive
309+
<< VPR_DEBUGIF_DMCONTROL_NDMRESET_Pos |
310+
VPR_DEBUGIF_DMCONTROL_DMACTIVE_Disabled
311+
<< VPR_DEBUGIF_DMCONTROL_DMACTIVE_Pos));
312+
#endif
301313

302314
p_cb->state = NRFX_DRV_STATE_UNINITIALIZED;
303315
}
@@ -432,6 +444,10 @@ nrfx_err_t nrfx_qspi2_dev_data_fmt_set(const nrfx_qspi2_t * p_qspi,
432444
{
433445
return NRFX_ERROR_INVALID_PARAM;
434446
}
447+
if (p_data_fmt->data_bit_reorder_unit != p_data_fmt->data_swap_unit)
448+
{
449+
return NRFX_ERROR_INVALID_PARAM;
450+
}
435451
if (p_data_fmt->data_padding != 0)
436452
{
437453
if (p_data_fmt->data_container + p_data_fmt->data_padding != 32)
@@ -630,7 +646,7 @@ nrfx_err_t nrfx_qspi2_xfer(const nrfx_qspi2_t * p_qspi,
630646
{
631647
if (flags == NRFX_QSPI2_FLAG_HOLD_XFER)
632648
{
633-
return nrfx_qspi2_xfer_prepare(p_qspi, p_xfer, xfer_count);
649+
return NRFX_ERROR_NOT_SUPPORTED;
634650
}
635651

636652
qspi2_control_block_t * p_cb = &m_cb[p_qspi->drv_inst_idx];
@@ -646,7 +662,6 @@ nrfx_err_t nrfx_qspi2_xfer(const nrfx_qspi2_t * p_qspi,
646662

647663
if (retval == NRFX_SUCCESS)
648664
{
649-
650665
nrf_qspi2_core_enable(p_qspi->p_reg);
651666
__ASB(p_qspi->p_reg);
652667

0 commit comments

Comments
 (0)