All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thorsten Blum <blum@kernel.org>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Thorsten Blum <blum@kernel.org>
Subject: [PATCH 5/5] rtc: gamecube: Use register definitions
Date: Mon,  9 Nov 2026 23:39:07 +0100	[thread overview]
Message-ID: <20261109223902.84918-10-blum@kernel.org> (raw)
In-Reply-To: <20261109223902.84918-6-blum@kernel.org>

Use the register definitions to replace the hard-coded addresses to
improve readability. Add RTC_SRAM_LAST for the SRAM range end.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 drivers/rtc/rtc-gamecube.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/rtc/rtc-gamecube.c b/drivers/rtc/rtc-gamecube.c
index ec672bee0134..dc4299f71f8f 100644
--- a/drivers/rtc/rtc-gamecube.c
+++ b/drivers/rtc/rtc-gamecube.c
@@ -73,6 +73,7 @@
 #define RTC_COUNTER	0x200000
 #define RTC_SRAM	0x200001
 #define RTC_SRAM_BIAS	0x200004
+#define RTC_SRAM_LAST	0x200010
 #define RTC_SNAPSHOT	0x204000
 #define RTC_ONTMR	0x210000
 #define RTC_OFFTMR	0x210001
@@ -283,11 +284,11 @@ static int gamecube_rtc_read_offset_from_sram(struct priv *d)
 }
 
 static const struct regmap_range rtc_rd_ranges[] = {
-	regmap_reg_range(0x200000, 0x200010),
-	regmap_reg_range(0x204000, 0x204000),
-	regmap_reg_range(0x210000, 0x210001),
-	regmap_reg_range(0x210004, 0x210007),
-	regmap_reg_range(0x21000c, 0x21000d),
+	regmap_reg_range(RTC_COUNTER, RTC_SRAM_LAST),
+	regmap_reg_range(RTC_SNAPSHOT, RTC_SNAPSHOT),
+	regmap_reg_range(RTC_ONTMR, RTC_OFFTMR),
+	regmap_reg_range(RTC_TEST0, RTC_TEST3),
+	regmap_reg_range(RTC_CONTROL0, RTC_CONTROL1),
 };
 
 static const struct regmap_access_table rtc_rd_regs = {
@@ -296,10 +297,10 @@ static const struct regmap_access_table rtc_rd_regs = {
 };
 
 static const struct regmap_range rtc_wr_ranges[] = {
-	regmap_reg_range(0x200000, 0x200010),
-	regmap_reg_range(0x204000, 0x204000),
-	regmap_reg_range(0x210000, 0x210001),
-	regmap_reg_range(0x21000d, 0x21000d),
+	regmap_reg_range(RTC_COUNTER, RTC_SRAM_LAST),
+	regmap_reg_range(RTC_SNAPSHOT, RTC_SNAPSHOT),
+	regmap_reg_range(RTC_ONTMR, RTC_OFFTMR),
+	regmap_reg_range(RTC_CONTROL1, RTC_CONTROL1),
 };
 
 static const struct regmap_access_table rtc_wr_regs = {
@@ -312,7 +313,7 @@ static const struct regmap_config gamecube_rtc_regmap_config = {
 	.val_bits = 32,
 	.rd_table = &rtc_rd_regs,
 	.wr_table = &rtc_wr_regs,
-	.max_register = 0x21000d,
+	.max_register = RTC_CONTROL1,
 	.name = "gamecube-rtc",
 };
 

  parent reply	other threads:[~2026-11-09 22:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 22:39 [PATCH 1/5] rtc: gamecube: Propagate address translation error Thorsten Blum
2026-11-09 22:39 ` [PATCH 2/5] rtc: gamecube: Add missing newline to SRAM bias debug message Thorsten Blum
2026-11-09 22:41   ` sashiko-bot
2026-11-09 22:39 ` [PATCH 3/5] rtc: gamecube: Explain why fast_io is enabled Thorsten Blum
2026-11-09 22:41   ` sashiko-bot
2026-11-09 22:39 ` [PATCH 4/5] rtc: gamecube: Use unsigned int for control0 Thorsten Blum
2026-11-09 22:41   ` sashiko-bot
2026-11-09 22:39 ` Thorsten Blum [this message]
2026-11-09 22:41   ` [PATCH 5/5] rtc: gamecube: Use register definitions sashiko-bot
2026-11-09 22:41 ` [PATCH 1/5] rtc: gamecube: Propagate address translation error sashiko-bot

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=20261109223902.84918-10-blum@kernel.org \
    --to=blum@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linkmauve@linkmauve.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=mpe@ellerman.id.au \
    /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.