From patchwork Mon Sep 28 03:31:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 11802767 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 172C36CA for ; Mon, 28 Sep 2020 03:32:04 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D85C9239A1 for ; Mon, 28 Sep 2020 03:32:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iJbuNcx6"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TPnACvqk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D85C9239A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=4SH+zje7WnxI2dg49mTCdDUKUvZak58HXjg1A7FNptY=; b=iJbuNcx6O6n11xoCQPcAic7ge/ xbSCZo1iAXPQGdSFaKYMXVwI8DzGF531Ni2YbE5o1QDs31U6NSEKRt7qNumVXEUUV3MRlqUwTbfD2 mj+1M18fEhp5U//PeTibyCGia04aRSd8QjJUG1+f6x6300KRYwi5m2OoTaWegONRymdqtrTIAfTHu x7pjm/rPxMNfhDzTUNyQaHvGPNuc9M8GV79wswoCJJYJekPuZqDsbj0FPxFDupftK9311FNs5jFMO xHA1NiIFTlF0uduQSN2xU4zfXA7a1eOutDQXh1FqBi/UP5OvBNxgtF5lPB70M/JpyPKDWML3GtJRA SEsCMmUw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMjtD-0005xC-IV; Mon, 28 Sep 2020 03:31:47 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMjtB-0005wO-9t for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 03:31:46 +0000 Received: by mail-pg1-x544.google.com with SMTP id m34so7074836pgl.9 for ; Sun, 27 Sep 2020 20:31:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=N/EpoZQfstu+PtLpJpKosc5sDI8cNsjHAqKjuh09dpU=; b=TPnACvqkAuZKzWjdeh9nwNFuQlDeml7iNwfm7yiuUMD+fLPKDKiPV0d3OUxkF/4nwv YOJkoUckvY6C5DCSyiXEGg3vqREv67TrjRFIQE1BZBezidWKQ63ALmygtJhiX5bbMOeX IUrlHOhAv38J+fNOK5OpVSZth44dtAChBiCSU= 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:mime-version :content-transfer-encoding; bh=N/EpoZQfstu+PtLpJpKosc5sDI8cNsjHAqKjuh09dpU=; b=fJMOJWQCc/N6zst44U9N9szsSasrhO1e5Yo/pxex63E9WZFhpNZwRklQCc/SH+vaJN ceOCvIc/3stJxEoLv5KpVkIIxU4nK8syYpbTujnBSH/ik/8caF8Lf8mMRipFaEaWn1DY qIfW8xLXtjgEjiDDeNkXHroW1/3KJvCAVNRO/ZuHJpXOHBdRJVgCdQOSxYF30dxw84IM uB03rX8gpcRYjtDHKXB99JAIIQme+g7XrbOtrSWX16CgDQAIGX2sMWrO3s1QPUSMJpiy rhSLXAbqIhfQF5vOfGZhnqEsZRopP6wO5nV258zoFEHgod9VJ/68OgHTSfNb4UUbZtMb lptg== X-Gm-Message-State: AOAM531zFI5NWTLbqVGst3QgE3kMe0NY+WcDsUPeta95bcW8t4O2B2c9 lfzbOXr0yNeUZ22ThRKyKDVpTA== X-Google-Smtp-Source: ABdhPJzTJGzCeQ9lvnJeSH23CAuBjJ+xu7mtkCHRt4CPpwRzS5FlrwfY9s2qHfFca9qJY+TDrd/WXA== X-Received: by 2002:aa7:8249:0:b029:142:2501:34db with SMTP id e9-20020aa782490000b0290142250134dbmr9395510pfn.52.1601263900127; Sun, 27 Sep 2020 20:31:40 -0700 (PDT) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:7220:84ff:fe09:41dc]) by smtp.gmail.com with ESMTPSA id z8sm8201440pgr.70.2020.09.27.20.31.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2020 20:31:39 -0700 (PDT) From: Nicolas Boichat To: Matthias Brugger Subject: [PATCH v2] soc: mediatek: Check if power domains can be powered on at boot time Date: Mon, 28 Sep 2020 11:31:35 +0800 Message-Id: <20200928113107.v2.1.I5e6f8c262031d0451fe7241b744f4f3111c1ce71@changeid> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200927_233145_465925_8DAD6277 X-CRM114-Status: GOOD ( 16.08 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:544 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.6 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolas Boichat , Sascha Hauer , linux-kernel@vger.kernel.org, Daniel Kurtz , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In the error case, where a power domain cannot be powered on successfully at boot time (in mtk_register_power_domains), pm_genpd_init would still be called with is_off=false, and the system would later try to disable the power domain again, triggering warnings as disabled clocks are disabled again (and other potential issues). Also print a warning splat in that case, as this should never happen. Fixes: c84e358718a66f7 ("soc: Mediatek: Add SCPSYS power domain driver") Signed-off-by: Nicolas Boichat --- Changes in v2: - Add WARN_ON if the domain can't be powered on, to make it more obvious that this should not happen (there is already an error message). drivers/soc/mediatek/mtk-scpsys.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c index f669d3754627..ca75b14931ec 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -524,6 +524,7 @@ static void mtk_register_power_domains(struct platform_device *pdev, for (i = 0; i < num; i++) { struct scp_domain *scpd = &scp->domains[i]; struct generic_pm_domain *genpd = &scpd->genpd; + bool on; /* * Initially turn on all domains to make the domains usable @@ -531,9 +532,9 @@ static void mtk_register_power_domains(struct platform_device *pdev, * software. The unused domains will be switched off during * late_init time. */ - genpd->power_on(genpd); + on = !WARN_ON(genpd->power_on(genpd) < 0); - pm_genpd_init(genpd, NULL, false); + pm_genpd_init(genpd, NULL, !on); } /*