bsp/imx: Add SMP support

Update #3090.
This commit is contained in:
Sebastian Huber
2017-09-22 13:48:40 +02:00
parent 3ad3849a89
commit 29919242db
3 changed files with 35 additions and 19 deletions

View File

@@ -88,6 +88,7 @@ libbsp_a_SOURCES += startup/bspreset.c
libbsp_a_SOURCES += startup/bspstart.c
libbsp_a_SOURCES += startup/ccm.c
if HAS_SMP
libbsp_a_SOURCES += ../shared/arm-a9mpcore-smp.c
libbsp_a_SOURCES += startup/bspsmp.c
endif

View File

@@ -14,28 +14,34 @@
#include <rtems/score/smpimpl.h>
uint32_t _CPU_SMP_Initialize(void)
{
return 1;
}
#include <arm/freescale/imx/imx_srcreg.h>
#include <arm/freescale/imx/imx_gpcreg.h>
#include <bsp/start.h>
bool _CPU_SMP_Start_processor(uint32_t cpu_index)
{
(void) cpu_index;
bool started;
/* Nothing to do */
if (cpu_index == 1) {
volatile imx_src *src = (volatile imx_src *) 0x30390000;
volatile imx_gpc *gpc = (volatile imx_gpc *) 0x303a0000;
return true;
}
void _CPU_SMP_Finalize_initialization(uint32_t cpu_count)
{
}
void _CPU_SMP_Prepare_start_multitasking(void)
{
}
void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
{
src->gpr3 = (uint32_t) _start;
gpc->pgc_a7core0_ctrl |= IMX_GPC_PGC_CTRL_PCR;
gpc->cpu_pgc_sw_pup_req |= IMX_GPC_CPU_PGC_CORE1_A7;
while ((gpc->cpu_pgc_pup_status1 & IMX_GPC_CPU_PGC_CORE1_A7) != 0) {
/* Wait */
}
gpc->pgc_a7core0_ctrl &= ~IMX_GPC_PGC_CTRL_PCR;
src->a7rcr1 |= IMX_SRC_A7RCR1_A7_CORE1_ENABLE;
started = true;
} else {
started = false;
}
return started;
}

View File

@@ -47,6 +47,15 @@ BSP_START_TEXT_SECTION static void setup_mmu_and_cache(void)
BSP_START_TEXT_SECTION void bsp_start_hook_0(void)
{
#ifdef RTEMS_SMP
uint32_t cpu_id = arm_cortex_a9_get_multiprocessor_cpu_id();
arm_a9mpcore_start_enable_smp_in_auxiliary_control();
if (cpu_id != 0) {
arm_a9mpcore_start_on_secondary_processor();
}
#endif
}
BSP_START_TEXT_SECTION void bsp_start_hook_1(void)