From patchwork Wed Jan 30 13:30:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Baluta X-Patchwork-Id: 10788591 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 BBD686C2 for ; Wed, 30 Jan 2019 13:30:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A911F2ED9C for ; Wed, 30 Jan 2019 13:30:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D6A72EE0F; Wed, 30 Jan 2019 13:30:32 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham 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 A3A902EDBA for ; Wed, 30 Jan 2019 13:30:31 +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=bMQm5Elk3rQ3skIxDfAjESFEnNAp7DEcryerm3J02nw=; b=jIk29Vx63qXH0o ovOHpComXhqYUVHJv4nvfbRRzTLTDrlIK8XKfwHtD2V7DhWXP13P0mFigQypgZreKW25Vb6cNr1TJ 1KZt6m6CuNK74wY8IcQpjr/1BD27yYTYr3BhfOG5nmNHQkw5JwgfnM98KC99fGY08vI8B6chEZp+K mRTThxlmdV598hxi88zVWSYl7G6xBEn9eYaPg2QBs0L7oWcvYOQ2GjpFmLS0Kf/cB8Jv0QjIaXYeP jjsFTaFRHKBrYm7VHfPF+vn8rYB1om5PnHw581cqCvG/UP6pO5jv7OzP6qeY6Xsinh4ZEJYrKl3pO pngRG3tUJQMtia550V3Q==; 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 1gopwi-0001DM-Vz; Wed, 30 Jan 2019 13:30:28 +0000 Received: from mail-eopbgr00077.outbound.protection.outlook.com ([40.107.0.77] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gopwf-0001Cj-JJ for linux-arm-kernel@lists.infradead.org; Wed, 30 Jan 2019 13:30:27 +0000 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=+44zd2N88E7g372vp7/pGqImutQ9Of5DsUkkVHJSAUM=; b=HwwT/jZlOPG4YQ2yizq4ICIseOWbxJG5/9dhVd3/0ZzTzsJEmRctOn/gHJQMo/xkkKMiU7u+NapemFurlxhhekDWLJWdy0ixetcNi/MPSocM942AJc/HhrmBCQz+ZZyy7UIy1ClU+/ObOlO/Yp9FJHARZlF6fjsL20kN2Zpq9LA= Received: from VI1PR0402MB3357.eurprd04.prod.outlook.com (52.134.1.18) by VI1PR0402MB3805.eurprd04.prod.outlook.com (52.134.16.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1558.21; Wed, 30 Jan 2019 13:30:22 +0000 Received: from VI1PR0402MB3357.eurprd04.prod.outlook.com ([fe80::2d83:eb90:f977:f649]) by VI1PR0402MB3357.eurprd04.prod.outlook.com ([fe80::2d83:eb90:f977:f649%3]) with mapi id 15.20.1580.017; Wed, 30 Jan 2019 13:30:22 +0000 From: Daniel Baluta To: "shawnguo@kernel.org" Subject: [PATCH v3] firmware: imx: Add support to start/stop a CPU Thread-Topic: [PATCH v3] firmware: imx: Add support to start/stop a CPU Thread-Index: AQHUuJ/zljwGGsgqVEqW1pCa+zHOeA== Date: Wed, 30 Jan 2019 13:30:22 +0000 Message-ID: <20190130133005.5732-1-daniel.baluta@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1P190CA0003.EURP190.PROD.OUTLOOK.COM (2603:10a6:802:2b::16) To VI1PR0402MB3357.eurprd04.prod.outlook.com (2603:10a6:803:2::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=daniel.baluta@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [95.76.156.53] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR0402MB3805; 6:hEAbz7+LBFeqVrtlmf5sapoD45lqWWgqXFdw99lQNGFLSkS5zIy4nNNdb+OejPN8V/PPpiIqe9r0Y+gZHh0QTnfDTNszztyZ2KaVlJfaR8LjUIp4SNkfHo5emJEdwanfx/ohMAjxBdGFo63ofA510phPsPNIV0ge9wO4LGDilQs0beFJPpgXu9pDs0wAMlVTEAHGRZDKwH2B6/ZfhFivezBS2sYPXnKE046vgGvDGc/XrSPxB5RL5Kb0mzpkd6yqMrswjlRqulne95cc8wQeVB35kCKlXfKbwwaxR+UCCRJjyrDKWknTnvsjdcF+twECqiiEv1daKFnuUyEhfV566OueupRyvrHgddE1EjuG0KrIB2UvrdVuAUf5s796uklinF1WAWiaFUCAQ4KWAb3MSH9fhWaJ8Nehtuj4eW/ammqvhrkX3N4+liVW71WGLUq3zwkwy3AemD61cQrAe7jXjg==; 5:Y5933ZQEISt/aIxLlWE00aQruaf8natQ4QtLy28jeO95warjj6sf9ZNptR8CPC4PypnC3fyBeIb9fg6sOJvhehBvPVlepanzKyTHuDyl1aIzOgKrKtkEhnZjy3lK0sCuQ7MpWwH9Hjoqu07LV62S+/e/tFePnFJij4qFw/ZnC095aFxRTbthsXQP5HVr1hawN7qcSZ9D2glBnwutS1j9/A==; 7:noBQ2hheIFc6bN7SsQiAmaMBeTJB6p+bJxhRBcshlhq4Fi4Jdv96RadPEyNcKvw3U/jPVe5gB6baogYWSQuVTO7S9hIqaGLe9M2pi/vFUy9vqRMtIpxnbeE/Y02sdApdq64foDrkooTjyvUVB9lMvQ== x-ms-office365-filtering-correlation-id: 154e7b1c-0d1e-499a-fbdd-08d686b71584 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0402MB3805; x-ms-traffictypediagnostic: VI1PR0402MB3805: x-microsoft-antispam-prvs: x-forefront-prvs: 0933E9FD8D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(39860400002)(366004)(396003)(346002)(199004)(189003)(5640700003)(97736004)(478600001)(106356001)(6116002)(3846002)(6486002)(105586002)(7736002)(25786009)(8676002)(305945005)(2906002)(66066001)(1730700003)(8936002)(81166006)(81156014)(14454004)(6436002)(6512007)(4326008)(50226002)(68736007)(2501003)(2616005)(54906003)(86362001)(186003)(39060400002)(99286004)(26005)(6506007)(52116002)(71190400001)(256004)(102836004)(476003)(36756003)(71200400001)(486006)(2351001)(1076003)(386003)(316002)(44832011)(6916009)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0402MB3805; H:VI1PR0402MB3357.eurprd04.prod.outlook.com; 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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: RpbCOVrMfi29AyMpN5pgt5ZHHvXYDuAfBKV2C6xG0c9Qtn1yncs/m7MGVJ+9qUpjy2lNw/zchm86M9QXagT7oFJAtHtSCJ7QIYvfZwHZyu3BmgjjI0dlsSwBTLA6C/Z7ZXyBAUCsH0+LRG/j+6zVFf02g4+jTT/2Eeek4bAqO1y3W1K3BYEeaim38nSHI6EKdqPBS7mrkvwCKk6BELetIOdELZqD4TKd4qXAGxbdCtxe8SMz7scE7YTAWqruR0mo0RseHfOfmf+pYLQidm+i/9n8pnqK6g9e/cOkCy/tlGqvtT6ECWqqUZOJ3y1UY1qDGqMKLOgCbG1pd4ozW+3V515sHKk2zA9b89FKQi0uhjOYnyT1JwQlxaxD68vox1WfN9X4h870tpyipeGj+il0IA5Qy1s7toB8egCMOv5Ly3o= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 154e7b1c-0d1e-499a-fbdd-08d686b71584 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jan 2019 13:30:21.2924 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3805 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190130_053025_645418_33473385 X-CRM114-Status: GOOD ( 10.78 ) 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: Aisheng Dong , "daniel.baluta@gmail.com" , Daniel Baluta , "s.hauer@pengutronix.de" , "linux-kernel@vger.kernel.org" , dl-linux-imx , "kernel@pengutronix.de" , "festevam@gmail.com" , "S.j. Wang" , "linux-arm-kernel@lists.infradead.org" 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 This is done via RPC call to SCU. Signed-off-by: Daniel Baluta Reviewed-by: Dong Aisheng --- Changes since v2: (as per Aisheng's review) - rename address with phys_address - remove unnecessary uint8_t cast - use 'true' as last parameter of imx_scu_call_rpc to actually wait for a response from SCU. drivers/firmware/imx/misc.c | 38 +++++++++++++++++++++++++++ include/linux/firmware/imx/svc/misc.h | 3 +++ 2 files changed, 41 insertions(+) diff --git a/drivers/firmware/imx/misc.c b/drivers/firmware/imx/misc.c index 97f5424dbac9..4b56a587dacd 100644 --- a/drivers/firmware/imx/misc.c +++ b/drivers/firmware/imx/misc.c @@ -18,6 +18,14 @@ struct imx_sc_msg_req_misc_set_ctrl { u16 resource; } __packed; +struct imx_sc_msg_req_cpu_start { + struct imx_sc_rpc_msg hdr; + u32 address_hi; + u32 address_lo; + u16 resource; + u8 enable; +} __packed; + struct imx_sc_msg_req_misc_get_ctrl { struct imx_sc_rpc_msg hdr; u32 ctrl; @@ -97,3 +105,33 @@ int imx_sc_misc_get_control(struct imx_sc_ipc *ipc, u32 resource, return 0; } EXPORT_SYMBOL(imx_sc_misc_get_control); + +/* + * This function starts/stops a CPU identified by @resource + * + * @param[in] ipc IPC handle + * @param[in] resource resource the control is associated with + * @param[in] enable true for start, false for stop + * @param[in] phys_addr initial instruction address to be executed + * + * @return Returns 0 for success and < 0 for errors. + */ +int imx_sc_pm_cpu_start(struct imx_sc_ipc *ipc, u32 resource, + bool enable, u64 phys_addr) +{ + struct imx_sc_msg_req_cpu_start msg; + struct imx_sc_rpc_msg *hdr = &msg.hdr; + + hdr->ver = IMX_SC_RPC_VERSION; + hdr->svc = IMX_SC_RPC_SVC_PM; + hdr->func = IMX_SC_PM_FUNC_CPU_START; + hdr->size = 4; + + msg.address_hi = phys_addr >> 32; + msg.address_lo = phys_addr; + msg.resource = resource; + msg.enable = enable; + + return imx_scu_call_rpc(ipc, &msg, true); +} +EXPORT_SYMBOL(imx_sc_pm_cpu_start); diff --git a/include/linux/firmware/imx/svc/misc.h b/include/linux/firmware/imx/svc/misc.h index e21c49aba92f..031dd4d3c766 100644 --- a/include/linux/firmware/imx/svc/misc.h +++ b/include/linux/firmware/imx/svc/misc.h @@ -52,4 +52,7 @@ int imx_sc_misc_set_control(struct imx_sc_ipc *ipc, u32 resource, int imx_sc_misc_get_control(struct imx_sc_ipc *ipc, u32 resource, u8 ctrl, u32 *val); +int imx_sc_pm_cpu_start(struct imx_sc_ipc *ipc, u32 resource, + bool enable, u64 phys_addr); + #endif /* _SC_MISC_API_H */