From patchwork Tue Jan 17 03:26:39 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: 44479 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1539137wrn; Mon, 16 Jan 2023 19:38:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXvyJj837bHY5zuP8ePrZpmputdbGKr5/3mSwGXJMZaT0mYhSoXQuL4UYIP17rhJX0G1K4xZ X-Received: by 2002:aa7:db8b:0:b0:49b:b274:b816 with SMTP id u11-20020aa7db8b000000b0049bb274b816mr1488113edt.37.1673926686299; Mon, 16 Jan 2023 19:38:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673926686; cv=none; d=google.com; s=arc-20160816; b=httfuEakupCmmeQ1wDwN3/mHxu8QuTPruJ80B/sjqPu42YbqcSJ6/45oP0xKWY4otL +SrZ0/y2NMAtfTXRLDVfvg9TYCT0PoHbQzImE7gUw5v9aovXy4a+PK0uwgwo5GIfT0LQ kUpfHGgJEPbDcNt7NFFavn6UqNuX07PtVMc9dP5y5EsLnOslA94vSBroC+8Fr1HkQGBQ wdX7xqPLwvmk5s6HblZ7sm9YobkcWM5ql3WvgS9KaYj3tRONybuFczMrQ6iLtTar9nXi o9+CXqc2udpwm0GqzjfeRpJwJSK2GUlyGWEZmBNJ6Arv+Sc4+IIfwcp/6uDhjzS6Xlkk gX0w== 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=khGtf/yFaQhuUYw3+sDq4AMQJejakM42FizGJgu2Vp4=; b=aYdEeO7zXZn/7r7At38vQplCwjMVF/J0nKfUKjxSCXepxnmfXAvfbSxMPCiAfjGLUC SIl3GnemN/xCGI7eic/VhSIAWA9iVaJnFTLazl5HqlgGwNQzUdYCQzR4j+jn7LRnTVj4 uJNmdb+ZE1NUujSD5TVuOrY2OThrg82nKGHALCrEbdrg7KG3zLuERcsjakH3BFE0TBNC Px/krrCf/JzkxzHDpR4KjZDCxRpSEB+/fYjSC8cRHb2xOTDq7XbFttp6H8GN1ZFS2zER ed9LRarpoKJKtLrMrHUZfv50lIhXT61kfHJbJ732i/xayZ8lQeBeRbyazHwDx+R0VO+0 Kl2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="PTIQZV/M"; 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 es15-20020a056402380f00b004865244368fsi7592470edb.334.2023.01.16.19.37.42; Mon, 16 Jan 2023 19:38:06 -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="PTIQZV/M"; 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 S235323AbjAQD1J (ORCPT + 99 others); Mon, 16 Jan 2023 22:27:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235308AbjAQD06 (ORCPT ); Mon, 16 Jan 2023 22:26:58 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 621AE227AD for ; Mon, 16 Jan 2023 19:26:51 -0800 (PST) X-UUID: c60cfd16961611ed945fc101203acc17-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=khGtf/yFaQhuUYw3+sDq4AMQJejakM42FizGJgu2Vp4=; b=PTIQZV/MFy3R8b9uI1mOJWsKeHEp8ajs5VZdtvHrzDwMvK/BP555eLmOo6vhECPrhPn+B3+DhaFUA0hsJM5FwvuFNsGbST8LDsqhO3myD83k49rozuqbrmMoIgCuLof52rBjVuc1bVfOWhC6nc06b7DJPFtdYyXUIaxTKXJH2j8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.18,REQID:543f5605-56ed-4f55-80df-3ce434bee6e1,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:90 X-CID-INFO: VERSION:1.1.18,REQID:543f5605-56ed-4f55-80df-3ce434bee6e1,IP:0,URL :0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTIO N:quarantine,TS:90 X-CID-META: VersionHash:3ca2d6b,CLOUDID:1769738c-8530-4eff-9f77-222cf6e2895b,B ulkID:23011711264751LS0397,BulkQuantity:0,Recheck:0,SF:38|28|17|19|48,TC:n il,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OS I:0,OSA:0 X-CID-BVR: 0 X-UUID: c60cfd16961611ed945fc101203acc17-20230117 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 925848481; Tue, 17 Jan 2023 11:26:47 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs13n1.mediatek.inc (172.21.101.193) 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:46 +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:46 +0800 From: Allen-KH Cheng To: Matthias Brugger , Enric Balletbo i Serra CC: , , , , , Allen-KH Cheng Subject: [PATCH 1/2] soc: mediatek: pm-domains: Add buck isolation offset and mask to power domain data Date: Tue, 17 Jan 2023 11:26:39 +0800 Message-ID: <20230117032640.13504-2-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=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAY_BE_FORGED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, T_SPF_TEMPERROR,UNPARSEABLE_RELAY autolearn=no 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?1755239348922017435?= X-GMAIL-MSGID: =?utf-8?q?1755239348922017435?= Add buck isolation offset and mask to power domain data. Signed-off-by: Allen-KH Cheng Reviewed-by: AngeloGioacchino Del Regno --- drivers/soc/mediatek/mtk-pm-domains.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/soc/mediatek/mtk-pm-domains.h b/drivers/soc/mediatek/mtk-pm-domains.h index 7d3c0c36316c..a5f24c58e35a 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.h +++ b/drivers/soc/mediatek/mtk-pm-domains.h @@ -81,6 +81,8 @@ struct scpsys_bus_prot_data { * @ctl_offs: The offset for main power control register. * @sram_pdn_bits: The mask for sram power control bits. * @sram_pdn_ack_bits: The mask for sram power control acked bits. + * @ext_buck_iso_offs: The offset for external buck isolation + * @ext_buck_iso_mask: The mask for external buck isolation * @caps: The flag for active wake-up action. * @bp_infracfg: bus protection for infracfg subsystem * @bp_smi: bus protection for smi subsystem @@ -91,6 +93,8 @@ struct scpsys_domain_data { int ctl_offs; u32 sram_pdn_bits; u32 sram_pdn_ack_bits; + int ext_buck_iso_offs; + u32 ext_buck_iso_mask; u8 caps; const struct scpsys_bus_prot_data bp_infracfg[SPM_MAX_BUS_PROT_DATA]; const struct scpsys_bus_prot_data bp_smi[SPM_MAX_BUS_PROT_DATA]; 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