On 26/07/2021 14:12, Linus Walleij wrote: > 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@xxxxxxxxxx> > Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> > Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> > --- > ChangeLog v2->v3: > - Depend on ARCH_IXP4XX since we use SoC code accessors (drop > COMPILE_TEST). > - Drop <linux/init.h> use <linux/bits.h> rather than bitops.h > - Fix some tabs vs spaces issues in the defines. > - Call clk_disable_unprepare(d) directly from the devres > callback, the void * argument will be handled. > ChangeLog v1->v2: > - Pull out dirty patches underneath this patch. Tested on a > clean v5.14-rc1, sorry for the mess :( > - Drop tick rate from the timer driver - was only used by this > watchdog after all. > - Retrieve a clock from the parent to get rate if possible, > fallback to a default clock rate if not. Prepare and > enable the clock. > - Add a devres hook to disable the clock after use. > - Drop pointless platfrom_set_drvdata() > - Put a more technically correct print at end of probe. > Merge path: I expect this to be merged through the watchdog > subsystem once the timer maintainers are happy with the patch, > so Daniel or tglx: once you approve the patch please ACK this. > --- Acked-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx> [ ... ] -- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog