From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B18215442F; Mon, 22 Jan 2024 15:19:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705936755; cv=none; b=Ku1QpHRaxgHY9j/94cCFiFd/mq2jBusdDqTqBGZKwQWzdHVy0gPYxOtVpS6RjPscebK40rCElX4RvMnZg2Sq7GwyDQ4Z2o+2toOuVQhYCWVoRvoxejkVkUD9L8pJrKrUo8ETsJrwslgFiu5ju4c5ESzx3Reh0sH4azIX00638JM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705936755; c=relaxed/simple; bh=XYMXd5vZmR554ho5VFUZcyQAKj3acDKFQJ8MZ3ziLUI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YGYLv/44u5NcvG7IwHsEo6mgVoaKZj0TPaP0uDLFnZA3q0YPtaajmIcq1KMp4RbIrozpcONAZWMAWh+/pqFfKW/C4UuC1gj0it9N0CBQB1cv6MeT8/wd7pjJrPyUiMzTT0LLwEXemLxAkXxu9X1XeEbhS3GdXuAF8qFCf8i+Uk0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ayxOZ6Bv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ayxOZ6Bv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08710C433C7; Mon, 22 Jan 2024 15:19:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705936754; bh=XYMXd5vZmR554ho5VFUZcyQAKj3acDKFQJ8MZ3ziLUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ayxOZ6Bv7T4qJUf/JqjGjS7Fhla4To2jqWhisWL9+fB2Hjdf/6DUfNEAQnbUh4RzK JnbUdiqJs+v3XQs0wwEqujUeFQQRxZPnGLMo3aBw0UX7PvcXvsU1WKZ45W4u5IbbiI uFrDVsZbn2FoTGy79bmNcEUunefN/mVnpbJZKE2P7OV1mEyYDyDG5cYw6f0U3S5Ah3 2c9w5s9chard3EbcfZRoZGRQoeFfXZvSI41+IkBYFjeo9OBds1kf451VAsqGKDM+yV R1VeEp8mvf+0IgCrpVRf4FwHX6R8pJgm2ukiYzaFol2zwbhQZIHHQEpWDwAvt1OFxg KrBgOsDKOug8g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Werner Fischer , Guenter Roeck , Wim Van Sebroeck , Sasha Levin , linux-watchdog@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 20/23] watchdog: it87_wdt: Keep WDTCTRL bit 3 unmodified for IT8784/IT8786 Date: Mon, 22 Jan 2024 10:18:00 -0500 Message-ID: <20240122151823.997644-20-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122151823.997644-1-sashal@kernel.org> References: <20240122151823.997644-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-watchdog@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 4.19.305 Content-Transfer-Encoding: 8bit From: Werner Fischer [ Upstream commit d12971849d71781c1e4ffd1117d4878ce233d319 ] 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 Link: https://lore.kernel.org/r/20231213094525.11849-4-devlists@wefi.net Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- 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 e96faea24925..d77e9dc0bd45 100644 --- a/drivers/watchdog/it87_wdt.c +++ b/drivers/watchdog/it87_wdt.c @@ -269,6 +269,7 @@ static struct watchdog_device wdt_dev = { static int __init it87_wdt_init(void) { u8 chip_rev; + u8 ctrl; int rc; rc = superio_enter(); @@ -324,7 +325,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) { -- 2.43.0