mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Madieu <john.madieu.xa@bp.renesas.com>
To: john.madieu.xa@bp.renesas.com, geert+renesas@glider.be,
	krzk+dt@kernel.org, robh@kernel.org
Cc: biju.das.jz@bp.renesas.com, claudiu.beznea.uj@bp.renesas.com,
	conor+dt@kernel.org, devicetree@vger.kernel.org,
	john.madieu@gmail.com, linux-kernel@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org, magnus.damm@gmail.com
Subject: [PATCH v5 5/5] soc: renesas: rzv2h: Add a callback to print SoC-specific extra features
Date: Tue, 28 Jan 2025 04:13:42 +0100	[thread overview]
Message-ID: <20250128031342.52675-6-john.madieu.xa@bp.renesas.com> (raw)
In-Reply-To: <20250128031342.52675-1-john.madieu.xa@bp.renesas.com>

Some RZ/V2H SoC variants feature a Mali-G31 (GPU) and/or a Mali-C55 (ISP)
IP(s). Detect and inform about their presence during SoC identification.
Also detect PLL frequency and warn in case of mismatch.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: John Madieu <john.madieu.xa@bp.renesas.com>
---
Changes:

v5: Use proper hex value to populate rzv2h_sys_soc_id_init_data and put as much
    variable as possible on the same line while printing messages
v4: No changes
v3: New patch

 drivers/soc/renesas/r9a09g057-sys.c | 41 +++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/drivers/soc/renesas/r9a09g057-sys.c b/drivers/soc/renesas/r9a09g057-sys.c
index fd92947a3174..378aa0030b6a 100644
--- a/drivers/soc/renesas/r9a09g057-sys.c
+++ b/drivers/soc/renesas/r9a09g057-sys.c
@@ -12,12 +12,53 @@
 
 #include "rz-sysc.h"
 
+/* Register Offsets */
+#define SYS_LSI_MODE		0x300
+/*
+ * BOOTPLLCA[1:0]
+ *	    [0,0] => 1.1GHZ
+ *	    [0,1] => 1.5GHZ
+ *	    [1,0] => 1.6GHZ
+ *	    [1,1] => 1.7GHZ
+ */
+#define SYS_LSI_MODE_STAT_BOOTPLLCA55	GENMASK(12, 11)
+#define SYS_LSI_MODE_CA55_1_7GHZ	0x3
+
+#define SYS_LSI_PRR		0x308
+#define SYS_LSI_PRR_GPU_DIS	BIT(0)
+#define SYS_LSI_PRR_ISP_DIS	BIT(4)
+
+static void rzv2h_sys_print_id(struct device *dev,
+				void __iomem *sysc_base,
+				struct soc_device_attribute *soc_dev_attr)
+{
+	bool gpu_enabled, isp_enabled;
+	u32 prr_val, mode_val;
+
+	prr_val = readl(sysc_base + SYS_LSI_PRR);
+	mode_val = readl(sysc_base + SYS_LSI_MODE);
+
+	/* Check GPU and ISP configuration */
+	gpu_enabled = !(prr_val & SYS_LSI_PRR_GPU_DIS);
+	isp_enabled = !(prr_val & SYS_LSI_PRR_ISP_DIS);
+
+	dev_info(dev, "Detected Renesas %s %s Rev %s%s%s\n",
+		 soc_dev_attr->family, soc_dev_attr->soc_id, soc_dev_attr->revision,
+		 gpu_enabled ? " with GE3D (Mali-G31)" : "",
+		 isp_enabled ? " with ISP (Mali-C55)" : "");
+
+	/* Check CA55 PLL configuration */
+	if (FIELD_GET(SYS_LSI_MODE_STAT_BOOTPLLCA55, mode_val) != SYS_LSI_MODE_CA55_1_7GHZ)
+		dev_warn(dev, "CA55 PLL is not set to 1.7GHz\n");
+}
+
 static const struct rz_sysc_soc_id_init_data rzv2h_sys_soc_id_init_data __initconst = {
 	.family = "RZ/V2H",
 	.id = 0x847a447,
 	.devid_offset = 0x304,
 	.revision_mask = 0xf0000000,
 	.specific_id_mask = 0x0fffffff,
+	.print_id = rzv2h_sys_print_id,
 };
 
 const struct rz_sysc_init_data rzv2h_sys_init_data = {
-- 
2.25.1


  parent reply	other threads:[~2025-01-28  3:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-28  3:13 [PATCH v5 0/5] soc: renesas: Add RZ/G3E SoC detection support John Madieu
2025-01-28  3:13 ` [PATCH v5 1/5] soc: renesas: Add SYSC driver for Renesas RZ family John Madieu
2025-01-29 14:58   ` Geert Uytterhoeven
2025-01-28  3:13 ` [PATCH v5 2/5] soc: renesas: rz-sysc: Move RZ/G3S SoC detection to the SYSC driver John Madieu
2025-01-29 15:00   ` Geert Uytterhoeven
2025-01-28  3:13 ` [PATCH v5 3/5] soc: renesas: rz-sysc: Add support for RZ/G3E family John Madieu
2025-01-29 15:00   ` Geert Uytterhoeven
2025-01-28  3:13 ` [PATCH v5 4/5] soc: renesas: rz-sysc: Move RZ/V2H SoC detection to the SYS driver John Madieu
2025-01-29 15:01   ` Geert Uytterhoeven
2025-01-28  3:13 ` John Madieu [this message]
2025-01-29 15:01   ` [PATCH v5 5/5] soc: renesas: rzv2h: Add a callback to print SoC-specific extra features Geert Uytterhoeven

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=20250128031342.52675-6-john.madieu.xa@bp.renesas.com \
    --to=john.madieu.xa@bp.renesas.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=claudiu.beznea.uj@bp.renesas.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=john.madieu@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=robh@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®