All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Fan (OSS) <peng.fan@oss.nxp.com>
To: u-boot@lists.denx.de
Subject: [PATCH 04/37] arm: imx8ulp: support print cpu info
Date: Mon, 12 Apr 2021 20:12:33 +0800	[thread overview]
Message-ID: <20210412121306.11484-5-peng.fan@oss.nxp.com> (raw)
In-Reply-To: <20210412121306.11484-1-peng.fan@oss.nxp.com>

From: Peng Fan <peng.fan@nxp.com>

Support print cpu info. the clock function has not been added, it will
be added in following patches.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm/include/asm/arch-imx8ulp/sys_proto.h |  3 +
 arch/arm/mach-imx/imx8ulp/soc.c               | 59 +++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git a/arch/arm/include/asm/arch-imx8ulp/sys_proto.h b/arch/arm/include/asm/arch-imx8ulp/sys_proto.h
index cab12c218e..8894611a0f 100644
--- a/arch/arm/include/asm/arch-imx8ulp/sys_proto.h
+++ b/arch/arm/include/asm/arch-imx8ulp/sys_proto.h
@@ -8,4 +8,7 @@
 
 #include <asm/mach-imx/sys_proto.h>
 
+extern unsigned long rom_pointer[];
+
+enum bt_mode get_boot_mode(void);
 #endif
diff --git a/arch/arm/mach-imx/imx8ulp/soc.c b/arch/arm/mach-imx/imx8ulp/soc.c
index b3679aefcb..e6ac5f8d25 100644
--- a/arch/arm/mach-imx/imx8ulp/soc.c
+++ b/arch/arm/mach-imx/imx8ulp/soc.c
@@ -3,9 +3,68 @@
  * Copyright 2021 NXP
  */
 
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/mach-imx/boot_mode.h>
 
 u32 get_cpu_rev(void)
 {
 	return (MXC_CPU_IMX8ULP << 12) | CHIP_REV_1_0;
 }
