[PATCH 04/42] imx: move imx8 sci header file to include/firmware/imx
Peng Fan (OSS)
peng.fan at oss.nxp.com
Fri Apr 28 06:08:09 CEST 2023
From: Peng Fan <peng.fan at nxp.com>
Move imx8 sci header file to include/firmware/imx, then we could
use build macro to reuse some i.MX8 drivers for i.MX9, such as
drivers/cpu/imx8_cpu.c.
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
arch/arm/include/asm/arch-imx8/power-domain.h | 2 +-
arch/arm/include/asm/arch-imx8/sys_proto.h | 2 +-
arch/arm/mach-imx/cmd_dek.c | 2 +-
arch/arm/mach-imx/imx8/ahab.c | 2 +-
arch/arm/mach-imx/imx8/cpu.c | 2 +-
arch/arm/mach-imx/imx8/fdt.c | 2 +-
arch/arm/mach-imx/imx8/iomux.c | 2 +-
arch/arm/mach-imx/imx8/misc.c | 2 +-
arch/arm/mach-imx/imx8/snvs_security_sc.c | 2 +-
arch/arm/mach-imx/parse-container.c | 2 +-
.../imx8qm_rom7720_a1/imx8qm_rom7720_a1.c | 2 +-
board/advantech/imx8qm_rom7720_a1/spl.c | 2 +-
board/congatec/cgtqmx8/cgtqmx8.c | 2 +-
board/freescale/imx8qm_mek/imx8qm_mek.c | 2 +-
board/freescale/imx8qxp_mek/imx8qxp_mek.c | 2 +-
board/freescale/imx8qxp_mek/spl.c | 2 +-
board/siemens/capricorn/board.c | 2 +-
board/toradex/apalis-imx8/apalis-imx8.c | 2 +-
board/toradex/colibri-imx8x/colibri-imx8x.c | 2 +-
drivers/clk/imx/clk-imx8.c | 2 +-
drivers/clk/imx/clk-imx8qm.c | 2 +-
drivers/clk/imx/clk-imx8qxp.c | 2 +-
drivers/cpu/imx8_cpu.c | 2 +-
drivers/cpu/imx9_cpu.c | 224 ++++++++++++++++++
drivers/misc/imx8/fuse.c | 2 +-
drivers/misc/imx8/scu.c | 2 +-
drivers/misc/imx8/scu_api.c | 2 +-
drivers/pinctrl/nxp/pinctrl-scu.c | 2 +-
.../power/domain/imx8-power-domain-legacy.c | 2 +-
drivers/power/domain/imx8-power-domain.c | 2 +-
drivers/thermal/imx_scu_thermal.c | 2 +-
.../firmware/imx}/sci/rpc.h | 0
.../firmware/imx}/sci/sci.h | 14 +-
.../firmware/imx}/sci/svc/misc/api.h | 0
.../firmware/imx}/sci/svc/pad/api.h | 0
.../firmware/imx}/sci/svc/pm/api.h | 0
.../firmware/imx}/sci/svc/rm/api.h | 2 +-
.../firmware/imx}/sci/svc/seco/api.h | 2 +-
.../firmware/imx}/sci/types.h | 0
39 files changed, 263 insertions(+), 39 deletions(-)
create mode 100644 drivers/cpu/imx9_cpu.c
rename {arch/arm/include/asm/arch-imx8 => include/firmware/imx}/sci/rpc.h (100%)
rename {arch/arm/include/asm/arch-imx8 => include/firmware/imx}/sci/sci.h (94%)
rename {arch/arm/include/asm/arch-imx8 => include/firmware/imx}/sci/svc/misc/api.h (100%)
rename {arch/arm/include/asm/arch-imx8 => include/firmware/imx}/sci/svc/pad/api.h (100%)
rename {arch/arm/include/asm/arch-imx8 => include/firmware/imx}/sci/svc/pm/api.h (100%)
rename {arch/arm/include/asm/arch-imx8 => include/firmware/imx}/sci/svc/rm/api.h (98%)
rename {arch/arm/include/asm/arch-imx8 => include/firmware/imx}/sci/svc/seco/api.h (96%)
rename {arch/arm/include/asm/arch-imx8 => include/firmware/imx}/sci/types.h (100%)
diff --git a/arch/arm/include/asm/arch-imx8/power-domain.h b/arch/arm/include/asm/arch-imx8/power-domain.h
index 1db86a1209b..bdb0baa9844 100644
--- a/arch/arm/include/asm/arch-imx8/power-domain.h
+++ b/arch/arm/include/asm/arch-imx8/power-domain.h
@@ -6,7 +6,7 @@
#ifndef _ASM_ARCH_IMX8_POWER_DOMAIN_H
#define _ASM_ARCH_IMX8_POWER_DOMAIN_H
-#include <asm/arch/sci/types.h>
+#include <firmware/imx/sci/types.h>
struct imx8_power_domain_plat {
sc_rsrc_t resource_id;
diff --git a/arch/arm/include/asm/arch-imx8/sys_proto.h b/arch/arm/include/asm/arch-imx8/sys_proto.h
index d38f606e07e..e7625c42985 100644
--- a/arch/arm/include/asm/arch-imx8/sys_proto.h
+++ b/arch/arm/include/asm/arch-imx8/sys_proto.h
@@ -3,7 +3,7 @@
* Copyright 2018 NXP
*/
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/mach-imx/sys_proto.h>
#include <asm/arch/power-domain.h>
#include <dm/platdata.h>
diff --git a/arch/arm/mach-imx/cmd_dek.c b/arch/arm/mach-imx/cmd_dek.c
index b65bf874b83..69ed57537b3 100644
--- a/arch/arm/mach-imx/cmd_dek.c
+++ b/arch/arm/mach-imx/cmd_dek.c
@@ -17,7 +17,7 @@
#include <mapmem.h>
#include <tee.h>
#ifdef CONFIG_IMX_SECO_DEK_ENCAP
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/mach-imx/image.h>
#endif
#include <cpu_func.h>
diff --git a/arch/arm/mach-imx/imx8/ahab.c b/arch/arm/mach-imx/imx8/ahab.c
index 5a4d39cdaad..9addb824b6d 100644
--- a/arch/arm/mach-imx/imx8/ahab.c
+++ b/arch/arm/mach-imx/imx8/ahab.c
@@ -9,7 +9,7 @@
#include <log.h>
#include <asm/global_data.h>
#include <asm/io.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/mach-imx/sys_proto.h>
#include <asm/arch-imx/cpu.h>
#include <asm/arch/sys_proto.h>
diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c
index be1f4edded1..894a8c14fe9 100644
--- a/arch/arm/mach-imx/imx8/cpu.c
+++ b/arch/arm/mach-imx/imx8/cpu.c
@@ -19,7 +19,7 @@
#include <errno.h>
#include <spl.h>
#include <thermal.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch-imx/cpu.h>
#include <asm/armv8/cpu.h>
diff --git a/arch/arm/mach-imx/imx8/fdt.c b/arch/arm/mach-imx/imx8/fdt.c
index a132ce2e6a3..02b3ee5c111 100644
--- a/arch/arm/mach-imx/imx8/fdt.c
+++ b/arch/arm/mach-imx/imx8/fdt.c
@@ -5,7 +5,7 @@
#include <common.h>
#include <log.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/sys_proto.h>
#include <asm/global_data.h>
#include <dm/ofnode.h>
diff --git a/arch/arm/mach-imx/imx8/iomux.c b/arch/arm/mach-imx/imx8/iomux.c
index 9c3cfbf0068..e4f7651bd1d 100644
--- a/arch/arm/mach-imx/imx8/iomux.c
+++ b/arch/arm/mach-imx/imx8/iomux.c
@@ -8,7 +8,7 @@
#include <asm/global_data.h>
#include <asm/io.h>
#include <asm/arch/iomux.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/arm/mach-imx/imx8/misc.c b/arch/arm/mach-imx/imx8/misc.c
index de19955e2f7..0ce3036818b 100644
--- a/arch/arm/mach-imx/imx8/misc.c
+++ b/arch/arm/mach-imx/imx8/misc.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
#include <common.h>
#include <log.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/mach-imx/sys_proto.h>
#include <imx_sip.h>
#include <linux/arm-smccc.h>
diff --git a/arch/arm/mach-imx/imx8/snvs_security_sc.c b/arch/arm/mach-imx/imx8/snvs_security_sc.c
index 507b5b42314..d7b20a1fcbf 100644
--- a/arch/arm/mach-imx/imx8/snvs_security_sc.c
+++ b/arch/arm/mach-imx/imx8/snvs_security_sc.c
@@ -15,7 +15,7 @@
#include <log.h>
#include <stddef.h>
#include <common.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch-imx8/imx8-pins.h>
#include <asm/arch-imx8/snvs_security_sc.h>
#include <asm/global_data.h>
diff --git a/arch/arm/mach-imx/parse-container.c b/arch/arm/mach-imx/parse-container.c
index a4214d53768..f7582825d6d 100644
--- a/arch/arm/mach-imx/parse-container.c
+++ b/arch/arm/mach-imx/parse-container.c
@@ -9,7 +9,7 @@
#include <spl.h>
#include <asm/mach-imx/image.h>
#ifdef CONFIG_AHAB_BOOT
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#endif
#define SEC_SECURE_RAM_BASE 0x31800000UL
diff --git a/board/advantech/imx8qm_rom7720_a1/imx8qm_rom7720_a1.c b/board/advantech/imx8qm_rom7720_a1/imx8qm_rom7720_a1.c
index ace18b2d603..206ce7d5c13 100644
--- a/board/advantech/imx8qm_rom7720_a1/imx8qm_rom7720_a1.c
+++ b/board/advantech/imx8qm_rom7720_a1/imx8qm_rom7720_a1.c
@@ -15,7 +15,7 @@
#include <asm/io.h>
#include <asm/gpio.h>
#include <asm/arch/clock.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/imx8-pins.h>
#include <asm/arch/iomux.h>
#include <asm/arch/sys_proto.h>
diff --git a/board/advantech/imx8qm_rom7720_a1/spl.c b/board/advantech/imx8qm_rom7720_a1/spl.c
index 22ed6397992..b602437c35b 100644
--- a/board/advantech/imx8qm_rom7720_a1/spl.c
+++ b/board/advantech/imx8qm_rom7720_a1/spl.c
@@ -14,7 +14,7 @@
#include <asm/io.h>
#include <asm/gpio.h>
#include <asm/arch/clock.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/imx8-pins.h>
#include <asm/arch/iomux.h>
diff --git a/board/congatec/cgtqmx8/cgtqmx8.c b/board/congatec/cgtqmx8/cgtqmx8.c
index c0a8a497c7b..bedd1e03308 100644
--- a/board/congatec/cgtqmx8/cgtqmx8.c
+++ b/board/congatec/cgtqmx8/cgtqmx8.c
@@ -12,7 +12,7 @@
#include <asm/io.h>
#include <asm/gpio.h>
#include <asm/arch/clock.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/imx8-pins.h>
#include <usb.h>
#include <asm/arch/iomux.h>
diff --git a/board/freescale/imx8qm_mek/imx8qm_mek.c b/board/freescale/imx8qm_mek/imx8qm_mek.c
index 682099ad9cf..d96d1d07bb1 100644
--- a/board/freescale/imx8qm_mek/imx8qm_mek.c
+++ b/board/freescale/imx8qm_mek/imx8qm_mek.c
@@ -14,7 +14,7 @@
#include <asm/io.h>
#include <asm/gpio.h>
#include <asm/arch/clock.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/imx8-pins.h>
#include <asm/arch/iomux.h>
#include <asm/arch/sys_proto.h>
diff --git a/board/freescale/imx8qxp_mek/imx8qxp_mek.c b/board/freescale/imx8qxp_mek/imx8qxp_mek.c
index 21cfa142f3b..516cefd2f24 100644
--- a/board/freescale/imx8qxp_mek/imx8qxp_mek.c
+++ b/board/freescale/imx8qxp_mek/imx8qxp_mek.c
@@ -16,7 +16,7 @@
#include <asm/io.h>
#include <asm/gpio.h>
#include <asm/arch/clock.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/imx8-pins.h>
#include <asm/arch/snvs_security_sc.h>
#include <asm/arch/iomux.h>
diff --git a/board/freescale/imx8qxp_mek/spl.c b/board/freescale/imx8qxp_mek/spl.c
index 2fa68400561..75aab1651c0 100644
--- a/board/freescale/imx8qxp_mek/spl.c
+++ b/board/freescale/imx8qxp_mek/spl.c
@@ -18,7 +18,7 @@
#include <dm/lists.h>
#include <asm/io.h>
#include <asm/gpio.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/imx8-pins.h>
#include <asm/arch/iomux.h>
#include <asm/arch/sys_proto.h>
diff --git a/board/siemens/capricorn/board.c b/board/siemens/capricorn/board.c
index 4a02d64aec3..a0c62e0fc4c 100644
--- a/board/siemens/capricorn/board.c
+++ b/board/siemens/capricorn/board.c
@@ -22,7 +22,7 @@
#include <asm/gpio.h>
#include <asm/arch/imx8-pins.h>
#include <asm/arch/iomux.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/sys_proto.h>
#ifndef CONFIG_SPL
#include <asm/arch-imx8/clock.h>
diff --git a/board/toradex/apalis-imx8/apalis-imx8.c b/board/toradex/apalis-imx8/apalis-imx8.c
index 6b43b587007..aa76c486eec 100644
--- a/board/toradex/apalis-imx8/apalis-imx8.c
+++ b/board/toradex/apalis-imx8/apalis-imx8.c
@@ -11,8 +11,8 @@
#include <asm/arch/clock.h>
#include <asm/arch/imx8-pins.h>
#include <asm/arch/iomux.h>
-#include <asm/arch/sci/sci.h>
#include <asm/arch/snvs_security_sc.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/sys_proto.h>
#include <asm/gpio.h>
#include <asm/io.h>
diff --git a/board/toradex/colibri-imx8x/colibri-imx8x.c b/board/toradex/colibri-imx8x/colibri-imx8x.c
index 6ed9cc4fa80..52fc7a391bb 100644
--- a/board/toradex/colibri-imx8x/colibri-imx8x.c
+++ b/board/toradex/colibri-imx8x/colibri-imx8x.c
@@ -11,7 +11,7 @@
#include <asm/arch/clock.h>
#include <asm/arch/imx8-pins.h>
#include <asm/arch/iomux.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/sys_proto.h>
#include <asm/gpio.h>
#include <asm/io.h>
diff --git a/drivers/clk/imx/clk-imx8.c b/drivers/clk/imx/clk-imx8.c
index 24bdab28aa4..ceeead34349 100644
--- a/drivers/clk/imx/clk-imx8.c
+++ b/drivers/clk/imx/clk-imx8.c
@@ -9,7 +9,7 @@
#include <dm.h>
#include <log.h>
#include <malloc.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/clock.h>
#include <dt-bindings/clock/imx8qxp-clock.h>
#include <dt-bindings/soc/imx_rsrc.h>
diff --git a/drivers/clk/imx/clk-imx8qm.c b/drivers/clk/imx/clk-imx8qm.c
index b874915ba6a..6c05d07c340 100644
--- a/drivers/clk/imx/clk-imx8qm.c
+++ b/drivers/clk/imx/clk-imx8qm.c
@@ -8,7 +8,7 @@
#include <clk-uclass.h>
#include <dm.h>
#include <log.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/clock.h>
#include <dt-bindings/clock/imx8qm-clock.h>
#include <dt-bindings/soc/imx_rsrc.h>
diff --git a/drivers/clk/imx/clk-imx8qxp.c b/drivers/clk/imx/clk-imx8qxp.c
index d580b437221..8bf7e325481 100644
--- a/drivers/clk/imx/clk-imx8qxp.c
+++ b/drivers/clk/imx/clk-imx8qxp.c
@@ -8,7 +8,7 @@
#include <clk-uclass.h>
#include <dm.h>
#include <log.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/clock.h>
#include <dt-bindings/clock/imx8qxp-clock.h>
#include <dt-bindings/soc/imx_rsrc.h>
diff --git a/drivers/cpu/imx8_cpu.c b/drivers/cpu/imx8_cpu.c
index b8eb2d28006..dc060513b38 100644
--- a/drivers/cpu/imx8_cpu.c
+++ b/drivers/cpu/imx8_cpu.c
@@ -9,7 +9,7 @@
#include <thermal.h>
#include <asm/global_data.h>
#include <asm/system.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch-imx/cpu.h>
#include <asm/armv8/cpu.h>
diff --git a/drivers/cpu/imx9_cpu.c b/drivers/cpu/imx9_cpu.c
new file mode 100644
index 00000000000..66534fe6d17
--- /dev/null
+++ b/drivers/cpu/imx9_cpu.c
@@ -0,0 +1,224 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019 NXP
+ */
+
+#include <common.h>
+#include <cpu.h>
+#include <dm.h>
+#include <thermal.h>
+#include <asm/global_data.h>
+#include <asm/system.h>
+#include <firmware/linux/imx/sci/sci.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch-imx/cpu.h>
+#include <asm/armv8/cpu.h>
+#include <linux/bitops.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct cpu_imx_plat {
+ const char *name;
+ const char *rev;
+ const char *type;
+ u32 cpu_rsrc;
+ u32 cpurev;
+ u32 freq_mhz;
+ u32 mpidr;
+};
+
+const char *get_imx9_type(u32 imxtype)
+{
+ switch (imxtype) {
+ case MXC_CPU_IMX93:
+ return "93";
+ default:
+ return "??";
+ }
+}
+
+const char *get_imx9_rev(u32 rev)
+{
+ switch (rev) {
+ case CHIP_REV_1_0:
+ return "1.";
+ case CHIP_REV_B:
+ return "B";
+ case CHIP_REV_C:
+ return "C";
+ default:
+ return "?";
+ }
+}
+
+static void set_core_data(struct udevice *dev)
+{
+ struct cpu_imx_plat *plat = dev_get_plat(dev);
+
+ if (device_is_compatible(dev, "arm,cortex-a35"))
+ plat->name = "A35";
+ else
+ plat->name = "?";
+}
+
+#if IS_ENABLED(CONFIG_IMX_SCU_THERMAL)
+static int cpu_imx_get_temp(struct cpu_imx_plat *plat)
+{
+ struct udevice *thermal_dev;
+ int cpu_tmp, ret;
+ int idx = 1; /* use "cpu-thermal0" device */
+
+ if (plat->cpu_rsrc == SC_R_A72)
+ idx = 2; /* use "cpu-thermal1" device */
+
+ ret = uclass_get_device(UCLASS_THERMAL, idx, &thermal_dev);
+ if (!ret) {
+ ret = thermal_get_temp(thermal_dev, &cpu_tmp);
+ if (ret)
+ return 0xdeadbeef;
+ } else {
+ return 0xdeadbeef;
+ }
+
+ return cpu_tmp;
+}
+#else
+static int cpu_imx_get_temp(struct cpu_imx_plat *plat)
+{
+ return 0;
+}
+#endif
+
+int cpu_imx_get_desc(const struct udevice *dev, char *buf, int size)
+{
+ struct cpu_imx_plat *plat = dev_get_plat(dev);
+ int ret, temp;
+
+ if (size < 100)
+ return -ENOSPC;
+
+ ret = snprintf(buf, size, "NXP i.MX8%s Rev%s %s at %u MHz",
+ plat->type, plat->rev, plat->name, plat->freq_mhz);
+
+ if (IS_ENABLED(CONFIG_IMX_SCU_THERMAL)) {
+ temp = cpu_imx_get_temp(plat);
+ buf = buf + ret;
+ size = size - ret;
+ if (temp != 0xdeadbeef)
+ ret = snprintf(buf, size, " at %dC", temp);
+ else
+ ret = snprintf(buf, size, " - invalid sensor data");
+ }
+
+ snprintf(buf + ret, size - ret, "\n");
+
+ return 0;
+}
+
+static int cpu_imx_get_info(const struct udevice *dev, struct cpu_info *info)
+{
+ struct cpu_imx_plat *plat = dev_get_plat(dev);
+
+ info->cpu_freq = plat->freq_mhz * 1000;
+ info->features = BIT(CPU_FEAT_L1_CACHE) | BIT(CPU_FEAT_MMU);
+ return 0;
+}
+
+static int cpu_imx_get_count(const struct udevice *dev)
+{
+ ofnode node;
+ int num = 0;
+
+ ofnode_for_each_subnode(node, dev_ofnode(dev->parent)) {
+ const char *device_type;
+
+ if (!ofnode_is_enabled(node))
+ continue;
+
+ device_type = ofnode_read_string(node, "device_type");
+ if (!device_type)
+ continue;
+
+ if (!strcmp(device_type, "cpu"))
+ num++;
+ }
+
+ return num;
+}
+
+static int cpu_imx_get_vendor(const struct udevice *dev, char *buf, int size)
+{
+ snprintf(buf, size, "NXP");
+ return 0;
+}
+
+static int cpu_imx_is_current(struct udevice *dev)
+{
+ struct cpu_imx_plat *plat = dev_get_plat(dev);
+
+ if (plat->mpidr == (read_mpidr() & 0xffff))
+ return 1;
+
+ return 0;
+}
+
+static const struct cpu_ops cpu_imx9_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_imx9_ids[] = {
+ { .compatible = "arm,cortex-a35" },
+ { .compatible = "arm,cortex-a53" },
+ { .compatible = "arm,cortex-a72" },
+ { }
+};
+
+static ulong imx9_get_cpu_rate(struct udevice *dev)
+{
+ struct cpu_imx_plat *plat = dev_get_plat(dev);
+ ulong rate;
+ int ret;
+
+ ret = sc_pm_get_clock_rate(-1, plat->cpu_rsrc, SC_PM_CLK_CPU,
+ (sc_pm_clock_rate_t *)&rate);
+ if (ret) {
+ printf("Could not read CPU frequency: %d\n", ret);
+ return 0;
+ }
+
+ return rate;
+}
+
+static int imx9_cpu_probe(struct udevice *dev)
+{
+ struct cpu_imx_plat *plat = dev_get_plat(dev);
+ u32 cpurev;
+
+ set_core_data(dev);
+ cpurev = get_cpu_rev();
+ plat->cpurev = cpurev;
+ plat->rev = get_imx9_rev(cpurev & 0xFFF);
+ plat->type = get_imx9_type((cpurev & 0xFF000) >> 12);
+ plat->freq_mhz = imx9_get_cpu_rate(dev) / 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;
+}
+
+U_BOOT_DRIVER(cpu_imx9_drv) = {
+ .name = "imx9x_cpu",
+ .id = UCLASS_CPU,
+ .of_match = cpu_imx9_ids,
+ .ops = &cpu_imx9_ops,
+ .probe = imx9_cpu_probe,
+ .plat_auto = sizeof(struct cpu_imx_plat),
+ .flags = DM_FLAG_PRE_RELOC,
+};
diff --git a/drivers/misc/imx8/fuse.c b/drivers/misc/imx8/fuse.c
index 38111c52548..b81f73f283f 100644
--- a/drivers/misc/imx8/fuse.c
+++ b/drivers/misc/imx8/fuse.c
@@ -7,7 +7,7 @@
#include <console.h>
#include <errno.h>
#include <fuse.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <asm/arch/sys_proto.h>
#include <asm/global_data.h>
#include <linux/arm-smccc.h>
diff --git a/drivers/misc/imx8/scu.c b/drivers/misc/imx8/scu.c
index 4ab5cb4bf13..798800aa758 100644
--- a/drivers/misc/imx8/scu.c
+++ b/drivers/misc/imx8/scu.c
@@ -13,7 +13,7 @@
#include <dm/lists.h>
#include <dm/root.h>
#include <dm/device-internal.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <linux/bitops.h>
#include <linux/iopoll.h>
#include <misc.h>
diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c
index 8f546e9b3fc..dfede7f1d5f 100644
--- a/drivers/misc/imx8/scu_api.c
+++ b/drivers/misc/imx8/scu_api.c
@@ -11,7 +11,7 @@
#include <asm/global_data.h>
#include <asm/io.h>
#include <dm.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <misc.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/pinctrl/nxp/pinctrl-scu.c b/drivers/pinctrl/nxp/pinctrl-scu.c
index c032be782a1..4959834c0fc 100644
--- a/drivers/pinctrl/nxp/pinctrl-scu.c
+++ b/drivers/pinctrl/nxp/pinctrl-scu.c
@@ -7,7 +7,7 @@
#include <errno.h>
#include <linux/bitops.h>
#include <asm/io.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <misc.h>
#include "pinctrl-imx.h"
diff --git a/drivers/power/domain/imx8-power-domain-legacy.c b/drivers/power/domain/imx8-power-domain-legacy.c
index bf45891bccd..37b0f95abac 100644
--- a/drivers/power/domain/imx8-power-domain-legacy.c
+++ b/drivers/power/domain/imx8-power-domain-legacy.c
@@ -14,7 +14,7 @@
#include <dm/device-internal.h>
#include <dm/device.h>
#include <dm/uclass-internal.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/power/domain/imx8-power-domain.c b/drivers/power/domain/imx8-power-domain.c
index 17b5d57b19b..b45e468756b 100644
--- a/drivers/power/domain/imx8-power-domain.c
+++ b/drivers/power/domain/imx8-power-domain.c
@@ -10,7 +10,7 @@
#include <malloc.h>
#include <power-domain-uclass.h>
#include <asm/arch/power-domain.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
static int imx8_power_domain_on(struct power_domain *power_domain)
{
diff --git a/drivers/thermal/imx_scu_thermal.c b/drivers/thermal/imx_scu_thermal.c
index e704bcbea86..3ec131cbc6e 100644
--- a/drivers/thermal/imx_scu_thermal.c
+++ b/drivers/thermal/imx_scu_thermal.c
@@ -12,7 +12,7 @@
#include <asm/global_data.h>
#include <dm/device-internal.h>
#include <dm/device.h>
-#include <asm/arch/sci/sci.h>
+#include <firmware/imx/sci/sci.h>
#include <linux/delay.h>
#include <linux/libfdt.h>
diff --git a/arch/arm/include/asm/arch-imx8/sci/rpc.h b/include/firmware/imx/sci/rpc.h
similarity index 100%
rename from arch/arm/include/asm/arch-imx8/sci/rpc.h
rename to include/firmware/imx/sci/rpc.h
diff --git a/arch/arm/include/asm/arch-imx8/sci/sci.h b/include/firmware/imx/sci/sci.h
similarity index 94%
rename from arch/arm/include/asm/arch-imx8/sci/sci.h
rename to include/firmware/imx/sci/sci.h
index 1c29209b399..dafe892aa4d 100644
--- a/arch/arm/include/asm/arch-imx8/sci/sci.h
+++ b/include/firmware/imx/sci/sci.h
@@ -7,13 +7,13 @@
#define _SC_SCI_H
#include <log.h>
-#include <asm/arch/sci/types.h>
-#include <asm/arch/sci/svc/misc/api.h>
-#include <asm/arch/sci/svc/pad/api.h>
-#include <asm/arch/sci/svc/pm/api.h>
-#include <asm/arch/sci/svc/rm/api.h>
-#include <asm/arch/sci/svc/seco/api.h>
-#include <asm/arch/sci/rpc.h>
+#include <firmware/imx/sci/types.h>
+#include <firmware/imx/sci/svc/misc/api.h>
+#include <firmware/imx/sci/svc/pad/api.h>
+#include <firmware/imx/sci/svc/pm/api.h>
+#include <firmware/imx/sci/svc/rm/api.h>
+#include <firmware/imx/sci/svc/seco/api.h>
+#include <firmware/imx/sci/rpc.h>
#include <dt-bindings/soc/imx_rsrc.h>
#include <linux/errno.h>
diff --git a/arch/arm/include/asm/arch-imx8/sci/svc/misc/api.h b/include/firmware/imx/sci/svc/misc/api.h
similarity index 100%
rename from arch/arm/include/asm/arch-imx8/sci/svc/misc/api.h
rename to include/firmware/imx/sci/svc/misc/api.h
diff --git a/arch/arm/include/asm/arch-imx8/sci/svc/pad/api.h b/include/firmware/imx/sci/svc/pad/api.h
similarity index 100%
rename from arch/arm/include/asm/arch-imx8/sci/svc/pad/api.h
rename to include/firmware/imx/sci/svc/pad/api.h
diff --git a/arch/arm/include/asm/arch-imx8/sci/svc/pm/api.h b/include/firmware/imx/sci/svc/pm/api.h
similarity index 100%
rename from arch/arm/include/asm/arch-imx8/sci/svc/pm/api.h
rename to include/firmware/imx/sci/svc/pm/api.h
diff --git a/arch/arm/include/asm/arch-imx8/sci/svc/rm/api.h b/include/firmware/imx/sci/svc/rm/api.h
similarity index 98%
rename from arch/arm/include/asm/arch-imx8/sci/svc/rm/api.h
rename to include/firmware/imx/sci/svc/rm/api.h
index ed303881e73..163d81403c5 100644
--- a/arch/arm/include/asm/arch-imx8/sci/svc/rm/api.h
+++ b/include/firmware/imx/sci/svc/rm/api.h
@@ -6,7 +6,7 @@
#ifndef SC_RM_API_H
#define SC_RM_API_H
-#include <asm/arch/sci/types.h>
+#include <firmware/imx/sci/types.h>
/* Defines for type widths */
#define SC_RM_PARTITION_W 5U /* Width of sc_rm_pt_t */
diff --git a/arch/arm/include/asm/arch-imx8/sci/svc/seco/api.h b/include/firmware/imx/sci/svc/seco/api.h
similarity index 96%
rename from arch/arm/include/asm/arch-imx8/sci/svc/seco/api.h
rename to include/firmware/imx/sci/svc/seco/api.h
index 3ed05842d99..6e9c302315b 100644
--- a/arch/arm/include/asm/arch-imx8/sci/svc/seco/api.h
+++ b/include/firmware/imx/sci/svc/seco/api.h
@@ -8,7 +8,7 @@
/* Includes */
-#include <asm/arch/sci/types.h>
+#include <firmware/imx/sci/types.h>
/* Defines */
#define SC_SECO_AUTH_CONTAINER 0U /* Authenticate container */
diff --git a/arch/arm/include/asm/arch-imx8/sci/types.h b/include/firmware/imx/sci/types.h
similarity index 100%
rename from arch/arm/include/asm/arch-imx8/sci/types.h
rename to include/firmware/imx/sci/types.h
--
2.40.0
More information about the U-Boot
mailing list