diff mbox series

[V3,6/9] cpu: imx8: support a72 as boot cpu

Message ID 20200503135855.11484-6-peng.fan@nxp.com
State Accepted
Commit 177f9996d3cdf04a592bc0fece640cf4d492d1cb
Headers show
Series [V3,1/9] uclass: cpu: Add new API to get udevice for current CPU | expand

Commit Message

Peng Fan May 3, 2020, 1:58 p.m. UTC
Support booting i.MX8QM with A72 as boot cpu

Reviewed-by: Simon Glass <sjg at chromium.org>
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
V3:
 None
V2:
 Add R-b tag

 drivers/cpu/imx8_cpu.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Stefano Babic May 4, 2020, 7:35 a.m. UTC | #1
> Support booting i.MX8QM with A72 as boot cpu
> Reviewed-by: Simon Glass <sjg at chromium.org>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/drivers/cpu/imx8_cpu.c b/drivers/cpu/imx8_cpu.c
index 7c54c290b8..c4679e1642 100644
--- a/drivers/cpu/imx8_cpu.c
+++ b/drivers/cpu/imx8_cpu.c
@@ -20,6 +20,7 @@  struct cpu_imx_platdata {
 	const char *type;
 	u32 cpurev;
 	u32 freq_mhz;
+	u32 mpidr;
 };
 
 const char *get_imx8_type(u32 imxtype)
@@ -144,16 +145,28 @@  static int cpu_imx_get_vendor(struct udevice *dev,  char *buf, int size)
 	return 0;
 }
 
+static int cpu_imx_is_current(struct udevice *dev)
+{
+	struct cpu_imx_platdata *plat = dev_get_platdata(dev);
+
+	if (plat->mpidr == (read_mpidr() & 0xffff))
+		return 1;
+
+	return 0;
+}
+
 static const struct cpu_ops cpu_imx8_ops = {
 	.get_desc	= cpu_imx_get_desc,
 	.get_info	= cpu_imx_get_info,
 	.get_count	= cpu_imx_get_count,
 	.get_vendor	= cpu_imx_get_vendor,
+	.is_current	= cpu_imx_is_current,
 };
 
 static const struct udevice_id cpu_imx8_ids[] = {
 	{ .compatible = "arm,cortex-a35" },
 	{ .compatible = "arm,cortex-a53" },
+	{ .compatible = "arm,cortex-a72" },
 	{ }
 };
 
@@ -185,6 +198,12 @@  static int imx8_cpu_probe(struct udevice *dev)
 	plat->rev = get_imx8_rev(cpurev & 0xFFF);
 	plat->type = get_imx8_type((cpurev & 0xFF000) >> 12);
 	plat->freq_mhz = imx8_get_cpu_rate() / 1000000;
+	plat->mpidr = dev_read_addr(dev);
+	if (plat->mpidr == FDT_ADDR_T_NONE) {
+		printf("%s: Failed to get CPU reg property\n", __func__);
+		return -EINVAL;
+	}
+
 	return 0;
 }