watchdog: ixp4xx: Rewrite driver to use core
authorLinus Walleij <linus.walleij@linaro.org>
Mon, 26 Jul 2021 12:12:14 +0000 (14:12 +0200)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Sun, 22 Aug 2021 08:28:12 +0000 (10:28 +0200)
commit580b8e2899770cf4768f52e37a1c8bddc46f13e7
treea9a05a7a79e25a1910f9876c705810fcbc15d203
parentdbe80cf471f940db3063197b7adb1169f89be9ed
watchdog: ixp4xx: Rewrite driver to use core

This rewrites the IXP4xx watchdog driver as follows:

- Spawn the watchdog driver as a platform device from the timer
  driver. It's one device in the hardware, and the fact that
  Linux splits the handling into two different devices is
  a Linux pecularity, and thus it becomes a Linux pecularity
  to spawn a separate watchdog driver.

- Spawn the watchdog driver from the timer driver at probe().
  This is well after the timer driver as actually registered and
  started and we know the register base is available.

- Instead of looping back callbacks to the timer drivers for all
  watchdog calls, pass the register base to the watchdog driver
  and manage the registers there. The two drivers aren't even
  interested in the same register so the spinlock is totally
  surplus, delete it.

- Replace pretty much all of the content in the watchdog driver
  with a simple, modern watchdog driver utilizing the watchdog
  core instead of registering its own misc device and ioctl()
  handling.

- Drop module parameters as the same already exist in the
  watchdog core.

What remains is a slim elegant (IMO) watchdog driver using the
watchdog core, spawning from device tree or boardfile alike.

Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210726121214.2572836-1-linus.walleij@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/clocksource/timer-ixp4xx.c
drivers/watchdog/Kconfig
drivers/watchdog/ixp4xx_wdt.c