From patchwork Sun Jun 17 22:58:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 138841 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp3314970lji; Sun, 17 Jun 2018 16:00:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJQwfmXUutURQkYv1I12fA7ukJC7gPnfBateVUmOHIIkBR/d2/MYsfw61J9vhvIIg0IwlsI X-Received: by 2002:a65:630b:: with SMTP id g11-v6mr8911431pgv.303.1529276430157; Sun, 17 Jun 2018 16:00:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529276430; cv=none; d=google.com; s=arc-20160816; b=yaOt3Hict19K3u+aNkqYU56iI6MmX8xIx969Scs866N0FjjoJnsPQiMVPSS+XF5VHN 4/K81JHsvpqtSMC+H2/CQcRTHqxw82haw2nYneiYfBoz8RcH6xTX5fVv43MncB4uyn+n Zz7gnVLuSoFFrJ/nfNYZ/+pFBxDc8LW5zFb1pV09EPXw7qDI/7OhanIzUtIqDGQyWlrP EBRqjhBh8bG3sDk6adXWTRZn0c/Oi0NnlKeYWuxBHiqjD4i2Qch9BWpyEx1jLuzADEuc GrCfGwShWtFvJmrrzoONoHjVeY69/7O8OC9aBcCIoluVzjnDsE5tSP2fZnYG5HOkheJr uNjQ== 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 :dkim-signature:arc-authentication-results; bh=j8fa9WzPF4V97t4b5ox4os68pI9WR7WZPGniZu8taEw=; b=iWRuPJ/c6y0rV39SAf8Dje1jMRvKkw0YjDtfFNB2ZPj32PQ79ecDjekO9E8LzlmOLW CeiFZh12GNY4RoJwXvvITjGxEy2YS5qblkN6Heu4WNIO9D2C4eSXU7MCMa4L43LTUQOn DsuqubyLg94fby5NtU/oUK3VV0hndNENzCdZN2cBC/UMFk+ciAbvT9we0rHv6Lsq7pJD 96QhC0x04SFzfkjtDhXoLG4Y+kt3nhcKl5t13+mI4dzeqhtmfGKARikxuWFo64qJPSto Vsmi9Sgtw3ss0csLbzYRLJAAssRmQg2NrRNJG8ne2SAf5r1LM2ZdsJHAct1sNjxHT1Nb C9vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a+SbKTRC; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f13-v6si10651317pgv.374.2018.06.17.16.00.29; Sun, 17 Jun 2018 16:00:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a+SbKTRC; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754269AbeFQXA2 (ORCPT + 10 others); Sun, 17 Jun 2018 19:00:28 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:39854 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754259AbeFQXA2 (ORCPT ); Sun, 17 Jun 2018 19:00:28 -0400 Received: by mail-lf0-f66.google.com with SMTP id t2-v6so15451406lfd.6 for ; Sun, 17 Jun 2018 16:00:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=j8fa9WzPF4V97t4b5ox4os68pI9WR7WZPGniZu8taEw=; b=a+SbKTRCvEmVD9krBXUkP6mzezLV4O/3a69dpY869sUVCs11K8+hhimDTJE5XkZWUG 0c4lcMraaIprKTZDwX1sGQgOlRU+wH9UOU2CMOKKrdqIDyC7dPj9OdUp0eAIAfnTHNes EgEc8ozKmRxr5BdpbWFknwjUvwIavFFyb2mok= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=j8fa9WzPF4V97t4b5ox4os68pI9WR7WZPGniZu8taEw=; b=PW2F8h9GppkqQ5pmm1S6DhI3hSji65MCY6GUSCwSHCjsZkEmlouU35FmC7nBApIt3x Kyb8cZBS83egZtiCVt93LX2Wap7o1yK/ovqaSBx+9VqxmRsrQdiG63Z8BsEtsEaPAgZa zGJzzm01Ep+M06IU9h/lNYbju9PQn0a5vhBeuRlM5e3ilpT7h4ciExKGDYnpNuhhkjIC ezYfn2EYJzy5olyrrcBBdLEfj2XSgchz/4GuR2Dt7XqYCM4+kCyGrLiCITGsLdQbWlFH F6CNNPevy8KM41YH+8eLGEkI3UziWaY7Uct6RQDw9MH6tLJPPE8k66RpjDUFUu0YyUpa 2M2A== X-Gm-Message-State: APt69E1CaaN0/Mi85ER0VE+geJyMOL7756MgGVyzY8ltoGEGVDSItb8Z vSFbc5FEHqlK/VQHRzVQ2UTDjw== X-Received: by 2002:a2e:4811:: with SMTP id v17-v6mr6240588lja.39.1529276426766; Sun, 17 Jun 2018 16:00:26 -0700 (PDT) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id 66-v6sm2507026lfy.53.2018.06.17.16.00.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Jun 2018 16:00:25 -0700 (PDT) From: Linus Walleij To: Sebastian Reichel Cc: linux-pm@vger.kernel.org, Hans Ulli Kroll , Florian Fainelli , Linus Walleij Subject: [PATCH] power: gemini-poweroff: Avoid more spurious poweroffs Date: Mon, 18 Jun 2018 00:58:19 +0200 Message-Id: <20180617225819.32586-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Even after the previous fix I have experienced more spurious poweroffs on the gemini SoC. After this fix it finally seems to go away. Fixes: f7a388d6cd1c ("power: reset: Add a driver for the Gemini poweroff") Signed-off-by: Linus Walleij --- drivers/power/reset/gemini-poweroff.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/power/reset/gemini-poweroff.c b/drivers/power/reset/gemini-poweroff.c index 2ac291af1265..90e35c07240a 100644 --- a/drivers/power/reset/gemini-poweroff.c +++ b/drivers/power/reset/gemini-poweroff.c @@ -130,7 +130,17 @@ static int gemini_poweroff_probe(struct platform_device *pdev) val |= GEMINI_CTRL_ENABLE; writel(val, gpw->base + GEMINI_PWC_CTRLREG); - /* Now that the state machine is active, clear the IRQ */ + /* Clear the IRQ */ + val = readl(gpw->base + GEMINI_PWC_CTRLREG); + val |= GEMINI_CTRL_IRQ_CLR; + writel(val, gpw->base + GEMINI_PWC_CTRLREG); + + /* Wait for this to clear */ + val = readl(gpw->base + GEMINI_PWC_STATREG); + while (val & 0x70U) + val = readl(gpw->base + GEMINI_PWC_STATREG); + + /* Clear the IRQ again */ val = readl(gpw->base + GEMINI_PWC_CTRLREG); val |= GEMINI_CTRL_IRQ_CLR; writel(val, gpw->base + GEMINI_PWC_CTRLREG);