alif/ospi_ext: Optimize XIP speed.
This change increases XIP read speed to ~30Mbytes/s at 50MHz DDR: - Enable continuous mode. - Remove hard-coded settings. - Set XIP continuous mode timeout. The prefetch remains disabled. Although enabling the prefetch gives the best performance for the CPU in XIP mode, it must be disabled when the NPU accesses the OSPI flash. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
parent
0709936653
commit
df06bf91a5
1 changed files with 4 additions and 3 deletions
|
|
@ -229,7 +229,7 @@ void ospi_xip_enter_ext(ospi_flash_cfg_t *ospi_cfg, uint32_t inst_len, uint32_t
|
||||||
| (ospi_cfg->ddr_en << XIP_CTRL_DDR_EN_OFFSET)
|
| (ospi_cfg->ddr_en << XIP_CTRL_DDR_EN_OFFSET)
|
||||||
| (0x1 << XIP_CTRL_RXDS_EN_OFFSET)
|
| (0x1 << XIP_CTRL_RXDS_EN_OFFSET)
|
||||||
| (0x1 << XIP_CTRL_INST_EN_OFFSET)
|
| (0x1 << XIP_CTRL_INST_EN_OFFSET)
|
||||||
| (0x0 << XIP_CTRL_CONT_XFER_EN_OFFSET)
|
| (0x1 << XIP_CTRL_CONT_XFER_EN_OFFSET)
|
||||||
| (0x0 << XIP_CTRL_HYPERBUS_EN_OFFSET)
|
| (0x0 << XIP_CTRL_HYPERBUS_EN_OFFSET)
|
||||||
| (0x1 << XIP_CTRL_RXDS_SIG_EN)
|
| (0x1 << XIP_CTRL_RXDS_SIG_EN)
|
||||||
| (0x0 << XIP_CTRL_XIP_MBL_OFFSET)
|
| (0x0 << XIP_CTRL_XIP_MBL_OFFSET)
|
||||||
|
|
@ -242,14 +242,15 @@ void ospi_xip_enter_ext(ospi_flash_cfg_t *ospi_cfg, uint32_t inst_len, uint32_t
|
||||||
|
|
||||||
ospi_writel(ospi_cfg, xip_ctrl, val);
|
ospi_writel(ospi_cfg, xip_ctrl, val);
|
||||||
|
|
||||||
ospi_writel(ospi_cfg, rx_sample_dly, 4);
|
ospi_writel(ospi_cfg, rx_sample_dly, OSPI_XIP_RX_SAMPLE_DELAY);
|
||||||
ospi_writel(ospi_cfg, txd_drive_edge, 1);
|
ospi_writel(ospi_cfg, txd_drive_edge, OSPI_XIP_DDR_DRIVE_EDGE);
|
||||||
ospi_cfg->aes_regs->aes_rxds_delay = OSPI_XIP_RXDS_DELAY;
|
ospi_cfg->aes_regs->aes_rxds_delay = OSPI_XIP_RXDS_DELAY;
|
||||||
|
|
||||||
ospi_writel(ospi_cfg, xip_mode_bits, 0x0);
|
ospi_writel(ospi_cfg, xip_mode_bits, 0x0);
|
||||||
ospi_writel(ospi_cfg, xip_incr_inst, incr_command);
|
ospi_writel(ospi_cfg, xip_incr_inst, incr_command);
|
||||||
ospi_writel(ospi_cfg, xip_wrap_inst, wrap_command);
|
ospi_writel(ospi_cfg, xip_wrap_inst, wrap_command);
|
||||||
ospi_writel(ospi_cfg, xip_ser, ospi_cfg->ser);
|
ospi_writel(ospi_cfg, xip_ser, ospi_cfg->ser);
|
||||||
|
ospi_writel(ospi_cfg, xip_cnt_time_out, 100);
|
||||||
|
|
||||||
spi_enable(ospi_cfg);
|
spi_enable(ospi_cfg);
|
||||||
ospi_xip_enable(ospi_cfg);
|
ospi_xip_enable(ospi_cfg);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue