[v2,1/2] ARM: nspire: Use syscon-reboot to handle restart

Message ID 20221026161302.5319-2-afd@ti.com
State New
Headers
Series TI-Nspire cleanups |

Commit Message

Andrew Davis Oct. 26, 2022, 4:13 p.m. UTC
  Writing this bit can be handled by the syscon-reboot driver. Add the
info to DT and remove the machine_desc version.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/boot/dts/nspire.dtsi |  7 +++++++
 arch/arm/mach-nspire/Kconfig  |  2 ++
 arch/arm/mach-nspire/mmio.h   |  3 ---
 arch/arm/mach-nspire/nspire.c | 10 ----------
 4 files changed, 9 insertions(+), 13 deletions(-)
  

Comments

Fabian Vogt Oct. 26, 2022, 6:35 p.m. UTC | #1
Hi,

Am Mittwoch, 26. Oktober 2022, 18:13:01 CEST schrieb Andrew Davis:
> Writing this bit can be handled by the syscon-reboot driver. Add the
> info to DT and remove the machine_desc version.
> 
> Signed-off-by: Andrew Davis <afd@ti.com>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

finally got this to run on real HW after reverting to an older .config
and refreshing options. Rebooting works fine here. Thanks a lot!

Tested-by: Fabian Vogt <fabian@ritter-vogt.de>
Reviewed-by: Fabian Vogt <fabian@ritter-vogt.de>

