diff options
Diffstat (limited to 'plat/socionext/uniphier/uniphier_bl31_setup.c')
-rw-r--r-- | plat/socionext/uniphier/uniphier_bl31_setup.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/plat/socionext/uniphier/uniphier_bl31_setup.c b/plat/socionext/uniphier/uniphier_bl31_setup.c index 47f2378bc..c2baebde9 100644 --- a/plat/socionext/uniphier/uniphier_bl31_setup.c +++ b/plat/socionext/uniphier/uniphier_bl31_setup.c @@ -14,13 +14,13 @@ #include <common/debug.h> #include <drivers/console.h> #include <lib/mmio.h> -#include <lib/xlat_tables/xlat_mmu_helpers.h> #include <plat/common/platform.h> #include "uniphier.h" static entry_point_info_t bl32_image_ep_info; static entry_point_info_t bl33_image_ep_info; +static unsigned int uniphier_soc = UNIPHIER_SOC_UNKNOWN; entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type) { @@ -37,7 +37,11 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, bl_params_node_t *bl_params = ((bl_params_t *)from_bl2)->head; - uniphier_console_setup(); + uniphier_soc = uniphier_get_soc_id(); + if (uniphier_soc == UNIPHIER_SOC_UNKNOWN) + plat_error_handler(-ENOTSUP); + + uniphier_console_setup(uniphier_soc); while (bl_params) { if (bl_params->image_id == BL32_IMAGE_ID) @@ -53,32 +57,33 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, panic(); } -#define UNIPHIER_SYS_CNTCTL_BASE 0x60E00000 +static const uintptr_t uniphier_cntctl_base[] = { + [UNIPHIER_SOC_LD11] = 0x60e00000, + [UNIPHIER_SOC_LD20] = 0x60e00000, + [UNIPHIER_SOC_PXS3] = 0x60e00000, +}; void bl31_platform_setup(void) { - unsigned int soc; + uintptr_t cntctl_base; - soc = uniphier_get_soc_id(); - if (soc == UNIPHIER_SOC_UNKNOWN) { - ERROR("unsupported SoC\n"); - plat_error_handler(-ENOTSUP); - } - - uniphier_cci_init(soc); + uniphier_cci_init(uniphier_soc); uniphier_cci_enable(); /* Initialize the GIC driver, cpu and distributor interfaces */ - uniphier_gic_driver_init(soc); + uniphier_gic_driver_init(uniphier_soc); uniphier_gic_init(); + assert(uniphier_soc < ARRAY_SIZE(uniphier_cntctl_base)); + cntctl_base = uniphier_cntctl_base[uniphier_soc]; + /* Enable and initialize the System level generic timer */ - mmio_write_32(UNIPHIER_SYS_CNTCTL_BASE + CNTCR_OFF, - CNTCR_FCREQ(0U) | CNTCR_EN); + mmio_write_32(cntctl_base + CNTCR_OFF, CNTCR_FCREQ(0U) | CNTCR_EN); + + uniphier_psci_init(uniphier_soc); } void bl31_plat_arch_setup(void) { - uniphier_mmap_setup(); - enable_mmu_el3(0); + uniphier_mmap_setup(uniphier_soc); } |