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