Skip to content

Commit 8a73b5b

Browse files
Zhiqiang-Houfabioestevam
authored andcommitted
cpu: imx: implement release_core callback
Release the secondary cores through the PSCI request. Signed-off-by: Hou Zhiqiang <[email protected]>
1 parent 01d94d0 commit 8a73b5b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

drivers/cpu/imx8_cpu.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <dm.h>
88
#include <thermal.h>
99
#include <asm/global_data.h>
10+
#include <asm/ptrace.h>
1011
#include <asm/system.h>
1112
#include <firmware/imx/sci/sci.h>
1213
#include <asm/arch/sys_proto.h>
@@ -15,6 +16,7 @@
1516
#include <imx_thermal.h>
1617
#include <linux/bitops.h>
1718
#include <linux/clk-provider.h>
19+
#include <linux/psci.h>
1820

1921
DECLARE_GLOBAL_DATA_PTR;
2022

@@ -240,12 +242,34 @@ static int cpu_imx_is_current(struct udevice *dev)
240242
return 0;
241243
}
242244

245+
static int cpu_imx_release_core(const struct udevice *dev, phys_addr_t addr)
246+
{
247+
struct cpu_imx_plat *plat = dev_get_plat(dev);
248+
struct pt_regs regs;
249+
250+
regs.regs[0] = PSCI_0_2_FN64_CPU_ON;
251+
regs.regs[1] = plat->mpidr;
252+
regs.regs[2] = addr;
253+
regs.regs[3] = 0;
254+
255+
smc_call(&regs);
256+
if (regs.regs[0]) {
257+
printf("Failed to release CPU core (mpidr: 0x%x)\n", plat->mpidr);
258+
return -1;
259+
}
260+
261+
printf("Released CPU core (mpidr: 0x%x) to address 0x%llx\n", plat->mpidr, addr);
262+
263+
return 0;
264+
}
265+
243266
static const struct cpu_ops cpu_imx_ops = {
244267
.get_desc = cpu_imx_get_desc,
245268
.get_info = cpu_imx_get_info,
246269
.get_count = cpu_imx_get_count,
247270
.get_vendor = cpu_imx_get_vendor,
248271
.is_current = cpu_imx_is_current,
272+
.release_core = cpu_imx_release_core,
249273
};
250274

251275
static const struct udevice_id cpu_imx_ids[] = {

0 commit comments

Comments
 (0)