+
+enum bt_mode get_boot_mode(void)
+{
+	u32 bt0_cfg = 0;
+
+	bt0_cfg = readl(CMC0_RBASE + 0x80);
+	bt0_cfg &= (BT0CFG_LPBOOT_MASK | BT0CFG_DUALBOOT_MASK);
+
+	if (!(bt0_cfg & BT0CFG_LPBOOT_MASK)) {
+		/* No low power boot */
+		if (bt0_cfg & BT0CFG_DUALBOOT_MASK)
+			return DUAL_BOOT;
+		else
+			return SINGLE_BOOT;
+	}
+
+	return LOW_POWER_BOOT;
+}
+
+#if defined(CONFIG_DISPLAY_CPUINFO)
+const char *get_imx_type(u32 imxtype)
+{
+	return "8ULP";
+}
+
+int print_cpuinfo(void)
+{
+	u32 cpurev;
+	char cause[18];
+
+	cpurev = get_cpu_rev();
+
+	printf("CPU:   Freescale i.MX%s rev%d.%d@%d MHz\n",
+	       get_imx_type((cpurev & 0xFF000) >> 12),
+	       (cpurev & 0x000F0) >> 4, (cpurev & 0x0000F) >> 0,
+	       mxc_get_clock(MXC_ARM_CLK) / 1000000);
+
+	printf("Boot mode: ");
+	switch (get_boot_mode()) {
+	case LOW_POWER_BOOT:
+		printf("Low power boot\n");
+		break;
+	case DUAL_BOOT:
+		printf("Dual boot\n");
+		break;
+	case SINGLE_BOOT:
+	default:
+		printf("Single boot\n");
+		break;
+	}
+
+	return 0;
+}
+#endif
+
-- 
2.30.0

  parent reply	other threads:[~2021-04-12 12:12 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12 12:12 [PATCH 00/37] imx: add i.MX8ULP support Peng Fan
2021-04-12 12:12 ` [PATCH 01/37] arm: imx: add i.MX8ULP basic Kconfig option Peng Fan
2021-04-12 12:12 ` [PATCH 02/37] arm: imx: add i.MX8ULP cpu type and helper Peng Fan
2021-04-12 12:12 ` [PATCH 03/37] arm: imx: sys_proto: move boot mode define to common header Peng Fan
2021-04-12 12:12 ` Peng Fan [this message]
2021-04-12 12:12 ` [PATCH 05/37] imx: imx8ulp: add get reset cause Peng Fan
2021-04-12 12:12 ` [PATCH 06/37] arm: imx: basic i.MX8ULP support Peng Fan
2021-04-12 12:12 ` [PATCH 07/37] arm: imx8: Move container parser and image to mach-imx common folder Peng Fan
2021-04-12 12:12 ` [PATCH 08/37] arm: imx8: Move container image header file to mach-imx Peng Fan
2021-04-12 12:12 ` [PATCH 09/37] arm: imx: parse-container: guard included header files Peng Fan
2021-04-12 12:12 ` [PATCH 10/37] arm: imx8ulp: add container support Peng Fan
2021-04-12 12:12 ` [PATCH 11/37] arm: imx: move container Kconfig under mach-imx Peng Fan
2021-04-12 12:12 ` [PATCH 12/37] driver: misc: Add MU and S400 API to communicate with Sentinel Peng Fan
2021-04-12 12:12 ` [PATCH 13/37] net: fec_mxc: support i.MX8ULP Peng Fan
2021-04-15  1:42   ` Ramon Fried
2021-04-12 12:12 ` [PATCH 14/37] pinctrl: Add pinctrl driver for imx8ulp Peng Fan
2021-04-12 12:12 ` [PATCH 15/37] driver: serial: fsl_lpuart: support i.MX8ULP Peng Fan
2021-04-12 12:12 ` [PATCH 16/37] arm: imx8ulp: add clock support Peng Fan
2021-04-12 12:12 ` [PATCH 17/37] drivers: mmc: fsl_esdhc_imx: support i.MX8ULP Peng Fan
2021-04-12 12:12 ` [PATCH 18/37] arm: imx8ulp: soc: Change to use CMC1 to get bootcfg Peng Fan
2021-04-12 12:12 ` [PATCH 19/37] arm: imx8ulp: Enable full L2 cache in SPL Peng Fan
2021-04-12 12:12 ` [PATCH 20/37] arm: imx8ulp: disable wdog3 Peng Fan
2021-04-12 12:12 ` [PATCH 21/37] arm: imx8ulp: Update the reset vector in u-boot Peng Fan
2021-04-12 12:12 ` [PATCH 22/37] drivers: misc: s400_api: Update S400_SUCCESS_IND to 0xd6 Peng Fan
2021-04-12 12:12 ` [PATCH 23/37] drivers: misc: imx8ulp: Add S400 API for image authentication Peng Fan
2021-04-12 12:12 ` [PATCH 24/37] drivers: misc: imx8ulp: Update S400 API for release RDC Peng Fan
2021-04-12 12:12 ` [PATCH 25/37] drivers: misc: s400_api: Update API for fuse read and write Peng Fan
2021-04-12 12:12 ` [PATCH 26/37] arm: imx8ulp: release and configure XRDC at early phase Peng Fan
2021-04-12 12:12 ` [PATCH 27/37] arm: imx8ulp: add xrdc support Peng Fan
2021-04-12 12:12 ` [PATCH 28/37] arm: imx8ulp: add trdc release request Peng Fan
2021-04-12 12:12 ` [PATCH 29/37] arm: imx8ulp: release trdc and assign lpav from RTD to APD Peng Fan
2021-04-12 12:12 ` [PATCH 30/37] arm: imx8ulp: Probe the S400 MU device in arch init Peng Fan
2021-04-12 12:13 ` [PATCH 31/37] arm: iMX8ULP: Add boot device relevant functions Peng Fan
2021-04-12 12:13 ` [PATCH 32/37] arm: imx8ulp: Allocate DCNANO and MIPI_DSI to AD domain Peng Fan
2021-04-12 12:13 ` [PATCH 33/37] arm: imx8ulp: add dummy imx_get_mac_from_fuse Peng Fan
2021-04-12 12:13 ` [PATCH 34/37] arm: imx8ulp: add iomuxc support Peng Fan
2021-04-12 12:13 ` [PATCH 35/37] driver: misc: imx8ulp: Add fuse driver for imx8ulp Peng Fan
2021-04-12 12:13 ` [PATCH 36/37] arm: dts: add i.MX8ULP dtsi Peng Fan
2021-04-12 12:13 ` [PATCH 37/37] arm: imx: add i.MX8ULP EVK support Peng Fan
2021-04-23 16:57   ` Fabio Estevam
2021-04-23 17:18     ` Fabio Estevam
2021-04-25  1:36       ` Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210412121306.11484-5-peng.fan@oss.nxp.com \
    --to=peng.fan@oss.nxp.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.