mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-18 10:34:19 +00:00
Merge changes from topic "fix-imx8m-uart-domain-permission" into integration
* changes: fix(imx8m): ensure domain permissions for the console refactor(imx8m): replace UART base magic numbers with macros
This commit is contained in:
commit
9bb2a0c337
10 changed files with 109 additions and 24 deletions
|
@ -17,16 +17,16 @@ static struct imx_uart {
|
|||
} imx8m_uart_info[] = {
|
||||
{ /* UART 1 */
|
||||
.ccm_reg = 0x4490,
|
||||
.uart_base = 0x30860000,
|
||||
.uart_base = IMX_UART1_BASE,
|
||||
}, { /* UART 2 */
|
||||
.ccm_reg = 0x44a0,
|
||||
.uart_base = 0x30890000,
|
||||
.uart_base = IMX_UART2_BASE,
|
||||
}, { /* UART 3 */
|
||||
.ccm_reg = 0x44b0,
|
||||
.uart_base = 0x30880000,
|
||||
.uart_base = IMX_UART3_BASE,
|
||||
}, { /* UART 4 */
|
||||
.ccm_reg = 0x44c0,
|
||||
.uart_base = 0x30a60000,
|
||||
.uart_base = IMX_UART4_BASE,
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ static const struct aipstz_cfg aipstz[] = {
|
|||
{0},
|
||||
};
|
||||
|
||||
static const struct imx_rdc_cfg rdc[] = {
|
||||
static struct imx_rdc_cfg rdc[] = {
|
||||
/* Master domain assignment */
|
||||
RDC_MDAn(RDC_MDA_M4, DID1),
|
||||
|
||||
|
@ -164,14 +164,14 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
|
|||
|
||||
imx_aipstz_init(aipstz);
|
||||
|
||||
imx_rdc_init(rdc);
|
||||
|
||||
imx_csu_init(csu_cfg);
|
||||
|
||||
if (console_base == 0U) {
|
||||
console_base = imx8m_uart_get_base();
|
||||
}
|
||||
|
||||
imx_rdc_init(rdc, console_base);
|
||||
|
||||
imx_csu_init(csu_cfg);
|
||||
|
||||
console_imx_uart_register(console_base, IMX_BOOT_UART_CLK_IN_HZ,
|
||||
IMX_CONSOLE_BAUDRATE, &console);
|
||||
/* This console is only used for boot stage */
|
||||
|
|
|
@ -85,6 +85,11 @@
|
|||
#define PLAT_CRASH_UART_CLK_IN_HZ 24000000
|
||||
#define IMX_CONSOLE_BAUDRATE 115200
|
||||
|
||||
#define IMX_UART1_BASE U(0x30860000)
|
||||
#define IMX_UART2_BASE U(0x30890000)
|
||||
#define IMX_UART3_BASE U(0x30880000)
|
||||
#define IMX_UART4_BASE U(0x30a60000)
|
||||
|
||||
#define IMX_AIPSTZ1 U(0x301f0000)
|
||||
#define IMX_AIPSTZ2 U(0x305f0000)
|
||||
#define IMX_AIPSTZ3 U(0x309f0000)
|
||||
|
|
|
@ -48,7 +48,7 @@ static const struct aipstz_cfg aipstz[] = {
|
|||
{0},
|
||||
};
|
||||
|
||||
static const struct imx_rdc_cfg rdc[] = {
|
||||
static struct imx_rdc_cfg rdc[] = {
|
||||
/* Master domain assignment */
|
||||
RDC_MDAn(RDC_MDA_M7, DID1),
|
||||
|
||||
|
@ -136,7 +136,11 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
|
|||
|
||||
imx_aipstz_init(aipstz);
|
||||
|
||||
imx_rdc_init(rdc);
|
||||
if (console_base == 0U) {
|
||||
console_base = imx8m_uart_get_base();
|
||||
}
|
||||
|
||||
imx_rdc_init(rdc, console_base);
|
||||
|
||||
imx_csu_init(csu_cfg);
|
||||
|
||||
|
@ -152,10 +156,6 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
|
|||
val = mmio_read_32(IMX_IOMUX_GPR_BASE + 0x2c);
|
||||
mmio_write_32(IMX_IOMUX_GPR_BASE + 0x2c, val | 0x3DFF0000);
|
||||
|
||||
if (console_base == 0U) {
|
||||
console_base = imx8m_uart_get_base();
|
||||
}
|
||||
|
||||
console_imx_uart_register(console_base, IMX_BOOT_UART_CLK_IN_HZ,
|
||||
IMX_CONSOLE_BAUDRATE, &console);
|
||||
/* This console is only used for boot stage */
|
||||
|
|
|
@ -68,6 +68,11 @@
|
|||
#define PLAT_CRASH_UART_CLK_IN_HZ 24000000
|
||||
#define IMX_CONSOLE_BAUDRATE 115200
|
||||
|
||||
#define IMX_UART1_BASE U(0x30860000)
|
||||
#define IMX_UART2_BASE U(0x30890000)
|
||||
#define IMX_UART3_BASE U(0x30880000)
|
||||
#define IMX_UART4_BASE U(0x30a60000)
|
||||
|
||||
#define IMX_AIPSTZ1 U(0x301f0000)
|
||||
#define IMX_AIPSTZ2 U(0x305f0000)
|
||||
#define IMX_AIPSTZ3 U(0x309f0000)
|
||||
|
|
|
@ -49,7 +49,7 @@ static const struct aipstz_cfg aipstz[] = {
|
|||
{0},
|
||||
};
|
||||
|
||||
static const struct imx_rdc_cfg rdc[] = {
|
||||
static struct imx_rdc_cfg rdc[] = {
|
||||
/* Master domain assignment */
|
||||
RDC_MDAn(RDC_MDA_M7, DID1),
|
||||
|
||||
|
@ -166,7 +166,11 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
|
|||
|
||||
imx_aipstz_init(aipstz);
|
||||
|
||||
imx_rdc_init(rdc);
|
||||
if (console_base == 0U) {
|
||||
console_base = imx8m_uart_get_base();
|
||||
}
|
||||
|
||||
imx_rdc_init(rdc, console_base);
|
||||
|
||||
imx_csu_init(csu_cfg);
|
||||
|
||||
|
@ -175,10 +179,6 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
|
|||
val = mmio_read_32(IMX_IOMUX_GPR_BASE + 0x2c);
|
||||
mmio_write_32(IMX_IOMUX_GPR_BASE + 0x2c, val | 0x3DFF0000);
|
||||
|
||||
if (console_base == 0U) {
|
||||
console_base = imx8m_uart_get_base();
|
||||
}
|
||||
|
||||
console_imx_uart_register(console_base, IMX_BOOT_UART_CLK_IN_HZ,
|
||||
IMX_CONSOLE_BAUDRATE, &console);
|
||||
/* This console is only used for boot stage */
|
||||
|
|
|
@ -86,6 +86,11 @@
|
|||
#define PLAT_CRASH_UART_CLK_IN_HZ 24000000
|
||||
#define IMX_CONSOLE_BAUDRATE 115200
|
||||
|
||||
#define IMX_UART1_BASE U(0x30860000)
|
||||
#define IMX_UART2_BASE U(0x30890000)
|
||||
#define IMX_UART3_BASE U(0x30880000)
|
||||
#define IMX_UART4_BASE U(0x30a60000)
|
||||
|
||||
#define IMX_AIPSTZ1 U(0x301f0000)
|
||||
#define IMX_AIPSTZ2 U(0x305f0000)
|
||||
#define IMX_AIPSTZ3 U(0x309f0000)
|
||||
|
|
|
@ -65,6 +65,11 @@
|
|||
#define PLAT_CRASH_UART_CLK_IN_HZ 25000000
|
||||
#define IMX_CONSOLE_BAUDRATE 115200
|
||||
|
||||
#define IMX_UART1_BASE U(0x30860000)
|
||||
#define IMX_UART2_BASE U(0x30890000)
|
||||
#define IMX_UART3_BASE U(0x30880000)
|
||||
#define IMX_UART4_BASE U(0x30a60000)
|
||||
|
||||
#define IMX_AIPS_BASE U(0x30200000)
|
||||
#define IMX_AIPS_SIZE U(0xC00000)
|
||||
#define IMX_AIPS1_BASE U(0x30200000)
|
||||
|
|
|
@ -4,13 +4,78 @@
|
|||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <lib/mmio.h>
|
||||
|
||||
#include <imx_rdc.h>
|
||||
|
||||
void imx_rdc_init(const struct imx_rdc_cfg *rdc_cfg)
|
||||
struct imx_uart {
|
||||
int index;
|
||||
unsigned int uart_base;
|
||||
};
|
||||
|
||||
static const struct imx_uart imx8m_uart_info[] = {
|
||||
{ /* UART 1 */
|
||||
.index = RDC_PDAP_UART1,
|
||||
.uart_base = IMX_UART1_BASE,
|
||||
}, { /* UART 2 */
|
||||
.index = RDC_PDAP_UART2,
|
||||
.uart_base = IMX_UART2_BASE,
|
||||
}, { /* UART 3 */
|
||||
.index = RDC_PDAP_UART3,
|
||||
.uart_base = IMX_UART3_BASE,
|
||||
}, { /* UART 4 */
|
||||
.index = RDC_PDAP_UART4,
|
||||
.uart_base = IMX_UART4_BASE,
|
||||
}
|
||||
};
|
||||
|
||||
static int imx_rdc_uart_get_pdap_index(unsigned int uart_base)
|
||||
{
|
||||
const struct imx_rdc_cfg *rdc = rdc_cfg;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(imx8m_uart_info); i++) {
|
||||
if (imx8m_uart_info[i].uart_base == uart_base) {
|
||||
return imx8m_uart_info[i].index;
|
||||
}
|
||||
}
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static void imx_rdc_console_access_enable(struct imx_rdc_cfg *rdc_cfg,
|
||||
unsigned int console_base)
|
||||
{
|
||||
struct imx_rdc_cfg *rdc;
|
||||
int console_pdap_index;
|
||||
|
||||
console_pdap_index = imx_rdc_uart_get_pdap_index(console_base);
|
||||
if (console_pdap_index < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (rdc = rdc_cfg; rdc->type != RDC_INVALID; rdc++) {
|
||||
if (rdc->type != RDC_PDAP || rdc->index != console_pdap_index) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rdc->index == console_pdap_index &&
|
||||
rdc->setting.rdc_pdap == (D0R | D0W)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (rdc->index == console_pdap_index) {
|
||||
rdc->setting.rdc_pdap = D0R | D0W;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void imx_rdc_init(struct imx_rdc_cfg *rdc_cfg, unsigned int console_base)
|
||||
{
|
||||
struct imx_rdc_cfg *rdc = rdc_cfg;
|
||||
|
||||
imx_rdc_console_access_enable(rdc, console_base);
|
||||
|
||||
while (rdc->type != RDC_INVALID) {
|
||||
switch (rdc->type) {
|
||||
|
|
|
@ -67,7 +67,7 @@ struct imx_rdc_cfg {
|
|||
.setting.rdc_mem_region[2] = (mrc), \
|
||||
}
|
||||
|
||||
void imx_rdc_init(const struct imx_rdc_cfg *cfg);
|
||||
void imx_rdc_init(struct imx_rdc_cfg *cfg, unsigned int console_base);
|
||||
|
||||
#endif /* IMX_RDC_H */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue