From patchwork Mon May 10 04:00:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 12246755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D617C433B4 for ; Mon, 10 May 2021 03:31:45 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 F07FB6101A for ; Mon, 10 May 2021 03:31:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F07FB6101A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=h85165iYKlxujDqi7N/5Z4KymLelJoP8e2Q48qKH7eg=; b=qw14WWcF2llwE+X+DoJIxjBd+ wy9G9EGQX1u57J+Xf9cPbenXWHjTl3DHKib/WMmTrAbwOJ0xuC0MUn5NxPdH+tbFQRVqKDCXOCltk 6ruWoZpBS07sEH5l3+AgQ/WSZdjJm7L7VMsze4zWe/bbZ0mdIJLGHKsQI+67C6/iQwr1G14EOSu54 B1UYN6knZo39JHt1o47rhmOeosEMKQb5X9edgk4DfrdrNzUhDW8l/PMbTFMQKWhUx8v/W4Owx0QKn jnbsFbXSALG3hrdKjqNrdrTGD++IHDG7mk/T31Lv2o77la4jvVR5zP/6zsUYTRq6XJOyhKBWaA3wc q2ksJAPaA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lfwc0-00Cy2q-Q3; Mon, 10 May 2021 03:29:41 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lfwbb-00Cxxr-Mf for linux-arm-kernel@desiato.infradead.org; Mon, 10 May 2021 03:29:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=D/oo5r10HjYifhxk7hRTOy6jWsuKsuFXbXBItk2pEbQ=; b=aCsaBxa9sLERRbTYtrXS2K3W36 FxnVqUh3ZArm7aZ6cOrDgGT8qI9hJn9ZvJG7c2PpcV2RIu84wSHU2p54ViYtNwO80BCv1v2KcBRiD f/BB/hB/b6pvhq2eXzd8jDX0YXcK2xAV38PU1zYsNhxLhAMuATZrSR7rz13KrYaR5aF6+AqpwXiEJ sIf8+qDc1j8wgQrtu2joeGsk7rCyX3So8qG/L0TuTYxek89QFNwv6+rhEPwWVPLd0r/3mKxY6HjY6 BbS31j7yQECxgiKOn3LicPGQgmt764FO4OwDYdwvzNva449dTt5H5/+bqJjLZQ6zzSln9v0itKdUi VuO9uI4A==; Received: from mail-eopbgr140048.outbound.protection.outlook.com ([40.107.14.48] helo=EUR01-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lfwbZ-008EiY-3Y for linux-arm-kernel@lists.infradead.org; Mon, 10 May 2021 03:29:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nGeNf1Jejtlzu9f0l0QWjJt6Q8qqxfJTt7lDCyGOyyAS90csCIcBN4z9WgogQF3JGLDZnfhi4ZASul3lj8D4nLKfn813gDJ8nMdEv5LXvrrSfTKEmrI8pmCYrdgB1Z/LmFqtL5Jl9Jw5GrOEJm9fMJBPRlghdwhWtSot7nfCdiz6SC2n5eSyJZy0BpX7j435zKfpvGXjP3QrTJDz/+BEac5B6CoQwBmf5zlAJLlc6msUtQLlB4Vya9ohIqv9lS3lhj9rKfJBvB7vXxS3g4jxPOqcf0F7gy1ywq2rI8dVHTszmvaaIg4pHdTeSnwwRdgBmutwocICQJ5LMI1oD33Tbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D/oo5r10HjYifhxk7hRTOy6jWsuKsuFXbXBItk2pEbQ=; b=OdkfXsOJia/nJktdvxafUFcapFacYDZxikuIz4xxfu8fVZeLS1cVl2vskWmnsGIH0ikltk7LXEGco+VyNZzqsoOfmf9luGRKK0H5eGOH9YyoRTS7U4YPRxY7ss0gciM6o+pfPEPG039MnawZi59nT308arUIi718aEmjMDdQ89vWzmyLhlyPMXS9f2Hxggkjn8xpBD6XgDgZKQfb7VF4Ca9dGg5BK7/9H/++ZUlKmo8sl6+CAZ5kEYQyyJl72LM25xT6whwP/3n10j9oQTxhcQSoDKfytf1GaN44m0wkYNw6mOUPZV2vOR9qEct96gS0T8CLAlr6TldFvX5kxwjFHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D/oo5r10HjYifhxk7hRTOy6jWsuKsuFXbXBItk2pEbQ=; b=Rum1y1a+vzdpQ+8+ckomR6Vuvl7Zc7FgJf2pvJhnCptTSm68V7+Cpb5UcFJNM5N6SduSz8RcTK2G36ghotut9E1hbyzIxJfhroUyA2Xg/09CODeyNdnCuNcIJAFTRrbyfa81TzGhTPAMIujk2Jby2A3l+xOewFZZ0eZtycrUOGE= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB7PR04MB4091.eurprd04.prod.outlook.com (2603:10a6:5:1e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Mon, 10 May 2021 03:29:09 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::45b9:c993:87ec:9a64]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::45b9:c993:87ec:9a64%8]) with mapi id 15.20.4108.031; Mon, 10 May 2021 03:29:09 +0000 From: "Peng Fan (OSS)" To: robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, p.zabel@pengutronix.de, l.stach@pengutronix.de, krzk@kernel.org, agx@sigxcpu.org, marex@denx.de, andrew.smirnov@gmail.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, ping.bai@nxp.com, frieder.schrempf@kontron.de, aford173@gmail.com, abel.vesa@nxp.com Subject: [PATCH V3 02/13] soc: imx: gpcv2: move domain mapping to domain driver probe Date: Mon, 10 May 2021 12:00:34 +0800 Message-Id: <20210510040045.13225-3-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210510040045.13225-1-peng.fan@oss.nxp.com> References: <20210510040045.13225-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR04CA0184.apcprd04.prod.outlook.com (2603:1096:4:14::22) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by SG2PR04CA0184.apcprd04.prod.outlook.com (2603:1096:4:14::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 03:29:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 053c5404-5e7b-4964-53b6-08d91363c5e3 X-MS-TrafficTypeDiagnostic: DB7PR04MB4091: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lKSRnhd/gzQV0qB3z3p+4Marrnrk1bEckPRtLqTP5SMuya6K58X7PUaswrG4uqLxhOp+tiWPyAiY6ImUaz3afmv5b0wfRRuijVHq+3DRi5MGp2GRyYCVNdZaKKrL2R0DjnnVUxOIom4cDzbiMbdpLLTmY4ujTEMCkgf/2YZcGuh2qIBVo0YQK+cFdyi3Z27Z4S7lzFGcer8+8rWcpLctNqfh+XCdYZKYpgCZ3KelkGdoeJfppP5HeTYR8PrqkjbregsOxLv4eKw1UqISoYZboQUNoZfZO5qfqEOGnVcEDPFaijt2A7ouf26x/KxPjthIsc+Em/himyrHpZkZm1CrkbRhhOhL1it3P8ezxIwQIXaE7n9GjTeaP2wSVfyKrV/GSZrIVzZSHB6RVdTAJJL+WBykgIPbGREamjPD6w5cicE01EzEXNLOYnt0yEUmfZqAah4Jb8V6Uld/f+eH6F1YomdYf3dHB2HNjL6JgXkusTMxuBBmunG3lDfePT7OZe/9ldL7kFFkpYNpCYfRYcvFSa0O9JjvEzzsMwC2dbgsh6SCuzhe9sak+UE5ctWEKN5buK77JwnNaZwEEmd2u0ieBGZAa3qw5yvw1B8uVg2ufWrqUFnEBYEBJ7YIZz/KmE5nmhYAU5PCGcnCHjLoaMTahrDbGTa9+eLq0QKzLEo3OXA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(366004)(136003)(39860400002)(396003)(316002)(86362001)(478600001)(4326008)(1076003)(2616005)(956004)(5660300002)(16526019)(6666004)(7416002)(66476007)(38100700002)(83380400001)(6506007)(52116002)(26005)(2906002)(38350700002)(6512007)(6486002)(66556008)(8936002)(186003)(8676002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: zCXgMGjB8C9QtpG2rw8Jpo+Z5WQDhd91PI3SQRZe36adP2o2MR8xI4tfIlxnmIrn8G689hALecTGNYwcMa4hl7iqGIVhO/uJAOcedKVPQI/YBRXQfW4twc64HYXuC7U9n4yCtKvnX26gZdK4Qgx3xtDxu5b605PKahCuAvTqjRjJY0Z2YCN4NmMGUj0uMaE8eU097h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FEEdjvHYpAri6s3V/0jT27pdZLNBCRz0Q1l53xLqxgTm48ZQJh7f4PSerb8VdvL X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 053c5404-5e7b-4964-53b6-08d91363c5e3 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2021 03:29:09.4304 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: McgLotXr8GNeceggz1i6193uQdKHaejQuRfwBcfE6H+GhAVGWu4H7k8ohveHfKYZjCNJipMPG7RIdFDRxZh9Cg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4091 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210509_202913_176044_90C1064C X-CRM114-Status: GOOD ( 14.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Lucas Stach As long as the power domain driver is active we want power control over the domain (which is what the mapping bit requests), so there is no point in whacking it for every power control action, simply set the bit in driver probe and clear it when the driver is removed. Tested-by: Frieder Schrempf Reviewed-by: Frieder Schrempf Signed-off-by: Lucas Stach --- drivers/soc/imx/gpcv2.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c index 512e6f4acafd..552d3e6bee52 100644 --- a/drivers/soc/imx/gpcv2.c +++ b/drivers/soc/imx/gpcv2.c @@ -140,14 +140,11 @@ static int imx_gpc_pu_pgc_sw_pxx_req(struct generic_pm_domain *genpd, int i, ret = 0; u32 pxx_req; - regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING, - domain->bits.map, domain->bits.map); - if (has_regulator && on) { ret = regulator_enable(domain->regulator); if (ret) { dev_err(domain->dev, "failed to enable regulator\n"); - goto unmap; + return ret; } } @@ -203,9 +200,7 @@ static int imx_gpc_pu_pgc_sw_pxx_req(struct generic_pm_domain *genpd, /* Preserve earlier error code */ ret = ret ?: err; } -unmap: - regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING, - domain->bits.map, 0); + return ret; } @@ -499,10 +494,13 @@ static int imx_pgc_domain_probe(struct platform_device *pdev) if (ret) return dev_err_probe(domain->dev, ret, "Failed to get domain's clocks\n"); + regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING, + domain->bits.map, domain->bits.map); + ret = pm_genpd_init(&domain->genpd, NULL, true); if (ret) { dev_err(domain->dev, "Failed to init power domain\n"); - goto out_put_clocks; + goto out_domain_unmap; } ret = of_genpd_add_provider_simple(domain->dev->of_node, @@ -516,7 +514,9 @@ static int imx_pgc_domain_probe(struct platform_device *pdev) out_genpd_remove: pm_genpd_remove(&domain->genpd); -out_put_clocks: +out_domain_unmap: + regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING, + domain->bits.map, 0); imx_pgc_put_clocks(domain); return ret; @@ -528,6 +528,10 @@ static int imx_pgc_domain_remove(struct platform_device *pdev) of_genpd_del_provider(domain->dev->of_node); pm_genpd_remove(&domain->genpd); + + regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING, + domain->bits.map, 0); + imx_pgc_put_clocks(domain); return 0;