diff mbox series

[5/5] maix: enable SBI system reset for MAIX

Message ID 20210304170051.58993-6-xypron.glpk@gmx.de
State Changes Requested, archived
Delegated to: Andes
Headers show
Series riscv: enable SBI system reset | expand

Commit Message

Heinrich Schuchardt March 4, 2021, 5 p.m. UTC
When running in S-mode we can use the SBI system reset extension to provide
the system reset.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 board/sipeed/maix/maix.c            | 5 +++++
 configs/sipeed_maix_smode_defconfig | 2 ++
 2 files changed, 7 insertions(+)

--
2.30.1

Comments

Sean Anderson March 4, 2021, 11:24 p.m. UTC | #1
On 3/4/21 12:00 PM, Heinrich Schuchardt wrote:
> When running in S-mode we can use the SBI system reset extension to provide
> the system reset.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>   board/sipeed/maix/maix.c            | 5 +++++
>   configs/sipeed_maix_smode_defconfig | 2 ++
>   2 files changed, 7 insertions(+)
> 
> diff --git a/board/sipeed/maix/maix.c b/board/sipeed/maix/maix.c
> index cbcb23cf5c..388eddee6e 100644
> --- a/board/sipeed/maix/maix.c
> +++ b/board/sipeed/maix/maix.c
> @@ -6,6 +6,7 @@
>   #include <common.h>
>   #include <clk.h>
>   #include <dm.h>
> +#include <dm/lists.h>
>   #include <fdt_support.h>
>   #include <asm/io.h>
> 
> @@ -37,5 +38,9 @@ int board_init(void)
>   			return ret;
>   	}
> 
> +	if (IS_ENABLED(CONFIG_SYSRESET_SBI))
> +		ret = device_bind_driver(gd->dm_root, "sbi-sysreset",
> +					 "sbi-sysreset", NULL);
> +

Besides that this isn't a device-tree driver, shouldn't this live in
arch_early_init_r or similar? This isn't really board-specific.

--Sean

>   	return 0;
>   }
> diff --git a/configs/sipeed_maix_smode_defconfig b/configs/sipeed_maix_smode_defconfig
> index 2516bb7258..aa95893feb 100644
> --- a/configs/sipeed_maix_smode_defconfig
> +++ b/configs/sipeed_maix_smode_defconfig
> @@ -7,4 +7,6 @@ CONFIG_STACK_SIZE=0x100000
>   # CONFIG_NET is not set
>   # CONFIG_INPUT is not set
>   # CONFIG_DM_ETH is not set
> +CONFIG_SYSRESET_SBI=y
> +# CONFIG_SYSRESET_SYSCON is not set
>   # CONFIG_EFI_UNICODE_CAPITALIZATION is not set
> --
> 2.30.1
>
Heinrich Schuchardt March 6, 2021, 7:31 a.m. UTC | #2
On 3/5/21 12:24 AM, Sean Anderson wrote:
> On 3/4/21 12:00 PM, Heinrich Schuchardt wrote:
>> When running in S-mode we can use the SBI system reset extension to
>> provide
>> the system reset.
>>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>> ---
>>   board/sipeed/maix/maix.c            | 5 +++++
>>   configs/sipeed_maix_smode_defconfig | 2 ++
>>   2 files changed, 7 insertions(+)
>>
>> diff --git a/board/sipeed/maix/maix.c b/board/sipeed/maix/maix.c
>> index cbcb23cf5c..388eddee6e 100644
>> --- a/board/sipeed/maix/maix.c
>> +++ b/board/sipeed/maix/maix.c
>> @@ -6,6 +6,7 @@
>>   #include <common.h>
>>   #include <clk.h>
>>   #include <dm.h>
>> +#include <dm/lists.h>
>>   #include <fdt_support.h>
>>   #include <asm/io.h>
>>
>> @@ -37,5 +38,9 @@ int board_init(void)
>>               return ret;
>>       }
>>
>> +    if (IS_ENABLED(CONFIG_SYSRESET_SBI))
>> +        ret = device_bind_driver(gd->dm_root, "sbi-sysreset",
>> +                     "sbi-sysreset", NULL);
>> +
>
> Besides that this isn't a device-tree driver, shouldn't this live in
> arch_early_init_r or similar? This isn't really board-specific.

Using arch_early_init_r() seems to be a viable alternative to putting
some dummy node into each device-tree.

Best regards

Heinrich

>
> --Sean
>
>>       return 0;
>>   }
>> diff --git a/configs/sipeed_maix_smode_defconfig
>> b/configs/sipeed_maix_smode_defconfig
>> index 2516bb7258..aa95893feb 100644
>> --- a/configs/sipeed_maix_smode_defconfig
>> +++ b/configs/sipeed_maix_smode_defconfig
>> @@ -7,4 +7,6 @@ CONFIG_STACK_SIZE=0x100000
>>   # CONFIG_NET is not set
>>   # CONFIG_INPUT is not set
>>   # CONFIG_DM_ETH is not set
>> +CONFIG_SYSRESET_SBI=y
>> +# CONFIG_SYSRESET_SYSCON is not set
>>   # CONFIG_EFI_UNICODE_CAPITALIZATION is not set
>> --
>> 2.30.1
>>
>
diff mbox series

Patch

diff --git a/board/sipeed/maix/maix.c b/board/sipeed/maix/maix.c
index cbcb23cf5c..388eddee6e 100644
--- a/board/sipeed/maix/maix.c
+++ b/board/sipeed/maix/maix.c
@@ -6,6 +6,7 @@ 
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <dm/lists.h>
 #include <fdt_support.h>
 #include <asm/io.h>

@@ -37,5 +38,9 @@  int board_init(void)
 			return ret;
 	}

+	if (IS_ENABLED(CONFIG_SYSRESET_SBI))
+		ret = device_bind_driver(gd->dm_root, "sbi-sysreset",
+					 "sbi-sysreset", NULL);
+
 	return 0;
 }
diff --git a/configs/sipeed_maix_smode_defconfig b/configs/sipeed_maix_smode_defconfig
index 2516bb7258..aa95893feb 100644
--- a/configs/sipeed_maix_smode_defconfig
+++ b/configs/sipeed_maix_smode_defconfig
@@ -7,4 +7,6 @@  CONFIG_STACK_SIZE=0x100000
 # CONFIG_NET is not set
 # CONFIG_INPUT is not set
 # CONFIG_DM_ETH is not set
+CONFIG_SYSRESET_SBI=y
+# CONFIG_SYSRESET_SYSCON is not set
 # CONFIG_EFI_UNICODE_CAPITALIZATION is not set