Merge a20_mp_start_ap and a31_mp_start_ap into one function.
This function works with all smp non-multicluster allwinner SoC (A20, A31, A31S and H3). Approved by: cognet (mentor) Differential Revision: https://reviews.freebsd.org/D6269
This commit is contained in:
parent
f2dbb750f4
commit
498b9fa710
@ -167,7 +167,7 @@ static platform_method_t a20_methods[] = {
|
||||
PLATFORMMETHOD(platform_devmap_init, allwinner_devmap_init),
|
||||
|
||||
#ifdef SMP
|
||||
PLATFORMMETHOD(platform_mp_start_ap, a20_mp_start_ap),
|
||||
PLATFORMMETHOD(platform_mp_start_ap, aw_mp_start_ap),
|
||||
PLATFORMMETHOD(platform_mp_setmaxid, aw_mp_setmaxid),
|
||||
#endif
|
||||
PLATFORMMETHOD_END,
|
||||
@ -182,7 +182,7 @@ static platform_method_t a31_methods[] = {
|
||||
PLATFORMMETHOD(platform_devmap_init, allwinner_devmap_init),
|
||||
|
||||
#ifdef SMP
|
||||
PLATFORMMETHOD(platform_mp_start_ap, a31_mp_start_ap),
|
||||
PLATFORMMETHOD(platform_mp_start_ap, aw_mp_start_ap),
|
||||
PLATFORMMETHOD(platform_mp_setmaxid, aw_mp_setmaxid),
|
||||
#endif
|
||||
PLATFORMMETHOD_END,
|
||||
@ -197,7 +197,7 @@ static platform_method_t a31s_methods[] = {
|
||||
PLATFORMMETHOD(platform_devmap_init, allwinner_devmap_init),
|
||||
|
||||
#ifdef SMP
|
||||
PLATFORMMETHOD(platform_mp_start_ap, a31_mp_start_ap),
|
||||
PLATFORMMETHOD(platform_mp_start_ap, aw_mp_start_ap),
|
||||
PLATFORMMETHOD(platform_mp_setmaxid, aw_mp_setmaxid),
|
||||
#endif
|
||||
PLATFORMMETHOD_END,
|
||||
|
@ -107,12 +107,28 @@ aw_mp_setmaxid(platform_t plat)
|
||||
mp_maxid = ncpu - 1;
|
||||
}
|
||||
|
||||
static void
|
||||
aw_common_mp_start_ap(bus_space_handle_t cpucfg, bus_space_handle_t prcm)
|
||||
void
|
||||
aw_mp_start_ap(platform_t plat)
|
||||
{
|
||||
int i, j;
|
||||
bus_space_handle_t cpucfg;
|
||||
bus_space_handle_t prcm;
|
||||
int i, j, soc_family;
|
||||
uint32_t val;
|
||||
|
||||
soc_family = allwinner_soc_family();
|
||||
if (soc_family == ALLWINNERSOC_SUN7I) {
|
||||
if (bus_space_map(fdtbus_bs_tag, A20_CPUCFG_BASE, CPUCFG_SIZE,
|
||||
0, &cpucfg) != 0)
|
||||
panic("Couldn't map the CPUCFG\n");
|
||||
} else {
|
||||
if (bus_space_map(fdtbus_bs_tag, CPUCFG_BASE, CPUCFG_SIZE,
|
||||
0, &cpucfg) != 0)
|
||||
panic("Couldn't map the CPUCFG\n");
|
||||
if (bus_space_map(fdtbus_bs_tag, PRCM_BASE, PRCM_SIZE, 0,
|
||||
&prcm) != 0)
|
||||
panic("Couldn't map the PRCM\n");
|
||||
}
|
||||
|
||||
dcache_wbinv_poc_all();
|
||||
|
||||
bus_space_write_4(fdtbus_bs_tag, cpucfg, CPUCFG_P_REG0,
|
||||
@ -141,7 +157,7 @@ aw_common_mp_start_ap(bus_space_handle_t cpucfg, bus_space_handle_t prcm)
|
||||
/* Release power clamp */
|
||||
for (i = 1; i < mp_ncpus; i++)
|
||||
for (j = 0; j <= CPU_PWR_CLAMP_STEPS; j++) {
|
||||
if (prcm) {
|
||||
if (soc_family != ALLWINNERSOC_SUN7I) {
|
||||
bus_space_write_4(fdtbus_bs_tag, prcm,
|
||||
CPU_PWR_CLAMP(i), 0xff >> j);
|
||||
} else {
|
||||
@ -152,7 +168,7 @@ aw_common_mp_start_ap(bus_space_handle_t cpucfg, bus_space_handle_t prcm)
|
||||
DELAY(10000);
|
||||
|
||||
/* Clear power-off gating */
|
||||
if (prcm) {
|
||||
if (soc_family != ALLWINNERSOC_SUN7I) {
|
||||
val = bus_space_read_4(fdtbus_bs_tag, prcm, CPU_PWROFF);
|
||||
for (i = 0; i < mp_ncpus; i++)
|
||||
val &= ~(1 << i);
|
||||
@ -179,39 +195,8 @@ aw_common_mp_start_ap(bus_space_handle_t cpucfg, bus_space_handle_t prcm)
|
||||
|
||||
armv7_sev();
|
||||
bus_space_unmap(fdtbus_bs_tag, cpucfg, CPUCFG_SIZE);
|
||||
}
|
||||
|
||||
void
|
||||
a20_mp_start_ap(platform_t plat)
|
||||
{
|
||||
bus_space_handle_t cpucfg;
|
||||
|
||||
if (bus_space_map(fdtbus_bs_tag, A20_CPUCFG_BASE, CPUCFG_SIZE,
|
||||
0, &cpucfg) != 0)
|
||||
panic("Couldn't map the CPUCFG\n");
|
||||
|
||||
aw_common_mp_start_ap(cpucfg, 0);
|
||||
armv7_sev();
|
||||
bus_space_unmap(fdtbus_bs_tag, cpucfg, CPUCFG_SIZE);
|
||||
}
|
||||
|
||||
void
|
||||
a31_mp_start_ap(platform_t plat)
|
||||
{
|
||||
bus_space_handle_t cpucfg;
|
||||
bus_space_handle_t prcm;
|
||||
|
||||
if (bus_space_map(fdtbus_bs_tag, CPUCFG_BASE, CPUCFG_SIZE,
|
||||
0, &cpucfg) != 0)
|
||||
panic("Couldn't map the CPUCFG\n");
|
||||
if (bus_space_map(fdtbus_bs_tag, PRCM_BASE, PRCM_SIZE, 0,
|
||||
&prcm) != 0)
|
||||
panic("Couldn't map the PRCM\n");
|
||||
|
||||
aw_common_mp_start_ap(cpucfg, prcm);
|
||||
armv7_sev();
|
||||
bus_space_unmap(fdtbus_bs_tag, cpucfg, CPUCFG_SIZE);
|
||||
bus_space_unmap(fdtbus_bs_tag, prcm, PRCM_SIZE);
|
||||
if (soc_family != ALLWINNERSOC_SUN7I)
|
||||
bus_space_unmap(fdtbus_bs_tag, prcm, PRCM_SIZE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -29,8 +29,7 @@
|
||||
#define _AW_MP_H_
|
||||
|
||||
void aw_mp_setmaxid(platform_t plat);
|
||||
void a20_mp_start_ap(platform_t plat);
|
||||
void a31_mp_start_ap(platform_t plat);
|
||||
void aw_mp_start_ap(platform_t plat);
|
||||
void a83t_mp_start_ap(platform_t plat);
|
||||
|
||||
#endif /* _AW_MP_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user