mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/5] rtc: gamecube: Propagate address translation error
@ 2026-11-09 22:39 Thorsten Blum
  2026-11-09 22:39 ` [PATCH 2/5] rtc: gamecube: Add missing newline to SRAM bias debug message Thorsten Blum
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Thorsten Blum @ 2026-11-09 22:39 UTC (permalink / raw)
  To: Alexandre Belloni, Michael Ellerman, Emmanuel Gil Peyrot
  Cc: linux-rtc, linux-kernel, Thorsten Blum

If of_address_to_resource() fails, propagate its error code instead of
returning -1 from gamecube_rtc_read_offset_from_sram().

Fixes: 86559400b3ef ("rtc: gamecube: Add a RTC driver for the GameCube, Wii and Wii U")
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 drivers/rtc/rtc-gamecube.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-gamecube.c b/drivers/rtc/rtc-gamecube.c
index 3fd562d3526a..0299f27106c0 100644
--- a/drivers/rtc/rtc-gamecube.c
+++ b/drivers/rtc/rtc-gamecube.c
@@ -238,7 +238,7 @@ static int gamecube_rtc_read_offset_from_sram(struct priv *d)
 	of_node_put(np);
 	if (ret) {
 		pr_err("no io memory range found\n");
-		return -1;
+		return ret;
 	}
 
 	hw_srnprot = ioremap(res.start, resource_size(&res));

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/5] rtc: gamecube: Add missing newline to SRAM bias debug message
  2026-11-09 22:39 [PATCH 1/5] rtc: gamecube: Propagate address translation error Thorsten Blum
@ 2026-11-09 22:39 ` Thorsten Blum
  2026-11-09 22:39 ` [PATCH 3/5] rtc: gamecube: Explain why fast_io is enabled Thorsten Blum
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Thorsten Blum @ 2026-11-09 22:39 UTC (permalink / raw)
  To: Alexandre Belloni, Michael Ellerman, Emmanuel Gil Peyrot
  Cc: linux-rtc, linux-kernel, Thorsten Blum

Add a newline to the SRAM bias debug message to terminate it properly.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 drivers/rtc/rtc-gamecube.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-gamecube.c b/drivers/rtc/rtc-gamecube.c
index 0299f27106c0..25290f162cbc 100644
--- a/drivers/rtc/rtc-gamecube.c
+++ b/drivers/rtc/rtc-gamecube.c
@@ -339,7 +339,7 @@ static int gamecube_rtc_probe(struct platform_device *pdev)
 	ret = gamecube_rtc_read_offset_from_sram(d);
 	if (ret)
 		return ret;
-	dev_dbg(dev, "SRAM bias: 0x%x", d->rtc_bias);
+	dev_dbg(dev, "SRAM bias: 0x%x\n", d->rtc_bias);
 
 	dev_set_drvdata(dev, d);
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/5] rtc: gamecube: Explain why fast_io is enabled
  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:39 ` Thorsten Blum
  2026-11-09 22:39 ` [PATCH 4/5] rtc: gamecube: Use unsigned int for control0 Thorsten Blum
  2026-11-09 22:39 ` [PATCH 5/5] rtc: gamecube: Use register definitions Thorsten Blum
  3 siblings, 0 replies; 5+ messages in thread
From: Thorsten Blum @ 2026-11-09 22:39 UTC (permalink / raw)
  To: Alexandre Belloni, Michael Ellerman, Emmanuel Gil Peyrot
  Cc: linux-rtc, linux-kernel, Thorsten Blum

Replace the TODO with an explanation of why fast_io is enabled.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 drivers/rtc/rtc-gamecube.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-gamecube.c b/drivers/rtc/rtc-gamecube.c
index 25290f162cbc..4b45274effdf 100644
--- a/drivers/rtc/rtc-gamecube.c
+++ b/drivers/rtc/rtc-gamecube.c
@@ -152,7 +152,7 @@ static int exi_write(void *context, u32 reg, u32 data)
 }
 
 static const struct regmap_bus exi_bus = {
-	/* TODO: is that true?  Not that it matters here, but still. */
+	/* Transfers use MMIO and busy-wait for completion without sleeping. */
 	.fast_io = true,
 	.reg_read = exi_read,
 	.reg_write = exi_write,

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 4/5] rtc: gamecube: Use unsigned int for control0
  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:39 ` [PATCH 3/5] rtc: gamecube: Explain why fast_io is enabled Thorsten Blum
@ 2026-11-09 22:39 ` Thorsten Blum
  2026-11-09 22:39 ` [PATCH 5/5] rtc: gamecube: Use register definitions Thorsten Blum
  3 siblings, 0 replies; 5+ messages in thread
From: Thorsten Blum @ 2026-11-09 22:39 UTC (permalink / raw)
  To: Alexandre Belloni, Michael Ellerman, Emmanuel Gil Peyrot
  Cc: linux-rtc, linux-kernel, Thorsten Blum

regmap_read() expects an unsigned int pointer for its output value.
Declare control0 as unsigned int to match the expected type.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 drivers/rtc/rtc-gamecube.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-gamecube.c b/drivers/rtc/rtc-gamecube.c
index 4b45274effdf..ec672bee0134 100644
--- a/drivers/rtc/rtc-gamecube.c
+++ b/drivers/rtc/rtc-gamecube.c
@@ -190,7 +190,7 @@ static int gamecube_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned lon
 {
 	struct priv *d = dev_get_drvdata(dev);
 	int value;
-	int control0;
+	unsigned int control0;
 	int ret;
 
 	switch (cmd) {

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 5/5] rtc: gamecube: Use register definitions
  2026-11-09 22:39 [PATCH 1/5] rtc: gamecube: Propagate address translation error Thorsten Blum
                   ` (2 preceding siblings ...)
  2026-11-09 22:39 ` [PATCH 4/5] rtc: gamecube: Use unsigned int for control0 Thorsten Blum
@ 2026-11-09 22:39 ` Thorsten Blum
  3 siblings, 0 replies; 5+ messages in thread
From: Thorsten Blum @ 2026-11-09 22:39 UTC (permalink / raw)
  To: Alexandre Belloni, Michael Ellerman, Emmanuel Gil Peyrot
  Cc: linux-rtc, linux-kernel, Thorsten Blum

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",
 };
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-09 22:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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:39 ` [PATCH 3/5] rtc: gamecube: Explain why fast_io is enabled Thorsten Blum
2026-11-09 22:39 ` [PATCH 4/5] rtc: gamecube: Use unsigned int for control0 Thorsten Blum
2026-11-09 22:39 ` [PATCH 5/5] rtc: gamecube: Use register definitions Thorsten Blum

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®