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

Koen Vandeputte koen.vandeputte at ncentric.com
Tue Jan 17 00:37:03 PST 2017

Hi Tim,

> Koen,
> 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.
Thanks for the detailed info.
> 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.

Feel free to Ack.
My plan was to first provide this baseline, and then add the needed 
customization via a second patch.

Like you have noticed, I deliberately submitted as platform specific (& 
disabled) for now until it's fully finished and thoroughly tested.
If another MPcore based platform would like to use it afterwards, it 
should be easy to share it. (Generic or target specific)

The earliest window I see in my calender to continue working on it is in 
about 2 weeks from now, if nothing else pops up ..
If you (or anyone else) would like to further provide fixes it in the 
meantime, please do. :-)

> Regards,
> Tim
> [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