aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorEtienne Carriere <etienne.carriere@st.com>2019-05-03 10:06:48 +0200
committerJérôme Forissier <jerome.forissier@linaro.org>2019-05-06 11:43:51 +0200
commit9d8a03dff9932de5a6956b8f2e18daffd371eb93 (patch)
tree29d007c80d9a66f4f71022fd74af273e0134d0c5 /core
parent45a858eba540a60bcb615ef4f03d1a86567390b0 (diff)
stm32_uart: register secure/non-secure device
stm32_uart instance registers as secure/non-secure resources according to device tree content. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Diffstat (limited to 'core')
-rw-r--r--core/drivers/stm32_uart.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/drivers/stm32_uart.c b/core/drivers/stm32_uart.c
index 30700e5a..daff9b6d 100644
--- a/core/drivers/stm32_uart.c
+++ b/core/drivers/stm32_uart.c
@@ -12,6 +12,7 @@
#include <kernel/delay.h>
#include <kernel/dt.h>
#include <kernel/panic.h>
+#include <stm32_util.h>
#include <util.h>
#define UART_REG_CR1 0x00 /* Control register 1 */
@@ -105,6 +106,16 @@ void stm32_uart_init(struct stm32_uart_pdata *pd, vaddr_t base)
}
#ifdef CFG_DT
+static void register_secure_uart(struct stm32_uart_pdata *pd)
+{
+ stm32mp_register_secure_periph_iomem(pd->base.pa);
+}
+
+static void register_non_secure_uart(struct stm32_uart_pdata *pd)
+{
+ stm32mp_register_non_secure_periph_iomem(pd->base.pa);
+}
+
struct stm32_uart_pdata *stm32_uart_init_from_dt_node(void *fdt, int node)
{
struct stm32_uart_pdata *pd = NULL;
@@ -132,6 +143,11 @@ struct stm32_uart_pdata *stm32_uart_init_from_dt_node(void *fdt, int node)
pd->secure ? MEM_AREA_IO_SEC :
MEM_AREA_IO_NSEC);
+ if (pd->secure)
+ register_secure_uart(pd);
+ else
+ register_non_secure_uart(pd);
+
return pd;
}
#endif /*CFG_DT*/