Received: by 10.213.65.68 with SMTP id h4csp1021692imn; Tue, 27 Mar 2018 13:10:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/G3p3UOv/V7rvR+WlkhQPUJYRKr1aJlQ7T6k7edzipYVMKzLTWgckN1dxyFhGxLv/pJWbf X-Received: by 10.99.165.22 with SMTP id n22mr477668pgf.53.1522181451046; Tue, 27 Mar 2018 13:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522181451; cv=none; d=google.com; s=arc-20160816; b=pd8Mh9Dtu/3I5Q8ggACfe9tqYaVWSL66d5E1n9+1luOxHI8XXu8/DyvmYq5f2EAeBZ rTy9d46nx43oxrERNPJ8i8GN0YLbHIEiZu5vZaNwmHVHmUMP9Sn9AKf4D79m5fpNxnXk lOgN2R4rhbFc7ntYvNaatUD89NWSQ6wWAyMw1QPsBY8JRSoFrPZCuU+8ky6w37xtC+i0 UTicX8AJlhSaLkIEoViro9pI209D2sfPKGJ4nKT6+B9ZV1nJhy4GI5Im7VYb6u+oEWgh HCcHFFxwYEJH9FQ8DctF9H9PaJwInLQxqFtmlAKhWgvXZqocMwD8rWNgJ7T57dWnfFwv EFTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=sHBBvckERwBV3aTMnqcFAM4e880K2aW3VvDH4KU/IYw=; b=WjDNUY6UNpgVp1QIlV+V+g1+j+3fpx2MxAzAu0AgoNwNSybl++iz/Qalm4Sf8sxXUD WvvTDlh+B2PXtnb+E5q4Vu8XieE6pB0EE/h1FtVfc01LFYFbUD8j4CybqFPMvG/1AiXa k4NFVmH5FypssP9fJ4CrWs8uuqRL8jq7s/Fu1bic+ornIOV5DkATWQyqONhnohFnqcvL W6KRJYinI2f2PBZMxqF7MakNsI18TRhgnj4rDZ8AZoQIm/YJUA5iQhIJlDKHIUdGN4c7 QVbT9O+DBbNOAQs3KlFKZahvNgO9ow9FpgeI13z0fzoczblZtVKThSGjDtBCJtVIv7eH 0GHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l84si1510780pfj.344.2018.03.27.13.10.36; Tue, 27 Mar 2018 13:10:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751739AbeC0UJi (ORCPT + 99 others); Tue, 27 Mar 2018 16:09:38 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:52368 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751375AbeC0UJf (ORCPT ); Tue, 27 Mar 2018 16:09:35 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2RK4xPH002975 for ; Tue, 27 Mar 2018 16:09:35 -0400 Received: from e16.ny.us.ibm.com (e16.ny.us.ibm.com [129.33.205.206]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gytjvdqh7-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 27 Mar 2018 16:09:34 -0400 Received: from localhost by e16.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 27 Mar 2018 16:09:32 -0400 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e16.ny.us.ibm.com (146.89.104.203) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 27 Mar 2018 16:09:30 -0400 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2RK9UWO57802754; Tue, 27 Mar 2018 20:09:30 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 79332AC043; Tue, 27 Mar 2018 16:10:49 -0400 (EDT) Received: from talon7.ibm.com (unknown [9.41.241.240]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP id E3B72AC040; Tue, 27 Mar 2018 16:10:48 -0400 (EDT) From: Eddie James To: linux-watchdog@vger.kernel.org Cc: openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, wim@linux-watchdog.org, linux@roeck-us.net, joel@jms.id.au, Eddie James Subject: [PATCH v2] aspeed: watchdog: Set bootstatus during probe Date: Tue, 27 Mar 2018 15:09:27 -0500 X-Mailer: git-send-email 1.8.3.1 X-TM-AS-GCONF: 00 x-cbid: 18032720-0024-0000-0000-0000033CBEFB X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008754; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000255; SDB=6.01009292; UDB=6.00514137; IPR=6.00788574; MB=3.00020274; MTD=3.00000008; XFM=3.00000015; UTC=2018-03-27 20:09:32 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18032720-0025-0000-0000-00004776CB39 Message-Id: <1522181367-11231-1-git-send-email-eajames@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-27_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803270201 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Check the aspeed timeout status register to see if the system has booted from the secondary boot source. If so, set the watchdog device bootstatus flag for "Card previously reset the CPU." Signed-off-by: Eddie James --- Changes since v1: - use bootstatus instead of status - use WDIOF_CARDRESET instead of raw register contents drivers/watchdog/aspeed_wdt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c index a5b8eb2..1abe4d0 100644 --- a/drivers/watchdog/aspeed_wdt.c +++ b/drivers/watchdog/aspeed_wdt.c @@ -55,6 +55,8 @@ struct aspeed_wdt_config { #define WDT_CTRL_WDT_INTR BIT(2) #define WDT_CTRL_RESET_SYSTEM BIT(1) #define WDT_CTRL_ENABLE BIT(0) +#define WDT_TIMEOUT_STATUS 0x10 +#define WDT_TIMEOUT_STATUS_BOOT_SECONDARY BIT(1) /* * WDT_RESET_WIDTH controls the characteristics of the external pulse (if @@ -192,6 +194,7 @@ static int aspeed_wdt_probe(struct platform_device *pdev) struct device_node *np; const char *reset_type; u32 duration; + u32 status; int ret; wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); @@ -307,6 +310,10 @@ static int aspeed_wdt_probe(struct platform_device *pdev) writel(duration - 1, wdt->base + WDT_RESET_WIDTH); } + status = readl(wdt->base + WDT_TIMEOUT_STATUS); + if (status & WDT_TIMEOUT_STATUS_BOOT_SECONDARY) + wdt->wdd.bootstatus = WDIOF_CARDRESET; + ret = devm_watchdog_register_device(&pdev->dev, &wdt->wdd); if (ret) { dev_err(&pdev->dev, "failed to register\n"); -- 1.8.3.1