blob: 269d8acbbb717ae34069fac7dbf37b90230ba44f [file] [log] [blame]
Yann Gautieree8f5422019-02-14 11:13:25 +01001/*
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
Yann Gautiera2e2a302019-02-14 11:13:39 +010010#include <stdbool.h>
11
Yann Gautieree8f5422019-02-14 11:13:25 +010012/* Functions to save and get boot context address given by ROM code */
Yann Gautiera2e2a302019-02-14 11:13:39 +010013void stm32mp_save_boot_ctx_address(uintptr_t address);
14uintptr_t stm32mp_get_boot_ctx_address(void);
Yann Gautieree8f5422019-02-14 11:13:25 +010015
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 */
29uintptr_t stm32_get_gpio_bank_base(unsigned int bank);
30unsigned long stm32_get_gpio_bank_clock(unsigned int bank);
31uint32_t stm32_get_gpio_bank_offset(unsigned int bank);
32
Yann Gautiera2e2a302019-02-14 11:13:39 +010033/*
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 */
37bool stm32mp_clk_is_enabled(unsigned long id);
38int stm32mp_clk_enable(unsigned long id);
39int stm32mp_clk_disable(unsigned long id);
40unsigned long stm32mp_clk_get_rate(unsigned long id);
41
Yann Gautieree8f5422019-02-14 11:13:25 +010042/* Initialise the IO layer and register platform IO devices */
Yann Gautiera2e2a302019-02-14 11:13:39 +010043void stm32mp_io_setup(void);
Yann Gautieree8f5422019-02-14 11:13:25 +010044
45#endif /* STM32MP_COMMON_H */