> ---
>  arch/arm/boot/dts/nspire.dtsi |  7 +++++++
>  arch/arm/mach-nspire/Kconfig  |  2 ++
>  arch/arm/mach-nspire/mmio.h   |  3 ---
>  arch/arm/mach-nspire/nspire.c | 10 ----------
>  4 files changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/nspire.dtsi b/arch/arm/boot/dts/nspire.dtsi
> index bb240e6a3a6f..6357b803521e 100644
> --- a/arch/arm/boot/dts/nspire.dtsi
> +++ b/arch/arm/boot/dts/nspire.dtsi
> @@ -172,7 +172,14 @@ rtc: rtc@90090000 {
>  			};
>  
>  			misc: misc@900a0000 {
> +				compatible = "syscon", "simple-mfd";
>  				reg = <0x900a0000 0x1000>;
> +
> +				reboot {
> +					compatible = "syscon-reboot";
> +					offset = <0x08>;
> +					value = <0x02>;
> +				};
>  			};
>  
>  			pwr: pwr@900b0000 {
> diff --git a/arch/arm/mach-nspire/Kconfig b/arch/arm/mach-nspire/Kconfig
> index b7a3871876d7..0ffdcaca1e6b 100644
> --- a/arch/arm/mach-nspire/Kconfig
> +++ b/arch/arm/mach-nspire/Kconfig
> @@ -9,5 +9,7 @@ config ARCH_NSPIRE
>  	select ARM_VIC
>  	select ARM_TIMER_SP804
>  	select NSPIRE_TIMER
> +	select POWER_RESET
> +	select POWER_RESET_SYSCON
>  	help
>  	  This enables support for systems using the TI-NSPIRE CPU
> diff --git a/arch/arm/mach-nspire/mmio.h b/arch/arm/mach-nspire/mmio.h
> index 48e32f13f311..2ce0656139ec 100644
> --- a/arch/arm/mach-nspire/mmio.h
> +++ b/arch/arm/mach-nspire/mmio.h
> @@ -5,9 +5,6 @@
>   *	Copyright (C) 2013 Daniel Tang <tangrs@tangrs.id.au>
>   */
>  
> -#define NSPIRE_MISC_PHYS_BASE		0x900A0000
> -#define NSPIRE_MISC_HWRESET		0x08
> -
>  #define NSPIRE_PWR_PHYS_BASE		0x900B0000
>  #define NSPIRE_PWR_VIRT_BASE		0xFEEB0000
>  #define NSPIRE_PWR_BUS_DISABLE1		0x18
> diff --git a/arch/arm/mach-nspire/nspire.c b/arch/arm/mach-nspire/nspire.c
> index 2d4abb0288b9..1e13337972dd 100644
> --- a/arch/arm/mach-nspire/nspire.c
> +++ b/arch/arm/mach-nspire/nspire.c
> @@ -27,16 +27,6 @@ static const char *const nspire_dt_match[] __initconst = {
>  	NULL,
>  };
>  
> -static void nspire_restart(enum reboot_mode mode, const char *cmd)
> -{
> -	void __iomem *base = ioremap(NSPIRE_MISC_PHYS_BASE, SZ_4K);
> -	if (!base)
> -		return;
> -
> -	writel(2, base + NSPIRE_MISC_HWRESET);
> -}
> -
>  DT_MACHINE_START(NSPIRE, "TI-NSPIRE")
>  	.dt_compat	= nspire_dt_match,
> -	.restart	= nspire_restart,
>  MACHINE_END
  
Krzysztof Kozlowski Oct. 26, 2022, 8:17 p.m. UTC | #2
On 26/10/2022 12:13, Andrew Davis wrote:
> Writing this bit can be handled by the syscon-reboot driver. Add the
> info to DT and remove the machine_desc version.
> 
> Signed-off-by: Andrew Davis <afd@ti.com>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  arch/arm/boot/dts/nspire.dtsi |  7 +++++++

DTS cannot go with code.

Additionally, this breaks people's filtering as there is no "dts" prefix
in the subject.

>  arch/arm/mach-nspire/Kconfig  |  2 ++
>  arch/arm/mach-nspire/mmio.h   |  3 ---
>  arch/arm/mach-nspire/nspire.c | 10 ----------
>  4 files changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/nspire.dtsi b/arch/arm/boot/dts/nspire.dtsi
> index bb240e6a3a6f..6357b803521e 100644
> --- a/arch/arm/boot/dts/nspire.dtsi
> +++ b/arch/arm/boot/dts/nspire.dtsi
> @@ -172,7 +172,14 @@ rtc: rtc@90090000 {
>  			};
>  
>  			misc: misc@900a0000 {
> +				compatible = "syscon", "simple-mfd";

These are not allowed on their own (need specific compatible) and you
should have warnings when running dtbs_check.

Best regards,
Krzysztof
  
Andrew Davis Oct. 27, 2022, 6:16 p.m. UTC | #3
On 10/26/22 3:17 PM, Krzysztof Kozlowski wrote:
> On 26/10/2022 12:13, Andrew Davis wrote:
>> Writing this bit can be handled by the syscon-reboot driver. Add the
>> info to DT and remove the machine_desc version.
>>
>> Signed-off-by: Andrew Davis <afd@ti.com>
>> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>> ---
>>   arch/arm/boot/dts/nspire.dtsi |  7 +++++++
> 
> DTS cannot go with code.
> 
> Additionally, this breaks people's filtering as there is no "dts" prefix
> in the subject.
> 
>>   arch/arm/mach-nspire/Kconfig  |  2 ++
>>   arch/arm/mach-nspire/mmio.h   |  3 ---
>>   arch/arm/mach-nspire/nspire.c | 10 ----------
>>   4 files changed, 9 insertions(+), 13 deletions(-)
>>
>> diff --git a/arch/arm/boot/dts/nspire.dtsi b/arch/arm/boot/dts/nspire.dtsi
>> index bb240e6a3a6f..6357b803521e 100644
>> --- a/arch/arm/boot/dts/nspire.dtsi
>> +++ b/arch/arm/boot/dts/nspire.dtsi
>> @@ -172,7 +172,14 @@ rtc: rtc@90090000 {
>>   			};
>>   
>>   			misc: misc@900a0000 {
>> +				compatible = "syscon", "simple-mfd";
> 
> These are not allowed on their own (need specific compatible) and you
> should have warnings when running dtbs_check.
> 

Ah, my bad, must have gotten lost in the other existing warnings.
Sent v3 with the above fixes, and tried to remove some existing warnings.

Thanks,
Andrew

> Best regards,
> Krzysztof
>
  

Patch

diff --git a/arch/arm/boot/dts/nspire.dtsi b/arch/arm/boot/dts/nspire.dtsi
index bb240e6a3a6f..6357b803521e 100644
--- a/arch/arm/boot/dts/nspire.dtsi
+++ b/arch/arm/boot/dts/nspire.dtsi
@@ -172,7 +172,14 @@  rtc: rtc@90090000 {
 			};
 
 			misc: misc@900a0000 {
+				compatible = "syscon", "simple-mfd";
 				reg = <0x900a0000 0x1000>;
+
+				reboot {
+					compatible = "syscon-reboot";
+					offset = <0x08>;
+					value = <0x02>;
+				};
 			};
 
 			pwr: pwr@900b0000 {
diff --git a/arch/arm/mach-nspire/Kconfig b/arch/arm/mach-nspire/Kconfig
index b7a3871876d7..0ffdcaca1e6b 100644
--- a/arch/arm/mach-nspire/Kconfig
+++ b/arch/arm/mach-nspire/Kconfig
@@ -9,5 +9,7 @@  config ARCH_NSPIRE
 	select ARM_VIC
 	select ARM_TIMER_SP804
 	select NSPIRE_TIMER
+	select POWER_RESET
+	select POWER_RESET_SYSCON
 	help
 	  This enables support for systems using the TI-NSPIRE CPU
diff --git a/arch/arm/mach-nspire/mmio.h b/arch/arm/mach-nspire/mmio.h
index 48e32f13f311..2ce0656139ec 100644
--- a/arch/arm/mach-nspire/mmio.h
+++ b/arch/arm/mach-nspire/mmio.h
@@ -5,9 +5,6 @@ 
  *	Copyright (C) 2013 Daniel Tang <tangrs@tangrs.id.au>
  */
 
-#define NSPIRE_MISC_PHYS_BASE		0x900A0000
-#define NSPIRE_MISC_HWRESET		0x08
-
 #define NSPIRE_PWR_PHYS_BASE		0x900B0000
 #define NSPIRE_PWR_VIRT_BASE		0xFEEB0000
 #define NSPIRE_PWR_BUS_DISABLE1		0x18
diff --git a/arch/arm/mach-nspire/nspire.c b/arch/arm/mach-nspire/nspire.c
index 2d4abb0288b9..1e13337972dd 100644
--- a/arch/arm/mach-nspire/nspire.c
+++ b/arch/arm/mach-nspire/nspire.c
@@ -27,16 +27,6 @@  static const char *const nspire_dt_match[] __initconst = {
 	NULL,
 };
 
-static void nspire_restart(enum reboot_mode mode, const char *cmd)
-{
-	void __iomem *base = ioremap(NSPIRE_MISC_PHYS_BASE, SZ_4K);
-	if (!base)
-		return;
-
-	writel(2, base + NSPIRE_MISC_HWRESET);
-}
-
 DT_MACHINE_START(NSPIRE, "TI-NSPIRE")
 	.dt_compat	= nspire_dt_match,
-	.restart	= nspire_restart,
 MACHINE_END