From patchwork Tue Oct 1 16:59:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13818559 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 F14F6CEACEA for ; Tue, 1 Oct 2024 17:03:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZK0basgN0caXy6pJhRrEiTQEkdwQudaB+HfTNGByWoo=; b=qWwC58Zit/VVo7qKijsn9Vc1sX Iv4KNGMnQZK9X/OjE2gKrzLUGLBNkZqZ68QWauacYB4vJwcDnCWHy0i58cLp4WIqre3sXs0A4wSgz 7aznkx40g68oNaThPYuGoslcqd1GirSLZ47gcQioHtwI8HwG2/hUrmltejjUCjTD9h4+N4XbY8vjn QGIqjVhsBAbikhlZEazRDyHyo0TOZ3M8NsH+fD0NWty9VWlnQaQSQhVQExIvVovbsVokNQr52vZqR 73S3mKuvp265tugo7BK9ixD3mHBpmKQQzM/VK/MaFZBYX9rYqxVJLN6GqPzfbOXPgKrPRohprO0KG gLh26aeQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svgHH-00000003cOW-20cP; Tue, 01 Oct 2024 17:03:11 +0000 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svgEs-00000003bpD-1LdD for linux-arm-kernel@lists.infradead.org; Tue, 01 Oct 2024 17:00:43 +0000 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-71dae4fc4c9so1629298b3a.0 for ; Tue, 01 Oct 2024 10:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727802041; x=1728406841; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZK0basgN0caXy6pJhRrEiTQEkdwQudaB+HfTNGByWoo=; b=FnYYP6Q79wMWy6GJwpXWCduJ49YGGiodMf1SeJeShZT56L4Pwj/qKdI8INv+ly9fcV w5iuiLuY92pobtYftCREm3//UYO4r/9ttBuqDyoAxpTZZjI4meCa9e5Lwm1RcPHzLt9V y5wT4l6sjDrwn9qRtiDPi2ltbyJv4jqm7qBmAiypkdjAuzuzE+RqJk9urW36k9aKFvV0 jHfGOs/KtVawLjz0z2uXRbewQuGKjo71zfMzs37jdB+HoawqoWotszgl3A1/OJFieBRd qCzqBmvC3e7cV7nqPpZHcrWkUc64UyUYlhGfq7I2/66/QxeWk8hAPgJkIhIYZX7FeP21 VU9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727802041; x=1728406841; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZK0basgN0caXy6pJhRrEiTQEkdwQudaB+HfTNGByWoo=; b=NgHVbW7EroVis2eViQlbGF95l8hjp5Bm6AIlXdTyZNz8AN+udbtpUtDNjiFJMk97ri ngxIpA+rAJyurzhbsiAr4MkIOCTFypT5V0rJvdiPAn/LeJhm6R6C62AYsCjwjkxJAxMg dTWG/7Y6d6OmS0MwLjNfqVUUOOGQQQfq0zij8cfL9xLMZu4bZ+b3Lcb3VlGgrhQq0uDN X/AZnI4AXwmAg8It9FlxcOb9ujnwfHaVPIENeXTWwOQFgWI21DnTKiHoDr2sDmSpTeHU IyfVnPm6oSHj2vt3Mmu8ED+bfr65IMCLcQuRnkAEbwKNzhp9KrtCydUDup2lwIh9v0Zy lDlg== X-Forwarded-Encrypted: i=1; AJvYcCXLqj+007tLFEvGMp2WMKEeU49qAK7edFpahBzb2T5+aL/y+UWM0Ak+DPnBGTX1uhyzrLjreaUPVGzqqyTua0H/@lists.infradead.org X-Gm-Message-State: AOJu0YzFz0kWjX9LP9HKu3EUlUgAY//ti5SUHr4PfkI7TWTJ5s0iD8nK MV9NZC7ziFPgTXmLHmIk90uwOLQE0skQjzRxKuKx98+/zI/sPq4q X-Google-Smtp-Source: AGHT+IGSi2gxdtKct+45b4m5zF0ZBj7/3pYWbnN++bcS5SKmJSk64eiCV8YmteZG9KCnAGLvlJKFMg== X-Received: by 2002:a05:6a00:3997:b0:718:dd89:a1db with SMTP id d2e1a72fcca58-71dc5d6f588mr412601b3a.28.1727802040771; Tue, 01 Oct 2024 10:00:40 -0700 (PDT) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-71b2651623asm8234054b3a.120.2024.10.01.10.00.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 10:00:40 -0700 (PDT) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , Wim Van Sebroeck , Guenter Roeck , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Nick Chan , Arnd Bergmann Subject: [PATCH v2 1/2] watchdog: apple: Actually flush writes after requesting watchdog restart Date: Wed, 2 Oct 2024 00:59:51 +0800 Message-ID: <20241001170018.20139-2-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241001170018.20139-1-towinchenmi@gmail.com> References: <20241001170018.20139-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241001_100042_381143_D2D5108C X-CRM114-Status: GOOD ( 14.97 ) 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 Although there is an existing code comment about flushing the writes, writes were not actually being flushed. Actually flush the writes by changing readl_relaxed() to readl(). Fixes: 4ed224aeaf661 ("watchdog: Add Apple SoC watchdog driver") Suggested-by: Arnd Bergmann Signed-off-by: Nick Chan Reviewed-by: Guenter Roeck --- drivers/watchdog/apple_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/watchdog/apple_wdt.c b/drivers/watchdog/apple_wdt.c index d4f739932f0b..62dabf223d90 100644 --- a/drivers/watchdog/apple_wdt.c +++ b/drivers/watchdog/apple_wdt.c @@ -130,7 +130,7 @@ static int apple_wdt_restart(struct watchdog_device *wdd, unsigned long mode, * can take up to ~20-25ms until the SoC is actually reset. Just wait * 50ms here to be safe. */ - (void)readl_relaxed(wdt->regs + APPLE_WDT_WD1_CUR_TIME); + (void)readl(wdt->regs + APPLE_WDT_WD1_CUR_TIME); mdelay(50); return 0; From patchwork Tue Oct 1 16:59:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13818560 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 8A716CEACED for ; Tue, 1 Oct 2024 17:04:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tgNguRTnjUZaIg7uPr+xWg/1h1wY5swm1wRQT6JqmIA=; b=LzVVFWhpze4KHxW8mHJNx1gNS5 f1ntBdfKJ/Ro+sD4zSMV4nk0LQq3DFRKMQY1EaoYmGeS41coHND63lXkvZk08p1DsIR34NOYtfkjf 0rgg6nOlUPY4j+TXBrg/qtK0qnzXTmPfdi2Css6WSembm6wRMExKwXfxfonotAVgM678iFvkWgG3K QGSsjmco8lf5bGb6v1QwVZgXzd+JQfEAk1wVROF7StiYHM98WTTR0Co5MNf732oHY1E/NEY1/2la2 01bd5dZJx8sH8f4LeYxDe30PdRlVLgkd42y1aCNFuJG4H5uO+5IHIreGgp9vOEwwC0fgQ+q+i39+J I+lS2nPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svgIS-00000003cbd-1hdN; Tue, 01 Oct 2024 17:04:24 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svgEu-00000003bpg-1v5X for linux-arm-kernel@lists.infradead.org; Tue, 01 Oct 2024 17:00:45 +0000 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-7e6ba3f93fdso3662978a12.1 for ; Tue, 01 Oct 2024 10:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727802044; x=1728406844; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tgNguRTnjUZaIg7uPr+xWg/1h1wY5swm1wRQT6JqmIA=; b=EMbN0/xA6jZm5Oooc4FMhMD/hP8+H7GIyIxtMF8Ms99QHjdBQGGF3XDk2bvVE+13Y2 CKDmDt79t6wi574kF2LQIrvQdeSefM5eQ6nTBtJ6nKLb7RS7NZ7Hzo98HpH7Yg9fpuKh Gc1xqJE/45CEgSislAX8uWsR9cX0JwUkGR5VPq85KX6Dbx9DtWTV7I2Uj+KrytgDTMuD euQ8GKFzyjXQKFWlCHgue6Ft7oUy+e0S6YZeyS9mcl2PMvMDrQa3ouqUC1lL9/SM84Zz reEWwf3ZJpSuWxyOvs0KSJbsr4jVNRp2rQeEFXbX+0O0NA58pF1dNbUQwJMyZ6H2vQBK 4xKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727802044; x=1728406844; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tgNguRTnjUZaIg7uPr+xWg/1h1wY5swm1wRQT6JqmIA=; b=dOv/XaZxCyS91tqtyGYu816ruaU5FaP7DUKq6BAv56e/K9VmxMT/OfNFrqj9doUcOs Pyw58EGRYNmafmzH+swjd+K+4RM1L5hzaindyCex0um0J4pUvSrXZUZH/o+CIkje2TJj QtZjA+xXbmZTMKDo3Pgpt5qGSiafYEPCsPd6JPAkYPBSALbteyfVYCLnFsF7oMTZlRS3 xQmlOQ0pwZUcB2gfujOQoBmKQDeHVT5+kUXBvdHyLQfdCe+JcUfRVp+59nZ1xhpfYZ61 kybOVgHH00K2d6s0O0J593yFbrI1Fav40YhQflW1OpRoDDhszSdt70IGPNqG9k29q6UF kbmQ== X-Forwarded-Encrypted: i=1; AJvYcCU1tphvuPgkRZ6NcLuIKIOoVug6nLBSGUkwf840t3zz1gcuNVaKEnAxo1TnpjPwSStSGF91zfbAuEOPqahZluDy@lists.infradead.org X-Gm-Message-State: AOJu0YyV8Gum7D5Gpm7VU6iepq3r7x8zvPpBLztp5V1yrJvR8ZO75rhs ADGPgW5RHmQCq4uJgOLLQR7jmx7t51xNHuoRdWi7YrQenj1+PdcGNv6Ag9sg X-Google-Smtp-Source: AGHT+IF+p9R1d1pnL6XCGLnTwwX3rwlZj+UtFNg6vndTxf9iMVY8yDmwifeIU5ozJ1PoZ+VX4QFIvw== X-Received: by 2002:a05:6a21:1304:b0:1d2:bbd9:4646 with SMTP id adf61e73a8af0-1d5e2dd9d54mr508335637.38.1727802043346; Tue, 01 Oct 2024 10:00:43 -0700 (PDT) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-71b2651623asm8234054b3a.120.2024.10.01.10.00.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 10:00:42 -0700 (PDT) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , Wim Van Sebroeck , Guenter Roeck , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Nick Chan Subject: [PATCH v2 2/2] watchdog: apple: Increase reset delay to 150ms Date: Wed, 2 Oct 2024 00:59:52 +0800 Message-ID: <20241001170018.20139-3-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241001170018.20139-1-towinchenmi@gmail.com> References: <20241001170018.20139-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241001_100044_515396_47BF145D X-CRM114-Status: GOOD ( 14.54 ) 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 The Apple A8X SoC seems to be slowest at resetting, taking up to around 125ms to reset. Wait 150ms to be safe here. Reviewed-by: Sven Peter Reviewed-by: Guenter Roeck Signed-off-by: Nick Chan --- drivers/watchdog/apple_wdt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/watchdog/apple_wdt.c b/drivers/watchdog/apple_wdt.c index 62dabf223d90..95d9e37df41c 100644 --- a/drivers/watchdog/apple_wdt.c +++ b/drivers/watchdog/apple_wdt.c @@ -127,11 +127,11 @@ static int apple_wdt_restart(struct watchdog_device *wdd, unsigned long mode, /* * Flush writes and then wait for the SoC to reset. Even though the * reset is queued almost immediately experiments have shown that it - * can take up to ~20-25ms until the SoC is actually reset. Just wait - * 50ms here to be safe. + * can take up to ~120-125ms until the SoC is actually reset. Just + * wait 150ms here to be safe. */ (void)readl(wdt->regs + APPLE_WDT_WD1_CUR_TIME); - mdelay(50); + mdelay(150); return 0; }