Re: [PATCH v4] drivers/soc/litex: Add restart handler

From: Stafford Horne
Date: Tue Jan 19 2021 - 16:37:49 EST


On Tue, Jan 19, 2021 at 09:09:38AM +0100, Geert Uytterhoeven wrote:
> Let the LiteX SoC Controller register a restart handler, which resets
> the LiteX SoC by writing 1 to CSR_CTRL_RESET_ADDR.
>
> Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>

Thanks, this looks good to me, queued to my linux-next branch.

-Stafford

> @@ -66,8 +71,19 @@ static int litex_check_csr_access(void __iomem *reg_addr)
>
> struct litex_soc_ctrl_device {
> void __iomem *base;
> + struct notifier_block reset_nb;
> };
>
> +static int litex_reset_handler(struct notifier_block *this, unsigned long mode,
> + void *cmd)
> +{
> + struct litex_soc_ctrl_device *soc_ctrl_dev =
> + container_of(this, struct litex_soc_ctrl_device, reset_nb);

Nice.

> + litex_write32(soc_ctrl_dev->base + RESET_REG_OFF, RESET_REG_VALUE);
> + return NOTIFY_DONE;
> +}
> +