1 /*
2  * Copyright (C) 2022, STMicroelectronics - All Rights Reserved
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 #ifndef STM32MP_RAM_H
7 #define STM32MP_RAM_H
8 
9 #include <stdbool.h>
10 
11 #include <drivers/st/stm32mp_ddr.h>
12 
13 #define PARAM(x, y)							\
14 	{								\
15 		.name = x,						\
16 		.offset = offsetof(struct stm32mp_ddr_config, y),	\
17 		.size = sizeof(config.y) / sizeof(uint32_t),		\
18 	}
19 
20 #define CTL_PARAM(x) PARAM("st,ctl-"#x, c_##x)
21 #define PHY_PARAM(x) PARAM("st,phy-"#x, p_##x)
22 
23 struct stm32mp_ddr_param {
24 	const char *name;      /* Name in DT */
25 	const uint32_t offset; /* Offset in config struct */
26 	const uint32_t size;   /* Size of parameters */
27 };
28 
29 int stm32mp_ddr_dt_get_info(void *fdt, int node, struct stm32mp_ddr_info *info);
30 int stm32mp_ddr_dt_get_param(void *fdt, int node, const struct stm32mp_ddr_param *param,
31 			     uint32_t param_size, uintptr_t config);
32 
33 #endif /* STM32MP_RAM_H */
34