File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 44 * SPDX-License-Identifier: Apache-2.0
55 */
66
7- #define DT_DRV_COMPAT st_stm32_fmc
8-
97#include <device.h>
8+ #include <soc.h>
109
1110#include <drivers/clock_control/stm32_clock_control.h>
1211#include <drivers/pinctrl.h>
1312
1413#include <logging/log.h>
1514LOG_MODULE_REGISTER (memc_stm32 , CONFIG_MEMC_LOG_LEVEL );
1615
16+ #if DT_HAS_COMPAT_STATUS_OKAY (st_stm32_fmc )
17+ #define DT_DRV_COMPAT st_stm32_fmc
18+ #elif DT_HAS_COMPAT_STATUS_OKAY (st_stm32h7_fmc )
19+ #define DT_DRV_COMPAT st_stm32h7_fmc
20+ #else
21+ #error "No compatible FMC devicetree node found"
22+ #endif
23+
1724struct memc_stm32_config {
1825 uint32_t fmc ;
1926 struct stm32_pclken pclken ;
@@ -43,6 +50,16 @@ static int memc_stm32_init(const struct device *dev)
4350 return r ;
4451 }
4552
53+ #if DT_HAS_COMPAT_STATUS_OKAY (st_stm32h7_fmc )
54+ #if (DT_ENUM_IDX (DT_DRV_INST (0 ), st_mem_swap ) == 1 )
55+ /* sdram-sram */
56+ MODIFY_REG (FMC_Bank1_R -> BTCR [0 ], FMC_BCR1_BMAP , FMC_BCR1_BMAP_0 );
57+ #elif (DT_ENUM_IDX (DT_DRV_INST (0 ), st_mem_swap ) == 2 )
58+ /* sdramb2 */
59+ MODIFY_REG (FMC_Bank1_R -> BTCR [0 ], FMC_BCR1_BMAP , FMC_BCR1_BMAP_1 );
60+ #endif
61+ #endif
62+
4663 return 0 ;
4764}
4865
You can’t perform that action at this time.
0 commit comments