1 /* 2 * Copyright (c) 2017-2020, STMicroelectronics - All Rights Reserved 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <assert.h> 8 #include <stdint.h> 9 10 #include <platform_def.h> 11 12 #include <common/debug.h> 13 #include <drivers/st/stm32_gpio.h> 14 15 #include <stm32mp_shared_resources.h> 16 17 /* GPIOZ pin count is saved in RAM to prevent parsing FDT several times */ 18 static int8_t gpioz_nbpin = -1; 19 20 static unsigned int get_gpio_nbpin(unsigned int bank) 21 { 22 if (bank != GPIO_BANK_Z) { 23 int count = fdt_get_gpio_bank_pin_count(bank); 24 25 assert((count >= 0) || (count <= (GPIO_PIN_MAX + 1))); 26 27 return (unsigned int)count; 28 } 29 30 if (gpioz_nbpin < 0) { 31 int count = fdt_get_gpio_bank_pin_count(GPIO_BANK_Z); 32 33 assert((count == 0) || (count == STM32MP_GPIOZ_PIN_MAX_COUNT)); 34 35 gpioz_nbpin = count; 36 } 37 38 return (unsigned int)gpioz_nbpin; 39 } 40 41 static unsigned int __unused get_gpioz_nbpin(void) 42 { 43 return get_gpio_nbpin(GPIO_BANK_Z); 44 } 45 46 /* Currently allow full access by non-secure to platform clock services */ 47 bool stm32mp_nsec_can_access_clock(unsigned long clock_id) 48 { 49 return true; 50 } 51 52 /* Currently allow full access by non-secure to platform reset services */ 53 bool stm32mp_nsec_can_access_reset(unsigned int reset_id) 54 { 55 return true; 56 } 57