[PATCH 2/2] watchdog: mediatek: mt7988: add wdt support
Guenter Roeck
linux at roeck-us.net
Fri Nov 10 07:13:01 PST 2023
On 11/10/23 03:55, AngeloGioacchino Del Regno wrote:
> Il 10/11/23 01:30, Daniel Golle ha scritto:
>> Add support for watchdog and reset generator unit of the MediaTek
>> MT7988 SoC.
>>
>> Signed-off-by: Daniel Golle <daniel at makrotopia.org>
>> ---
>> drivers/watchdog/mtk_wdt.c | 56 +++++++++++++++++++++++++++++++++++++-
>> 1 file changed, 55 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
>> index b2330b16b497a..b98b8c29735aa 100644
>> --- a/drivers/watchdog/mtk_wdt.c
>> +++ b/drivers/watchdog/mtk_wdt.c
>> @@ -12,6 +12,7 @@
>> #include <dt-bindings/reset/mt2712-resets.h>
>> #include <dt-bindings/reset/mediatek,mt6795-resets.h>
>> #include <dt-bindings/reset/mt7986-resets.h>
>> +#include <dt-bindings/reset/mediatek,mt7988-resets.h>
>> #include <dt-bindings/reset/mt8183-resets.h>
>> #include <dt-bindings/reset/mt8186-resets.h>
>> #include <dt-bindings/reset/mt8188-resets.h>
>> @@ -58,6 +59,8 @@
>> #define WDT_SWSYSRST 0x18U
>> #define WDT_SWSYS_RST_KEY 0x88000000
>> +#define WDT_SWSYSRST_EN 0xfc
>> +
>> #define DRV_NAME "mtk-wdt"
>> #define DRV_VERSION "1.0"
>> @@ -71,44 +74,85 @@ struct mtk_wdt_dev {
>> struct reset_controller_dev rcdev;
>> bool disable_wdt_extrst;
>> bool reset_by_toprgu;
>> + bool has_swsysrst_en;
>
> mtk_wdt_data is always a const and this has_swsysrst_en member is never supposed
> to change during runtime.
>
> At this point, just add a pointer to struct mtk_wdt_data in mtk_wdt_dev, then
> instead of mtk_wdt->has_swsysrst_en you check mtk_wdt->pdata->has_swsysrst_en.
>
Oh, I don't know. Personally I dislike having to execute double dereferences
at runtime. I tend to accept it because people seem to like it, but I really
don't see the point.
Guenter
More information about the linux-arm-kernel
mailing list