Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp177727lqh; Wed, 27 Mar 2024 20:17:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXEqkUUWZe+JRoY0WcQJJl19tpeIvJ9+n0jfdRLJt6X61Hg8hQwVGt/uayXVoNlkmQSEagZHIx9a7nMP+7VXD+0a99dIMB6C6tiwIXkfg== X-Google-Smtp-Source: AGHT+IGi2a3/NtKc21Cs3KKc6BqO+lf7UppH9oVOECgiVHHCDUC7FJyC3vqCP5QvzRGG6MvZccNf X-Received: by 2002:ac8:7dcf:0:b0:431:4406:6f5f with SMTP id c15-20020ac87dcf000000b0043144066f5fmr1741820qte.1.1711595835387; Wed, 27 Mar 2024 20:17:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711595835; cv=pass; d=google.com; s=arc-20160816; b=D1kXIm2uWd2EJvjNLKkxKjRH4O04vCsIGBZJeSYd1GjsNfJwHhG1/gTtqjhauFA+cV R3oVxh8/lue8eI5DssOolImBHC564kP+b67EDSnhVzFozIn/Pkc9fFni9gU1sBy/Cr1D +4ab4Xs+xoShZB+/q26U1A0YzJL7JkD7bBNmJy64T53vcGLeFA8kE/3H27RMwRPZzPPe xhU9d/pfiq19RV/t+OLHWB27sNHx0kntXuO5QTBdj61UTqmozORezez6wUyBdJUTOUmj mEoTxMZL81dXhuzF92t1/bOHzW/Avt6VVis0Mqrkh38TB5J0R0WOAPmEkzYC1JjfnsRn Qj0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:references :to:from:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=aIic1Gjzm4RHTASBVGxTr3rcD5mx/7GlOl+VtL8tSQM=; fh=2YCGQmMb19L5T6xEO3EQsBPZQbMQX5BNtmuW4qko200=; b=R4Jm+aLqbkvhNaHHwCva0lstZGzEZOKgL4vGtcFNX8gfipokMlYf8IFCxMas2QqcNw bgFs4wjFMolUHJgWwesveqTKanyX3+QrYpFdM3BTSpo/PtAwQH6cb80nRrI+cFH7iUmR Wy4YMWwfaRKvA7KegoB4dkOlnrH3z67oHPTDlmDgiTK7ediFPM+7rh4hma9KXL8Kbo+z UvCFoRgqNNk9dYo9GaDa6FidPVsJdO4WBJc9mjsxMVApMSFj5iyEj9azHc486VcT0nv/ tkvbdPuEV6jt2RpiFdhg0cimnbkhUsr4oLNejH14+aJJIQz1duDT5RoQkJMPl3BAP+i5 D1EQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Uqn+XqvP; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-122371-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122371-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t18-20020a05622a149200b00432b42cf290si457618qtx.4.2024.03.27.20.17.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 20:17:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-122371-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Uqn+XqvP; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-122371-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122371-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D65651C244E2 for ; Thu, 28 Mar 2024 03:17:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0325B2B9D7; Thu, 28 Mar 2024 03:17:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Uqn+XqvP" Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9679517984; Thu, 28 Mar 2024 03:17:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711595828; cv=none; b=KtHVV4ARQ39qDC1VhHjzhKdf+ySEdO+fjRNt+YUaJPaWMlDtz5RMrncGsR1pg24a7avbMpUFtKLBRdTwkmPIwWIv9wdzekynhq6fMPupElCmm/ycQsP9B4I0jxH+6nKX71NtHd7jW2VJJYmFO0pz0FgZCNaxKz10Cya/vmjzA8g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711595828; c=relaxed/simple; bh=WZU75sEIJ9I4luZXGeKzBikSpTAyJfvx+j8qch27+Ug=; h=Message-ID:Date:MIME-Version:Subject:From:To:References: In-Reply-To:Content-Type; b=q0lM79XrCF+Auni3nesZvu1WzcA38Xa3Ff5/4o3Hivm9cfNZYb4I/UBnjiL0K+O6zJnPT3zvE4xNXPPynD/GdZn7ktXsDdhX5wTrqhbcaPktm30WFdjuurvg3zXYicC1yJtSlFdNCvKucUMFdA9vAnBwpZXJrYNPOUC96NmK00k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Uqn+XqvP; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1dddbe47ac1so10764605ad.1; Wed, 27 Mar 2024 20:17:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711595826; x=1712200626; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :to:from:subject:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=aIic1Gjzm4RHTASBVGxTr3rcD5mx/7GlOl+VtL8tSQM=; b=Uqn+XqvPoTnuzRYy4vtuzA/63C+Hi1+z4PbLCiUEXdkuYnBrD1MGw9KdeOS1WnXKae xSxDoZ1d+oATBsTTfnQScbv2CpU3bQN/g54HANSDDXMzWLodr67CGvRpbjMpc208J2BC FPk59/tSfd3GCANyVdXqTeDTl+mXvU6e1QcKgRTP+AMTRWwdWlMlh4gSun2DhOSCkGeO XCQdfczEriX/jibvlAde7ibFOglc/uJY38Cu9K81zGdvC+SISc5Br+nuJs9imIx/eV3+ Wo+PF2ivg20JTb9F2CKtOEIDEkyApi4WQWM5MIMN4ZF7DaXA3nBIpOhODhvbEG0B1HzX kNQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711595826; x=1712200626; h=content-transfer-encoding:in-reply-to:content-language:references :to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aIic1Gjzm4RHTASBVGxTr3rcD5mx/7GlOl+VtL8tSQM=; b=N6lGYJdGAQ0+cAHghOGSzRsfYQ9lt3pCdAf+K5M88uM/HykUia8FMybUsylQtaO86k FH01trbZnxuZ0nSaX3JXvLnSQESgytwNmQc/0ETSkd5kaqlQxEhABjP0ww3oPVeZyIPB o37i+wnbaTjVSvENlo7DiTD0bDfsj/K5qLKgpdk9jGz4Wc79w37gelARgp9IIIg6SNhO gwSkzxbxff+qSpeuzddM1kWj29xhoFsQpkqalElAhJmgfOhI5AaPe7p9HMx+8Ttz7ffD 7rHNKsb3QaUCmHFlwmc1f0YF/oS5HNfctpPBSH6Cuw5G7ibwSAkUkO7XneuMIcACUg6w bZqw== X-Forwarded-Encrypted: i=1; AJvYcCVLKM8edGyBEVwLqklNAYJal/qKmK8hnADXe0XQSQesoauT+rVFjTVWjjI/C1LV2v7+zv/H+n1kFNDSbjwn5TnvCwmH8wY+/qTPS0TOI9QC+r4Vo17wpqKWyFbtUqHo+4Ae2fXrMlnY7wI/Z26GjuCxqbQcbixLtacfMDUUgUTOU358ZIkhve6h X-Gm-Message-State: AOJu0YwBwuM+0eAp/9UadjhpVgbNXzDKeuZqnlr0/pPmYF9XumGXem/W rBi+MU2a4HDFIkMoBp4UORFLPs1QEC9D3NVruMccAl7Yr6pnMuIS X-Received: by 2002:a17:903:446:b0:1e0:cea:257e with SMTP id iw6-20020a170903044600b001e00cea257emr1359031plb.2.1711595825766; Wed, 27 Mar 2024 20:17:05 -0700 (PDT) Received: from ?IPV6:2001:b400:e355:7eb0:17c6:c47d:d4ee:f9e8? (2001-b400-e355-7eb0-17c6-c47d-d4ee-f9e8.emome-ip6.hinet.net. [2001:b400:e355:7eb0:17c6:c47d:d4ee:f9e8]) by smtp.gmail.com with ESMTPSA id y2-20020a17090264c200b001e20b3ccdc2sm303861pli.285.2024.03.27.20.17.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Mar 2024 20:17:05 -0700 (PDT) Message-ID: <9dca6a69-5fa2-4184-8e18-f5fa1c17f3c3@gmail.com> Date: Thu, 28 Mar 2024 11:17:01 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 4/4] drivers: watchdog: ast2500 and ast2600 support bootstatus From: PeterYin To: patrick@stwcx.xyz, Wim Van Sebroeck , Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Joel Stanley , Andrew Jeffery , linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20240328013303.3609385-1-peteryin.openbmc@gmail.com> <20240328013303.3609385-5-peteryin.openbmc@gmail.com> Content-Language: en-US In-Reply-To: <20240328013303.3609385-5-peteryin.openbmc@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Peter Yin 於 3/28/24 09:33 寫道: > Add WDIOF_EXTERN1 and WDIOF_CARDRESET bootstatus in ast2600 > > Regarding the AST2600 specification, the WDTn Timeout Status Register > (WDT10) has bit 1 reserved. Bit 1 of the status register indicates > on ast2500 if the boot was from the second boot source. > It does not indicate that the most recent reset was triggered by > the watchdog. The code should just be changed to set WDIOF_CARDRESET > if bit 0 of the status register is set. > > Include SCU register to veriy WDIOF_EXTERN1 in ast2600 SCU74 or > ast2500 SCU3C when bit1 is set. > > Signed-off-by: Peter Yin > --- > drivers/watchdog/aspeed_wdt.c | 34 ++++++++++++++++++++++++++++++---- > 1 file changed, 30 insertions(+), 4 deletions(-) > > diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c > index b4773a6aaf8c..c3c8098c035d 100644 > --- a/drivers/watchdog/aspeed_wdt.c > +++ b/drivers/watchdog/aspeed_wdt.c > @@ -11,10 +11,12 @@ > #include > #include > #include > +#include > #include > #include > #include > #include > +#include > #include > > static bool nowayout = WATCHDOG_NOWAYOUT; > @@ -82,6 +84,13 @@ MODULE_DEVICE_TABLE(of, aspeed_wdt_of_table); > #define WDT_RESET_MASK1 0x1c > #define WDT_RESET_MASK2 0x20 > > +/* > + * Ast2600 SCU74 bit1 is External reset flag > + * Ast2500 SCU3C bit1 is External reset flag > + */ > +#define AST2500_SYSTEM_RESET_EVENT 0x3C > +#define AST2600_SYSTEM_RESET_EVENT 0x74 > +#define EXTERN_RESET_FLAG BIT(1) > /* > * WDT_RESET_WIDTH controls the characteristics of the external pulse (if > * enabled), specifically: > @@ -330,6 +339,11 @@ static int aspeed_wdt_probe(struct platform_device *pdev) > if (IS_ERR(wdt->base)) > return PTR_ERR(wdt->base); > > + struct regmap *scu_base = syscon_regmap_lookup_by_phandle(dev->of_node, > + "aspeed,scu"); > + if (IS_ERR(scu_base)) > + return PTR_ERR(scu_base); > + > wdt->wdd.info = &aspeed_wdt_info; > > if (wdt->cfg->irq_mask) { > @@ -459,14 +473,26 @@ static int aspeed_wdt_probe(struct platform_device *pdev) > } > > status = readl(wdt->base + WDT_TIMEOUT_STATUS); > - if (status & WDT_TIMEOUT_STATUS_BOOT_SECONDARY) { > + if (status & WDT_TIMEOUT_STATUS_EVENT) > wdt->wdd.bootstatus = WDIOF_CARDRESET; > > - if (of_device_is_compatible(np, "aspeed,ast2400-wdt") || > - of_device_is_compatible(np, "aspeed,ast2500-wdt")) > - wdt->wdd.groups = bswitch_groups; > + if (of_device_is_compatible(np, "aspeed,ast2600-wdt")) { > + ret = regmap_read(scu_base, > + AST2600_SYSTEM_RESET_EVENT, > + &status); > + } else { > + ret = regmap_read(scu_base, > + AST2500_SYSTEM_RESET_EVENT, > + &status); > + wdt->wdd.groups = bswitch_groups; > } > > + /* > + * Reset cause by Extern Reset > + */ > + if (status & EXTERN_RESET_FLAG && !ret) > + wdt->wdd.bootstatus |= WDIOF_EXTERN1; > + > dev_set_drvdata(dev, wdt); > > return devm_watchdog_register_device(dev, &wdt->wdd); Please ignore this version, as I lost the definition for WDT_TIMEOUT_STATUS_EVENT. Thanks.