From patchwork Sun Oct 7 13:10:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10629635 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 73546112B for ; Sun, 7 Oct 2018 13:26:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51BD029171 for ; Sun, 7 Oct 2018 13:26:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4404529206; Sun, 7 Oct 2018 13:26:02 +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 80A2629171 for ; Sun, 7 Oct 2018 13:26:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727802AbeJGUdN (ORCPT ); Sun, 7 Oct 2018 16:33:13 -0400 Received: from mail-ve1eur01on0079.outbound.protection.outlook.com ([104.47.1.79]:39997 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726803AbeJGUdN (ORCPT ); Sun, 7 Oct 2018 16:33:13 -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=ot0pGC1L4qTHTCMImhoRCHgnW0Yr2Ca9NE/d36QhgGw=; b=e48v8cmuJTSC2OeS/4OCZXiaQjI/BweSTTUuF6KP8mQyQq7ioF0UjRjEXDmDN0yIY6L5EdfniSyNzLh9BTPEXkHDdeVIZhroEu+w3W8AkoDtUFxNu6bts9j8eYvNk9pV1324N5i92+1kUtH0SBW9oAf+porwDg6je9x42pKmWc8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; Received: from shlinux2.ap.freescale.net (119.31.174.66) by AM6PR04MB4215.eurprd04.prod.outlook.com (2603:10a6:209:4f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.18; Sun, 7 Oct 2018 13:25:35 +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 V4 2/2] firmware: imx: add SCU power domain driver Date: Sun, 7 Oct 2018 21:10:07 +0800 Message-Id: <1538917807-1921-3-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1538917807-1921-1-git-send-email-aisheng.dong@nxp.com> References: <1538917807-1921-1-git-send-email-aisheng.dong@nxp.com> MIME-Version: 1.0 X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK0PR01CA0045.apcprd01.prod.exchangelabs.com (2603:1096:203:3e::33) To AM6PR04MB4215.eurprd04.prod.outlook.com (2603:10a6:209:4f::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a3ffa372-796b-497b-0c58-08d62c585f76 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM6PR04MB4215; X-Microsoft-Exchange-Diagnostics: 1;AM6PR04MB4215;3:pFEALRkzRtsapNyC7Ddpkirr2ggNU+eclziOCgxIuWVm5BXch1rse21MuaZl4QP0jiI2FRAjGoSEMRLajG4mszSoPFB/KvvqfJDBJyLLOr1brGSHKYmy/SwL2oPS85vFZkLhXDrx+7AZXDgoCqtF3anK5wN3rCpkcfa+E3mgKtO1hco1ezhGYkP5JKrDA51Y3YrYmPutZupEp3U3iH5WUsrnAEQjlgOuvwmItIR85c4mczLtBxJiUXcFexhNZU5n;25:sKAG76eynCIa8J8p4UIGRxore6Z8oJJn6XpM1i0aSeT8i5WolDF2MKzmwEcq4ex46uD6LsDl298TiZ8MXiWZclgwndvdbjtTJ7pt865IfDvz/QpfVcbpr+XWZO5GZM9Ij7ApIPOiTOO3KHMY7cS1+HY4T2h2094cHU6if5V4NV7L0k4V/++hY+nGsv0PgtPO9pVJ6Z1avBlgy5H9SN6eTuv9y7c2h7XxqR5KXTxpLSSNnSNAfHK2shKToUEL0Srvr7MY31e1fKyONq9m0tirRxQm/agOU/b1edjAXEjFninya9xZZo1Oq2fvEoP1so0l3EdgE+ifCBOk068qC3HqMA==;31:BmPJ8RkU0n7cafNfGbA0SXGBmnGCEZrI1YpJrcXAOx5RR0GNhVIHJl/7tDe/1qvGISYwwSIAO1f549PU1/W995KxXN2jmVnYuK6hoGHq0DSidvOq6miPFhhmPIl0LLz0/YEPpyu9mpPK8GsHcPJMD6evhzXf/zS2qMKZvtnMqWVHBWKsGx9tGFnlwa8s6u1Y5e/aDGhNy8DbVvYYuJivLHe8relVU+hrqw41mHJRQWA= X-MS-TrafficTypeDiagnostic: AM6PR04MB4215: X-Microsoft-Exchange-Diagnostics: 1;AM6PR04MB4215;20:j4DOeO4NEvInpSv1KFYHlfnsgNLzHVGcKUgGdonXf1+LBdc73jn48dWiP80m2/BlrRZIdVONNznp65DEtz4U0abgab+AW5J2DJFO1aO1+6zWYVSJgsOw5DSA+RmJNHu1m4Cx9ApoR0434t3sLMQTX8OLjjwACBhUUsynK/SZgbeGwoDjejXl+TeBXafJ37f/oERBxHLHRgJ3VCdcZfQTPIEv6cIdQ16ipnUU7PygXi8AukqtPlvr8qZFYL8F0KHRRCtCoE4uLHq6Mj+aB8bOwlkb20k0wFX3L3p/J6HEreq0EI2iHHR4bHTluJBm8+qOuUv4pKD7+tpQQ+yFNqaPLpSJJwxMnDCMvsz02JeT9PFAgEo5o2QIwTnGbMk6OcAZO5K9wjiTiwoegjD059keMafbCOUjuFptj2GN1qHN5noTzFxAeG3jpZeDh+psGOkzo4x1WkQKlry6dLXQyAtwQaAi+wkpnLodQYROnzzaMCXOdoHdF7ZLVeF8HHbxAWun;4:ZPjMqbGhbBq8HC8DLWZsb4PHEx91qqToxI6zueIV5hsHlplY3Fkd8evG7UImbXaSnyeVZTxIOelMGDlSCXWtAsHiewJMIdY/bW+S7N3JAbo3EVMaD9lhKTO80uBhIS7VB5/TxD4Exi7AKCDnwU7ydnfiwJzxRBSv+XZpLB8hvEhA1wRqfL2WQ3AjylBJyz+oGy9XrfyPRsoq2uguX+obnBOHVYZTVTLz/i+5eJZGjKql80VYtg2dPmp27GJ6zCEIxTOV1AVrCM4iRLmem6FGttEZ1xMnbXcETUNLkOvAf5q1NQALNIBcjYMgCO71CTUx9xbAacD3sBh1I1dr7w+sMvX4VfaivQJn6fJ4+PHHHxGd1Z0DDo5B+rwf1xpLH73d 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)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(201708071742011)(7699051);SRVR:AM6PR04MB4215;BCL:0;PCL:0;RULEID:;SRVR:AM6PR04MB4215; X-Forefront-PRVS: 0818724663 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39850400004)(376002)(346002)(366004)(136003)(396003)(54534003)(199004)(189003)(4326008)(16586007)(39060400002)(8936002)(8676002)(86362001)(2906002)(106356001)(50226002)(478600001)(2361001)(52116002)(51416003)(36756003)(68736007)(81166006)(2351001)(76176011)(81156014)(6486002)(14444005)(105586002)(316002)(6506007)(386003)(48376002)(16526019)(186003)(97736004)(6512007)(50466002)(476003)(2616005)(956004)(11346002)(53936002)(446003)(486006)(3846002)(6116002)(7736002)(305945005)(25786009)(66066001)(6666003)(6916009)(5660300001)(26005)(47776003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR04MB4215;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;AM6PR04MB4215;23:Gap3qtYXoZziH+Ly+DmDLzheKy9C3H/0xLXpb0wD0wu7iMQggzuJkTr5OjkvqLkXETwO4Ax2ujSsASsAGOGbBi+sEolvMGBTtQ/UtX6A7qFajtiJmZLOvP4nZBvkb9AE/S110m9N9ZXGx8ZSwCLBJyPmmAbjMZkfV5oZ+zRAVUpjsk3IgoBw6DbjTarxpXCQoUWwPLVU3daclgPY1fv26A1cO4Dr7nndk2yAszhkOLub/Sr69iBzEYQM9+jxp52lH9trDJuFjkOMCxcA1RUNL/q9aZQ7ksm22v6b+Zdu5gholcaQqG/yhkdSYxbIHrmbnRR2uCL+PuM67zrnLbQRI6M3Ij8vyGN9Q1thNV1KOlu6BpmTNnq+EdWDfO5QwxxMqiRYUJvgQ3gct0vK5VrWmbaN4jHdDvmmXu1Kbo4kPHLjK8apX+Qj8jkRS8KsPO5fWMgAQh1XtkXDVoYGzu/xYNjj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pamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2018 13:25:35.7297 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3ffa372-796b-497b-0c58-08d62c585f76 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB4215 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: v3->v4: * update firmware headfile patch from include/soc/imx to include/linux/firmware/imx 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 | 167 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 175 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..af5b9e4 --- /dev/null +++ b/drivers/firmware/imx/scu-pd.c @@ -0,0 +1,167 @@ +// 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");