public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Udit Kumar <u-kumar1@ti.com>
To: <vigneshr@ti.com>, <trini@konsulko.com>, <m-chawdhry@ti.com>
Cc: <bb@ti.com>, <n-francis@ti.com>, <nm@ti.com>,
	<gehariprasath@ti.com>, <u-boot@lists.denx.de>,
	Udit Kumar <u-kumar1@ti.com>
Subject: [PATCH v2 1/3] arm: mach-k3: arm: mach-k3: Add writel_verify macro for register write verification
Date: Wed, 15 Apr 2026 20:51:50 +0530	[thread overview]
Message-ID: <20260415152152.3048491-2-u-kumar1@ti.com> (raw)
In-Reply-To: <20260415152152.3048491-1-u-kumar1@ti.com>

Add a helper macro to write and verify a 32-bit value to a memory-mapped
register. This is essential for hardware errata workarounds that require
confirmation that register writes have taken effect before proceeding with
initialization.

Signed-off-by: Udit Kumar <u-kumar1@ti.com>
---
 arch/arm/mach-k3/include/mach/hardware.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/mach-k3/include/mach/hardware.h b/arch/arm/mach-k3/include/mach/hardware.h
index 81b5f1fa45e..b337a71956f 100644
--- a/arch/arm/mach-k3/include/mach/hardware.h
+++ b/arch/arm/mach-k3/include/mach/hardware.h
@@ -126,4 +126,14 @@ struct rom_extended_boot_data {
 
 u32 get_boot_device(void);
 const char *get_reset_reason(void);
+
+#define writel_verify(val, addr) \
+do { \
+	u32 readback; \
+	writel(val, addr); \
+	readback = readl(addr); \
+	if (readback != val) \
+		printf("writel_verify failed: addr=0x%p, expected=0x%x, got=0x%x\n", \
+		       (void *)(addr), (val), readback); \
+} while (0)
 #endif /* _ASM_ARCH_HARDWARE_H_ */
-- 
2.34.1


  reply	other threads:[~2026-04-15 15:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-15 15:21 [PATCH v2 0/3] j721s2: j784s4: Add workaround for errata i2437 Udit Kumar
2026-04-15 15:21 ` Udit Kumar [this message]
2026-04-15 15:21 ` [PATCH v2 2/3] arch: mach-k3: j721s2_init: " Udit Kumar
2026-04-15 15:21 ` [PATCH v2 3/3] arch: mach-k3: j784s4_init: " Udit Kumar

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=20260415152152.3048491-2-u-kumar1@ti.com \
    --to=u-kumar1@ti.com \
    --cc=bb@ti.com \
    --cc=gehariprasath@ti.com \
    --cc=m-chawdhry@ti.com \
    --cc=n-francis@ti.com \
    --cc=nm@ti.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    /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