From patchwork Thu Mar 14 06:57:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PeterYin X-Patchwork-Id: 13592134 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA344C5475B for ; Thu, 14 Mar 2024 06:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=3QO7uKnMb19VAA63NUUpTACU2njGz5Z/8OkMvmCwTR8=; b=tNr329XU4YRs/c k9TFfvtXlOFEOOACxrYqzrNpSwM/uPdKHeIafciv99/GBrm2bx2Zcorw15qYVpc4dMNJ+HLjSizAn OhFSEpXbeC+CHNyC6OC+qnf9rodXAjCuj+bZAMCYpNnlM+1BvMbFrIlfc6uQZo1DEQvtukOePefOi EQlGFo0r/PCPu3TK6xrDu5wiOhR5yZgoxUCHKFS/rhXyFWNWyRo+aD7R8sxAu3Tgovr6GJthImotf wWw5XVgvRDXBy4q9CU5i6U0Fy6kTP/w6tpo9WD6UZrLY7Pn4p4PLllUjq9w2kIrlYrikYVPFnOcpp DDFze7q/3n6h+29yzEfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkf2J-0000000DHVb-28M3; Thu, 14 Mar 2024 06:57:55 +0000 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkf2G-0000000DHTi-0ra7 for linux-arm-kernel@lists.infradead.org; Thu, 14 Mar 2024 06:57:53 +0000 Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3c2376cc5ccso389613b6e.0 for ; Wed, 13 Mar 2024 23:57:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710399469; x=1711004269; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=W3XCzn158oeVoQis+pbpqZUpajHhpzGWGyFPRII2fyI=; b=bIEN0juGFwQbM3jw1GyCiPl/EK/ahX1r4Q4fiE+ah5d+xrXZ7AsLtatT0ROyiDAmge DscXJ+RjHOMG7Sn7vSuxbHXUAuAbhH4+GJEcjqWgBnmLjbd9AG9JHVftHfftNhuRVdWy RbmYZmUXUjT1ZY5kFaQPqdjvXfoCDgxAvnhI56wLytolQpQbgp0Myaly2Zv/E9zArowb EKybounhZRTE/inoBYG5BdFTTkn1tP6I4+xWbqN6N59EV0LSyUQJeTn2yGZ7HoPWCls9 0G9svpPgJ+lDTV+1kvn7X18O7DsRB6FXj1Qj3GE14NoqntCqNn65D3qSdnLm0NqkkP3X cOIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710399469; x=1711004269; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=W3XCzn158oeVoQis+pbpqZUpajHhpzGWGyFPRII2fyI=; b=YYyobJ4lTFGI5xbRtj+rbBRm8L3hS6+gHQ7EctaIlP7XA1V0uRAQpR5WyVZFNCT/Xj CZktz4V+EeYHTqmWaxKOCvr8LgbLkmGAbo46qJU1Ld3XBB8lI6J7Jc8q/zHEykNLMQWR CemA4fDSIfu5j+G/uw6Ycw1yjscWWCkm8k+GNYZctRIcZsdEegDMVI1UDxudLZLquCbz c8iptXyF7LObCDWPYPqkcLKfyQZ1YJOjBFBVnPGHXROXGCoAbRtfE/Xa9elmNn0XII5w 54Va/DoqRTi9ciFecMS6CWFHtVoboJPxt/cGev3m75XTimxptp//V7YF+vH5ddq7wEHy ep8w== X-Forwarded-Encrypted: i=1; AJvYcCVrVBlrrcpG3VYwcL9Up469JIwxKJkTBz0I/gDCKjDlQAczI4s+t7Hr0Ni4Y1DIqyAykkOclcjJJzkqqzfHD9fif9Sn9mqGfLDu4Py1/Jbec4VrsXU= X-Gm-Message-State: AOJu0Yw2QP+Qkamrelzs4LjMF/1n+cjXfiv4IIi0irj3qRj7BNaBxqKP LD5i1NFRF5vcLcAcLS3fSsEVXuibbnDhMIVKqJv4CsG9axiOZuPp47s/5UnO X-Google-Smtp-Source: AGHT+IEGDBPn5h1CV4s3eWeXANQ5Zk+Wc9Bse4rPgbtE2gjJ8e8WQd/zlGsODb+VhYWDWnMuXDgUpg== X-Received: by 2002:a05:6808:399b:b0:3c2:36dd:a368 with SMTP id gq27-20020a056808399b00b003c236dda368mr980223oib.10.1710399468981; Wed, 13 Mar 2024 23:57:48 -0700 (PDT) Received: from localhost.localdomain (2001-b400-e359-9e59-9ebb-2f4b-4781-fe3b.emome-ip6.hinet.net. [2001:b400:e359:9e59:9ebb:2f4b:4781:fe3b]) by smtp.gmail.com with ESMTPSA id a5-20020aa78e85000000b006e6857da474sm733847pfr.178.2024.03.13.23.57.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 23:57:48 -0700 (PDT) From: Peter Yin To: patrick@stwcx.xyz, Wim Van Sebroeck , Guenter Roeck , Joel Stanley , Andrew Jeffery , linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v1] drivers: watchdog: ast2600 support bootstatus Date: Thu, 14 Mar 2024 14:57:44 +0800 Message-Id: <20240314065744.1182701-1-peteryin.openbmc@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240313_235752_266101_78FE3FD2 X-CRM114-Status: GOOD ( 13.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add WDIOF_EXTERN1 bootstatus in ast2600 Signed-off-by: Peter Yin --- Change log: v1 - Patch 0001 - Add WDIOF_EXTERN1 bootstatus --- drivers/watchdog/aspeed_wdt.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c index b4773a6aaf8c..8adadd394be6 100644 --- a/drivers/watchdog/aspeed_wdt.c +++ b/drivers/watchdog/aspeed_wdt.c @@ -81,6 +81,7 @@ MODULE_DEVICE_TABLE(of, aspeed_wdt_of_table); #define WDT_CLEAR_TIMEOUT_AND_BOOT_CODE_SELECTION BIT(0) #define WDT_RESET_MASK1 0x1c #define WDT_RESET_MASK2 0x20 +#define WDT_EVENT_COUNTER_MASK (0xFFF << 8) /* * WDT_RESET_WIDTH controls the characteristics of the external pulse (if @@ -459,8 +460,17 @@ static int aspeed_wdt_probe(struct platform_device *pdev) } status = readl(wdt->base + WDT_TIMEOUT_STATUS); - if (status & WDT_TIMEOUT_STATUS_BOOT_SECONDARY) { - wdt->wdd.bootstatus = WDIOF_CARDRESET; + + if (of_device_is_compatible(np, "aspeed,ast2600-wdt")) { + if (status & WDT_EVENT_COUNTER_MASK) { + /* + * Reset cause by WatchDog + */ + wdt->wdd.bootstatus |= WDIOF_EXTERN1; + } + } else { + if (status & WDT_TIMEOUT_STATUS_BOOT_SECONDARY) + wdt->wdd.bootstatus = WDIOF_CARDRESET; if (of_device_is_compatible(np, "aspeed,ast2400-wdt") || of_device_is_compatible(np, "aspeed,ast2500-wdt"))