[LEDE-DEV] [PATCH] cns3xxx: restore mpcore watchdog

Tim Harvey tharvey at gateworks.com
Mon Jan 16 13:37:09 PST 2017

On Tue, Jan 10, 2017 at 5:34 AM, Koen Vandeputte
<koen.vandeputte at ncentric.com> wrote:
> Adds the mpcore watchdog driver for kernel 4.4 as it was originally
> present up to kernel 3.12
> - Disabled by default for now, but can be simply enabled in kernelconfig
> - Currently does not contain the latest patches as mentioned here:


Thanks for submitting this - I agree with Felix that we should add
back the functionality if possible.

The issue mentioned in the commit which removed the driver from
mainline linux [1] regarding 'Nothing ensures the userspace ioctl()
will end-up kicking the watchdog on the right CPU.' is addressed by
the fact that the watchdog register base defined in laguna.c [2] as
the register 'CNS3XXX_TC11MP_TWD_BASE + 0x100' always points to the
CPU0 watchdog as opposed to CNS3XXX_TC11MP_TWD_BASE which would be
aliased to the watchdog of whatever CPU core the process is running.

However, I found after a bit of digging I found that this mainline
driver requires other patches to make the watchdog reliable which
apparently never got accepted upstream [3] [4] [5] [6]. While these
patches were apparently never accepted upstream they were in the
OpenWrt git repo for the 3.10 kernel and below and not surprisingly
got removed when the kernel bumped past 3.10. These patches also need
to be re-added (at least definitely [3]) as without them you'll find
that the timer count is too large and the watchdog will unexpectedly
trip typically within a matter of several minutes.

With these additional patches added I would say that we should also
enable the watchdog in the kernel config.

How do you want to proceed? I could ack your patch (as it adds the
base driver back from mainline but doesn't enable it) then followup
with a patch that adds back the additional patches (to
target/platform/cns3xxx unless there are other targets that use the
arm11mpcore processor and want the twd fixes?) and enables the
watchdog kernel driver. Note that the patches affect other files so we
can't simply merge them all into the files directory.



[1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6e63a3a294fdf91eaaac1061a9c7a5f53d16ac25
[2] https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c;h=4a596125ab5c8ab1b3a1d31e00d406097b2412d0;hb=HEAD#l636
[3] https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/generic/target/linux/generic/target/linux/generic/patches-3.10/target/linux/generic/patches-3.10/992-mpcore_wdt_fix_watchdog_counter_loading.patch;h=ae81f3f384b5805ee64dcbadcaab38aaea1acf1e
[4] https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/generic/target/linux/generic/target/linux/generic/patches-3.10/target/linux/generic/patches-3.10/993-mpcore_wdt_fix_wdioc_setoptions_handling.patch;h=c986ac8f216c2a201875b44fc2fe6a8191680c13
[5] https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/generic/target/linux/generic/target/linux/generic/patches-3.10/target/linux/generic/patches-3.10/994-mpcore_wdt_fix_timer_mode_setup.patch;h=ecc2452cabe058990d56052644e3d328e549df01
[6] https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/generic/target/linux/generic/target/linux/generic/patches-3.10/target/linux/generic/patches-3.10/995-mpcore_twd_calibrate_single_core.patch;h=70411160fac88aeae42a2696039ab9bb5e9f47ba

More information about the Lede-dev mailing list