Message ID | 20230323012929.10815-5-dipenp@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 j10csp2664090wrt; Wed, 22 Mar 2023 18:31:14 -0700 (PDT) X-Google-Smtp-Source: AK7set+qi0fSz8tETPbPH0jMnqB7Ti0cMDI+VJXxamrcrjGvBY2UUssaEbI6FL0czASxQmNdK4rS X-Received: by 2002:a17:906:698d:b0:930:28d6:4581 with SMTP id i13-20020a170906698d00b0093028d64581mr8697361ejr.59.1679535073992; Wed, 22 Mar 2023 18:31:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679535073; cv=pass; d=google.com; s=arc-20160816; b=QKWhBxilAwNHUDCnqXbZIWHDvhq8J4JeBDCqkeq8pvsM2yQFoOXj9jZk+EffhIcwA6 Ft/E6qxN7t2Lr9KwHrRPiykP0/zXzDJZxeaAd8kjf91I00KffRCSAJtnNKuUUDAdK3F+ Yk6U+2SzPnwoewE09xh7TBTyDL1M3CvpV5gH30aNbvfl72gl7cia6QWW4kbjrZn7zIdu pMiPWfLDiskmmqNoc3v7qN/gwr140/PdwtjK0Im4k9LmNI1fI9nonWWFiOM7pVcgntFC xuOl10GZ2RARRzGEIPpSRNMPucghAIXZk2spPSNhdmavLrNRhEEgSctl3BXpHYaoHfwK 3WSQ== 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=aRSrneVwlnQEB9m06wEPIjU9TDyL1SRZmKcYT9YP7UM=; b=uPwD2oTXU4j3N6AUXHKwk3Hv10Cg1bmdXK6SnnTpQLtoJkulRie6WGsQHSHua2dL/F AJKRH+NDKDU5S9S1Og2AcvbMCVLrBdRHd/RYGHC8Tv/3TLNL9ofbZUo6oOfQXoTLoDTp ezT1n/7mAdVTEszv7mwcW6qlFNhHaC3vw1x28cuYBU62QsfTBerYlgakab3v2GVx41Yv zp0kT38L82SbFGh2RiB8N1sr3nQRqfvwaHq2a3JohE36rh6jqzQxBfmDdoDo0dm/l31R xu9rf4LJ/NfQk4BWycvWeHSlapWMRKacmuMu2ed/5+avd3Qaw9uaypFZuDZXOh9m87CZ x4ZQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=USwU3gFr; 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 z7-20020a1709063a0700b008cdeb3c9cd3si19269787eje.791.2023.03.22.18.30.49; Wed, 22 Mar 2023 18:31:13 -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=USwU3gFr; 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 S230261AbjCWBaG (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Wed, 22 Mar 2023 21:30:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230121AbjCWB3t (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 22 Mar 2023 21:29:49 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2065.outbound.protection.outlook.com [40.107.220.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CD5A2D5A; Wed, 22 Mar 2023 18:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NOLM52lUVHBrmQQE68omjH6xWpnZ4iHeKKs1SNOdZNL5aN9SQKk6gM6ey+bTx5StOgixbO/Im3Q48Yw6xGoio920cUaT6TiX8xi0It2nUOkArdm3iaFQQi0YvoqhwNv/TDEmZ1qeOAoPQ/aRWs2MkmG9WbYzFrj+RMe5dkqMUIF7FNUvicjNHA2gupg7dilbILihdPoRHXdC5qSgyxsuUTSF1LyJsh8vQTK2IcfaJIsypKkwVbZ70PFDJIevPADl39tT+ND5EQl/ndvudFgaf96cy2nz5LMgPalhPYGj2JnQe2Y6EB/9Hf+KzXlqpSmcAMdDGEs/WqnThZs2vr63sQ== 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=aRSrneVwlnQEB9m06wEPIjU9TDyL1SRZmKcYT9YP7UM=; b=govFxe8XtCphJbTsFM5Eh8lDUA3/AD5mbMN3SZGVVnEVJYEqsImEpuMThikbs57s+Y+42STsZRv4M0R8D7nWzQ9Nx6EX0DI9PenTtZEIuawB2BA3bd58L7YfVw1/taxa7m2hxuYFLpmP9/DmEGc1/+UX+eImCBA2IbXF3U7QF8bF8Jo0bEaR/IGDWddtTwFkMXuGwykGn/beJ2r2+/qNcYICY7IhdfgVqHxnTdrNsBZMfhFLd2xM7mEME6be+8/SlThsJV2V9nhi6ssC34Pu0DEGSaaZZTvx+Iy7T1Y7Aq29MAjqIfS9qUk4XF42DwxOgSxvqHKX1/UQtK1Yh1QxiQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.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=aRSrneVwlnQEB9m06wEPIjU9TDyL1SRZmKcYT9YP7UM=; b=USwU3gFrx8i3bkEF+/xAfQhApyQyt+oFWDRFuy2niSavh8QOoyszOHN3NZpYYZAjXP7pPHFMMN1kV0iSU35//gAPQK3bleDVWPfKiIcy/zllvN1Ll0kvRhyByHlX5YUftBL0WB+41fDDJ8tBxeBGadiLd6iUjqXOO0U++KF/fNyaY/Ge1ppsw2s8aM+874Ihsd1fieiWJrS7bXUTKJ6sTONEMe4WS04KLBi02TznJ1Fe4ot0bhdAe12/xhbMhxY/NWPukQ5s87BKOuyBndItlyHwQhORJgDnOi9RvSjcH0SJYKMfD6TVW+qIZo6qDmss9O+8TBRk9ZPCYLKiCTBjrQ== Received: from MW4PR04CA0198.namprd04.prod.outlook.com (2603:10b6:303:86::23) by SA1PR12MB6870.namprd12.prod.outlook.com (2603:10b6:806:25e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Thu, 23 Mar 2023 01:29:44 +0000 Received: from CO1NAM11FT042.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::9a) by MW4PR04CA0198.outlook.office365.com (2603:10b6:303:86::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Thu, 23 Mar 2023 01:29:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT042.mail.protection.outlook.com (10.13.174.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.17 via Frontend Transport; Thu, 23 Mar 2023 01:29:44 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 22 Mar 2023 18:29:34 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Wed, 22 Mar 2023 18:29:33 -0700 Received: from dipenp.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.5 via Frontend Transport; Wed, 22 Mar 2023 18:29:33 -0700 From: Dipen Patel <dipenp@nvidia.com> To: <thierry.reding@gmail.com>, <jonathanh@nvidia.com>, <linux-kernel@vger.kernel.org>, <linux-tegra@vger.kernel.org>, <linux-gpio@vger.kernel.org>, <linus.walleij@linaro.org>, <devicetree@vger.kernel.org>, <linux-doc@vger.kernel.org>, <robh+dt@kernel.org>, <timestamp@lists.linux.dev>, <krzysztof.kozlowski+dt@linaro.org>, <brgl@bgdev.pl>, <corbet@lwn.net>, <gregkh@linuxfoundation.org> CC: Dipen Patel <dipenp@nvidia.com> Subject: [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller Date: Wed, 22 Mar 2023 18:29:23 -0700 Message-ID: <20230323012929.10815-5-dipenp@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230323012929.10815-1-dipenp@nvidia.com> References: <20230323012929.10815-1-dipenp@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT042:EE_|SA1PR12MB6870:EE_ X-MS-Office365-Filtering-Correlation-Id: 24f479a2-cbc7-4d2f-e1ee-08db2b3e1509 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hyLaBmxefDrQzcpNskfNgKteNTzFW0+p9D/I1y3rQI+pnhhlguz3Ch1S4+BM7fmBMT1pYH5yi2ZCRF5txdu2I5TAeG9py1CPR2HG5c2wdj7g2j73g06H6lBcQoZYsyelG4tbq+0RHD7p/ORu49z682LGn95R4FmZvDLUEWGTTX5V5OG4uz6BHcNPvwdXd49Q8eVCR9Vdk5JZQ8jH2PJE8yKjOiLxi8N+XVmhF29RR+qagOYqWEXb9V7vj/pYZUOKdDy9OGw/IEdYlnwVH455ktYx6+kMR+TsYT9BZILrRPjn8rYhyqakOCPhkYfxFQsj+OSMjkJHQe7YHMezmiw+Wpj/fmTfxTfnlfkS+fJx7WutqW2Jed+PCIrQYXdsKXFVT9INcYSP+cxBqMwl7ATjs0ORubc9R5WbEXFTaDdXcn7HikNvZanOrh0w1En9UOER9zBm23D1MKSuJEAePdUdKLKwcDdzz/P9QJjxLDglTBGbg+J/6FSDH1CjIcRSk0T3QW03pIYk0WeJznbzBPQl30/FFhcCSXj5qn1zqS5aGnzRD6kNgn0gf923lFEMUYnggI/f01o5A/jzBWNREFubVC+YkLWqgBc9FwH/Q3WqgYk++MKJJxfG4y2CjeXL9KVKvpsLrxF0vzDTXhQ0m8BjPGRK9Et+aYTHtAl/MkEigna7dQf+qlNmDfNLmJZ/+g6TCUDQ1nPdmuWfzQramuRwSNNo+SabD0vcV5OzUq2stkihwkEavy2yOxksf83agPOWxqD7/n37NMudxPPFnZakn+9NRtSoyPwjoi45zZzux80XFlQp5DeQ2LjA3ImxrT5G X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(39860400002)(136003)(396003)(346002)(376002)(451199018)(36840700001)(46966006)(40470700004)(921005)(4326008)(86362001)(40460700003)(356005)(7416002)(26005)(36756003)(41300700001)(110136005)(47076005)(70206006)(8676002)(5660300002)(8936002)(83380400001)(6666004)(36860700001)(40480700001)(426003)(82740400003)(336012)(316002)(7636003)(107886003)(7696005)(82310400005)(2616005)(2906002)(186003)(70586007)(478600001)(1076003)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2023 01:29:44.2430 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 24f479a2-cbc7-4d2f-e1ee-08db2b3e1509 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT042.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6870 X-Spam-Status: No, score=-0.2 required=5.0 tests=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=unavailable 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?1761120169798814140?= X-GMAIL-MSGID: =?utf-8?q?1761120169798814140?= |
Series |
Add Tegra234 HTE support
|
|
Commit Message
Dipen Patel
March 23, 2023, 1:29 a.m. UTC
Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
This is done to help below case.
Without this property code would look like:
if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon"))
hte_dev->c = gpiochip_find("tegra194-gpio-aon",
tegra_get_gpiochip_from_name);
else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon"))
hte_dev->c = gpiochip_find("tegra234-gpio-aon",
tegra_get_gpiochip_from_name);
else
return -ENODEV;
This means for every future addition of the compatible string, if else
condition statements have to be expanded.
With the property:
gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0);
....
hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node);
This simplifies the code significantly. The introdunction of this
property/binding does not break existing Tegra194 provider driver.
Signed-off-by: Dipen Patel <dipenp@nvidia.com>
---
.../timestamp/nvidia,tegra194-hte.yaml | 31 +++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
Comments
On Thu, Mar 23, 2023 at 2:29 AM Dipen Patel <dipenp@nvidia.com> wrote: > Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards. > This is done to help below case. > > Without this property code would look like: > if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon")) > hte_dev->c = gpiochip_find("tegra194-gpio-aon", > tegra_get_gpiochip_from_name); > else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon")) > hte_dev->c = gpiochip_find("tegra234-gpio-aon", > tegra_get_gpiochip_from_name); > else > return -ENODEV; > > This means for every future addition of the compatible string, if else > condition statements have to be expanded. > > With the property: > gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0); > .... > hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node); > > This simplifies the code significantly. The introdunction of this > property/binding does not break existing Tegra194 provider driver. > > Signed-off-by: Dipen Patel <dipenp@nvidia.com> It is fair to assume that other operating systems will need this too so I interpret the commit message as an example of the issues faced by anyone making a driver for this HW. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
On Wed, 22 Mar 2023 18:29:23 -0700, Dipen Patel wrote: > Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards. > This is done to help below case. > > Without this property code would look like: > if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon")) > hte_dev->c = gpiochip_find("tegra194-gpio-aon", > tegra_get_gpiochip_from_name); > else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon")) > hte_dev->c = gpiochip_find("tegra234-gpio-aon", > tegra_get_gpiochip_from_name); > else > return -ENODEV; > > This means for every future addition of the compatible string, if else > condition statements have to be expanded. > > With the property: > gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0); > .... > hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node); > > This simplifies the code significantly. The introdunction of this > property/binding does not break existing Tegra194 provider driver. > > Signed-off-by: Dipen Patel <dipenp@nvidia.com> > --- > .../timestamp/nvidia,tegra194-hte.yaml | 31 +++++++++++++++++-- > 1 file changed, 29 insertions(+), 2 deletions(-) > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13): yamllint warnings/errors: dtschema/dtc warnings/errors: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.example.dtb: timestamp@c1e0000: reg: [[0, 203292672], [0, 65536]] is too long From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.example.dtb: timestamp@c1e0000: reg: [[0, 203292672], [0, 65536]] is too long From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.example.dtb: timestamp@3aa0000: reg: [[0, 61472768], [0, 65536]] is too long From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml doc reference errors (make refcheckdocs): See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230323012929.10815-5-dipenp@nvidia.com The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch. If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date: pip3 install dtschema --upgrade Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote: > Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards. > This is done to help below case. > > Without this property code would look like: > if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon")) > hte_dev->c = gpiochip_find("tegra194-gpio-aon", > tegra_get_gpiochip_from_name); > else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon")) > hte_dev->c = gpiochip_find("tegra234-gpio-aon", > tegra_get_gpiochip_from_name); > else > return -ENODEV; Or you just put the name in match data. > > This means for every future addition of the compatible string, if else > condition statements have to be expanded. > > With the property: > gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0); > .... > hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node); > > This simplifies the code significantly. The introdunction of this typo > property/binding does not break existing Tegra194 provider driver. Making a new property required is an ABI break. > Signed-off-by: Dipen Patel <dipenp@nvidia.com> > --- > .../timestamp/nvidia,tegra194-hte.yaml | 31 +++++++++++++++++-- > 1 file changed, 29 insertions(+), 2 deletions(-) > > diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml > index eafc33e9ae2e..841273a3d8ae 100644 > --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml > +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml > @@ -51,6 +51,12 @@ properties: > LIC instance has 11 slices and Tegra234 LIC has 17 slices. > enum: [3, 11, 17] > > + nvidia,gpio-controller: > + $ref: /schemas/types.yaml#/definitions/phandle > + description: > + The phandle to AON gpio controller instance. This is required to handle > + namespace conversion between GPIO and GTE. Explain what the GPIO controller is needed for rather than how this changes the driver. > + > '#timestamp-cells': > description: > This represents number of line id arguments as specified by the > @@ -65,22 +71,43 @@ required: > - interrupts > - "#timestamp-cells" > > +allOf: > + - if: > + properties: > + compatible: > + contains: > + enum: > + - nvidia,tegra234-gte-aon > + then: > + required: > + - nvidia,gpio-controller > + > additionalProperties: false > > examples: > - | > tegra_hte_aon: timestamp@c1e0000 { > compatible = "nvidia,tegra194-gte-aon"; > - reg = <0xc1e0000 0x10000>; > + reg = <0x0 0xc1e0000 0x0 0x10000>; > + interrupts = <0 13 0x4>; > + nvidia,int-threshold = <1>; > + #timestamp-cells = <1>; > + }; > + > + - | > + tegra234_hte_aon: timestamp@c1e0000 { > + compatible = "nvidia,tegra234-gte-aon"; > + reg = <0x0 0xc1e0000 0x0 0x10000>; > interrupts = <0 13 0x4>; > nvidia,int-threshold = <1>; > + nvidia,gpio-controller = <&gpio_aon>; > #timestamp-cells = <1>; > }; > > - | > tegra_hte_lic: timestamp@3aa0000 { > compatible = "nvidia,tegra194-gte-lic"; > - reg = <0x3aa0000 0x10000>; > + reg = <0x0 0x3aa0000 0x0 0x10000>; > interrupts = <0 11 0x4>; > nvidia,int-threshold = <1>; > #timestamp-cells = <1>; > -- > 2.17.1 >
On 3/24/23 10:13 AM, Rob Herring wrote: > On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote: >> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards. >> This is done to help below case. >> >> Without this property code would look like: >> if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon")) >> hte_dev->c = gpiochip_find("tegra194-gpio-aon", >> tegra_get_gpiochip_from_name); >> else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon")) >> hte_dev->c = gpiochip_find("tegra234-gpio-aon", >> tegra_get_gpiochip_from_name); >> else >> return -ENODEV; > > Or you just put the name in match data. Not sure I have understood this comment, but "name" the first argument is already there to supply to callback to match data. Also, this if else is needed to know which "name" to provide. > >> >> This means for every future addition of the compatible string, if else >> condition statements have to be expanded. >> >> With the property: >> gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0); >> .... >> hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node); >> >> This simplifies the code significantly. The introdunction of this > > typo ACK... > >> property/binding does not break existing Tegra194 provider driver. > > Making a new property required is an ABI break. The driver code for the Tegra194 binds by old binding and does not need this new property, the relevant code is part of this patch series. > >> Signed-off-by: Dipen Patel <dipenp@nvidia.com> >> --- >> .../timestamp/nvidia,tegra194-hte.yaml | 31 +++++++++++++++++-- >> 1 file changed, 29 insertions(+), 2 deletions(-) >> >> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml >> index eafc33e9ae2e..841273a3d8ae 100644 >> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml >> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml >> @@ -51,6 +51,12 @@ properties: >> LIC instance has 11 slices and Tegra234 LIC has 17 slices. >> enum: [3, 11, 17] >> >> + nvidia,gpio-controller: >> + $ref: /schemas/types.yaml#/definitions/phandle >> + description: >> + The phandle to AON gpio controller instance. This is required to handle >> + namespace conversion between GPIO and GTE. > > Explain what the GPIO controller is needed for rather than how this > changes the driver. Doesn't "This is required..." statement addresses why GPIO controller is needed for part? Or do you want detail explanation which is already part of the commit? > >> + >> '#timestamp-cells': >> description: >> This represents number of line id arguments as specified by the >> @@ -65,22 +71,43 @@ required: >> - interrupts >> - "#timestamp-cells" >> >> +allOf: >> + - if: >> + properties: >> + compatible: >> + contains: >> + enum: >> + - nvidia,tegra234-gte-aon >> + then: >> + required: >> + - nvidia,gpio-controller > >> + >> additionalProperties: false >> >> examples: >> - | >> tegra_hte_aon: timestamp@c1e0000 { >> compatible = "nvidia,tegra194-gte-aon"; >> - reg = <0xc1e0000 0x10000>; >> + reg = <0x0 0xc1e0000 0x0 0x10000>; >> + interrupts = <0 13 0x4>; >> + nvidia,int-threshold = <1>; >> + #timestamp-cells = <1>; >> + }; >> + >> + - | >> + tegra234_hte_aon: timestamp@c1e0000 { >> + compatible = "nvidia,tegra234-gte-aon"; >> + reg = <0x0 0xc1e0000 0x0 0x10000>; >> interrupts = <0 13 0x4>; >> nvidia,int-threshold = <1>; >> + nvidia,gpio-controller = <&gpio_aon>; >> #timestamp-cells = <1>; >> }; >> >> - | >> tegra_hte_lic: timestamp@3aa0000 { >> compatible = "nvidia,tegra194-gte-lic"; >> - reg = <0x3aa0000 0x10000>; >> + reg = <0x0 0x3aa0000 0x0 0x10000>; >> interrupts = <0 11 0x4>; >> nvidia,int-threshold = <1>; >> #timestamp-cells = <1>; >> -- >> 2.17.1 >>
On 23/03/2023 02:29, Dipen Patel wrote: > Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards. > This is done to help below case. > > Without this property code would look like: > if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon")) > hte_dev->c = gpiochip_find("tegra194-gpio-aon", > tegra_get_gpiochip_from_name); > else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon")) > hte_dev->c = gpiochip_find("tegra234-gpio-aon", > tegra_get_gpiochip_from_name); > else > return -ENODEV; > > This means for every future addition of the compatible string, if else > condition statements have to be expanded. > > With the property: > gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0); > .... > hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node); > > This simplifies the code significantly. The introdunction of this > property/binding does not break existing Tegra194 provider driver. > > Signed-off-by: Dipen Patel <dipenp@nvidia.com> > --- > .../timestamp/nvidia,tegra194-hte.yaml | 31 +++++++++++++++++-- > 1 file changed, 29 insertions(+), 2 deletions(-) > > diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml > index eafc33e9ae2e..841273a3d8ae 100644 > --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml > +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml > @@ -51,6 +51,12 @@ properties: > LIC instance has 11 slices and Tegra234 LIC has 17 slices. > enum: [3, 11, 17] > > + nvidia,gpio-controller: > + $ref: /schemas/types.yaml#/definitions/phandle > + description: > + The phandle to AON gpio controller instance. This is required to handle > + namespace conversion between GPIO and GTE. > + > '#timestamp-cells': > description: > This represents number of line id arguments as specified by the > @@ -65,22 +71,43 @@ required: > - interrupts > - "#timestamp-cells" > > +allOf: > + - if: > + properties: > + compatible: > + contains: > + enum: > + - nvidia,tegra234-gte-aon > + then: > + required: > + - nvidia,gpio-controller > + > additionalProperties: false > > examples: > - | > tegra_hte_aon: timestamp@c1e0000 { > compatible = "nvidia,tegra194-gte-aon"; > - reg = <0xc1e0000 0x10000>; > + reg = <0x0 0xc1e0000 0x0 0x10000>; This is not really explained in commit msg... are you sure you tested it? Best regards, Krzysztof
On 24/03/2023 19:51, Dipen Patel wrote: > On 3/24/23 10:13 AM, Rob Herring wrote: >> On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote: >>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards. >>> This is done to help below case. >>> >>> Without this property code would look like: >>> if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon")) >>> hte_dev->c = gpiochip_find("tegra194-gpio-aon", >>> tegra_get_gpiochip_from_name); >>> else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon")) >>> hte_dev->c = gpiochip_find("tegra234-gpio-aon", >>> tegra_get_gpiochip_from_name); >>> else >>> return -ENODEV; >> >> Or you just put the name in match data. > > Not sure I have understood this comment, but "name" the first argument is > already there to supply to callback to match data. Also, this if else is > needed to know which "name" to provide. The point is that of_device_is_compatible() do not really scale and make code more difficult to read. Your variant-customization should in general entirely come from match/driver data. >> >>> >>> This means for every future addition of the compatible string, if else >>> condition statements have to be expanded. >>> >>> With the property: >>> gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0); >>> .... >>> hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node); >>> >>> This simplifies the code significantly. The introdunction of this >> >> typo > > ACK... >> >>> property/binding does not break existing Tegra194 provider driver. >> >> Making a new property required is an ABI break. > The driver code for the Tegra194 binds by old binding and does not need > this new property, the relevant code is part of this patch series. >> >>> Signed-off-by: Dipen Patel <dipenp@nvidia.com> >>> --- >>> .../timestamp/nvidia,tegra194-hte.yaml | 31 +++++++++++++++++-- >>> 1 file changed, 29 insertions(+), 2 deletions(-) >>> >>> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml >>> index eafc33e9ae2e..841273a3d8ae 100644 >>> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml >>> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml >>> @@ -51,6 +51,12 @@ properties: >>> LIC instance has 11 slices and Tegra234 LIC has 17 slices. >>> enum: [3, 11, 17] >>> >>> + nvidia,gpio-controller: >>> + $ref: /schemas/types.yaml#/definitions/phandle >>> + description: >>> + The phandle to AON gpio controller instance. This is required to handle >>> + namespace conversion between GPIO and GTE. >> >> Explain what the GPIO controller is needed for rather than how this >> changes the driver. > Doesn't "This is required..." statement addresses why GPIO controller is needed > for part? Or do you want detail explanation which is already part of the commit? Your bindings commit msg focused on driver and it is not really what it should be about. Best regards, Krzysztof
On 3/25/23 4:07 AM, Krzysztof Kozlowski wrote: > On 23/03/2023 02:29, Dipen Patel wrote: >> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards. >> This is done to help below case. >> >> Without this property code would look like: >> if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon")) >> hte_dev->c = gpiochip_find("tegra194-gpio-aon", >> tegra_get_gpiochip_from_name); >> else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon")) >> hte_dev->c = gpiochip_find("tegra234-gpio-aon", >> tegra_get_gpiochip_from_name); >> else >> return -ENODEV; >> >> This means for every future addition of the compatible string, if else >> condition statements have to be expanded. >> >> With the property: >> gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0); >> .... >> hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node); >> >> This simplifies the code significantly. The introdunction of this >> property/binding does not break existing Tegra194 provider driver. >> >> Signed-off-by: Dipen Patel <dipenp@nvidia.com> >> --- >> .../timestamp/nvidia,tegra194-hte.yaml | 31 +++++++++++++++++-- >> 1 file changed, 29 insertions(+), 2 deletions(-) >> >> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml >> index eafc33e9ae2e..841273a3d8ae 100644 >> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml >> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml >> @@ -51,6 +51,12 @@ properties: >> LIC instance has 11 slices and Tegra234 LIC has 17 slices. >> enum: [3, 11, 17] >> >> + nvidia,gpio-controller: >> + $ref: /schemas/types.yaml#/definitions/phandle >> + description: >> + The phandle to AON gpio controller instance. This is required to handle >> + namespace conversion between GPIO and GTE. >> + >> '#timestamp-cells': >> description: >> This represents number of line id arguments as specified by the >> @@ -65,22 +71,43 @@ required: >> - interrupts >> - "#timestamp-cells" >> >> +allOf: >> + - if: >> + properties: >> + compatible: >> + contains: >> + enum: >> + - nvidia,tegra234-gte-aon >> + then: >> + required: >> + - nvidia,gpio-controller >> + >> additionalProperties: false >> >> examples: >> - | >> tegra_hte_aon: timestamp@c1e0000 { >> compatible = "nvidia,tegra194-gte-aon"; >> - reg = <0xc1e0000 0x10000>; >> + reg = <0x0 0xc1e0000 0x0 0x10000>; > > This is not really explained in commit msg... are you sure you tested it? I have to revert this part back in next patch as when I upgraded dtsschema it gave me errors. > > > Best regards, > Krzysztof >
On 3/25/23 4:09 AM, Krzysztof Kozlowski wrote: > On 24/03/2023 19:51, Dipen Patel wrote: >> On 3/24/23 10:13 AM, Rob Herring wrote: >>> On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote: >>>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards. >>>> This is done to help below case. >>>> >>>> Without this property code would look like: >>>> if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon")) >>>> hte_dev->c = gpiochip_find("tegra194-gpio-aon", >>>> tegra_get_gpiochip_from_name); >>>> else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon")) >>>> hte_dev->c = gpiochip_find("tegra234-gpio-aon", >>>> tegra_get_gpiochip_from_name); >>>> else >>>> return -ENODEV; >>> >>> Or you just put the name in match data. >> >> Not sure I have understood this comment, but "name" the first argument is >> already there to supply to callback to match data. Also, this if else is >> needed to know which "name" to provide. > > The point is that of_device_is_compatible() do not really scale and make > code more difficult to read. Your variant-customization should in > general entirely come from match/driver data. Perhaps I should not have mentioned driver related details here about how this property will help, that detail will go in driver patch. In the next patch series I will remove this commit and just focus on what this property is. > > >>> >>>> >>>> This means for every future addition of the compatible string, if else >>>> condition statements have to be expanded. >>>> >>>> With the property: >>>> gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0); >>>> .... >>>> hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node); >>>> >>>> This simplifies the code significantly. The introdunction of this >>> >>> typo >> >> ACK... >>> >>>> property/binding does not break existing Tegra194 provider driver. >>> >>> Making a new property required is an ABI break. >> The driver code for the Tegra194 binds by old binding and does not need >> this new property, the relevant code is part of this patch series. >>> >>>> Signed-off-by: Dipen Patel <dipenp@nvidia.com> >>>> --- >>>> .../timestamp/nvidia,tegra194-hte.yaml | 31 +++++++++++++++++-- >>>> 1 file changed, 29 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml >>>> index eafc33e9ae2e..841273a3d8ae 100644 >>>> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml >>>> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml >>>> @@ -51,6 +51,12 @@ properties: >>>> LIC instance has 11 slices and Tegra234 LIC has 17 slices. >>>> enum: [3, 11, 17] >>>> >>>> + nvidia,gpio-controller: >>>> + $ref: /schemas/types.yaml#/definitions/phandle >>>> + description: >>>> + The phandle to AON gpio controller instance. This is required to handle >>>> + namespace conversion between GPIO and GTE. >>> >>> Explain what the GPIO controller is needed for rather than how this >>> changes the driver. >> Doesn't "This is required..." statement addresses why GPIO controller is needed >> for part? Or do you want detail explanation which is already part of the commit? > > Your bindings commit msg focused on driver and it is not really what it > should be about. ACK... > > Best regards, > Krzysztof >
On 04/04/2023 06:24, Dipen Patel wrote: > On 3/25/23 4:09 AM, Krzysztof Kozlowski wrote: >> On 24/03/2023 19:51, Dipen Patel wrote: >>> On 3/24/23 10:13 AM, Rob Herring wrote: >>>> On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote: >>>>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards. >>>>> This is done to help below case. >>>>> >>>>> Without this property code would look like: >>>>> if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon")) >>>>> hte_dev->c = gpiochip_find("tegra194-gpio-aon", >>>>> tegra_get_gpiochip_from_name); >>>>> else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon")) >>>>> hte_dev->c = gpiochip_find("tegra234-gpio-aon", >>>>> tegra_get_gpiochip_from_name); >>>>> else >>>>> return -ENODEV; >>>> >>>> Or you just put the name in match data. >>> >>> Not sure I have understood this comment, but "name" the first argument is >>> already there to supply to callback to match data. Also, this if else is >>> needed to know which "name" to provide. >> >> The point is that of_device_is_compatible() do not really scale and make >> code more difficult to read. Your variant-customization should in >> general entirely come from match/driver data. > > Perhaps I should not have mentioned driver related details here about how > this property will help, that detail will go in driver patch. In the next > patch series I will remove this commit and just focus on what this property > is. Regardless of this commit, driver match data is the way to go, not of_device_is_compatible(). Best regards, Krzysztof
On Mon, Apr 03, 2023 at 09:24:17PM -0700, Dipen Patel wrote: > On 3/25/23 4:09 AM, Krzysztof Kozlowski wrote: > > On 24/03/2023 19:51, Dipen Patel wrote: > >> On 3/24/23 10:13 AM, Rob Herring wrote: > >>> On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote: > >>>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards. > >>>> This is done to help below case. > >>>> > >>>> Without this property code would look like: > >>>> if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon")) > >>>> hte_dev->c = gpiochip_find("tegra194-gpio-aon", > >>>> tegra_get_gpiochip_from_name); > >>>> else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon")) > >>>> hte_dev->c = gpiochip_find("tegra234-gpio-aon", > >>>> tegra_get_gpiochip_from_name); > >>>> else > >>>> return -ENODEV; > >>> > >>> Or you just put the name in match data. > >> > >> Not sure I have understood this comment, but "name" the first argument is > >> already there to supply to callback to match data. Also, this if else is > >> needed to know which "name" to provide. > > > > The point is that of_device_is_compatible() do not really scale and make > > code more difficult to read. Your variant-customization should in > > general entirely come from match/driver data. > > Perhaps I should not have mentioned driver related details here about how > this property will help, that detail will go in driver patch. In the next > patch series I will remove this commit and just focus on what this property > is. I think the point that Rob and Krzysztof are trying to make that rather than adding a new property for this, we can add a const char *gpio field to struct tegra_hte_data and then set that to the compatible string of the GPIO controller that we need this for. To be honest, I slightly prefer the explicit phandle reference, but it also complicates things a bit and looking up by compatible string isn't all that bad. Thierry
On Mon, Mar 27, 2023 at 09:58:19AM -0700, Dipen Patel wrote: > On 3/25/23 4:07 AM, Krzysztof Kozlowski wrote: > > On 23/03/2023 02:29, Dipen Patel wrote: > >> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards. > >> This is done to help below case. > >> > >> Without this property code would look like: > >> if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon")) > >> hte_dev->c = gpiochip_find("tegra194-gpio-aon", > >> tegra_get_gpiochip_from_name); > >> else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon")) > >> hte_dev->c = gpiochip_find("tegra234-gpio-aon", > >> tegra_get_gpiochip_from_name); > >> else > >> return -ENODEV; > >> > >> This means for every future addition of the compatible string, if else > >> condition statements have to be expanded. > >> > >> With the property: > >> gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0); > >> .... > >> hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node); > >> > >> This simplifies the code significantly. The introdunction of this > >> property/binding does not break existing Tegra194 provider driver. > >> > >> Signed-off-by: Dipen Patel <dipenp@nvidia.com> > >> --- > >> .../timestamp/nvidia,tegra194-hte.yaml | 31 +++++++++++++++++-- > >> 1 file changed, 29 insertions(+), 2 deletions(-) > >> > >> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml > >> index eafc33e9ae2e..841273a3d8ae 100644 > >> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml > >> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml > >> @@ -51,6 +51,12 @@ properties: > >> LIC instance has 11 slices and Tegra234 LIC has 17 slices. > >> enum: [3, 11, 17] > >> > >> + nvidia,gpio-controller: > >> + $ref: /schemas/types.yaml#/definitions/phandle > >> + description: > >> + The phandle to AON gpio controller instance. This is required to handle > >> + namespace conversion between GPIO and GTE. > >> + > >> '#timestamp-cells': > >> description: > >> This represents number of line id arguments as specified by the > >> @@ -65,22 +71,43 @@ required: > >> - interrupts > >> - "#timestamp-cells" > >> > >> +allOf: > >> + - if: > >> + properties: > >> + compatible: > >> + contains: > >> + enum: > >> + - nvidia,tegra234-gte-aon > >> + then: > >> + required: > >> + - nvidia,gpio-controller > >> + > >> additionalProperties: false > >> > >> examples: > >> - | > >> tegra_hte_aon: timestamp@c1e0000 { > >> compatible = "nvidia,tegra194-gte-aon"; > >> - reg = <0xc1e0000 0x10000>; > >> + reg = <0x0 0xc1e0000 0x0 0x10000>; > > > > This is not really explained in commit msg... are you sure you tested it? > I have to revert this part back in next patch as when I upgraded dtsschema it gave me errors. We need the 0x0 in the DTS files because we have #address-cells = <2> and #size-tells = <2>. For the examples, those default to just 1 cell, so this can't be an exact copy of what we have in the DTS files. Please make sure to always validate the bindings and examples. Thierry
On 4/4/23 3:30 AM, Thierry Reding wrote: > On Mon, Mar 27, 2023 at 09:58:19AM -0700, Dipen Patel wrote: >> On 3/25/23 4:07 AM, Krzysztof Kozlowski wrote: >>> On 23/03/2023 02:29, Dipen Patel wrote: >>>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards. >>>> This is done to help below case. >>>> >>>> Without this property code would look like: >>>> if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon")) >>>> hte_dev->c = gpiochip_find("tegra194-gpio-aon", >>>> tegra_get_gpiochip_from_name); >>>> else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon")) >>>> hte_dev->c = gpiochip_find("tegra234-gpio-aon", >>>> tegra_get_gpiochip_from_name); >>>> else >>>> return -ENODEV; >>>> >>>> This means for every future addition of the compatible string, if else >>>> condition statements have to be expanded. >>>> >>>> With the property: >>>> gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0); >>>> .... >>>> hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node); >>>> >>>> This simplifies the code significantly. The introdunction of this >>>> property/binding does not break existing Tegra194 provider driver. >>>> >>>> Signed-off-by: Dipen Patel <dipenp@nvidia.com> >>>> --- >>>> .../timestamp/nvidia,tegra194-hte.yaml | 31 +++++++++++++++++-- >>>> 1 file changed, 29 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml >>>> index eafc33e9ae2e..841273a3d8ae 100644 >>>> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml >>>> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml >>>> @@ -51,6 +51,12 @@ properties: >>>> LIC instance has 11 slices and Tegra234 LIC has 17 slices. >>>> enum: [3, 11, 17] >>>> >>>> + nvidia,gpio-controller: >>>> + $ref: /schemas/types.yaml#/definitions/phandle >>>> + description: >>>> + The phandle to AON gpio controller instance. This is required to handle >>>> + namespace conversion between GPIO and GTE. >>>> + >>>> '#timestamp-cells': >>>> description: >>>> This represents number of line id arguments as specified by the >>>> @@ -65,22 +71,43 @@ required: >>>> - interrupts >>>> - "#timestamp-cells" >>>> >>>> +allOf: >>>> + - if: >>>> + properties: >>>> + compatible: >>>> + contains: >>>> + enum: >>>> + - nvidia,tegra234-gte-aon >>>> + then: >>>> + required: >>>> + - nvidia,gpio-controller >>>> + >>>> additionalProperties: false >>>> >>>> examples: >>>> - | >>>> tegra_hte_aon: timestamp@c1e0000 { >>>> compatible = "nvidia,tegra194-gte-aon"; >>>> - reg = <0xc1e0000 0x10000>; >>>> + reg = <0x0 0xc1e0000 0x0 0x10000>; >>> >>> This is not really explained in commit msg... are you sure you tested it? >> I have to revert this part back in next patch as when I upgraded dtsschema it gave me errors. > > We need the 0x0 in the DTS files because we have #address-cells = <2> > and #size-tells = <2>. For the examples, those default to just 1 cell, > so this can't be an exact copy of what we have in the DTS files. > > Please make sure to always validate the bindings and examples. Ack... > > Thierry
On 4/4/23 3:28 AM, Thierry Reding wrote: > On Mon, Apr 03, 2023 at 09:24:17PM -0700, Dipen Patel wrote: >> On 3/25/23 4:09 AM, Krzysztof Kozlowski wrote: >>> On 24/03/2023 19:51, Dipen Patel wrote: >>>> On 3/24/23 10:13 AM, Rob Herring wrote: >>>>> On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote: >>>>>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards. >>>>>> This is done to help below case. >>>>>> >>>>>> Without this property code would look like: >>>>>> if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon")) >>>>>> hte_dev->c = gpiochip_find("tegra194-gpio-aon", >>>>>> tegra_get_gpiochip_from_name); >>>>>> else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon")) >>>>>> hte_dev->c = gpiochip_find("tegra234-gpio-aon", >>>>>> tegra_get_gpiochip_from_name); >>>>>> else >>>>>> return -ENODEV; >>>>> >>>>> Or you just put the name in match data. >>>> >>>> Not sure I have understood this comment, but "name" the first argument is >>>> already there to supply to callback to match data. Also, this if else is >>>> needed to know which "name" to provide. >>> >>> The point is that of_device_is_compatible() do not really scale and make >>> code more difficult to read. Your variant-customization should in >>> general entirely come from match/driver data. >> >> Perhaps I should not have mentioned driver related details here about how >> this property will help, that detail will go in driver patch. In the next >> patch series I will remove this commit and just focus on what this property >> is. > > I think the point that Rob and Krzysztof are trying to make that rather > than adding a new property for this, we can add a const char *gpio field > to struct tegra_hte_data and then set that to the compatible string of > the GPIO controller that we need this for. This means it will have to track the label of the gpio controller and for each new provider, we have to touch the driver to set the char *field. Also, I think having gpio controller property in the DT presents/describes the tegra HTE provider perfectly as it does have hard dependency on the tegra gpio controller. > > To be honest, I slightly prefer the explicit phandle reference, but it > also complicates things a bit and looking up by compatible string isn't > all that bad. > > Thierry
On 4/3/23 10:33 PM, Krzysztof Kozlowski wrote: > On 04/04/2023 06:24, Dipen Patel wrote: >> On 3/25/23 4:09 AM, Krzysztof Kozlowski wrote: >>> On 24/03/2023 19:51, Dipen Patel wrote: >>>> On 3/24/23 10:13 AM, Rob Herring wrote: >>>>> On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote: >>>>>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards. >>>>>> This is done to help below case. >>>>>> >>>>>> Without this property code would look like: >>>>>> if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon")) >>>>>> hte_dev->c = gpiochip_find("tegra194-gpio-aon", >>>>>> tegra_get_gpiochip_from_name); >>>>>> else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon")) >>>>>> hte_dev->c = gpiochip_find("tegra234-gpio-aon", >>>>>> tegra_get_gpiochip_from_name); >>>>>> else >>>>>> return -ENODEV; >>>>> >>>>> Or you just put the name in match data. >>>> >>>> Not sure I have understood this comment, but "name" the first argument is >>>> already there to supply to callback to match data. Also, this if else is >>>> needed to know which "name" to provide. >>> >>> The point is that of_device_is_compatible() do not really scale and make >>> code more difficult to read. Your variant-customization should in >>> general entirely come from match/driver data. >> >> Perhaps I should not have mentioned driver related details here about how >> this property will help, that detail will go in driver patch. In the next >> patch series I will remove this commit and just focus on what this property >> is. > > Regardless of this commit, driver match data is the way to go, not > of_device_is_compatible(). I agree... > > > > Best regards, > Krzysztof >
diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml index eafc33e9ae2e..841273a3d8ae 100644 --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml @@ -51,6 +51,12 @@ properties: LIC instance has 11 slices and Tegra234 LIC has 17 slices. enum: [3, 11, 17] + nvidia,gpio-controller: + $ref: /schemas/types.yaml#/definitions/phandle + description: + The phandle to AON gpio controller instance. This is required to handle + namespace conversion between GPIO and GTE. + '#timestamp-cells': description: This represents number of line id arguments as specified by the @@ -65,22 +71,43 @@ required: - interrupts - "#timestamp-cells" +allOf: + - if: + properties: + compatible: + contains: + enum: + - nvidia,tegra234-gte-aon + then: + required: + - nvidia,gpio-controller + additionalProperties: false examples: - | tegra_hte_aon: timestamp@c1e0000 { compatible = "nvidia,tegra194-gte-aon"; - reg = <0xc1e0000 0x10000>; + reg = <0x0 0xc1e0000 0x0 0x10000>; + interrupts = <0 13 0x4>; + nvidia,int-threshold = <1>; + #timestamp-cells = <1>; + }; + + - | + tegra234_hte_aon: timestamp@c1e0000 { + compatible = "nvidia,tegra234-gte-aon"; + reg = <0x0 0xc1e0000 0x0 0x10000>; interrupts = <0 13 0x4>; nvidia,int-threshold = <1>; + nvidia,gpio-controller = <&gpio_aon>; #timestamp-cells = <1>; }; - | tegra_hte_lic: timestamp@3aa0000 { compatible = "nvidia,tegra194-gte-lic"; - reg = <0x3aa0000 0x10000>; + reg = <0x0 0x3aa0000 0x0 0x10000>; interrupts = <0 11 0x4>; nvidia,int-threshold = <1>; #timestamp-cells = <1>;