[PATCH v2 6/6] lib: reset/fdt_reset_atcwdt200: Use defined macros and function in atcsmu.h

Anup Patel anup at brainfault.org
Tue Jan 17 20:17:05 PST 2023


On Wed, Jan 18, 2023 at 7:50 AM Yu Chien Peter Lin
<peterlin at andestech.com> wrote:
>
> Reuse the smu related macros and function in atcsmu.h.
>
> Signed-off-by: Yu Chien Peter Lin <peterlin at andestech.com>
> ---
>  lib/utils/reset/fdt_reset_atcwdt200.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/lib/utils/reset/fdt_reset_atcwdt200.c b/lib/utils/reset/fdt_reset_atcwdt200.c
> index 91acc9f..c524f84 100644
> --- a/lib/utils/reset/fdt_reset_atcwdt200.c
> +++ b/lib/utils/reset/fdt_reset_atcwdt200.c
> @@ -16,6 +16,7 @@
>  #include <sbi/sbi_system.h>
>  #include <sbi_utils/fdt/fdt_helper.h>
>  #include <sbi_utils/reset/fdt_reset.h>
> +#include <sbi_utils/sys/atcsmu.h>
>
>  #define ATCWDT200_WP_NUM 0x5aa5
>  #define WREN_REG 0x18
> @@ -41,12 +42,6 @@
>  #define CLK_PCLK (1 << 1)
>  #define WDT_EN (1 << 0)
>
> -#define FLASH_BASE 0x80000000ULL
> -#define SMU_RESET_VEC_LO_OFF 0x50
> -#define SMU_RESET_VEC_HI_OFF 0x60
> -#define SMU_HARTn_RESET_VEC_LO(n) (SMU_RESET_VEC_LO_OFF + (n * 0x4))
> -#define SMU_HARTn_RESET_VEC_HI(n) (SMU_RESET_VEC_HI_OFF + (n * 0x4))
> -
>  static volatile char *wdt_addr;
>  static volatile char *smu_addr;
>
> @@ -66,10 +61,8 @@ static void ae350_system_reset(u32 type, u32 reason)
>  {
>         const struct sbi_platform *plat = sbi_platform_thishart_ptr();
>
> -       for (int i = 0; i < sbi_platform_hart_count(plat); i++) {
> -               writel(FLASH_BASE, smu_addr + SMU_HARTn_RESET_VEC_LO(i));
> -               writel(FLASH_BASE >> 32, smu_addr + SMU_HARTn_RESET_VEC_HI(i));
> -       }
> +       for (int i = 0; i < sbi_platform_hart_count(plat); i++)
> +               smu_set_reset_vector(FLASH_BASE, i);

This also means that "config FDT_RESET_ATCWDT200" now depends
upon SYS_ATCSMU

Regards,
Anup


>
>         /* Program WDT control register  */
>         writew(ATCWDT200_WP_NUM, wdt_addr + WREN_REG);
> --
> 2.34.1
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi



More information about the opensbi mailing list