Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
dff9fe92
Commit
dff9fe92
authored
May 27, 2020
by
Mark Dykes
Committed by
TrustedFirmware Code Review
May 27, 2020
Browse files
Merge "plat/stm32mp1: fdt helpers for secure aware gpio bank" into integration
parents
6bc95379
ccc199ed
Changes
4
Hide whitespace changes
Inline
Side-by-side
plat/st/common/include/stm32mp_common.h
View file @
dff9fe92
...
...
@@ -61,6 +61,9 @@ uintptr_t stm32_get_gpio_bank_base(unsigned int bank);
unsigned
long
stm32_get_gpio_bank_clock
(
unsigned
int
bank
);
uint32_t
stm32_get_gpio_bank_offset
(
unsigned
int
bank
);
/* Return node offset for target GPIO bank ID @bank or a FDT error code */
int
stm32_get_gpio_bank_pinctrl_node
(
void
*
fdt
,
unsigned
int
bank
);
/* Print CPU information */
void
stm32mp_print_cpuinfo
(
void
);
...
...
plat/st/common/include/stm32mp_dt.h
View file @
dff9fe92
/*
* Copyright (c) 2020, STMicroelectronics - All Rights Reserved
* Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
...
...
@@ -39,5 +40,6 @@ uintptr_t dt_get_pwr_base(void);
uint32_t
dt_get_pwr_vdd_voltage
(
void
);
uintptr_t
dt_get_syscfg_base
(
void
);
const
char
*
dt_get_board_model
(
void
);
int
fdt_get_gpio_bank_pin_count
(
unsigned
int
bank
);
#endif
/* STM32MP_DT_H */
plat/st/common/stm32mp_dt.c
View file @
dff9fe92
...
...
@@ -393,3 +393,51 @@ const char *dt_get_board_model(void)
return
(
const
char
*
)
fdt_getprop
(
fdt
,
node
,
"model"
,
NULL
);
}
/*******************************************************************************
* This function gets the pin count for a GPIO bank based from the FDT.
* It also checks node consistency.
******************************************************************************/
int
fdt_get_gpio_bank_pin_count
(
unsigned
int
bank
)
{
int
pinctrl_node
;
int
node
;
uint32_t
bank_offset
;
pinctrl_node
=
stm32_get_gpio_bank_pinctrl_node
(
fdt
,
bank
);
if
(
pinctrl_node
<
0
)
{
return
-
FDT_ERR_NOTFOUND
;
}
bank_offset
=
stm32_get_gpio_bank_offset
(
bank
);
fdt_for_each_subnode
(
node
,
fdt
,
pinctrl_node
)
{
const
fdt32_t
*
cuint
;
if
(
fdt_getprop
(
fdt
,
node
,
"gpio-controller"
,
NULL
)
==
NULL
)
{
continue
;
}
cuint
=
fdt_getprop
(
fdt
,
node
,
"reg"
,
NULL
);
if
(
cuint
==
NULL
)
{
continue
;
}
if
(
fdt32_to_cpu
(
*
cuint
)
!=
bank_offset
)
{
continue
;
}
if
(
fdt_get_status
(
node
)
==
DT_DISABLED
)
{
return
0
;
}
cuint
=
fdt_getprop
(
fdt
,
node
,
"ngpios"
,
NULL
);
if
(
cuint
==
NULL
)
{
return
-
FDT_ERR_NOTFOUND
;
}
return
(
int
)
fdt32_to_cpu
(
*
cuint
);
}
return
0
;
}
plat/st/stm32mp1/stm32mp1_private.c
View file @
dff9fe92
...
...
@@ -109,6 +109,28 @@ unsigned long stm32_get_gpio_bank_clock(unsigned int bank)
return
GPIOA
+
(
bank
-
GPIO_BANK_A
);
}
int
stm32_get_gpio_bank_pinctrl_node
(
void
*
fdt
,
unsigned
int
bank
)
{
switch
(
bank
)
{
case
GPIO_BANK_A
:
case
GPIO_BANK_B
:
case
GPIO_BANK_C
:
case
GPIO_BANK_D
:
case
GPIO_BANK_E
:
case
GPIO_BANK_F
:
case
GPIO_BANK_G
:
case
GPIO_BANK_H
:
case
GPIO_BANK_I
:
case
GPIO_BANK_J
:
case
GPIO_BANK_K
:
return
fdt_path_offset
(
fdt
,
"/soc/pin-controller"
);
case
GPIO_BANK_Z
:
return
fdt_path_offset
(
fdt
,
"/soc/pin-controller-z"
);
default:
panic
();
}
}
static
int
get_part_number
(
uint32_t
*
part_nb
)
{
uint32_t
part_number
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment