drivers: memc: fix FlexRAM bank cfg issue
From IMXRT1170RM.pdf, iomuxc_gpr->GPR17 is used to configure FlexRAM bank 0~7. iomuxc_gpr->GPR18 is used to configure FlexRAM bank 8~15. Set low 2 bytes to iomuxc_gpr->GPR17. Set high 2 bytes to iomuxc_gpr->GPR18. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
This commit is contained in:
parent
747440c46e
commit
97fcbc905b
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023 NXP
|
* Copyright 2023-2024 NXP
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
@ -44,20 +44,27 @@ void memc_flexram_register_callback(flexram_callback_t callback, void *user_data
|
||||||
* call from platform_init to set up flexram if using runtime map
|
* call from platform_init to set up flexram if using runtime map
|
||||||
* must be inlined because cannot use stack
|
* must be inlined because cannot use stack
|
||||||
*/
|
*/
|
||||||
#define GPR17_REG_FILL(node_id, prop, idx) + (DT_PROP_BY_IDX(node_id, prop, idx) << (2*idx))
|
#define GPR_FLEXRAM_REG_FILL(node_id, prop, idx) \
|
||||||
|
(((uint32_t)DT_PROP_BY_IDX(node_id, prop, idx)) << (2 * idx))
|
||||||
static inline void memc_flexram_dt_partition(void)
|
static inline void memc_flexram_dt_partition(void)
|
||||||
{
|
{
|
||||||
/* iomuxc_gpr must be const (in ROM region) because used in reconfiguring ram */
|
/* iomuxc_gpr must be const (in ROM region) because used in reconfiguring ram */
|
||||||
static IOMUXC_GPR_Type *const iomuxc_gpr =
|
static IOMUXC_GPR_Type *const iomuxc_gpr =
|
||||||
(IOMUXC_GPR_Type *)DT_REG_ADDR(IOMUXC_GPR_DT_NODE);
|
(IOMUXC_GPR_Type *)DT_REG_ADDR(IOMUXC_GPR_DT_NODE);
|
||||||
/* do not create stack variables or use any data from ram in this function */
|
/* do not create stack variables or use any data from ram in this function */
|
||||||
iomuxc_gpr->GPR17 = DT_FOREACH_PROP_ELEM_SEP(FLEXRAM_DT_NODE,
|
#if defined(CONFIG_SOC_SERIES_IMXRT11XX)
|
||||||
flexram_bank_spec, GPR17_REG_FILL, (+));
|
iomuxc_gpr->GPR17 = (DT_FOREACH_PROP_ELEM_SEP(FLEXRAM_DT_NODE, flexram_bank_spec,
|
||||||
|
GPR_FLEXRAM_REG_FILL, (+))) & 0xFFFF;
|
||||||
|
iomuxc_gpr->GPR18 = (((DT_FOREACH_PROP_ELEM_SEP(FLEXRAM_DT_NODE, flexram_bank_spec,
|
||||||
|
GPR_FLEXRAM_REG_FILL, (+)))) >> 16) & 0xFFFF;
|
||||||
|
#elif defined(CONFIG_SOC_SERIES_IMXRT10XX)
|
||||||
|
iomuxc_gpr->GPR17 = DT_FOREACH_PROP_ELEM_SEP(FLEXRAM_DT_NODE, flexram_bank_spec,
|
||||||
|
GPR_FLEXRAM_REG_FILL, (+));
|
||||||
|
#endif
|
||||||
iomuxc_gpr->GPR16 |= IOMUXC_GPR_GPR16_FLEXRAM_BANK_CFG_SEL_MASK;
|
iomuxc_gpr->GPR16 |= IOMUXC_GPR_GPR16_FLEXRAM_BANK_CFG_SEL_MASK;
|
||||||
}
|
}
|
||||||
#endif /* FLEXRAM_RUNTIME_BANKS_USED */
|
#endif /* FLEXRAM_RUNTIME_BANKS_USED */
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_MEMC_NXP_FLEXRAM_MAGIC_ADDR_API
|
#ifdef CONFIG_MEMC_NXP_FLEXRAM_MAGIC_ADDR_API
|
||||||
/** @brief Sets magic address for OCRAM
|
/** @brief Sets magic address for OCRAM
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue