linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Claudiu.Beznea@microchip.com>
To: <sre@kernel.org>, <Nicolas.Ferre@microchip.com>,
	<alexandre.belloni@bootlin.com>,
	<Ludovic.Desroches@microchip.com>
Cc: <linux-pm@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <Claudiu.Beznea@microchip.com>
Subject: [PATCH 13/15] power: reset: at91-reset: keep only one reset function
Date: Tue, 21 Jan 2020 10:03:38 +0000	[thread overview]
Message-ID: <1579601001-5711-14-git-send-email-claudiu.beznea@microchip.com> (raw)
In-Reply-To: <1579601001-5711-1-git-send-email-claudiu.beznea@microchip.com>

Keep only one reset function. With this, notifier_call member of
struct at91_reset_data could be removed.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/power/reset/at91-reset.c | 52 +++-------------------------------------
 1 file changed, 3 insertions(+), 49 deletions(-)

diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
index 61433060d784..9c1b69f76a01 100644
--- a/drivers/power/reset/at91-reset.c
+++ b/drivers/power/reset/at91-reset.c
@@ -50,8 +50,6 @@ enum reset_type {
 };
 
 struct at91_reset_data {
-	int (*notifier_call)(struct notifier_block *this, unsigned long mode,
-			     void *cmd);
 	u32 args;
 };
 
@@ -69,38 +67,8 @@ struct at91_reset {
 * reset register it can be left driving the data bus and
 * killing the chance of a subsequent boot from NAND
 */
-static int at91sam9260_restart(struct notifier_block *this, unsigned long mode,
-			       void *cmd)
-{
-	struct at91_reset *reset = container_of(this, struct at91_reset, nb);
-
-	asm volatile(
-		/* Align to cache lines */
-		".balign 32\n\t"
-
-		/* Disable SDRAM accesses */
-		"str	%2, [%0, #" __stringify(AT91_SDRAMC_TR) "]\n\t"
-
-		/* Power down SDRAM */
-		"str	%3, [%0, %5]\n\t"
-
-		/* Reset CPU */
-		"str	%4, [%1, #" __stringify(AT91_RSTC_CR) "]\n\t"
-
-		"b	.\n\t"
-		:
-		: "r" (reset->ramc_base[0]),
-		  "r" (reset->rstc_base),
-		  "r" (1),
-		  "r" cpu_to_le32(AT91_SDRAMC_LPCB_POWER_DOWN),
-		  "r" (reset->args),
-		  "r" (reset->ramc_lpr));
-
-	return NOTIFY_DONE;
-}
-
-static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
-			       void *cmd)
+static int at91_reset(struct notifier_block *this, unsigned long mode,
+		      void *cmd)
 {
 	struct at91_reset *reset = container_of(this, struct at91_reset, nb);
 
@@ -137,16 +105,6 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
 	return NOTIFY_DONE;
 }
 
-static int sama5d3_restart(struct notifier_block *this, unsigned long mode,
-			   void *cmd)
-{
-	struct at91_reset *reset = container_of(this, struct at91_reset, nb);
-
-	writel(reset->args, reset->rstc_base);
-
-	return NOTIFY_DONE;
-}
-
 static void __init at91_reset_status(struct platform_device *pdev,
 				     void __iomem *base)
 {
@@ -199,22 +157,18 @@ static const struct of_device_id at91_ramc_of_match[] = {
 };
 
 static const struct at91_reset_data at91sam9260_reset_data = {
-	.notifier_call = at91sam9260_restart,
 	.args = AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST,
 };
 
 static const struct at91_reset_data at91sam9g45_reset_data = {
-	.notifier_call = at91sam9g45_restart,
 	.args = AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST,
 };
 
 static const struct at91_reset_data sama5d3_reset_data = {
-	.notifier_call = sama5d3_restart,
 	.args = AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST,
 };
 
 static const struct at91_reset_data samx7_reset_data = {
-	.notifier_call = sama5d3_restart,
 	.args = AT91_RSTC_KEY | AT91_RSTC_PROCRST,
 };
 
@@ -277,7 +231,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)
 
 	match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
 	reset_data = match->data;
-	reset->nb.notifier_call = reset_data->notifier_call;
+	reset->nb.notifier_call = at91_reset;
 	reset->nb.priority = 192;
 	reset->args = reset_data->args;
 
-- 
2.7.4

  parent reply	other threads:[~2020-01-21 10:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-21 10:03 [PATCH 00/15] rework at91-reset driver Claudiu.Beznea
2020-01-21 10:03 ` [PATCH 01/15] power: reset: at91-reset: introduce struct at91_reset Claudiu.Beznea
2020-01-21 10:03 ` [PATCH 03/15] power: reset: at91-reset: add sclk to " Claudiu.Beznea
2020-01-21 10:03 ` [PATCH 02/15] power: reset: at91-reset: add ramc_base[] " Claudiu.Beznea
2020-01-21 10:03 ` [PATCH 04/15] power: reset: at91-reset: add notifier block " Claudiu.Beznea
2020-01-21 10:03 ` [PATCH 05/15] power: reset: at91-reset: convert reset in pointer " Claudiu.Beznea
2020-01-21 10:03 ` [PATCH 08/15] power: reset: at91-reset: introduce struct at91_reset_data Claudiu.Beznea
2020-01-21 10:03 ` [PATCH 06/15] power: reset: at91-reset: pass rstc base address to at91_reset_status() Claudiu.Beznea
2020-01-21 10:03 ` [PATCH 07/15] power: reset: at91-reset: devm_kzalloc() for at91_reset data structure Claudiu.Beznea
2020-01-21 10:03 ` [PATCH 10/15] power: reset: at91-reset: use r4 as tmp argument Claudiu.Beznea
2020-01-21 10:03 ` [PATCH 09/15] power: reset: at91-reset: introduce args member in at91_reset_data Claudiu.Beznea
2020-01-21 10:03 ` [PATCH 11/15] power: reset: at91-reset: introduce ramc_lpr to struct at91_reset Claudiu.Beznea
2020-01-21 10:03 ` [PATCH 12/15] power: reset: at91-reset: make at91sam9g45_restart() generic Claudiu.Beznea
2020-01-21 10:03 ` Claudiu.Beznea [this message]
2020-01-21 10:03 ` [PATCH 14/15] power: reset: at91-reset: get rid of at91_reset_data Claudiu.Beznea
2020-01-21 10:03 ` [PATCH 15/15] power: reset: at91-reset: handle nrst async for sam9x60 Claudiu.Beznea
2020-03-08 18:54 ` [PATCH 00/15] rework at91-reset driver Sebastian Reichel

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=1579601001-5711-14-git-send-email-claudiu.beznea@microchip.com \
    --to=claudiu.beznea@microchip.com \
    --cc=Ludovic.Desroches@microchip.com \
    --cc=Nicolas.Ferre@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@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;
as well as URLs for NNTP newsgroup(s).