From patchwork Tue Jan 17 03:26:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allen-KH Cheng X-Patchwork-Id: 44478 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1538987wrn; Mon, 16 Jan 2023 19:37:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXuuDaQX6ImS1bzx5wuCRWjfc8XPlkl4969WJsQriQGMsM7wD5UYX7CykozkwWWqSzGPyTHV X-Received: by 2002:a17:907:9006:b0:84d:411d:64a4 with SMTP id ay6-20020a170907900600b0084d411d64a4mr13775092ejc.38.1673926652894; Mon, 16 Jan 2023 19:37:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673926652; cv=none; d=google.com; s=arc-20160816; b=Z2XyWMxCV/cGUdGOICdabDhQgNeapu5jXoa1gYSx5GGyZhcmSGCjOGj7WujTh/a5FP UPx7OdhNu+X7/wVdhhOobIPRU7RcrS+BYQgpu6EVBQ2T4QjUb9VEjNlSwaVeyHADv7P7 pdbWfbgvYEapMLbuGzFx/lIlHt6Iyb7D99KNAe7aqShhSxC5QrxtKP5KHSaXkUnkdC2m 8wE9Tpg3Nil8EyYW6esY46xKadA9XsHVL73B9RguZKjTuY2+2uchub/S9U0KTfBSdbw5 rUPezCKAFDartUkotXE3M/UDiAhce7QTJ5CT6pf5jhrs3bz5q0YxcIea0gMlhq+oG1Ne Odxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5C2D2S86cb16nMfLO4Diw2Eh4jJ4yT3vi26gK/otEzg=; b=eUuVhjEVy9cCx9vvJGh7QFBu2dhnM7jSt7aHLLspHm2pZQ4nOJ+WGBi95x0sJoOFdv yNjq3NqI1B80sqYEpbnnGFqfKW5DHEQqVAhb3osEvXzaRh/3Uv6vY2EtJXlZrkB2UuBg z+Tcc5qAEJNM96SNCpKHuZTtmL7CHcIocJbQ1NdyYFP1J2BEm6hiumEBqSacjAyPP5M1 +sB865h86RHnfBLtVDi2lIkVj6tYsl7VjHR8bNpy+OPaSL5gMj5CtvY4CHv0vXpsRU9h cNWg1NK1cs7shLBTP/em5GEXDToUYlS++ss8Xig3kQmRn49U1dl0Mh6HHjpAiPYaeqWQ umtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="rV/yfyKU"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn20-20020a17090794d400b007d6648874a2si11175554ejc.711.2023.01.16.19.37.09; Mon, 16 Jan 2023 19:37:32 -0800 (PST) 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=@mediatek.com header.s=dk header.b="rV/yfyKU"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235285AbjAQD1S (ORCPT + 99 others); Mon, 16 Jan 2023 22:27:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235337AbjAQD1B (ORCPT ); Mon, 16 Jan 2023 22:27:01 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66D6922DEE for ; Mon, 16 Jan 2023 19:26:53 -0800 (PST) X-UUID: c6f171c6961611ed945fc101203acc17-20230117 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=5C2D2S86cb16nMfLO4Diw2Eh4jJ4yT3vi26gK/otEzg=; b=rV/yfyKU1u0fbaNhI0vN2X0ivRrqnQbb89mKpiXsFZWC0W4LiVSJ/ZbPG/QAIPhr6SJ8fLL5rd9uPjTF90sgdtNtwRsWY9BcgFFvtSSNIUmbkgQnXs23rY1Rnf0+EjVUo3oDZ/OWh4vfD3oe9z0Nns82IXbUlI0sC+5e1VYrZps=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.18,REQID:6a9e5795-77ff-4af4-acbf-23dcf273d8bf,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:3ca2d6b,CLOUDID:9769738c-8530-4eff-9f77-222cf6e2895b,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0 X-CID-BVR: 0 X-UUID: c6f171c6961611ed945fc101203acc17-20230117 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 185448080; Tue, 17 Jan 2023 11:26:48 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Tue, 17 Jan 2023 11:26:47 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Tue, 17 Jan 2023 11:26:47 +0800 From: Allen-KH Cheng To: Matthias Brugger , Enric Balletbo i Serra CC: , , , , , Allen-KH Cheng Subject: [PATCH 2/2] soc: mediatek: pm-domains: Add buck isolation setting in power domain Date: Tue, 17 Jan 2023 11:26:40 +0800 Message-ID: <20230117032640.13504-3-allen-kh.cheng@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230117032640.13504-1-allen-kh.cheng@mediatek.com> References: <20230117032640.13504-1-allen-kh.cheng@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755239313592421281?= X-GMAIL-MSGID: =?utf-8?q?1755239313592421281?= In some chipsets, we need to disable EXT_BUCK_ISO before turning on the specific power pm-domains (mtcmos), such as ADSP in MT8192 and CAM_VCORE in MT8188. Add the MTK_SCPD_EXT_BUCK_ISO flag to control the buck isolation setting in the mediatek power domain driver. Fixes: 59b644b01cf4 ("soc: mediatek: Add MediaTek SCPSYS power domains") Signed-off-by: Allen-KH Cheng Reviewed-by: AngeloGioacchino Del Regno --- drivers/soc/mediatek/mtk-pm-domains.c | 8 ++++++++ drivers/soc/mediatek/mtk-pm-domains.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c index 474b272f9b02..be972e35b26e 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.c +++ b/drivers/soc/mediatek/mtk-pm-domains.c @@ -218,6 +218,10 @@ static int scpsys_power_on(struct generic_pm_domain *genpd) if (ret) goto err_reg; + if (pd->data->ext_buck_iso_offs && MTK_SCPD_CAPS(pd, MTK_SCPD_EXT_BUCK_ISO)) + regmap_clear_bits(scpsys->base, pd->data->ext_buck_iso_offs, + pd->data->ext_buck_iso_mask); + /* subsys power on */ regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_BIT); regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_2ND_BIT); @@ -272,6 +276,10 @@ static int scpsys_power_off(struct generic_pm_domain *genpd) if (ret < 0) return ret; + if (pd->data->ext_buck_iso_offs && MTK_SCPD_CAPS(pd, MTK_SCPD_EXT_BUCK_ISO)) + regmap_set_bits(scpsys->base, pd->data->ext_buck_iso_offs, + pd->data->ext_buck_iso_mask); + clk_bulk_disable_unprepare(pd->num_subsys_clks, pd->subsys_clks); /* subsys power off */ diff --git a/drivers/soc/mediatek/mtk-pm-domains.h b/drivers/soc/mediatek/mtk-pm-domains.h index a5f24c58e35a..5ec53ee073c4 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.h +++ b/drivers/soc/mediatek/mtk-pm-domains.h @@ -10,6 +10,7 @@ #define MTK_SCPD_DOMAIN_SUPPLY BIT(4) /* can't set MTK_SCPD_KEEP_DEFAULT_OFF at the same time */ #define MTK_SCPD_ALWAYS_ON BIT(5) +#define MTK_SCPD_EXT_BUCK_ISO BIT(6) #define MTK_SCPD_CAPS(_scpd, _x) ((_scpd)->data->caps & (_x)) #define SPM_VDE_PWR_CON 0x0210