From patchwork Wed Dec 13 09:45:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Werner Fischer X-Patchwork-Id: 13490598 Received: from srv.wefi.net (srv.wefi.net [80.66.63.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EB7B7D0 for ; Wed, 13 Dec 2023 01:45:34 -0800 (PST) Received: from x390.thomas-krenn.com (unknown [91.223.201.37]) by srv.wefi.net (Postfix) with ESMTPA id 3C8725A358C; Wed, 13 Dec 2023 10:45:33 +0100 (CET) From: Werner Fischer To: Wim Van Sebroeck , Guenter Roeck Cc: linux-watchdog@vger.kernel.org, Werner Fischer Subject: [PATCH 1/4] watchdog: it87_wdt: add blank line after variable declaration Date: Wed, 13 Dec 2023 10:45:22 +0100 Message-Id: <20231213094525.11849-1-devlists@wefi.net> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-watchdog@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This patch fixes the following checkpatch.pl warning: WARNING: Missing a blank line after declarations Signed-off-by: Werner Fischer Reviewed-by: Guenter Roeck --- drivers/watchdog/it87_wdt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c index e888b1bdd1f2..6b7f7ec03633 100644 --- a/drivers/watchdog/it87_wdt.c +++ b/drivers/watchdog/it87_wdt.c @@ -146,6 +146,7 @@ static inline void superio_outb(int val, int reg) static inline int superio_inw(int reg) { int val; + outb(reg++, REG); val = inb(VAL) << 8; outb(reg, REG); From patchwork Wed Dec 13 09:45:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Werner Fischer X-Patchwork-Id: 13490601 Received: from srv.wefi.net (srv.wefi.net [80.66.63.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EB9A2DB for ; Wed, 13 Dec 2023 01:45:34 -0800 (PST) Received: from x390.thomas-krenn.com (unknown [91.223.201.37]) by srv.wefi.net (Postfix) with ESMTPA id 824415A358D; Wed, 13 Dec 2023 10:45:33 +0100 (CET) From: Werner Fischer To: Wim Van Sebroeck , Guenter Roeck Cc: linux-watchdog@vger.kernel.org, Werner Fischer Subject: [PATCH 2/4] watchdog: it87_wdt: Remove redundant max_units setting Date: Wed, 13 Dec 2023 10:45:23 +0100 Message-Id: <20231213094525.11849-2-devlists@wefi.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231213094525.11849-1-devlists@wefi.net> References: <20231213094525.11849-1-devlists@wefi.net> Precedence: bulk X-Mailing-List: linux-watchdog@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit 893dc8b5c978 ("watchdog: it87: Drop support for resetting watchdog though CIR and Game port") removed the try_gameport variable, and left max_units setting redundant. To clean up the code, this patch removes this redundant setting. Signed-off-by: Werner Fischer Reviewed-by: Guenter Roeck --- drivers/watchdog/it87_wdt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c index 6b7f7ec03633..ca377096bdd7 100644 --- a/drivers/watchdog/it87_wdt.c +++ b/drivers/watchdog/it87_wdt.c @@ -274,10 +274,6 @@ static int __init it87_wdt_init(void) case IT8712_ID: max_units = (chip_rev < 8) ? 255 : 65535; break; - case IT8716_ID: - case IT8726_ID: - max_units = 65535; - break; case IT8607_ID: case IT8613_ID: case IT8620_ID: @@ -287,9 +283,11 @@ static int __init it87_wdt_init(void) case IT8655_ID: case IT8665_ID: case IT8686_ID: + case IT8716_ID: case IT8718_ID: case IT8720_ID: case IT8721_ID: + case IT8726_ID: case IT8728_ID: case IT8772_ID: case IT8783_ID: From patchwork Wed Dec 13 09:45:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Werner Fischer X-Patchwork-Id: 13490600 Received: from srv.wefi.net (srv.wefi.net [80.66.63.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EB932D5 for ; Wed, 13 Dec 2023 01:45:34 -0800 (PST) Received: from x390.thomas-krenn.com (unknown [91.223.201.37]) by srv.wefi.net (Postfix) with ESMTPA id C0D455A3590; Wed, 13 Dec 2023 10:45:33 +0100 (CET) From: Werner Fischer To: Wim Van Sebroeck , Guenter Roeck Cc: linux-watchdog@vger.kernel.org, Werner Fischer Subject: [PATCH 3/4] watchdog: it87_wdt: Add IT8659 ID Date: Wed, 13 Dec 2023 10:45:24 +0100 Message-Id: <20231213094525.11849-3-devlists@wefi.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231213094525.11849-1-devlists@wefi.net> References: <20231213094525.11849-1-devlists@wefi.net> Precedence: bulk X-Mailing-List: linux-watchdog@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This patch adds watchdog support for the ITE IT8659 watchdog. IT8659 watchdog works in the same way as the other watchdogs supported by it87_wdt. Before this patch, IT8659 watchdog is not supported. After a modprobe, dmesg reports: it87_wdt: Unknown Chip found, Chip 8659 Revision 0007 With this patch, modprobe it87_wdt recognizes the watchdog as the dmesg output shows: it87_wdt: Chip IT8659 revision 7 initialized. timeout=60 sec (nowayout=0 testmode=0) Watchdog tests on a YANLING YL-ALP3L2C-1235U system have been successful, the watchdog works as expected with this patch. Signed-off-by: Werner Fischer Reviewed-by: Guenter Roeck --- drivers/watchdog/it87_wdt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c index ca377096bdd7..f6a344c002af 100644 --- a/drivers/watchdog/it87_wdt.c +++ b/drivers/watchdog/it87_wdt.c @@ -13,9 +13,9 @@ * http://www.ite.com.tw/ * * Support of the watchdog timers, which are available on - * IT8607, IT8613, IT8620, IT8622, IT8625, IT8628, IT8655, IT8665, - * IT8686, IT8702, IT8712, IT8716, IT8718, IT8720, IT8721, IT8726, - * IT8728, IT8772, IT8783 and IT8784. + * IT8607, IT8613, IT8620, IT8622, IT8625, IT8628, IT8655, IT8659, + * IT8665, IT8686, IT8702, IT8712, IT8716, IT8718, IT8720, IT8721, + * IT8726, IT8728, IT8772, IT8783, IT8784 and IT8786. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt @@ -56,6 +56,7 @@ #define IT8625_ID 0x8625 #define IT8628_ID 0x8628 #define IT8655_ID 0x8655 +#define IT8659_ID 0x8659 #define IT8665_ID 0x8665 #define IT8686_ID 0x8686 #define IT8702_ID 0x8702 @@ -281,6 +282,7 @@ static int __init it87_wdt_init(void) case IT8625_ID: case IT8628_ID: case IT8655_ID: + case IT8659_ID: case IT8665_ID: case IT8686_ID: case IT8716_ID: From patchwork Wed Dec 13 09:45:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Werner Fischer X-Patchwork-Id: 13490599 Received: from srv.wefi.net (srv.wefi.net [80.66.63.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EBB32E8 for ; Wed, 13 Dec 2023 01:45:34 -0800 (PST) Received: from x390.thomas-krenn.com (unknown [91.223.201.37]) by srv.wefi.net (Postfix) with ESMTPA id 00EE55A3591; Wed, 13 Dec 2023 10:45:33 +0100 (CET) From: Werner Fischer To: Wim Van Sebroeck , Guenter Roeck Cc: linux-watchdog@vger.kernel.org, Werner Fischer Subject: [PATCH 4/4] watchdog: it87_wdt: Keep WDTCTRL bit 3 unmodified for IT8784/IT8786 Date: Wed, 13 Dec 2023 10:45:25 +0100 Message-Id: <20231213094525.11849-4-devlists@wefi.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231213094525.11849-1-devlists@wefi.net> References: <20231213094525.11849-1-devlists@wefi.net> Precedence: bulk X-Mailing-List: linux-watchdog@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 WDTCTRL bit 3 sets the mode choice for the clock input of IT8784/IT8786. Some motherboards require this bit to be set to 1 (= PCICLK mode), otherwise the watchdog functionality gets broken. The BIOS of those motherboards sets WDTCTRL bit 3 already to 1. Instead of setting all bits of WDTCTRL to 0 by writing 0x00 to it, keep bit 3 of it unchanged for IT8784/IT8786 chips. In this way, bit 3 keeps the status as set by the BIOS of the motherboard. Watchdog tests have been successful with this patch with the following systems: IT8784: Thomas-Krenn LES plus v2 (YANLING YL-KBRL2 V2) IT8786: Thomas-Krenn LES plus v3 (YANLING YL-CLU L2) IT8786: Thomas-Krenn LES network 6L v2 (YANLING YL-CLU6L) Link: https://lore.kernel.org/all/140b264d-341f-465b-8715-dacfe84b3f71@roeck-us.net/ Signed-off-by: Werner Fischer Reviewed-by: Guenter Roeck --- drivers/watchdog/it87_wdt.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c index f6a344c002af..9297a5891912 100644 --- a/drivers/watchdog/it87_wdt.c +++ b/drivers/watchdog/it87_wdt.c @@ -258,6 +258,7 @@ static struct watchdog_device wdt_dev = { static int __init it87_wdt_init(void) { u8 chip_rev; + u8 ctrl; int rc; rc = superio_enter(); @@ -316,7 +317,18 @@ static int __init it87_wdt_init(void) superio_select(GPIO); superio_outb(WDT_TOV1, WDTCFG); - superio_outb(0x00, WDTCTRL); + + switch (chip_type) { + case IT8784_ID: + case IT8786_ID: + ctrl = superio_inb(WDTCTRL); + ctrl &= 0x08; + superio_outb(ctrl, WDTCTRL); + break; + default: + superio_outb(0x00, WDTCTRL); + } + superio_exit(); if (timeout < 1 || timeout > max_units * 60) {