1 /*
2  * Copyright 2022 NXP
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6  #include <soc.h>
7 
SystemInitHook(void)8 void SystemInitHook(void)
9 {
10 #if DT_SAME_NODE(DT_NODELABEL(flexspi), DT_PARENT(DT_CHOSEN(zephyr_flash)))
11 	/* AT25SF128A SPI Flash on the RT1010-EVK requires special alignment
12 	 * considerations, so set the READADDROPT bit in the FlexSPI so it
13 	 * will fetch more data than each AHB burst requires to meet alignment
14 	 * requirements
15 	 *
16 	 * Without this, the FlexSPI will return corrupted data during early
17 	 * boot, causing a hardfault. This can also be resolved by enabling
18 	 * the instruction cache in very early boot.
19 	 */
20 	FLEXSPI->AHBCR |= FLEXSPI_AHBCR_READADDROPT_MASK;
21 #endif
22 }
23