From patchwork Fri May 11 03:35:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinbo Zhu X-Patchwork-Id: 10393223 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5031C60236 for ; Fri, 11 May 2018 03:39:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EFB028DBC for ; Fri, 11 May 2018 03:39:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40DBF28DEF; Fri, 11 May 2018 03:39:34 +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=-2.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B6A6F28DBC for ; Fri, 11 May 2018 03:39:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Ves0JVJZ94G1R8VxqoAUJYXSH0l89i0NGKXvyNUxZzw=; b=IkVgqkerT90g/I pRdS9Qswt15OBBtTi5m9HPfm55YcBLBV0VPT4eb+zHlZVwPr78XuNlGh7lfmiFdYMjy2quTn1l3n5 3HzN4lBt5TVnz1eIo7U1e48v8VxtNbgxUhPTBeln6iFFIamRTf1ggvvdvOvn1ziHsjLsstKIaJG2a cenbOvPNj8RFZg8MyGe2B5mhXAsvHbt1fHj4l8mT28N6ujp7DgkIEjx8vqySnOOsc7w+vUEh7wB2d EvdUcMoCnfngU4R8uyV3GFEIN9ZY+EepWx17mu/5EXMEeU3RDTn3NMoP/BnFT5P4loj/y0ABS1vnT o5IK9Q9TeIfqNW+q2+gw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGytw-00036g-Hp; Fri, 11 May 2018 03:39:24 +0000 Received: from mail-sn1nam01on0122.outbound.protection.outlook.com ([104.47.32.122] helo=NAM01-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGyrb-0001tM-QJ for linux-arm-kernel@lists.infradead.org; Fri, 11 May 2018 03:37:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freescale.onmicrosoft.com; s=selector1-freescale-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=jTOLyIfTNrr+BexN+kpEcN7gcMrWfQqDCtFOU+OXi18=; b=HKjSM6lNvQ8OL4dWmmupy/W9wddMJgPIixdhiU6MBPu5nN8z/2tQZMhyruS5cDXI1jamZtl32Diq+eOTVBtFyQdbQ5BJgTyb5qsMk8yysi1QDqoyVyjKuEpC4V5JLSJDAGrP2xe3UdS0DgIZ5WuHMmCxWzasYgQdx4ijjyZxTsg= Received: from BYAPR03CA0016.namprd03.prod.outlook.com (2603:10b6:a02:a8::29) by CO2PR03MB2182.namprd03.prod.outlook.com (2603:10b6:102:9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Fri, 11 May 2018 03:36:41 +0000 Received: from BN1AFFO11FD020.protection.gbl (2a01:111:f400:7c10::106) by BYAPR03CA0016.outlook.office365.com (2603:10b6:a02:a8::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.755.16 via Frontend Transport; Fri, 11 May 2018 03:36:41 +0000 Authentication-Results: spf=fail (sender IP is 64.157.242.222) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 64.157.242.222 as permitted sender) receiver=protection.outlook.com; client-ip=64.157.242.222; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (64.157.242.222) by BN1AFFO11FD020.mail.protection.outlook.com (10.58.52.80) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.715.13 via Frontend Transport; Fri, 11 May 2018 03:36:39 +0000 Received: from az84smr01.freescale.net (az84smr01.freescale.net [10.64.34.197]) by tx30smr01.am.freescale.net (8.14.3/8.14.3) with ESMTP id w4B3ab1o025434; Thu, 10 May 2018 20:36:37 -0700 Received: from titan.ap.freescale.net ([10.192.208.233]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id w4B3aTso014534; Thu, 10 May 2018 20:36:30 -0700 From: Yinbo Zhu To: , Rob Herring , Mark Rutland , "Catalin Marinas )" , "Will Deacon )" , "Lorenzo Pieralisi )" , Li Yang Subject: [PATCH 1/9] armv8: pm: add rcpm module support Date: Fri, 11 May 2018 11:35:22 +0800 Message-ID: <20180511033530.7931-1-yinbo.zhu@nxp.com> X-Mailer: git-send-email 2.14.1 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:64.157.242.222; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(1496009)(396003)(376002)(39860400002)(39380400002)(346002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(53936002)(81166006)(51416003)(8676002)(59450400001)(81156014)(50226002)(1076002)(77096007)(2616005)(476003)(126002)(6666003)(97736004)(47776003)(44832011)(26005)(6636002)(5660300001)(486006)(8936002)(336012)(106466001)(86362001)(498600001)(54906003)(110136005)(48376002)(305945005)(356003)(85426001)(7416002)(316002)(8656006)(105606002)(16586007)(36756003)(7406005)(2906002)(4326008)(50466002)(2004002); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR03MB2182; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; LANG:en; PTR:ErrorRetry; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD020; 1:ms15d6VkVj9REkrdedynDa5LwWgiB8IWKrwpEf50dY4MTUmeNTMLG2vRl0IPsBcQ9f1KomrXNWcF06Oxfy+jxe1j/coOwRRn83WQP9glzKHr62jI/IF7sIRQCCh9sHOe MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(5600026)(2017052603328); SRVR:CO2PR03MB2182; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2182; 3:SyryYKRD2z/dZ+Bwnw2PR2ahNSFzAKbAfYsG8rKxC4EtCaT2zOq4SzBIDSwuncRPTWHVvaQNL95tVqjrGkcQI+DJiAJCjD9Bf4jcJqqkb/IiN+vS2U9dAri+5qDrUDbLUEPaz0tt5VbTZKBzve6UfPGQMCo6eNijLx3XEHKxtAyhvJhJmoqljsKQc9vVxfzYJ6VRpZzCB7e6LwsANf9QCnTQJBlu3HAG3RZYYTrFghl86LuzqwHTndBrK5ucv6zafOAAPRti0aQjpxyUaQq8GZDMlkNgtGTzEwZk0VeOKI+Up5HKJHuZtjvUVVFIHyQPb/7SMhZV2cATMBc4tPYpszPwdB8B0TnS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RNE+LKjyM93t2XVXafC9UpFmRkCje336pwhhV2ftehtcuetpGp603P8LH/ipZ9dyzJXlzbH84ZyFjdRAxPNfpHUSiRrsa4SZLBn6gkFknaOywCP5DU9eCeEyJCVsVx0UcCz3A6LdnL5Jh1410wPnPkG/PUTURrfUOcBDT4/uASfUdNOGURtDs5upbdjNzZYewX4SBQZyLtMLEyAyVIoXqlD7NhRtE91xNhXrEKt/VtnJP2/YECDJ92qayWWpVnA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-MS-Exchange-SenderADCheck: 0 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93003095)(3231254)(944501410)(52105095)(3002001)(6055026)(149027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061750153)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:CO2PR03MB2182; BCL:0; PCL:0; RULEID:; SRVR:CO2PR03MB2182; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2182; 4:i/t2Mv6sXJDARF+1IYckvI+itGF/bgwLyoPqunl7d83p4nN2PJ4OCbIQRxwbRfGTq9+d6VZNfFEGiTgGSLFGmqzwaxTuV7Lk6thbwvFZ9B9mg2v6TEcEJEhVAfhmRe4v7Wu9ktNVMJeJqNd8EojQ/FdhLOblTQhYBRksGHisUwb60UNML9X+/8JNpUPfxk5kbGLzc6pVpBjJ4eBsVr1b9b3D+iVmMLX7h3/Nh9LnB2Pyo5qW27HGVlcfMbauVuRwDISi7ovH+LmNalmEAndC1O4AW+kPV9EfrKhNaVY5DbaaMfJANHdJGN3knaJYcwYs X-Forefront-PRVS: 06691A4183 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2182; 23:eSDUC+KEZKDCi/zTSm3j/K1P5nMOc5UOci+2/4EiO?= =?us-ascii?Q?JPRiAcouH7t+7vNK6t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Ll6Pj9J2kzFoqVAvr3rNtykpSURSpIqQ==; 5:t48meVm/sEto2Me5jIxPzYeG3zRx9WvKRZXIAib123ycpff7DXTaTUxBjB2QRCzaDkzxpeBKUFE0zAJYaCKlbqL5xdLPsXOYFtpSdfpdMj0E3D8X2peuVFDnEByW/n7Es1s+xjDLXTy2nLoDVgj66hNTqludRsqkVYrQCgx5HEg=; 24:3WbK4NmjGxnCRQ2t1DBqnTSPvADl4NQQzy3uXLzdVN9/7/2ObPiyKlwuMZmD9B+sdGE+oViT/4uGXIKDt/JuMevP3fcat2dV194G7AQaxck= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2182; 7:nUI74Lu8QVV2NP3W1r6uu0BGwmFuGzQwRd0/n8VMOYaKrQ33MzoctrOvZITmTQWs2CwUffaprGZAEyS8Gqr37wTaR3m489mhk7U8IreaRxdO+/dnzX62v/IT/vr2Q9om9UAEpoaEcJEAdYwqFLX6H2PZ7xOhBa++9adjRcq+uOcp9z1O+HM3VfMAhlDjRLI5kzGGYkI2YbtuWTZjIGl9UCrthER8F9NYQxDnzGIyA89sz87u5XngpiBF0RFEWh63 X-MS-Office365-Filtering-Correlation-Id: 9481e755-57a5-46c0-5b30-08d5b6f06826 X-OriginatorOrg: freescale.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2018 03:36:39.5579 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9481e755-57a5-46c0-5b30-08d5b6f06826 X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[64.157.242.222]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR03MB2182 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180510_203659_947181_850D7E9D X-CRM114-Status: GOOD ( 17.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Madalin Bucur , "open list:CLOCKSOURCE, CLOCKEVENT DRIVERS" , Minghuan Lian , Zhao Qiang , Meng Yi , =?UTF-8?q?Horia=20Geant=C4=83?= , Tang Yuantian , Sumit Garg , Daniel Lezcano , "jiaheng . fan" , Wang Dongsheng , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Hou Zhiqiang , "open list:FREESCALE SOC DRIVERS" , Nipun Gupta , Yuantian Tang , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, costi , Changming Huang , Priyanka Jain , Po Liu , ying.zhang22455@nxp.com, xiaobo.xie@nxp.com, Fabio Estevam , ran.wang_1@nxp.com, Shawn Guo , Bogdan Purcareata Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Yuantian Tang The Run Control and Power Management (RCPM) module communicates with embedded cores, coherency modules, and other device platform module to provide run control and power management functionality Signed-off-by: Tang Yuantian Signed-off-by: Yinbo Zhu --- drivers/soc/fsl/Makefile | 1 + drivers/soc/fsl/rcpm.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+), 0 deletions(-) create mode 100644 drivers/soc/fsl/rcpm.c diff --git a/drivers/soc/fsl/Makefile b/drivers/soc/fsl/Makefile index 629dab8..68fcd71 100644 --- a/drivers/soc/fsl/Makefile +++ b/drivers/soc/fsl/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_FSL_DPAA) += qbman/ obj-$(CONFIG_QUICC_ENGINE) += qe/ obj-$(CONFIG_CPM) += qe/ +obj-$(CONFIG_SUSPEND) += rcpm.o obj-$(CONFIG_FSL_GUTS) += guts.o obj-$(CONFIG_FSL_LS2_CONSOLE) += ls2-console/ obj-$(CONFIG_LS_SOC_DRIVERS) += layerscape/ diff --git a/drivers/soc/fsl/rcpm.c b/drivers/soc/fsl/rcpm.c new file mode 100644 index 0000000..ff0477b --- /dev/null +++ b/drivers/soc/fsl/rcpm.c @@ -0,0 +1,153 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2016 NXP + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#define pr_fmt(fmt) "RCPM: %s: " fmt, __func__ + +#include +#include +#include +#include +#include + +/* RCPM register offset */ +#define RCPM_IPPDEXPCR0 0x140 + +#define RCPM_WAKEUP_CELL_SIZE 2 + +struct rcpm_config { + int ipp_num; + int ippdexpcr_offset; + u32 ippdexpcr[2]; + void *rcpm_reg_base; +}; + +static struct rcpm_config *rcpm; + +static inline void rcpm_reg_write(u32 offset, u32 value) +{ + iowrite32be(value, rcpm->rcpm_reg_base + offset); +} + +static inline u32 rcpm_reg_read(u32 offset) +{ + return ioread32be(rcpm->rcpm_reg_base + offset); +} + +static void rcpm_wakeup_fixup(struct device *dev, void *data) +{ + struct device_node *node = dev ? dev->of_node : NULL; + u32 value[RCPM_WAKEUP_CELL_SIZE]; + int ret, i; + + if (!dev || !node || !device_may_wakeup(dev)) + return; + + /* + * Get the values in the "rcpm-wakeup" property. + * Three values are: + * The first is a pointer to the RCPM node. + * The second is the value of the ippdexpcr0 register. + * The third is the value of the ippdexpcr1 register. + */ + ret = of_property_read_u32_array(node, "fsl,rcpm-wakeup", + value, RCPM_WAKEUP_CELL_SIZE); + if (ret) + return; + + pr_debug("wakeup source: the device %s\n", node->full_name); + + for (i = 0; i < rcpm->ipp_num; i++) + rcpm->ippdexpcr[i] |= value[i + 1]; +} + +static int rcpm_suspend_prepare(void) +{ + int i; + + WARN_ON(!rcpm); + + for (i = 0; i < rcpm->ipp_num; i++) + rcpm->ippdexpcr[i] = 0; + + dpm_for_each_dev(NULL, rcpm_wakeup_fixup); + + for (i = 0; i < rcpm->ipp_num; i++) { + rcpm_reg_write(rcpm->ippdexpcr_offset + 4 * i, + rcpm->ippdexpcr[i]); + pr_debug("ippdexpcr%d = 0x%x\n", i, rcpm->ippdexpcr[i]); + } + + return 0; +} + +static int rcpm_suspend_notifier_call(struct notifier_block *bl, + unsigned long state, + void *unused) +{ + switch (state) { + case PM_SUSPEND_PREPARE: + rcpm_suspend_prepare(); + break; + } + + return NOTIFY_DONE; +} + +static struct rcpm_config rcpm_default_config = { + .ipp_num = 1, + .ippdexpcr_offset = RCPM_IPPDEXPCR0, +}; + +static const struct of_device_id rcpm_matches[] = { + { + .compatible = "fsl,qoriq-rcpm-2.1", + .data = &rcpm_default_config, + }, + {} +}; + +static struct notifier_block rcpm_suspend_notifier = { + .notifier_call = rcpm_suspend_notifier_call, +}; + +static int __init layerscape_rcpm_init(void) +{ + const struct of_device_id *match; + struct device_node *np; + + np = of_find_matching_node_and_match(NULL, rcpm_matches, &match); + if (!np) { + pr_err("Can't find the RCPM node.\n"); + return -EINVAL; + } + + if (match->data) + rcpm = (struct rcpm_config *)match->data; + else + return -EINVAL; + + rcpm->rcpm_reg_base = of_iomap(np, 0); + of_node_put(np); + if (!rcpm->rcpm_reg_base) + return -ENOMEM; + + register_pm_notifier(&rcpm_suspend_notifier); + + pr_info("The RCPM driver initialized.\n"); + + return 0; +} + +subsys_initcall(layerscape_rcpm_init);