Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp742909ybx; Thu, 7 Nov 2019 02:00:56 -0800 (PST) X-Google-Smtp-Source: APXvYqyY8CXgXgUbg5azEffNX5pXtTLd/JuEIH1crVdYLX9jScMeRaLSYFV5lGzFkD4xzdybKW4D X-Received: by 2002:a50:ae26:: with SMTP id c35mr2588889edd.55.1573120855963; Thu, 07 Nov 2019 02:00:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1573120855; cv=pass; d=google.com; s=arc-20160816; b=RLRWURDQJB1lUbtzSKTW6aVQN/qU2zwRLFZXL4OURVm/WGt15DJOMkGhUDi8e+ps8x rpjR8+815GGhM40Mfj6IajzBd24HVKHnQ9/PB9l8pw0w/U4OO5G2MJ0qAqRvMIhzw98L 2xASaOApIYNYXCjxQYymgmC0hjrR1PG0ys8xcbBQblsj4J9+grIsKlZY++0zHTDcilKK vjSBt3vuYYgwnNcmPe7avnpOI35q5D2eKUqvIsr8WUlIW0GbhhykO2+U8XngsYheGAQo a5rwfGTwDIWPiazrXkBpYMkrpthwFWC5vdE7gGodKilONW8UcIXTccMu5r4WAhnrOlpS XYqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=utnQmyOC7DmJloCvFG9Re5bMwKQqSTdIudL3gjCpA68=; b=lJQFsjppEPd2MuAEcJxxO2CqUuNemcNXZUiemYGt5n6PYf+8gio1Lv+RCbu+ELFUCo ExMp+mKSdOCK8b4b3SY+E6pgA3VfiA9P7tYCmh+BnxHcZTu27zL+POrKu8PuwdWxRGIF dpMzOfvkEKzaqoW0RdyC9vN3ZE+rKNea4bI/bAr+6fzOLiSTgVLb/k7Mgsj4X90fYiT4 yLXTRnAPAsESidT5wX3co4ZZLaZ7zAEmMrVzFQ8207m6rihIuRbp15+Hf+Nw3LjRXAaT bw1W7duVApswBU3NeOTddm2KVDiS0/zlu/zxqvZey3KE9feMUjBe85+GAYi6d9htzH73 tEyQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=SyZp80y9; arc=pass (i=1 spf=pass spfdomain=xilinx.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v4si1101885edm.299.2019.11.07.02.00.31; Thu, 07 Nov 2019 02:00:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=SyZp80y9; arc=pass (i=1 spf=pass spfdomain=xilinx.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387980AbfKGJ71 (ORCPT + 99 others); Thu, 7 Nov 2019 04:59:27 -0500 Received: from mail-eopbgr750084.outbound.protection.outlook.com ([40.107.75.84]:42805 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727434AbfKGJ70 (ORCPT ); Thu, 7 Nov 2019 04:59:26 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OkYP/R3SqDW5dD7EI5JYpPsLKKsuegYi3X1YHJR5mqVttbjzaf/evlBZH26WaAhAVzfPDH8IiVe4Si8xCtvkxVp/KQ9hYFr0EcvPNYZ4JLW1YTbIIr0hS1CfWklgromWLJV32dqn/nT/30Z6+HX7xc0J4zDCQ4YegKalUDTbgHmJVhvW8yFPPTzUInIPOr8Q1hi3sxK9rRmgh6kfI4v+nCCGD5HLxkTtJkbPXfJ94E2+K4S44Oepv7+AH4SmseI6Nnq9B4O2v1BTGjSeM8Ezy6SWSXzZccDrULANCEmCosi8WGxUh5PdBMysiSr7AunZLRSlcZHPiHWFJtDvb9o7Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=utnQmyOC7DmJloCvFG9Re5bMwKQqSTdIudL3gjCpA68=; b=BfmXpgaXDhGIK3+wFW4W5QWSrzX3WX+TvEP3w0lqqygESwyGVCb0tDsJZLd0ZUS6kkXnRXM1TpyKneMzv2sVK364bi+mZqwQpeT/pW5KqUihLhTk3vU6kVXjPJPZQxB8m9ph0pf6IxQpkUa7bu1F/EDYkRF2J+Y3/ROp2kYW9SNhlBOy8XOU9LcuEfMyerk44vm4Dmok09E3PaDdTuNamVtO6x+IopQ0uJx/50/YdKqZp8xJ+2eLQCQI9pMbJlqRF6PqVN9OV6/rjxRaAf3cqTgiYWO7Tt0qqI0HJrLluBzu91ptjoDVc4lq85rlUsN5RUGXK3n/mLwfCbFqOBzj2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=utnQmyOC7DmJloCvFG9Re5bMwKQqSTdIudL3gjCpA68=; b=SyZp80y9m5w74fCbnLkZ2FoVXzPqdKw6SqeDISlttjdZV9fFAwhGyvnM+NWq1zWruheM2nsdU5FSSnZu+boXv6/PsIsEYwjI0KNaebSwK1VMT5yhIPPc4upfeLuOhXhvP2Uge5QfEOWSG4HQL5b9pA4TRlBBpKtd0GwF23dnSAs= Received: from BL0PR02CA0030.namprd02.prod.outlook.com (2603:10b6:207:3c::43) by BYAPR02MB4071.namprd02.prod.outlook.com (2603:10b6:a02:fc::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.23; Thu, 7 Nov 2019 09:58:43 +0000 Received: from CY1NAM02FT030.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::206) by BL0PR02CA0030.outlook.office365.com (2603:10b6:207:3c::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 09:58:43 +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 CY1NAM02FT030.mail.protection.outlook.com (10.152.75.163) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2430.20 via Frontend Transport; Thu, 7 Nov 2019 09:58:42 +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 1iSeYs-0003CH-EO; Thu, 07 Nov 2019 01:58:42 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iSeYn-0003c6-Bm; Thu, 07 Nov 2019 01:58:37 -0800 Received: from xsj-pvapsmtp01 (xsj-smtp1.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id xA79wRSK016564; Thu, 7 Nov 2019 01:58:27 -0800 Received: from [172.19.2.91] (helo=xsjjollys50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iSeYd-0003bQ-4g; Thu, 07 Nov 2019 01:58:27 -0800 From: Rajan Vaja To: mturquette@baylibre.com, sboyd@kernel.org, michal.simek@xilinx.com, shubhrajyoti.datta@xilinx.com, jolly.shah@xilinx.com, nava.manne@xilinx.com, tejas.patel@xilinx.com Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rajan Vaja Subject: [PATCH] clk: zynqmp: Warn user if clock user are more than allowed Date: Thu, 7 Nov 2019 01:58:14 -0800 Message-Id: <1573120694-6015-1-git-send-email-rajan.vaja@xilinx.com> X-Mailer: git-send-email 2.7.4 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)(4636009)(376002)(39860400002)(136003)(346002)(396003)(199004)(189003)(36386004)(36756003)(106002)(50466002)(426003)(14444005)(26005)(16586007)(4326008)(336012)(356004)(5660300002)(48376002)(186003)(107886003)(6666004)(478600001)(8676002)(81156014)(81166006)(44832011)(70586007)(2906002)(305945005)(8936002)(70206006)(47776003)(316002)(486006)(51416003)(6636002)(476003)(7696005)(126002)(2616005)(9786002)(50226002);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR02MB4071;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1;MX:1; MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ce7d3cd8-b394-47dc-217d-08d763691294 X-MS-TrafficTypeDiagnostic: BYAPR02MB4071: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:513; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rwh0KwULzVcdgxeNTwHHJf/K14baqh0Q+GOO0etdUcRxbcEFM8+lA8OS8jKAuV4O8/fT3k5hJ+jqsal+pyypUmu7MvB2vgh0SUvKNFQvOjLGbQGcoP4CZZS92SYCz8htUKXf4AMQP3qQJfePVkC3sS9MAgvb/oqX1NHbt09J9jLkPtr/ZV4jxjRTV0Eagpxkbb982n314ZjoIlmAXxNl06FvQ+asPaYAQ90DuBmYwR0u9dLpiVz3QBNEsMfdzY3ElXL4tq08MZzd7eQ8gEV4T3x+85Ao8EKXBuvMrroCGpJNtUesDNtKPoiwevz6GNsSs7Vj7PXNlpX8GyF/QBw5p5AwVseTUufhkdFN5OO7WAWIUp5xY/5fQAh5ueDnegSWLUJlOGQi8QRjsnsNXdBU9dvOrhvKFQRPyfhuauKMe/zMebpwrmwToQ4C5tK5Dp9P X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 09:58:42.9227 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce7d3cd8-b394-47dc-217d-08d763691294 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: BYAPR02MB4071 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Warn user if clock is used by more than allowed devices. This check is done by firmware and returns respective error code. Upon receiving error code for excessive user, warn user for the same. This change is done to restrict VPLL use count. It is assumed that VPLL is used by one user only. Signed-off-by: Rajan Vaja Signed-off-by: Michal Simek --- drivers/clk/zynqmp/pll.c | 9 ++++++--- drivers/firmware/xilinx/zynqmp.c | 2 ++ include/linux/firmware/xlnx-zynqmp.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/clk/zynqmp/pll.c b/drivers/clk/zynqmp/pll.c index a541397..2f4ccaa 100644 --- a/drivers/clk/zynqmp/pll.c +++ b/drivers/clk/zynqmp/pll.c @@ -188,9 +188,12 @@ static int zynqmp_pll_set_rate(struct clk_hw *hw, unsigned long rate, frac = (parent_rate * f) / FRAC_DIV; ret = eemi_ops->clock_setdivider(clk_id, m); - if (ret) - pr_warn_once("%s() set divider failed for %s, ret = %d\n", - __func__, clk_name, ret); + if (ret) { + if (ret == -EUSERS) + WARN(1, "More than allowed devices are using the %s, which is forbidden\n", clk_name); + pr_err("%s() set divider failed for %s, ret = %d\n", + __func__, clk_name, ret); + } eemi_ops->ioctl(0, IOCTL_SET_PLL_FRAC_DATA, clk_id, f, NULL); diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index 75bdfaa..74d9f13 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -48,6 +48,8 @@ static int zynqmp_pm_ret_code(u32 ret_status) return -EACCES; case XST_PM_ABORT_SUSPEND: return -ECANCELED; + case XST_PM_MULT_USER: + return -EUSERS; case XST_PM_INTERNAL: case XST_PM_CONFLICT: case XST_PM_INVALID_NODE: diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index adb14bc..a3b0a39 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -89,6 +89,7 @@ enum pm_ret_status { XST_PM_INVALID_NODE, XST_PM_DOUBLE_REQ, XST_PM_ABORT_SUSPEND, + XST_PM_MULT_USER = 2008, }; enum pm_ioctl_id { -- 2.7.4