From patchwork Mon Oct 8 18:21:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jolly Shah X-Patchwork-Id: 10631239 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 9A5DE17E3 for ; Mon, 8 Oct 2018 18:26:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CA572994A for ; Mon, 8 Oct 2018 18:26:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7EC772995F; Mon, 8 Oct 2018 18:26:27 +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,RCVD_IN_DNSWL_NONE 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 300D92994A for ; Mon, 8 Oct 2018 18:26:26 +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:References:In-Reply-To: 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: List-Owner; bh=9yQzKQsehbE3EE6cZG6LMlzXQmN7Wiq5TxIafZt/T8g=; b=cL2qSC7TtjHZw6 l2FdbfWzn0l+jMhhPFA8yaUCAjO17thoDt7ZA9y/3hdTpZF5ImsHbgJ1LIjs08EVkgwC9Xs5+8Ek3 BnmYlmISiGD0cwNuBCVyvWIpUdelio0ASRQizHw+X9wUir3P+h8MpYfVUnx/ARg8jzbfZvIR91Z6+ Sm+VamSq4/iIsBJfpm5Xwlk94TS02SNqoQTKKHWgLb7g5kc6c+9D7yO43s9kL5aZOS8EmeslNPHu7 dED5IoS4KTH+aa29z3gHcS28wbz8aQmmsMBkyzWFBW9z6bok4hitaoRBJDpZRX/3KgnFxGJzhCTdP U7t2J8S941sYZKxOUwqQ==; 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 1g9aEX-0006F2-Ii; Mon, 08 Oct 2018 18:26:21 +0000 Received: from mail-eopbgr730064.outbound.protection.outlook.com ([40.107.73.64] helo=NAM05-DM3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g9aAf-0003HK-Iv for linux-arm-kernel@lists.infradead.org; Mon, 08 Oct 2018 18:24:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SJPK/Fv/6Y2Wo/HsHIWIKsWPfhsni+7rYOSnWVD+Ihw=; b=wM1gtWYdSbjFyEyz5ZbMGxPx70Hw1NGw2kkwi36IAhylKdDRiJRtEb0+W3YaXUrDjVRZb+V0DFkPvtF+5KcHhHcGRmSVzeksHWmel4jt0IsB/VEWpOq5ytbIbKvGcX8VWm+qA508yr/WQs0Knm4Cjj+FbisKhVJddy6zo8ZglRY= Received: from MWHPR0201CA0044.namprd02.prod.outlook.com (2603:10b6:301:73::21) by BLUPR02MB082.namprd02.prod.outlook.com (2a01:111:e400:811::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.1185.25; Mon, 8 Oct 2018 18:22:07 +0000 Received: from BL2NAM02FT048.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::207) by MWHPR0201CA0044.outlook.office365.com (2603:10b6:301:73::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1207.18 via Frontend Transport; Mon, 8 Oct 2018 18:22:06 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2NAM02FT048.mail.protection.outlook.com (10.152.76.109) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1228.17 via Frontend Transport; Mon, 8 Oct 2018 18:22:02 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1g9aAL-0006BA-Vi; Mon, 08 Oct 2018 11:22:01 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1g9aAG-0004DT-SD; Mon, 08 Oct 2018 11:21:56 -0700 Received: from xsj-pvapsmtp01 (smtp2.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w98ILtjL024115; Mon, 8 Oct 2018 11:21:55 -0700 Received: from [172.19.2.91] (helo=xsjjollys50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1g9aAF-0004D8-9F; Mon, 08 Oct 2018 11:21:55 -0700 From: Jolly Shah To: , , , , , Subject: [PATCH v6 2/4] firmware: xilinx: Add zynqmp IOCTL API for device control Date: Mon, 8 Oct 2018 11:21:44 -0700 Message-ID: <1539022906-18073-3-git-send-email-jollys@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539022906-18073-1-git-send-email-jollys@xilinx.com> References: <1539022906-18073-1-git-send-email-jollys@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(136003)(396003)(346002)(376002)(2980300002)(438002)(199004)(189003)(446003)(14444005)(77096007)(126002)(11346002)(36386004)(106466001)(36756003)(486006)(2616005)(356003)(476003)(2906002)(7696005)(478600001)(217873002)(186003)(44832011)(72206003)(26005)(51416003)(426003)(54906003)(305945005)(336012)(106002)(76176011)(5660300001)(2201001)(316002)(9786002)(81156014)(8936002)(47776003)(4326008)(63266004)(110136005)(107886003)(48376002)(50466002)(16586007)(50226002)(6666003)(81166006)(8676002)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR02MB082; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; LANG:en; PTR:unknown-60-83.xilinx.com; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; BL2NAM02FT048; 1:+qgce/otNyuaDyP+PQ6aUZIz8NsiUuDSeTku022BeElS14fK8b/BA4huCKnyiILXshm8m0Apb8pPL5aeOmvt65fSjUexlEOqE9HkJe7Umm4NrvDDoHJv1MI0jqmDAA7k MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 11d2a5ac-df41-407d-ed0d-08d62d4af377 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060); SRVR:BLUPR02MB082; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB082; 3:TrKzz8zLNZs05vP5Z3yXHQMcL89NDXFpdpZ6YDQ/67HdZCKbPlVl8w3XducUZ4f7Q3Ok2Wo7bTHpX1OdHfdCq4JyaupBjSsVohWZJGturhLMH10IGyp2IRgzeCwqQZjFGeYlzU/d0ZHW/8dSIVjPjuRIhHWw2GKPqCcgmYJpiakG5/wP1DgCfsEZSqHjzkA/hXqzSpnaCs1Ti1w4hPVNjMId8yp40leOU5ZPpekVk2Fs5pMsSsyAwVeLL8AaU5G6/Oo3fOnWHhWg18wfoqA/ocinHs/5vN2lSnrO94Q8XNVjQV1WwPdQMsbDXlakEejBwUoziJIS6hjjtjWUxxWgFypGFuHVbEVuOayWoyWynB8=; 25:UD1rekE5t+b7k5T1DApSRT7Xi4Dl2Uwnrq+UsIaM74G8AgeJRJ3khnzWaahYONFiKHFdnCVKYli+3n1dTsYdZPokeCgOpj7H+Za9p/BCi70lk9vdQhVtYBdnpNB2XWqvkcxa0kcPwrhfzbTPlMRUauleQQVBm2P6C+epHUlN84Q6x5R8vAVQMgP+qkSjRRAfvtIP5NElHMMDhOQ7ziYRv1DzlTurdtwtqsYl5/I68DJl1ZNto92zr6cioOXfDZLz6f44UD3knxFZdvUCEiOJKNrCLe4TffjsyUP27DCwt80CzEQTPjcO8CFXp8GoeRhaZP1P/vwwgjRoVS5XjSuqmQ== X-MS-TrafficTypeDiagnostic: BLUPR02MB082: X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB082; 31:RmZFTEnV7Izh5vArU2dharnySM/7eGRekA21bkmaGwZx7LKtbXOQ5TXFGGulRpbjr4tWEN3Q0MP1+3KAC4+9qP7+51YAfBkSEk7L10i5DNpnckEUuz29U44+Du7eMe4cTKL5kmKzAF/zA3EbTUDAA6W9ovMWFj72JFVQfDm6pkDJ3IpWktPOCrU6clW7uP3swF8UWvNhF0OcX0eo/5E7ttcHz99hHiWuS+xo5IRFKuQ=; 20:0o15uhfbkvbJBSuyLswJIDOEhTAWW97EJGkIgcmX0LyaA6rrM4HlxgxT5WNKwCklHQJNVIUhyLp3BbjKrzBtFxzhatXxV5SgKG1yDBgY+OltbQewCTfoiwA4P+DZFnm9BYDAHh5bqysq4HuPv6kvZGU4xeO3D7F+VzsSLzCGlCsJSdZVwib16X/G3vruWty/CxaScFmPJ+qjkuMNy9t9Z1Cdr+Q7OjeAGBPIEp6QB312kFpYH5W8euDsdBHIIqSKEKuDONNGSaY2tVk5Bk3XEcgLqgpRaXeFFmTdvanuD3K113SuIGpSdmCjtB8EnIAEhc+IVm4IKZmKhKYeQYud0oGPD4DZfsOMZuvuyqmWiaNAapB/tLZmbsnBcZrfKA9bR59J7SW0uG5LXXc9d3ayN56KwwYr4+rU151xvvuL6yrl1foHvfuA31+NKH3ObmANIHDRHOIARZ2v7siX6OniFoRt6TmosA3kYEbKgXN2w0R2i0lRQW0oyvJeKDh5Tg8v X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93004095)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(201708071742011)(7699051); SRVR:BLUPR02MB082; BCL:0; PCL:0; RULEID:; SRVR:BLUPR02MB082; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB082; 4:QmagnLu+jJsFd0ZEd+/BwskICMxAOdE5bGwCxk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eMhZbJSz5oyxAT5kJY+eH83LYyON3JKTLGk+LI/6z6nKDQCdSZ4hz8Bpa1sSbny4tcOMrPpY3IY6fNW5hdG7XsGbYnMu4EkpVRSLy9WWlF6tM/BX5X+5aIa+NCVi/ZDGzytwfCtKvg8LdYalDpiHqijGsFhFnLNnbkXRn7B/EbWBk5IgaApKmP+iPslqvf5Ja6XEbCfkQFPX2Jx2Kum1CL04hswPTBd3lpEaurTQknBE5oBvnhthGfD9InC2C5vLEMBxfw9Xk4jjfior7QLq89I1OeyJvjfBwiB36twYiChVb5H5GcQ==; 5:MIqQbKuYkfItf/WCDD0tK4ndPg+ZjBLPZhwZf4iPCyUSXjUYneKOmkJIJByXqVT0MXshmhJr0njrwrqkbF46QMhxl+q+xsqNBVG+lv2GE6iVb9HK9MqwvSKkqClXUtK73hnIEJIOvJiddPfTdPVkiAoaM90UiByGb8kBRu/O30A=; 7:i7zVviy5/V15HpHEJ5Ey7SDbcl+IAXyjTBEEEn4biveTFS+BtBAia1DyF2Eu3W6kMyjh5u1SdT457qtVtqSwRiZR1iSgitR7pI/bP5IUac8YRQ8zUTKAsEdWUn9RcMzBck8KpDEZMYK10oRkGjGgMTJz1dSZcxMawG0i4ihkUGYDAC91hXwlEuykv0Cr9egppejdP60qlYk6J+SmffZl8wXyT2TcqMqE3IVBOC7mlLXZsClEAoz/tp5KkYaCZ4x0 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2018 18:22:02.7868 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11d2a5ac-df41-407d-ed0d-08d62d4af377 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB082 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181008_112221_689478_2BCE1D69 X-CRM114-Status: GOOD ( 12.07 ) 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: Rajan Vaja , rajanv@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jolly Shah 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: Rajan Vaja Add ZynqMP firmware IOCTL API to control and configure devices like PLLs, SD, Gem, etc. Signed-off-by: Rajan Vaja Signed-off-by: Jolly Shah Acked-by: Olof Johansson --- drivers/firmware/xilinx/zynqmp.c | 42 ++++++++++++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 4 +++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index 84b3fd2..9a1c72a 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -428,6 +428,47 @@ static int zynqmp_pm_clock_getparent(u32 clock_id, u32 *parent_id) return ret; } +/** + * zynqmp_is_valid_ioctl() - Check whether IOCTL ID is valid or not + * @ioctl_id: IOCTL ID + * + * Return: 1 if IOCTL is valid else 0 + */ +static inline int zynqmp_is_valid_ioctl(u32 ioctl_id) +{ + switch (ioctl_id) { + case IOCTL_SET_PLL_FRAC_MODE: + case IOCTL_GET_PLL_FRAC_MODE: + case IOCTL_SET_PLL_FRAC_DATA: + case IOCTL_GET_PLL_FRAC_DATA: + return 1; + default: + return 0; + } +} + +/** + * zynqmp_pm_ioctl() - PM IOCTL API for device control and configs + * @node_id: Node ID of the device + * @ioctl_id: ID of the requested IOCTL + * @arg1: Argument 1 to requested IOCTL call + * @arg2: Argument 2 to requested IOCTL call + * @out: Returned output value + * + * This function calls IOCTL to firmware for device control and configuration. + * + * Return: Returns status, either success or error+reason + */ +static int zynqmp_pm_ioctl(u32 node_id, u32 ioctl_id, u32 arg1, u32 arg2, + u32 *out) +{ + if (!zynqmp_is_valid_ioctl(ioctl_id)) + return -EINVAL; + + return zynqmp_pm_invoke_fn(PM_IOCTL, node_id, ioctl_id, + arg1, arg2, out); +} + static const struct zynqmp_eemi_ops eemi_ops = { .get_api_version = zynqmp_pm_get_api_version, .query_data = zynqmp_pm_query_data, @@ -440,6 +481,7 @@ static const struct zynqmp_eemi_ops eemi_ops = { .clock_getrate = zynqmp_pm_clock_getrate, .clock_setparent = zynqmp_pm_clock_setparent, .clock_getparent = zynqmp_pm_clock_getparent, + .ioctl = zynqmp_pm_ioctl, }; /** diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index 015e130..7a9db08 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -34,7 +34,8 @@ enum pm_api_id { PM_GET_API_VERSION = 1, - PM_QUERY_DATA = 35, + PM_IOCTL = 34, + PM_QUERY_DATA, PM_CLOCK_ENABLE, PM_CLOCK_DISABLE, PM_CLOCK_GETSTATE, @@ -99,6 +100,7 @@ struct zynqmp_eemi_ops { int (*clock_getrate)(u32 clock_id, u64 *rate); int (*clock_setparent)(u32 clock_id, u32 parent_id); int (*clock_getparent)(u32 clock_id, u32 *parent_id); + int (*ioctl)(u32 node_id, u32 ioctl_id, u32 arg1, u32 arg2, u32 *out); }; #if IS_REACHABLE(CONFIG_ARCH_ZYNQMP)