Re: [PATCH 2/3] watchdog: mtk_wdt: add support for 16-bit control registers
From: Matthias Brugger <matthias.bgg@gmail.com>
Date: 2021-02-10 11:39:43
Also in:
linux-mediatek
On 02/02/2021 02:33, Boris Lysov wrote:
В Sun, 31 Jan 2021 16:31:09 -0800 Guenter Roeck [off-list ref] пишет:quoted
We can't do this. With this flag enabled, the watchdog won't support other SoCs, and there is nothing that prevents the flag from being set for those SoCs. This has to be handled differently, without configuration flag. Maybe use regmap for register addresses, [snip], or use accessor functions in mtk_wdt_dev.Thank you for reviewing my patch! I will consider suggested fixes, and I will come up with better solution in V2. I'm beginner developer, and am still learning.quoted
use the compatible string to determine which regmap settings to useI think relying on hardcoded "compatible string - settings" pairs in driver is not good. Whilst most Mediatek watchdogs I've seen use similar drivers, no one (except Mediatek itself, of course) knows for sure how many devices use 16-bit mode, and specifying each one in C code may _theoretically_ bloat it. (well, on the other hand, I've seen other watchdog drivers with many compatible devices listed in C code, and they didn't seem bloated at all)
We enable 16 bit access for "mediatek,mt6577-wdt" if we have a new SoC that also needs 16 bit access, most probably we can just update the binding documentation by adding the new SoC with a fallback to mt6577: "mediatek,mt1234-wdt", "mediatek,mt6577-wdt": for MT1234 As no binding to mt1234 is present in the driver, the mt6577 one will be used. Regards, Matthias