diff options
| author | Udit Kumar <[email protected]> | 2026-04-15 20:51:50 +0530 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-05-11 12:32:00 -0600 |
| commit | ad681c816484c2246b4803de64553f760c0f44cd (patch) | |
| tree | 506111db091c8b55d2045ae6a3e53a9380c58d12 | |
| parent | fba241926982eb17ef79fafe8531ec9fd6837ae5 (diff) | |
arm: mach-k3: arm: mach-k3: Add writel_verify macro for register write verification
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 <[email protected]>
| -rw-r--r-- | arch/arm/mach-k3/include/mach/hardware.h | 10 |
1 files changed, 10 insertions, 0 deletions
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_ */ |
