Message ID | 20230320182441.11904-2-sumitg@nvidia.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1375140wrt; Mon, 20 Mar 2023 11:43:29 -0700 (PDT) X-Google-Smtp-Source: AK7set9Wb46gWn6fZM95q9xyXaRHi5PsrZJzR1AH7BDSu2uTMkEvKdt6bIM7dLTbaU372yC1MWi8 X-Received: by 2002:a17:902:d4cd:b0:19b:dbf7:f9ca with SMTP id o13-20020a170902d4cd00b0019bdbf7f9camr23016605plg.0.1679337809584; Mon, 20 Mar 2023 11:43:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679337809; cv=pass; d=google.com; s=arc-20160816; b=CT6p9Mym8l+m/c/lbfTwF4Pm0Gg9hzrxvZdgSHdl0VcL3s3tyJPQuAVFm4VWPJfDyV AyiPsMVjVaE/2tJkCwnIOQUtn6ITADMfJXD0OoxTNguUB0QvV4bTRV3+VkawNn41HmY3 KKayBU/dS7KhesRngLUEK2bRBh5mdDauOtemp1l2UN2eZF92LTLqGtPoQSFzd0y9iAMx 1BzoO8lfEgm784YjzTS8Kshkv3ah4HBFGlNUl7wsvCegCmCaJ16eS1c1bIBjOCN1MnG4 FzwQkRb5Qr9dsYpCFu9f75N3pAK3wiVk4N/hyrIPqG+Nx9K/6OTFtz265F3Ny2W3IieP Sqbw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ZY7hBPAPyidQC30WF7UQ3BbHzOEMRgFy/GmbkaFA/xQ=; b=ze0unajd/HQBsBYuElOY2UbrP7zM7KIuPo08Z17+IoHkT99sWxF3BF9Ejms74vJRQD onBJ8t0hZTgNSoh6pOLf7PIlHjqlFpvjHk+TQaA36dBdY6qa1fbvhC6fnlaA6gzmWwEp 5QxqAFGS00EYGZwDTw9i4KJ0Kg4A4FC/+6JGf3yTxpnN4190oEaeQO2KxsOqoRVevkRW SpDlowi+ZK5DnQdsqPFVc3TUtdfnWgCD8KJVAolR8A4K6J2n0RGcf+L9SCG/VB2JbEt9 Y7z3jC49evcxknV+rPr9QjWnPprCStvsbquxfV3m4TJNQRSGVSfLtQ+TDGvStfsuua3L LEmg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=PvMvX127; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lg5-20020a170902fb8500b0019e25cff4f5si10252301plb.617.2023.03.20.11.43.13; Mon, 20 Mar 2023 11:43:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=PvMvX127; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229867AbjCTSeU (ORCPT <rfc822;pusanteemu@gmail.com> + 99 others); Mon, 20 Mar 2023 14:34:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231206AbjCTSd4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 20 Mar 2023 14:33:56 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2065.outbound.protection.outlook.com [40.107.244.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3CE86EA1; Mon, 20 Mar 2023 11:26:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oXYgdsLDW3tSMC+eSHVftyatopk/i6CXHA/blOfH7PLYex8AiCzvN/Np7iwZ/TLfnE7p0xXKSkLOdSYcBlTtkHcnxv3rVj0Ke2tvTA33MvvSCE9ncRK3gDq8XrXK+L5JpEpoMbga5dVrfE++2MZZiFC+nhQ4DlscwajYXQW+wAViwc90D/Frvxmee3z9MsImfKaIyqbt0hh1zrwHeeTNPkS9rCZHM4rcLQt58bc7fqV41u3nd3futuKDYnM9oQOSun0NoOkCEtYuOHdE6I4dVMj/gMz0ZxeJKx0mOLhUYKjqWKWpV+kUBF8V8OjEQSoCh+boYDYEHj4b7c+cbZRC4A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZY7hBPAPyidQC30WF7UQ3BbHzOEMRgFy/GmbkaFA/xQ=; b=K0dvzQTrCEO4TE1y7IQ3+S41ZQDR+7YBuC6Dpzal3THrZEsFR+ss8CGxzp9kJHi3WhdXFDdCeC/90+Xl1nwM6sh9kym8F7UKFrv3hlDbJu6dtGCWM9edrnkGaRJGaKubW6QD4pHqB/NNzcNcbGGFe8yGfC0UQ/uMVXr0xDWDqEp+JNWEyyAVBo3Z2VDSpYbSIvRtSjuI7pKbdVuc4clLQh4rAzGL01+KwyiouKW8AQXyHxeofMQLFQE64V/b0OGkubLOp3VWfAoegixkBEr/rO/GqGSDfsfybBqNXoA0CW4T6L9bU/0p4SIS2kyWAPxcy8gYf3Pw32k190mnxJn8AQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=google.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZY7hBPAPyidQC30WF7UQ3BbHzOEMRgFy/GmbkaFA/xQ=; b=PvMvX127qXl5WYitlBmsy5plMsG1gZpwNzAhYwR8x7HsGxLzd75udihDBtdinFFzZRNxs/ohWuJfljE4nyXHGXpVuKk8qm5f4iRYTzRyG1uR0lSgQe/PlfFjkwoeoOgSER21NnzRYN2Lg+5uLuGVIkXR4Myf+ZmL1A3fgPbGX+yh89YtbDU8ZjnV4J+uTlb9DwCdhnMlJLsOpPjHV2iqX1siv+bHOUz0kHk8XmDg81ogK18np+MxJ1blsxLAEuvlEFVEwpHqduYMHJPfVueh0DnI+qZv4ZzX0OAlfyB34gua8soXLdy2A1SoFxwAYdonEPcJyhA6pBxoLXEn1tYj4g== Received: from MW4P223CA0021.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::26) by DS0PR12MB7725.namprd12.prod.outlook.com (2603:10b6:8:136::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Mon, 20 Mar 2023 18:25:24 +0000 Received: from CO1NAM11FT112.eop-nam11.prod.protection.outlook.com (2603:10b6:303:80:cafe::1e) by MW4P223CA0021.outlook.office365.com (2603:10b6:303:80::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Mon, 20 Mar 2023 18:25:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CO1NAM11FT112.mail.protection.outlook.com (10.13.174.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.16 via Frontend Transport; Mon, 20 Mar 2023 18:25:23 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 20 Mar 2023 11:25:09 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 20 Mar 2023 11:25:09 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.5 via Frontend Transport; Mon, 20 Mar 2023 11:25:04 -0700 From: Sumit Gupta <sumitg@nvidia.com> To: <treding@nvidia.com>, <krzysztof.kozlowski@linaro.org>, <dmitry.osipenko@collabora.com>, <viresh.kumar@linaro.org>, <rafael@kernel.org>, <jonathanh@nvidia.com>, <robh+dt@kernel.org>, <lpieralisi@kernel.org> CC: <linux-kernel@vger.kernel.org>, <linux-tegra@vger.kernel.org>, <linux-pm@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-pci@vger.kernel.org>, <mmaddireddy@nvidia.com>, <kw@linux.com>, <bhelgaas@google.com>, <vidyas@nvidia.com>, <sanjayc@nvidia.com>, <ksitaraman@nvidia.com>, <ishah@nvidia.com>, <bbasu@nvidia.com>, <sumitg@nvidia.com> Subject: [Patch v3 01/11] firmware: tegra: add function to get BPMP data Date: Mon, 20 Mar 2023 23:54:31 +0530 Message-ID: <20230320182441.11904-2-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230320182441.11904-1-sumitg@nvidia.com> References: <20230320182441.11904-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT112:EE_|DS0PR12MB7725:EE_ X-MS-Office365-Filtering-Correlation-Id: 135b7234-a11e-47c9-410f-08db2970787e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l1Uq0tg3Gm/vLlgfzyv87t8jmJL6NBmGVBpS9K3jjyBdfUmZNIvLQBWxljqyI7/Y2NEuDwdHRLhBDVK7Q+k9KSsuBL2WimhLXv2RSE4jN0/MOG+or/lNyYa4EKa1eX+uc2u4m5PdcjtVISAnn/e251E8QbyKFivGFMyJHeu/MiTGxPUn5SuTF12LYWfAo8ebUu8CXOmS9IwO7ZNbilA+RwLMSa8ZBWlk87TxFNccMgxRQtczhI3hwU9lwOp/+Ya6l4CNbE2Mk5gPsJDIOzKysnL+F3xvECc43BPGFUYdWGzVq00k858Ra3GkygOT5KSSVYbWUw6pXqKqOsGNYmrggY5Tdr0fuztKF04Q3GSFzm0XVYfbyH7w54sOQUmJXgJM6OUcAnBzgBTkwcW1ilAst7gGDGdx4qu7oM+ZXj/jx8K/EYXkpsvcAFBS2+aajPd5cnzeq9bz6hflxZubzJDOfXOp03y5qofO0D5R2BsNdGlvlcOhQSegHtHsSA44UzDzqiGOKwhUK3xKcBv+OSCorhsN8aVrW29ehq/nCRI8Ri3Y9gZYMid4Vt6aaucDEL2hIg2OBbyEi3uCXuiR07kaU1dM+IuQi3gY+z2CU1+glU96LZqXc5mmPBpjkw9iT/LJ3JrUgoc2UKnVTQV8vViSWPHJJZOEHJLMf6i1O7/xLxqiZCsKWjDPbgsJgLkqBlUwV/chzOBE1GbfuGYuWcHiMWY/qywzNxJ1aC/7gGk3zXaAVr14eXDJmiwTSv/e/6Fd X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(346002)(396003)(376002)(39860400002)(136003)(451199018)(46966006)(40470700004)(36840700001)(110136005)(2616005)(426003)(47076005)(83380400001)(82310400005)(316002)(7696005)(54906003)(107886003)(7416002)(6666004)(5660300002)(478600001)(1076003)(186003)(26005)(36860700001)(356005)(336012)(40460700003)(86362001)(7636003)(70206006)(70586007)(8936002)(2906002)(82740400003)(40480700001)(4326008)(36756003)(41300700001)(8676002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2023 18:25:23.6735 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 135b7234-a11e-47c9-410f-08db2970787e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT112.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7725 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760913323232479938?= X-GMAIL-MSGID: =?utf-8?q?1760913323232479938?= |
Series |
Tegra234 Memory interconnect support
|
|
Commit Message
Sumit Gupta
March 20, 2023, 6:24 p.m. UTC
Add new function 'of_tegra_bpmp_get()' which can be
used by other drivers like MC to get BPMP data without
adding any property in respective drivers DT node.
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
---
drivers/firmware/tegra/bpmp.c | 38 +++++++++++++++++++++++++++++++++++
include/soc/tegra/bpmp.h | 5 +++++
2 files changed, 43 insertions(+)
Comments
On Mon, Mar 20, 2023 at 11:54:31PM +0530, Sumit Gupta wrote: > Add new function 'of_tegra_bpmp_get()' which can be > used by other drivers like MC to get BPMP data without > adding any property in respective drivers DT node. > > Signed-off-by: Sumit Gupta <sumitg@nvidia.com> > --- > drivers/firmware/tegra/bpmp.c | 38 +++++++++++++++++++++++++++++++++++ > include/soc/tegra/bpmp.h | 5 +++++ > 2 files changed, 43 insertions(+) Sorry for not noticing this earlier, but can we not resolve the BPMP using the existing tegra_bpmp_get()? That requires the presence of the nvidia,bpmp property, but since we're adding new functionality here that's not a problem. Thierry
On 23/03/23 15:38, Thierry Reding wrote: > On Mon, Mar 20, 2023 at 11:54:31PM +0530, Sumit Gupta wrote: >> Add new function 'of_tegra_bpmp_get()' which can be >> used by other drivers like MC to get BPMP data without >> adding any property in respective drivers DT node. >> >> Signed-off-by: Sumit Gupta <sumitg@nvidia.com> >> --- >> drivers/firmware/tegra/bpmp.c | 38 +++++++++++++++++++++++++++++++++++ >> include/soc/tegra/bpmp.h | 5 +++++ >> 2 files changed, 43 insertions(+) > > Sorry for not noticing this earlier, but can we not resolve the BPMP > using the existing tegra_bpmp_get()? That requires the presence of the > nvidia,bpmp property, but since we're adding new functionality here > that's not a problem. > > Thierry Ok, will add "nvidia,bpmp" property within mc node and cache the result to use later instead of doing the lookup every time. Also, will drop this patch in v4. Thank you for suggesting. Thank, Sumit
diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c index 042c2043929d..d825067a223a 100644 --- a/drivers/firmware/tegra/bpmp.c +++ b/drivers/firmware/tegra/bpmp.c @@ -39,6 +39,44 @@ channel_to_ops(struct tegra_bpmp_channel *channel) return bpmp->soc->ops; } +struct tegra_bpmp *of_tegra_bpmp_get(void) +{ + struct platform_device *pdev; + struct device_node *bpmp_dev; + struct tegra_bpmp *bpmp; + + /* Check for bpmp device status in DT */ + bpmp_dev = of_find_compatible_node(NULL, NULL, "nvidia,tegra186-bpmp"); + if (!bpmp_dev) { + bpmp = ERR_PTR(-ENODEV); + goto err_out; + } + if (!of_device_is_available(bpmp_dev)) { + bpmp = ERR_PTR(-ENODEV); + goto err_put; + } + + pdev = of_find_device_by_node(bpmp_dev); + if (!pdev) { + bpmp = ERR_PTR(-ENODEV); + goto err_put; + } + + bpmp = platform_get_drvdata(pdev); + if (!bpmp) { + bpmp = ERR_PTR(-EPROBE_DEFER); + put_device(&pdev->dev); + goto err_put; + } + + return bpmp; +err_put: + of_node_put(bpmp_dev); +err_out: + return bpmp; +} +EXPORT_SYMBOL_GPL(of_tegra_bpmp_get); + struct tegra_bpmp *tegra_bpmp_get(struct device *dev) { struct platform_device *pdev; diff --git a/include/soc/tegra/bpmp.h b/include/soc/tegra/bpmp.h index 5842e38bb288..9fd3aa9e69bb 100644 --- a/include/soc/tegra/bpmp.h +++ b/include/soc/tegra/bpmp.h @@ -120,6 +120,7 @@ struct tegra_bpmp_message { }; #if IS_ENABLED(CONFIG_TEGRA_BPMP) +struct tegra_bpmp *of_tegra_bpmp_get(void); struct tegra_bpmp *tegra_bpmp_get(struct device *dev); void tegra_bpmp_put(struct tegra_bpmp *bpmp); int tegra_bpmp_transfer_atomic(struct tegra_bpmp *bpmp, @@ -135,6 +136,10 @@ void tegra_bpmp_free_mrq(struct tegra_bpmp *bpmp, unsigned int mrq, void *data); bool tegra_bpmp_mrq_is_supported(struct tegra_bpmp *bpmp, unsigned int mrq); #else +static inline struct tegra_bpmp *of_tegra_bpmp_get(void) +{ + return ERR_PTR(-EOPNOTSUPP); +} static inline struct tegra_bpmp *tegra_bpmp_get(struct device *dev) { return ERR_PTR(-ENOTSUPP);