mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: wsa@kernel.org, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/5] ARM: at91: at91sam9_rst: add DT support for at91sam9260
Date: Tue, 26 Sep 2023 20:38:33 +0200	[thread overview]
Message-ID: <20230926183835.2617909-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20230926183835.2617909-1-a.fatoum@pengutronix.de>

AT91SAM9260 needs a special reset sequence that we already implement
at91sam9_reset(). Make it easily available to DT-enabled boards by
adding it to the at91sam9_rst driver used for newer SoCs.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-at91/at91sam9_rst.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9_rst.c b/arch/arm/mach-at91/at91sam9_rst.c
index db7411a053d6..d2c008e3439a 100644
--- a/arch/arm/mach-at91/at91sam9_rst.c
+++ b/arch/arm/mach-at91/at91sam9_rst.c
@@ -10,6 +10,7 @@
 #include <linux/bitfield.h>
 #include <linux/clk.h>
 #include <mach/at91/at91_rstc.h>
+#include <mach/at91/at91sam9260.h>
 #include <reset_source.h>
 
 struct at91sam9x_rst {
@@ -56,6 +57,16 @@ static void __noreturn at91sam9x_restart_soc(struct restart_handler *rst)
 	hang();
 }
 
+void __noreturn at91sam9_reset(void __iomem *sdram, void __iomem *rstc_cr);
+
+static void __noreturn at91sam9260_restart_soc(struct restart_handler *rst)
+{
+	struct at91sam9x_rst *priv = container_of(rst, struct at91sam9x_rst, restart);
+
+	at91sam9_reset(IOMEM(AT91SAM9260_BASE_SDRAMC),
+		       IOMEM(priv->base + AT91_RSTC_CR));
+}
+
 static int at91sam9x_rst_probe(struct device *dev)
 {
 	struct at91sam9x_rst *priv;
@@ -83,14 +94,15 @@ static int at91sam9x_rst_probe(struct device *dev)
 	at91sam9x_set_reset_reason(dev, priv->base);
 
 	priv->restart.name = "at91sam9x-rst";
-	priv->restart.restart = at91sam9x_restart_soc;
+	priv->restart.restart = device_get_match_data(dev);
 
 	return restart_handler_register(&priv->restart);
 }
 
 static const __maybe_unused struct of_device_id at91sam9x_rst_dt_ids[] = {
-	{ .compatible = "atmel,at91sam9g45-rstc", },
-	{ .compatible = "atmel,sama5d3-rstc", },
+	{ .compatible = "atmel,at91sam9260-rstc", at91sam9260_restart_soc },
+	{ .compatible = "atmel,at91sam9g45-rstc", at91sam9x_restart_soc },
+	{ .compatible = "atmel,sama5d3-rstc", at91sam9x_restart_soc },
 	{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, at91sam9x_rst_dt_ids);
-- 
2.39.2




  parent reply	other threads:[~2023-09-26 18:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26 18:38 [PATCH 0/5] ARM: at91: add first DT support for Calao usb/tny boards Ahmad Fatoum
2023-09-26 18:38 ` [PATCH 1/5] Revert "mtd: nand: drop DT support in legacy driver" Ahmad Fatoum
2023-09-26 18:38 ` [PATCH 2/5] ARM: at91: add SDRAMC driver for memory detection Ahmad Fatoum
2023-09-26 18:38 ` Ahmad Fatoum [this message]
2023-09-26 18:38 ` [PATCH 4/5] ARM: at91: sam9260: don't build non-DT device support when unneeded Ahmad Fatoum
2023-09-26 18:38 ` [PATCH 5/5] ARM: at91: add first DT support for Calao usb/tny boards Ahmad Fatoum
2023-09-26 21:21 ` OFFLIST Re: [PATCH 0/5] " Wolfram Sang
2023-10-04  8:25 ` Sascha Hauer

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=20230926183835.2617909-4-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=wsa@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