|
| 1 | +//! FlexSPI configuration block (FCB) for the iMXRT1170EVK. |
| 2 | +//! |
| 3 | +//! This FCB is compatible with thei Macronix MX25UM51345GXDI00 Hyperflash (Octal SPI) storage found on the |
| 4 | +//! VMU RT1170. However, it only supports reads. |
| 5 | +#![no_std] |
| 6 | + |
| 7 | +pub use nor::ConfigurationBlock; |
| 8 | + |
| 9 | +use imxrt_boot_gen::flexspi::{self, opcodes::sdr::*, *}; |
| 10 | +use imxrt_boot_gen::serial_flash::*; |
| 11 | + |
| 12 | +const BOOT_SEQ_READ: Sequence = SequenceBuilder::new() |
| 13 | + .instr(Instr::new(CMD, Pads::One, 0x03)) |
| 14 | + .instr(Instr::new(RADDR, Pads::One, 0x18)) |
| 15 | + .instr(Instr::new(READ, Pads::One, 0x04)) |
| 16 | + .instr(STOP) |
| 17 | + .build(); |
| 18 | + |
| 19 | +const BOOT_LUT: LookupTable = LookupTable::new().command(Command::Read, BOOT_SEQ_READ); |
| 20 | + |
| 21 | +const BOOT_CONFIGURATION_BLOCK: flexspi::ConfigurationBlock = |
| 22 | + flexspi::ConfigurationBlock::new(BOOT_LUT) |
| 23 | + .version(Version::new(1, 4, 0)) |
| 24 | + .read_sample_clk_src(ReadSampleClockSource::InternalLoopback) |
| 25 | + .cs_hold_time(1) |
| 26 | + .cs_setup_time(1) |
| 27 | + .controller_misc_options(0x10) |
| 28 | + .serial_flash_pad_type(FlashPadType::Single) |
| 29 | + .serial_clk_freq(SerialClockFrequency::MHz80) |
| 30 | + .flash_size(SerialFlashRegion::A1, 64 * 1024 * 1024); |
| 31 | + |
| 32 | +/// Boot FlexSPI NOR Configuration for the VMU only needs read commands |
| 33 | +/// over single wire SPI at a slower clock. |
| 34 | +/// |
| 35 | +/// After booting the VMU can reconfigure FlexSPI to be clocked faster |
| 36 | +/// using OctalSPI as needed with the full LUT of command sequences. |
| 37 | +pub const BOOT_SERIAL_NOR_CONFIGURATION_BLOCK: nor::ConfigurationBlock = |
| 38 | + nor::ConfigurationBlock::new(BOOT_CONFIGURATION_BLOCK) |
| 39 | + .page_size(256) |
| 40 | + .sector_size(4 * 1024) |
| 41 | + .ip_cmd_serial_clk_freq(nor::SerialClockFrequency::MHz30) |
| 42 | + .block_size(64 * 1024); |
| 43 | + |
| 44 | +#[no_mangle] |
| 45 | +#[cfg_attr(all(target_arch = "arm", target_os = "none"), link_section = ".fcb")] |
| 46 | +pub static FLEXSPI_CONFIGURATION_BLOCK: nor::ConfigurationBlock = |
| 47 | + BOOT_SERIAL_NOR_CONFIGURATION_BLOCK; |
0 commit comments