Yann Gautier | ee8f542 | 2019-02-14 11:13:25 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <assert.h> |
| 8 | |
| 9 | #include <platform_def.h> |
| 10 | |
| 11 | #include <arch_helpers.h> |
| 12 | #include <common/debug.h> |
Yann Gautier | ee8f542 | 2019-02-14 11:13:25 +0100 | [diff] [blame] | 13 | #include <plat/common/platform.h> |
| 14 | |
| 15 | uintptr_t plat_get_ns_image_entrypoint(void) |
| 16 | { |
| 17 | return BL33_BASE; |
| 18 | } |
| 19 | |
| 20 | unsigned int plat_get_syscnt_freq2(void) |
| 21 | { |
| 22 | return read_cntfrq_el0(); |
| 23 | } |
| 24 | |
| 25 | static uintptr_t boot_ctx_address; |
| 26 | |
Yann Gautier | a2e2a30 | 2019-02-14 11:13:39 +0100 | [diff] [blame] | 27 | void stm32mp_save_boot_ctx_address(uintptr_t address) |
Yann Gautier | ee8f542 | 2019-02-14 11:13:25 +0100 | [diff] [blame] | 28 | { |
| 29 | boot_ctx_address = address; |
| 30 | } |
| 31 | |
Yann Gautier | a2e2a30 | 2019-02-14 11:13:39 +0100 | [diff] [blame] | 32 | uintptr_t stm32mp_get_boot_ctx_address(void) |
Yann Gautier | ee8f542 | 2019-02-14 11:13:25 +0100 | [diff] [blame] | 33 | { |
| 34 | return boot_ctx_address; |
| 35 | } |
| 36 | |
| 37 | uintptr_t stm32_get_gpio_bank_base(unsigned int bank) |
| 38 | { |
| 39 | if (bank == GPIO_BANK_Z) { |
| 40 | return GPIOZ_BASE; |
| 41 | } |
| 42 | |
| 43 | assert(GPIO_BANK_A == 0 && bank <= GPIO_BANK_K); |
| 44 | |
| 45 | return GPIOA_BASE + (bank * GPIO_BANK_OFFSET); |
| 46 | } |
| 47 | |
| 48 | unsigned long stm32_get_gpio_bank_clock(unsigned int bank) |
| 49 | { |
| 50 | if (bank == GPIO_BANK_Z) { |
| 51 | return GPIOZ; |
| 52 | } |
| 53 | |
| 54 | assert(GPIO_BANK_A == 0 && bank <= GPIO_BANK_K); |
| 55 | |
| 56 | return GPIOA + (bank - GPIO_BANK_A); |
| 57 | } |
| 58 | |
| 59 | uint32_t stm32_get_gpio_bank_offset(unsigned int bank) |
| 60 | { |
| 61 | if (bank == GPIO_BANK_Z) { |
| 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | assert(GPIO_BANK_A == 0 && bank <= GPIO_BANK_K); |
| 66 | |
| 67 | return bank * GPIO_BANK_OFFSET; |
| 68 | } |