blob: 18606818cb75869b07ae283806bc7de5536ea20c [file] [log] [blame]
Etienne Carriere7ad2c012019-12-08 08:14:03 +01001/*
2 * Copyright (c) 2017-2020, STMicroelectronics - All Rights Reserved
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Etienne Carrierebeb53d92020-05-13 10:13:54 +02007#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
Etienne Carriere7ad2c012019-12-08 08:14:03 +010015#include <stm32mp_shared_resources.h>
16
Etienne Carrierebeb53d92020-05-13 10:13:54 +020017/* GPIOZ pin count is saved in RAM to prevent parsing FDT several times */
18static int8_t gpioz_nbpin = -1;
19
20static 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
41static unsigned int __unused get_gpioz_nbpin(void)
42{
43 return get_gpio_nbpin(GPIO_BANK_Z);
44}
45
Etienne Carriere7ad2c012019-12-08 08:14:03 +010046/* Currently allow full access by non-secure to platform clock services */
47bool 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 */
53bool stm32mp_nsec_can_access_reset(unsigned int reset_id)
54{
55 return true;
56}