Hi Geert,

On Friday, February 10, 2017, Geert Uytterhoeven wrote:
> Alternatively, you can write a restart driver (cfr.
> drivers/power/reset/rmobile-reset.c) that binds against a
> "renesas,r7s72100-wdt" device node, but doesn't implement watchdog
> functionality.
> You're gonna need DT bindings anyway.

I like that idea. That should take me no time at all.
Thank you.

Do you think I can still keep my 'weak function' idea in there??


extern void __attribute__ ((weak)) prepare_for_restart(void)
{
        /* override to do board specific stuff */
}

static int renesas_wdt_reset_handler(struct notifier_block *this,
                                 unsigned long mode, void *cmd)
{
        pr_debug("%s %lu\n", __func__, mode);

        prepare_for_restart();

        /* set WDT for reset */
        . . .

        return NOTIFY_DONE;
}



Or...do you think I can just use the rmobile-reset.c driver and
just add WDT to it?

Honestly, the only thing different will be rmobile_reset_handler().
I could make a rmobile_wdt_reset_handler() and I could just pass in
a different notifier_block depending on the DT.

What do you think?

static const struct of_device_id rmobile_reset_of_match[] = {
        { .compatible = "renesas,sysc-rmobile", },
        { .compatible = "renesas,wdt-rmobile", },
        { /* sentinel */ }
};


Chris

Reply via email to