Skip to content

Commit 70b96f4

Browse files
bas-archembeddedkartben
authored andcommitted
soc: mimxrt11xx: Work around USDHC errata.
Errata ERR050396 causes data corruption if writes happen to TCM memory so work around it by not marking AXI transaction cacheable. Workaround taken from NXP SDK example. Signed-off-by: Bas van Loon <[email protected]>
1 parent c996051 commit 70b96f4

File tree

1 file changed

+20
-2
lines changed
  • soc/nxp/imxrt/imxrt11xx

1 file changed

+20
-2
lines changed

soc/nxp/imxrt/imxrt11xx/soc.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ __weak void clock_init(void)
202202
* changed in the following PLL/PFD configuration code.
203203
*/
204204

205-
206205
static const clock_arm_pll_config_t armPllConfig = {
207206
.postDivider = CONCAT(kCLOCK_PllPostDiv, DT_PROP(DT_NODELABEL(arm_pll), clock_div)),
208207
.loopDivider = DT_PROP(DT_NODELABEL(arm_pll), clock_mult) * 2,
@@ -525,7 +524,7 @@ __weak void clock_init(void)
525524
#endif
526525
#endif
527526

528-
#if CONFIG_IMX_USDHC
527+
#if defined(CONFIG_IMX_USDHC)
529528
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc1))
530529
/* Configure USDHC1 using SysPll2Pfd2*/
531530
rootCfg.mux = kCLOCK_USDHC1_ClockRoot_MuxSysPll2Pfd2;
@@ -742,6 +741,25 @@ static int imxrt_init(void)
742741
/* Initialize system clock */
743742
clock_init();
744743

744+
#if defined(CONFIG_IMX_USDHC) && defined(CONFIG_CPU_CORTEX_M7) && \
745+
(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc1)) || \
746+
DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc2)))
747+
/* USDHC ERR050396 workaround */
748+
749+
/* ERR050396
750+
* Errata description:
751+
* AXI to AHB conversion for CM7 AHBS port (port to access CM7 to TCM) is by a NIC301
752+
* block, instead of XHB400 block. NIC301 doesn't support sparse write conversion.
753+
* Any AXI to AHB conversion need XHB400, not by NIC. This will result in data corruption
754+
* in case of AXI sparse write reaches the NIC301 ahead of AHBS.
755+
* Errata workaround:
756+
* For uSDHC, don't set the bit#1 of IOMUXC_GPR28 (AXI transaction is cacheable), if write
757+
* data to TCM aligned in 4 bytes; No such write access limitation for OCRAM or external
758+
* RAM
759+
*/
760+
IOMUXC_GPR->GPR28 &= (~IOMUXC_GPR_GPR28_AWCACHE_USDHC_MASK);
761+
#endif
762+
745763
return 0;
746764
}
747765

0 commit comments

Comments
 (0)