On Tuesday 12 May 2015, fu.wei@linaro.org wrote:
> From: Fu Wei <fu.wei@linaro.org>
>
> (1)Use linux kernel watchdog framework
> (2)Work with FDT on ARM64
> (3)Use "pretimeout" in watchdog framework.
> (4)In first timeout(WS0), do panic to save system context.
>
> Signed-off-by: Fu Wei <fu.wei@linaro.org>
> ---
> drivers/watchdog/Kconfig | 10 +
> drivers/watchdog/Makefile | 1 +
> drivers/watchdog/sbsa_gwdt.c | 560 +++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 571 insertions(+)
> create mode 100644 drivers/watchdog/sbsa_gwdt.c
>
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index e5e7c55..46d6f46 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -152,6 +152,16 @@ config ARM_SP805_WATCHDOG
> ARM Primecell SP805 Watchdog timer. This will reboot your system when
> the timeout is reached.
>
> +config ARM_SBSA_WATCHDOG
> + tristate "ARM SBSA Generic Watchdog"
> + depends on ARM64 && ARM_AMBA
> + select WATCHDOG_CORE
Ideally make it possible to build this on all architectures, so we get compile
coverage on x86 builds.
You should also drop the ARM_AMBA dependency because this is regular
platform_driver.
ARM_AMBA is only used for primecell devices, which this is not.
> +#if IS_BUILTIN(CONFIG_OF)
> +static const struct of_device_id sbsa_gwdt_of_match[] = {
> + { .compatible = "arm,sbsa-gwdt", },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, sbsa_gwdt_of_match);
> +#endif
> +
> +static const struct dev_pm_ops sbsa_gwdt_pm_ops = {
> + SET_SYSTEM_SLEEP_PM_OPS(sbsa_gwdt_suspend, sbsa_gwdt_resume)
> +};
> +
> +static struct platform_driver sbsa_gwdt_driver = {
> + .driver = {
> + .name = "sbsa-gwdt",
> + .pm = &sbsa_gwdt_pm_ops,
> + .of_match_table = sbsa_gwdt_of_match,
> + },
But fix the undefined reference here first: sbsa_gwdt_of_match is hidden
behind CONFIG_OF, which is always set on ARM64. Just remove the #ifdef
and it will build on other architectures as well.
arnd