1 /* 2 * Copyright (C) 2018-2019, STMicroelectronics - All Rights Reserved 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef STM32MP_COMMON_H 8 #define STM32MP_COMMON_H 9 10 #include <stdbool.h> 11 12 /* Functions to save and get boot context address given by ROM code */ 13 void stm32mp_save_boot_ctx_address(uintptr_t address); 14 uintptr_t stm32mp_get_boot_ctx_address(void); 15 16 /* 17 * Platform util functions for the GPIO driver 18 * @bank: Target GPIO bank ID as per DT bindings 19 * 20 * Platform shall implement these functions to provide to stm32_gpio 21 * driver the resource reference for a target GPIO bank. That are 22 * memory mapped interface base address, interface offset (see below) 23 * and clock identifier. 24 * 25 * stm32_get_gpio_bank_offset() returns a bank offset that is used to 26 * check DT configuration matches platform implementation of the banks 27 * description. 28 */ 29 uintptr_t stm32_get_gpio_bank_base(unsigned int bank); 30 unsigned long stm32_get_gpio_bank_clock(unsigned int bank); 31 uint32_t stm32_get_gpio_bank_offset(unsigned int bank); 32 33 /* 34 * Util for clock gating and to get clock rate for stm32 and platform drivers 35 * @id: Target clock ID, ID used in clock DT bindings 36 */ 37 bool stm32mp_clk_is_enabled(unsigned long id); 38 int stm32mp_clk_enable(unsigned long id); 39 int stm32mp_clk_disable(unsigned long id); 40 unsigned long stm32mp_clk_get_rate(unsigned long id); 41 42 /* Initialise the IO layer and register platform IO devices */ 43 void stm32mp_io_setup(void); 44 45 #endif /* STM32MP_COMMON_H */ 46