mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] ARM: at91: at91sam9x5: fix co-existance of erratum-aware and generic reset
@ 2021-01-04  9:34 Ahmad Fatoum
  2021-01-05 12:02 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2021-01-04  9:34 UTC (permalink / raw)
  To: barebox

We have a generic at91sam9 reset driver, but it's unaware of the
erratum on the at91sam9x5, which can prevent reboot from NAND due to
interference from SDRAM. The workaround is packing the powering down
of the DDR and the system reset into a single cache line and executing
that. This would be a bit tedious to add into the device tree probed
driver, thus:

 - Don't activate the work around if we are device-tree enabled, but
   have a newer SoC
 - Give the workaround a slightly higher priority, so it's taken instead
   of the generic DT driver

This fixes an issue of failing reset with the at91_multi_defconfig,
because both reset drivers have the same priority of 100.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-at91/at91sam9x5.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index 086e27a79f51..8266b512c999 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -11,10 +11,17 @@ static void at91sam9x5_restart(struct restart_handler *rst)
 			  IOMEM(AT91SAM9X5_BASE_RSTC + AT91_RSTC_CR));
 }
 
+static struct restart_handler restart;
+
 static int at91sam9x5_initialize(void)
 {
-	restart_handler_register_fn("soc", at91sam9x5_restart);
+	if (IS_ENABLED(CONFIG_OFDEVICE) && !of_machine_is_compatible("atmel,at91sam9x5"))
+		return 0;
+
+	restart.name = "soc";
+	restart.priority = 110;
+	restart.restart = at91sam9x5_restart;
 
-	return 0;
+	return restart_handler_register(&restart);
 }
 coredevice_initcall(at91sam9x5_initialize);
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH master] ARM: at91: at91sam9x5: fix co-existance of erratum-aware and generic reset
  2021-01-04  9:34 [PATCH master] ARM: at91: at91sam9x5: fix co-existance of erratum-aware and generic reset Ahmad Fatoum
@ 2021-01-05 12:02 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-01-05 12:02 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Jan 04, 2021 at 10:34:32AM +0100, Ahmad Fatoum wrote:
> We have a generic at91sam9 reset driver, but it's unaware of the
> erratum on the at91sam9x5, which can prevent reboot from NAND due to
> interference from SDRAM. The workaround is packing the powering down
> of the DDR and the system reset into a single cache line and executing
> that. This would be a bit tedious to add into the device tree probed
> driver, thus:
> 
>  - Don't activate the work around if we are device-tree enabled, but
>    have a newer SoC
>  - Give the workaround a slightly higher priority, so it's taken instead
>    of the generic DT driver
> 
> This fixes an issue of failing reset with the at91_multi_defconfig,
> because both reset drivers have the same priority of 100.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/mach-at91/at91sam9x5.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
> index 086e27a79f51..8266b512c999 100644
> --- a/arch/arm/mach-at91/at91sam9x5.c
> +++ b/arch/arm/mach-at91/at91sam9x5.c
> @@ -11,10 +11,17 @@ static void at91sam9x5_restart(struct restart_handler *rst)
>  			  IOMEM(AT91SAM9X5_BASE_RSTC + AT91_RSTC_CR));
>  }
>  
> +static struct restart_handler restart;
> +
>  static int at91sam9x5_initialize(void)
>  {
> -	restart_handler_register_fn("soc", at91sam9x5_restart);
> +	if (IS_ENABLED(CONFIG_OFDEVICE) && !of_machine_is_compatible("atmel,at91sam9x5"))
> +		return 0;
> +
> +	restart.name = "soc";
> +	restart.priority = 110;
> +	restart.restart = at91sam9x5_restart;
>  
> -	return 0;
> +	return restart_handler_register(&restart);
>  }
>  coredevice_initcall(at91sam9x5_initialize);
> -- 
> 2.29.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2021-01-05 12:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-04  9:34 [PATCH master] ARM: at91: at91sam9x5: fix co-existance of erratum-aware and generic reset Ahmad Fatoum
2021-01-05 12:02 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox