Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp848347rwi; Wed, 19 Oct 2022 03:51:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vsN/xzmTzIqYDkjvwyuCkOsB1Ahsx3lLHhi6SPwaLTZ8F1FFVTOKxD4ZwVCtNWJfVhoH6 X-Received: by 2002:a05:6402:3890:b0:451:ef52:8f9e with SMTP id fd16-20020a056402389000b00451ef528f9emr6838165edb.107.1666176671017; Wed, 19 Oct 2022 03:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176671; cv=none; d=google.com; s=arc-20160816; b=ujAakrKtrL6ttLHw7LijcVILo8RmpHPYWDODo12qg0PC4DAIDVLq6AsnL5R8k0NLaG 6Kt1o+0Gd2KW0xjBYDdJmTIM49LRWqbo7DcjvXtjqoKYHGG38QScdrn2QxwELilzKMjO PFlKeQyzcwDvZS3wKuZ+sKjOeQHm+VN3U2IyNPWnJhqdpCyxcS2n+0bIALdtBTZy9mbu RXvxPaP3UcymAEutJvUVLpCvKCVdlOQuFOLGaqK5o88D1uJ87YzGw2Eo6QldrsaBQGF+ g3OIuUhRRtHx+69pJx0Foa/eNRwVWpBV2snPWLoBNPwm6MnfiPNYch9k96MMy8pwKUG4 Cfjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6C8DjW/IvvYcxe33M7PUmphdEF6lhzM+yYi9FV9hmhI=; b=VjhPJ+cdz1UZ8oNQr/bS46DPtu33edySfvylaaMGap1AI4a55iddJEQjRLE/OQNr5s 61aoeEy/DQKL1ThldAxK7xq5dIO8enxM+9UWSxzZLk4nJ3XRQjw+7GQrvR+BQr1OnX8f yHlu+vteZRhNQS+f/C1L75EKdiBvIcq7xA6pjpKpEXUP5zA6nrTFgWOCjTYoTGBLFM6g OFSYaC7YjevqLmTo7c9HcxeicMAS9jKkjIYTJ/UCHqlxQqIsZPZZw2BshQ9uzQ/FLBbG rq1G/0iCHfwXO2OaJ1USQdjB01D1bdWvrfsih1zrhQF7p7OoeNIKqbLj7M9BOAzyCZKN jWAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D6ePb1g2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa44-20020a17090786ac00b0078a10c159b4si14138550ejc.290.2022.10.19.03.50.44; Wed, 19 Oct 2022 03:51:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D6ePb1g2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234237AbiJSKsY (ORCPT + 99 others); Wed, 19 Oct 2022 06:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232308AbiJSKqe (ORCPT ); Wed, 19 Oct 2022 06:46:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A44CDD887; Wed, 19 Oct 2022 03:21:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A9F3BB8244D; Wed, 19 Oct 2022 09:00:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23F58C433D6; Wed, 19 Oct 2022 09:00:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170035; bh=K97j+I7L9AaRvIOBnMiDgOiubOBBSINEGKUsqgcayO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D6ePb1g2+4lEMC8gQt5NON75X8E7AJO7DpIVeUff/TOuRF2f9lg7GM7LKI0KjtT7E beM2pUaer7aCW0E+t0SqucA/4mwsGpmMYHAViV8o86lyE8e0FSH0S9C1ucI8acd1+5 U0aGbcek5xwS2I08unJZRsPdemuVZurFMnZwUXbE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Matthias Brugger , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 502/862] clk: mediatek: mt8195-infra_ao: Set pwrmcu clocks as critical Date: Wed, 19 Oct 2022 10:29:49 +0200 Message-Id: <20221019083312.178174715@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: AngeloGioacchino Del Regno [ Upstream commit 3f10f49cd9f8ab6471639d4ca2c6db9451121779 ] The pwrmcu is responsible for power management and idle states in SSPM: on older SoCs this was managed in Linux drivers like sspm/mcupm/eemgpu but, at least on MT8195, this functionality was transferred to the ATF firmware. For this reason, turning off the pwrmcu related clocks from the kernel will lead to unability to resume the platform after suspend and other currently unknown PM related side-effects. Set the PWRMCU and PWRMCU_BUS_H clocks as critical to prevent the kernel from turning them off, fixing the aforementioned issue. Fixes: e2edf59dec0b ("clk: mediatek: Add MT8195 infrastructure clock support") Signed-off-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220719093316.37253-1-angelogioacchino.delregno@collabora.com Reviewed-by: Matthias Brugger Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mt8195-infra_ao.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt8195-infra_ao.c b/drivers/clk/mediatek/clk-mt8195-infra_ao.c index 97657f255618..832160c92996 100644 --- a/drivers/clk/mediatek/clk-mt8195-infra_ao.c +++ b/drivers/clk/mediatek/clk-mt8195-infra_ao.c @@ -55,8 +55,12 @@ static const struct mtk_gate_regs infra_ao4_cg_regs = { #define GATE_INFRA_AO1(_id, _name, _parent, _shift) \ GATE_INFRA_AO1_FLAGS(_id, _name, _parent, _shift, 0) +#define GATE_INFRA_AO2_FLAGS(_id, _name, _parent, _shift, _flag) \ + GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao2_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, _flag) + #define GATE_INFRA_AO2(_id, _name, _parent, _shift) \ - GATE_MTK(_id, _name, _parent, &infra_ao2_cg_regs, _shift, &mtk_clk_gate_ops_setclr) + GATE_INFRA_AO2_FLAGS(_id, _name, _parent, _shift, 0) #define GATE_INFRA_AO3_FLAGS(_id, _name, _parent, _shift, _flag) \ GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao3_cg_regs, _shift, \ @@ -136,8 +140,11 @@ static const struct mtk_gate infra_ao_clks[] = { GATE_INFRA_AO2(CLK_INFRA_AO_UNIPRO_SYS, "infra_ao_unipro_sys", "top_ufs", 11), GATE_INFRA_AO2(CLK_INFRA_AO_UNIPRO_TICK, "infra_ao_unipro_tick", "top_ufs_tick1us", 12), GATE_INFRA_AO2(CLK_INFRA_AO_UFS_MP_SAP_B, "infra_ao_ufs_mp_sap_b", "top_ufs_mp_sap_cfg", 13), - GATE_INFRA_AO2(CLK_INFRA_AO_PWRMCU, "infra_ao_pwrmcu", "top_pwrmcu", 15), - GATE_INFRA_AO2(CLK_INFRA_AO_PWRMCU_BUS_H, "infra_ao_pwrmcu_bus_h", "top_axi", 17), + /* pwrmcu is used by ATF for platform PM: clocks must never be disabled by the kernel */ + GATE_INFRA_AO2_FLAGS(CLK_INFRA_AO_PWRMCU, "infra_ao_pwrmcu", "top_pwrmcu", 15, + CLK_IS_CRITICAL), + GATE_INFRA_AO2_FLAGS(CLK_INFRA_AO_PWRMCU_BUS_H, "infra_ao_pwrmcu_bus_h", "top_axi", 17, + CLK_IS_CRITICAL), GATE_INFRA_AO2(CLK_INFRA_AO_APDMA_B, "infra_ao_apdma_b", "top_axi", 18), GATE_INFRA_AO2(CLK_INFRA_AO_SPI4, "infra_ao_spi4", "top_spi", 25), GATE_INFRA_AO2(CLK_INFRA_AO_SPI5, "infra_ao_spi5", "top_spi", 26), -- 2.35.1