From patchwork Sun Sep 30 00:53:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10621043 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1B51316B1 for ; Sun, 30 Sep 2018 01:08:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A4A52917E for ; Sun, 30 Sep 2018 01:08:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2C2C291A2; Sun, 30 Sep 2018 01:08:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A52962917E for ; Sun, 30 Sep 2018 01:08:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726686AbeI3Hi7 (ORCPT ); Sun, 30 Sep 2018 03:38:59 -0400 Received: from mail-db5eur01on0082.outbound.protection.outlook.com ([104.47.2.82]:52784 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726442AbeI3Hi6 (ORCPT ); Sun, 30 Sep 2018 03:38:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fWPtQt51mt/wSQGn/HILGqPTkDyaXY7TH5DVVuXMH8o=; b=USVuqRScsc0Rv6h2cnteJevN8vaiPjZCBzrjaT98staG71gnduxyEnug9a9Pv2IeI/GXliawRB3fJuAs+esxmC2c4j5oh7Yl6pt23VMzGvFVoutrZANgx+uaokDv3NHLynzcttxFi5Ce7jkr/6KpuGyT920JlcarXeD1oL+0HBs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; Received: from shlinux2.ap.freescale.net (119.31.174.66) by AM0PR04MB4210.eurprd04.prod.outlook.com (2603:10a6:208:66::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.23; Sun, 30 Sep 2018 01:08:11 +0000 From: Dong Aisheng To: linux-arm-kernel@lists.infradead.org Cc: dongas86@gmail.com, kernel@pengutronix.de, shawnguo@kernel.org, fabio.estevam@nxp.com, linux-imx@nxp.com, rjw@rjwysocki.net, ulf.hansson@linaro.org, khilman@kernel.org, linux-pm@vger.kernel.org, Dong Aisheng Subject: [PATCH V3 2/2] firmware: imx: add SCU power domain driver Date: Sun, 30 Sep 2018 08:53:17 +0800 Message-Id: <1538268797-24830-3-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1538268797-24830-1-git-send-email-aisheng.dong@nxp.com> References: <1538268797-24830-1-git-send-email-aisheng.dong@nxp.com> MIME-Version: 1.0 X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK0PR01CA0062.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::26) To AM0PR04MB4210.eurprd04.prod.outlook.com (2603:10a6:208:66::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 80b6fe41-f8ba-4041-5a48-08d62671330f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM0PR04MB4210; X-Microsoft-Exchange-Diagnostics: 1;AM0PR04MB4210;3:Kt6W1AcX4uMpOhg2GGESJZTPCNFXE8tprsQdzglVVJFgckVU/7Y2BwVDPA+f27+UeOcIGQt9UCRNsnn3uVTa4HbGdk7IqcuByprLVkhcRaejrYUeQ9fHgCeSNh2E6G1zqNPXnzhlQYtjhKEKzn7dJNaraAMqqufW9jyrZ9Kr1n18URBpkPiBZefrENPZ/b8Z1u315FB9gpHHLbYuN734BZYiUbLq1/a19ljSgEmQLmjZUkUIWnb4Uc0o7dBONR1s;25:fsxAy1h9Bz2uTW5ecDQYXQrgau8YQMJIBjj4zqDmFqyhozVd3AyEMjBYWskRBZO1B5iBBug+u4xVHnNDngdEw50NssoCL6nt5Zt4yjsi4iTHVScOjTbzJoFp3bMwtFFlOiBFVSv7e/cacmKROVaaFP1ooIp10Z/g99P2Ty3uqs7BuOSpOl8g4U/ABnvxiGs/oa6RAjVdQd9Yf+f9TMV37YGbqNFXA0T4ZmZKUObw2iD1itjHI/gxp1jngHiWb0c1rNlUQTxKRK5MuCBR5NS70VXng5Ik99m1Hay5NPVdCE5BPM7XPlYi5LRlTAo4svSeFCFLhC7KV5wRVytJhORr2g==;31:jrmxXgRIkmnt3tIBF4HxAEywbF22EDf6QRUdDphYvCb+EuJV778bVgLMK7g3RJXLkk94+6bt6825qiq6QNBxlIAfmCMXSv1NVbk/1oNeITMeEXDMG6enINP/3LEMgLykLvR2PLfxvB4cIUvDmgPq74cE8FNzTH5O2IuzUntV3sLFt55ukc6iFU/dZhB7H6lSy0VvvIh7SheNnzeoroZhRK1z8KYui1z9EzV2ECem+yE= X-MS-TrafficTypeDiagnostic: AM0PR04MB4210: X-Microsoft-Exchange-Diagnostics: 1;AM0PR04MB4210;20:VuPY9nvRpVgAlEB/JRce73xb8TIiTbxBr6m0zR9VEdSDGp+d0CVYX6iZaz6kQz6gE1tkZAblnaJ1TfWMQ0+sizZG8exXGXuUAJKUfRkJV5K1lT3RI6ujtiaD9hzwg/CM4Rue05ZBUVXLWQLnnMIh83E8tfbydLIIUnyLkFIOCU7K/Q8GT1q/zkjv52+gYTmbXwFpXJvDsaVOIJHmPojxFeFFzSeRCSe5SkbHTJ7shFEEdR9gIziKr2Tx1Twy3di+zKRGzJk3BN2zyylcSwq2vjhpc8Zx/gxqHQ5dQWD5PUCldO591IrSUaM97dVvdzs6fc+juh3dS5M3pSTQDKP7wL6fq3tNsJwZnPUXCR3WfZQ2+ehY9S7EnK34tAwYZshWUFAIiI9tL88Tn3UfCHT+5bb1YmlIRTips003V9hdX92hbZF4tPud5wCZQkLVdz2UoJQAx+0tq71VeW0K+TbaFrEaabqBClaVCex4KWX0+cdyZoIQLO1OJHuJTCLYntFR;4:Jx0b9ET18qsn/AVHqA3X5cgnHThLZajumRz/9gzCUDsqw12KrpDQfPwNAA/Br9V9EopNetemOoQulfRiXA8AxvUpoIxU3DdeP1/Aml4MkmG48t9dC2DSdhIy8E4NMokVCe/yyAmJxpVjBamM9EvAI0OQUPwzy+gIhtfi255FTzn6ZLPEesA1I1K7bk37W2MfyL/VtV4nLwkhEHaGVrhdMTDeBx/9z6tgpXMG0me78vvMah0aINmhuXJ7RSpsQzXQDVOIUfHIdfGUhfqY5oh3rqUgW0hotBKEu1cVsQ7U6vqTk6GCVV5FYntcQsumyKPIEucSuyHIp4nMo+n2kYpltoAqJM0LdXhJ8/OhPDmWCojgYG0f9B9qssBSCoXlin7y X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(269456686620040)(185117386973197)(9452136761055); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051);SRVR:AM0PR04MB4210;BCL:0;PCL:0;RULEID:;SRVR:AM0PR04MB4210; X-Forefront-PRVS: 08118EFC2B X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(366004)(39860400002)(136003)(199004)(54534003)(189003)(16586007)(48376002)(50466002)(52116002)(6512007)(105586002)(106356001)(51416003)(446003)(2351001)(2361001)(316002)(486006)(6486002)(66066001)(11346002)(956004)(47776003)(476003)(2616005)(305945005)(5660300001)(4326008)(25786009)(8676002)(26005)(81156014)(81166006)(186003)(16526019)(8936002)(3846002)(6116002)(50226002)(68736007)(97736004)(6916009)(7736002)(2906002)(39060400002)(36756003)(14444005)(76176011)(53936002)(86362001)(386003)(478600001)(34290500001)(6506007);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB4210;H:shlinux2.ap.freescale.net;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;AM0PR04MB4210;23:EaVK3zgAZv4ZTUW0XUE7nDYsW4CgqEryLaNKNzTE5/aPwD4n5uSxtBe4ZRoMpwc2NXEanG1j7r7y7ywxBj5tSeH1R5pyS+PhCH+vC32Ulap7RN/C42mACspQyENuf3bavTzeNjJ9WnEJ0pRkOxgPhhYwR7v3mOJ7iAtX26uovB3AY+dROGmXcanVZW+7ZXJ43wSPHvEGkSsyd3qUMkA8rglavFCNVw8g24ikRGwJxntvtEeRqiOtCLwqyLa4amJn88MNOeLw9X3s83z0Qa1uGFOTXk/WQjDv+JthmXm/Cmg36RxHBv+TImYacgAbz3gvLAPDjq6GpBpIkQNCXztrUrEMdqFqFXst1Ug9Lp5mJpRp3b3mna1ZSf3h8fvBnFw2tmHJuiE5szEuLsmgmSF8kNm8IrJQMDTM66g2RtH+N7CBcZ9ArJ/jWtjUyOAmNt1BevKKqVQSibT0rxBRhiJo8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SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2018 01:08:11.6425 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 80b6fe41-f8ba-4041-5a48-08d62671330f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4210 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some i.MX SoCs contain a system controller that is responsible for controlling the state of the IPs that are present. Communication between the host processor running an OS and the system controller happens through a SCU protocol. This patch adds SCU protocol based power domains drivers. Cc: Shawn Guo Cc: Sascha Hauer Cc: Fabio Estevam Cc: "Rafael J. Wysocki" Cc: Kevin Hilman Cc: linux-pm@vger.kernel.org Reviewed-by: Ulf Hansson Signed-off-by: Dong Aisheng --- ChangeLog: v2->v3: * name of structures/enums updated with imx_sc prefix v1->v2: * move into drivers/firmware/imx * Implement sc_pm_set_resource_power_mode() API in the driver instead of call it via SCU API according to Sascha's suggestion --- drivers/firmware/imx/Kconfig | 6 ++ drivers/firmware/imx/Makefile | 3 +- drivers/firmware/imx/scu-pd.c | 168 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 drivers/firmware/imx/scu-pd.c diff --git a/drivers/firmware/imx/Kconfig b/drivers/firmware/imx/Kconfig index b170c28..6a7a7c2 100644 --- a/drivers/firmware/imx/Kconfig +++ b/drivers/firmware/imx/Kconfig @@ -9,3 +9,9 @@ config IMX_SCU This driver manages the IPC interface between host CPU and the SCU firmware running on M4. + +config IMX_SCU_PD + bool "IMX SCU Power Domain driver" + depends on IMX_SCU + help + The System Controller Firmware (SCFW) based power domain driver. diff --git a/drivers/firmware/imx/Makefile b/drivers/firmware/imx/Makefile index 0ac04df..1b2e15b 100644 --- a/drivers/firmware/imx/Makefile +++ b/drivers/firmware/imx/Makefile @@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_IMX_SCU) += imx-scu.o misc.o +obj-$(CONFIG_IMX_SCU) += imx-scu.o misc.o +obj-$(CONFIG_IMX_SCU_PD) += scu-pd.o diff --git a/drivers/firmware/imx/scu-pd.c b/drivers/firmware/imx/scu-pd.c new file mode 100644 index 0000000..69ed028 --- /dev/null +++ b/drivers/firmware/imx/scu-pd.c @@ -0,0 +1,168 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2016 Freescale Semiconductor, Inc. + * Copyright 2017~2018 NXP + * Dong Aisheng + * + * Implementation of the SCU based Power Domains + */ + +#define pr_fmt(fmt) "scu_pd: " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +struct imx_sc_pm_domain { + struct generic_pm_domain pd; + u32 rsrc_id; +}; + +static struct imx_sc_ipc *pm_ipc_handle; + +/* SCU Power Mode Protocol definition */ +struct imx_sc_msg_req_set_resource_power_mode { + struct imx_sc_rpc_msg hdr; + u16 resource; + u8 mode; +} __packed; + +static int imx_sc_pd_power(struct generic_pm_domain *domain, bool power_on) +{ + struct imx_sc_msg_req_set_resource_power_mode msg; + struct imx_sc_rpc_msg *hdr = &msg.hdr; + struct imx_sc_pm_domain *pd; + int ret; + + pd = container_of(domain, struct imx_sc_pm_domain, pd); + + hdr->ver = IMX_SC_RPC_VERSION; + hdr->svc = (uint8_t)IMX_SC_RPC_SVC_PM; + hdr->func = (uint8_t)IMX_SC_PM_FUNC_SET_RESOURCE_POWER_MODE; + hdr->size = 2; + + msg.resource = pd->rsrc_id; + msg.mode = power_on ? IMX_SC_PM_PW_MODE_ON : IMX_SC_PM_PW_MODE_LP; + + ret = imx_scu_call_rpc(pm_ipc_handle, &msg, true); + if (ret) + pr_err("failed to power %s resource %d ret %d\n", + power_on ? "up" : "off", pd->rsrc_id, ret); + + return ret; +} + +static int imx_sc_pd_power_on(struct generic_pm_domain *domain) +{ + return imx_sc_pd_power(domain, true); +} + +static int imx_sc_pd_power_off(struct generic_pm_domain *domain) +{ + return imx_sc_pd_power(domain, false); +} + +static struct generic_pm_domain *imx_sc_pm_add_one_domain( + struct device_node *np, + struct generic_pm_domain *genpd_parent) +{ + struct imx_sc_pm_domain *imx_sc_pd; + u32 rsrc_id; + int ret; + + imx_sc_pd = kzalloc(sizeof(*imx_sc_pd), GFP_KERNEL); + if (!imx_sc_pd) + return ERR_PTR(-ENOMEM); + + if (!of_property_read_u32(np, "reg", &rsrc_id)) { + if (rsrc_id > IMX_SC_R_LAST) { + pr_warn("%pOF: invalid rsrc id %d found", np, rsrc_id); + ret = -EINVAL; + goto err; + } + imx_sc_pd->rsrc_id = rsrc_id; + } else { + imx_sc_pd->rsrc_id = IMX_SC_R_LAST; + } + + if (imx_sc_pd->rsrc_id != IMX_SC_R_LAST) { + imx_sc_pd->pd.power_off = imx_sc_pd_power_off; + imx_sc_pd->pd.power_on = imx_sc_pd_power_on; + } + + imx_sc_pd->pd.name = np->name; + + ret = pm_genpd_init(&imx_sc_pd->pd, NULL, true); + if (ret < 0) + goto err; + + if (genpd_parent) { + ret = pm_genpd_add_subdomain(genpd_parent, &imx_sc_pd->pd); + if (ret) + goto err; + } + + ret = of_genpd_add_provider_simple(np, &imx_sc_pd->pd); + if (!ret) + return &imx_sc_pd->pd; + + pm_genpd_remove_subdomain(genpd_parent, &imx_sc_pd->pd); + +err: + pr_warn("failed to add PM domain %pOF: %d\n", np, ret); + kfree(imx_sc_pd); + return ERR_PTR(ret); +} + +static void imx_sc_pm_add_pm_domains(struct device_node *parent, + struct generic_pm_domain *genpd_parent) +{ + struct generic_pm_domain *pd; + struct device_node *np; + + for_each_child_of_node(parent, np) { + pd = imx_sc_pm_add_one_domain(np, genpd_parent); + if (!IS_ERR(pd)) + imx_sc_pm_add_pm_domains(np, pd); + } +} + +static int imx_sc_pd_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + int ret; + + ret = imx_scu_get_handle(&pm_ipc_handle); + if (ret) + return ret; + + imx_sc_pm_add_pm_domains(np, NULL); + + return 0; +} + +static const struct of_device_id imx_sc_pd_match[] = { + { .compatible = "fsl,scu-pd", }, + { /* sentinel */ } +}; + +static struct platform_driver imx_sc_pd_driver = { + .driver = { + .name = "imx-scu-pd", + .of_match_table = imx_sc_pd_match, + }, + .probe = imx_sc_pd_probe, +}; +builtin_platform_driver(imx_sc_pd_driver); + +MODULE_AUTHOR("Dong Aisheng "); +MODULE_DESCRIPTION("IMX SCU Power Domain driver"); +MODULE_LICENSE("GPL v2");