Figure 13-216 shows the high-level sequence that can be followed by the SOC CPU and FOTA HW
ENGINE firmware, for implementing FOTA writes using OSPI Controller.
The first flowchart shows the SOC
software and the second flowchart shows the FOTA HW ENGINE firmware flow described
as follows:
- SOC CPU configures OSPI
Controller based on required settings. This includes setting up DAC and/or INDAC
modes in OSPI and setting up various flash parameters like dummy cycles
etc.
- SOC CPU configures FOTA
accelerator using FSAS_FOTA_GENREGS region. This includes setting up interrupt
enables and general-purpose registers which have firmware defined interpretation
(can contain FOTA write address etc.).
- SOC CPU brings the FOTA HW ENGINE
out of reset by clearing FOTA_INIT.reset, FOTA_INIT.clkdis, and
FOTA_INIT.mem_access bits in FSAS_FOTA_GENREGS region.
- SOC CPU/DMA transfers up to one
page of data into FOTA write buffer (WBUF_GENREGS Register ).
- SOC CPU sets FOTA_CTRL.go
bit to indicate that FOTA HW ENGINE can start FOTA writes. Once this is set, SOC
CPU refrains from accessing OSPI Controller configuration space. This is
recommended because the FOTA HW ENGINE will periodically access configuration
bus (thereby blocking access to SOC) in order to write and read OSPI
registers.
- FOTA HW ENGINE takes control of
configuration and data interfaces, using bus access logic, according to
arbitration rules defined in firmware. Any new data or configuration requests
from the SOC are held. Also, any pending transactions on the interfaces are
complete and the control switches to the FOTA. Thus, the ongoing XIP is
paused.
- FOTA HW ENGINE firmware
configures the OSPI Controller for the write transaction. This is mainly for
changing any settings required for writes (for example disabling PHY pipeline
mode).
- FOTA HW ENGINE firmware transfers
data from FOTA write buffer to flash.
- FOTA HW ENGINE firmware polls for
data transfer completion status to make sure the data has been transferred from
OSPI to flash, and the OSPI data lines are now idle.
- FOTA HW ENGINE firmware then
reverts back the OSPI Controller configuration settings (for example re-enabling
PHY pipeline mode).
- FOTA HW ENGINE then relinquishes
control of configuration and data interfaces. Thus, XIP can now resume.
- If flash polling is not
implemented by FOTA HW ENGINE firmware, steps 12 through 20 are skipped.
- FOTA HW ENGINE firmware uses
internal FOTA HW ENGINE timer to periodically poll flash status for write
completion.
- When timer elapses, FOTA HW
ENGINE firmware takes control of configuration and data interfaces. Any new data
or configuration requests from the SOC are held. Also, any pending transactions
on the interfaces are complete and the control switches to the FOTA. Thus, the
ongoing XIP is paused.
- FOTA HW ENGINE firmware
configures the OSPI Controller for the status read transaction.
- FOTA HW ENGINE firmware issues
STIG command to OSPI Controller to read flash status.
- FOTA HW ENGINE firmware polls for
STIG command completion.
- FOTA HW ENGINE firmware then
reverts back the OSPI Controller configuration settings.
- FOTA HW ENGINE firmware
relinquishes control of configuration and data interfaces. Thus, XIP can now
resume.
- After reading the flash status,
if it indicates that the write is in progress, FOTA HW ENGINE firmware repeats
steps 13 through 19.
- Once, the page write is
completed, FOTA HW ENGINE firmware reports status back to SOC CPU. This can be
done using interrupt or polling by SOC CPU.
- If more pages have to be written
to flash, the FOTA sequence can be repeated.
- SOC CPU puts FOTA HW ENGINE back
to reset and clock disabled state by writing to FOTA_INIT register in
FSAS_FOTA_GENREGS region.