Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp312216rdb; Wed, 17 Jan 2024 02:48:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IH0BA/s1zDjMZqKoMndQbHvO/DckcSGM6S3uuk+fF4pbcrRVqIajeaYK7pgq/7TU4kBpyB+ X-Received: by 2002:a05:620a:43a9:b0:783:6b49:8394 with SMTP id a41-20020a05620a43a900b007836b498394mr2307416qkp.65.1705488511713; Wed, 17 Jan 2024 02:48:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705488511; cv=pass; d=google.com; s=arc-20160816; b=gcwtaWRAfMi0UjPocTVgkm5p2AYw39gZx89Bzb3lpwa/kIKMmW3H35UgmwgaMsBYBd 3hESM9fSckxUQh4aJQUERtuTwv9tNzxs03aMsllhXDg8v8er/z36egoH1gzDQrrXznEY SAK5zWasvbqDqAdrtDPlGr3CAMQ9FztWG/UviJnl1TbOMVd+VmFIHg1+btDPAB/iNpjX imUeDGCKlx69EWPs8ia/R21h5A7MvsDSXYq5afZQ0qYboQNGipJwbOQoHfKLCyXnhsxJ /uUPgAkdsqE+nKYVwRzXWFj1i0dpwybtufuyUxpF3ULtkBRgn0h+ecqLA2iZVI42gVTp vQWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:cc:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=a9repfQha27ojMZqc1rUcTlZNTIRH7v52A6zYo+wIZE=; fh=Y/yRHlFgJU9Squ1DR+EVzNyIBZmltuEPUPwH50F6sVM=; b=uM6zcW6vzYO8Ckb9fsF2uCXL3vOgruLeycI1vBLHQIqb77MgoT+JOTOHn5N1DWVhsN I6yqbcAYXt7QN0t/GW8rQM/2QB/lcZpwzcBs8JJeXonJfIcKsUhNyEta7TZat6nyowd6 qmMS4r4/HdmOhcGMNNKBgB1NFGGKtK2rUDwVZ5NbZVjCk6CTB7akE3AIT9cn+repRzQ6 wYn7HZEq+ruGFfPBMIOqcKRnbWYZfRp9eSfwfOPa9Ym609g9hgqOZag3ZMqIhwqz/JKF 28s89TH4RjREVsCo+lOiQkeMmkGVkErkLBsz2TkYTHQUm/ml/G40yuprFduk6GbhTfjK j9bQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=UoCTlZAU; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-28862-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28862-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u11-20020a05620a120b00b007835a6907bfsi5988661qkj.389.2024.01.17.02.48.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 02:48:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28862-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=UoCTlZAU; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-28862-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28862-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6A68F1C2128E for ; Wed, 17 Jan 2024 10:48:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 16C601CAB6; Wed, 17 Jan 2024 10:48:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="UoCTlZAU" Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 705BE1428D; Wed, 17 Jan 2024 10:48:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.142 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705488500; cv=none; b=mPTiNvp0qJweJMbP2XsNc6srFfdV1Gs0VoB6cOg6qQr4vXoX5I5AIlvJZm7AGfMhytWhUcEO4o7MRP0v9CzNJBQtWXlBilZ/YJtS6jJrtXoCWOws+uOgPGrinL0Wbg/twwbm7GACiV099IsAuDe6C+6SGTiywV6gwUhOKDLCnS8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705488500; c=relaxed/simple; bh=IRtIPKrPrnPgK7udAFy1ECVgEAhcxlGb0ZzxkDNZeqk=; h=Received:DKIM-Signature:Received:Received:Received:Received: Message-ID:Date:MIME-Version:User-Agent:CC:Subject:To:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-EXCLAIMER-MD-CONFIG; b=EBBHC6bKh3D+kK0X58mZ4+i3lDtBzCbZDqtFD1v2RjYi/g0aVzjORF7jRB1OOcqogM+h+IyhqzoIHVgsj3bhq/GyhmKlcj5YeDMDkNtaTfNJuGPq50hKXstdQ+3Z3RVllTpS4pieq4r3ei/N5Nmudm3MF2hsR4QZ/NMf0Djbdrg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=UoCTlZAU; arc=none smtp.client-ip=198.47.19.142 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 40HAm5aI094593; Wed, 17 Jan 2024 04:48:05 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1705488485; bh=a9repfQha27ojMZqc1rUcTlZNTIRH7v52A6zYo+wIZE=; h=Date:CC:Subject:To:References:From:In-Reply-To; b=UoCTlZAUXcHhs+tNI1IRq810MUigORiqpXNxg9UbCNzMh4iNTLjr6h9kRgwTDB8uV DXt+4c8ADDZ8K72aNV0O5Ea+TUsUIJSI5KPAyhztByS/2sa6CCVB1jCn1M6Am0PURu 2kqchHsgc2I+MtWSqNMqBRNaq5mCbwNUZx9KpoLo= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 40HAm5vN046838 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 17 Jan 2024 04:48:05 -0600 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Wed, 17 Jan 2024 04:48:04 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Wed, 17 Jan 2024 04:48:04 -0600 Received: from [172.24.227.9] (uda0492258.dhcp.ti.com [172.24.227.9]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 40HAm0pQ061384; Wed, 17 Jan 2024 04:48:01 -0600 Message-ID: Date: Wed, 17 Jan 2024 16:17:59 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird CC: , , , , , , , , , , , , , Subject: Re: [PATCH 1/3] dt-bindings: PCI: ti,j721e-pci-*: Fix check for num-lanes To: Krzysztof Kozlowski References: <20240117102526.557006-1-s-vadapalli@ti.com> <20240117102526.557006-2-s-vadapalli@ti.com> <28fd561a-7c13-48dc-9995-230dc758f257@linaro.org> Content-Language: en-US From: Siddharth Vadapalli In-Reply-To: <28fd561a-7c13-48dc-9995-230dc758f257@linaro.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Hello Krzysztof, On 17/01/24 16:04, Krzysztof Kozlowski wrote: > On 17/01/2024 11:25, Siddharth Vadapalli wrote: >> The existing implementation for validating the "num-lanes" property >> based on the compatible(s) doesn't enforce it. Fix it by updating the >> checks to handle both single-compatible and multi-compatible cases. >> >> Fixes: b3ba0f6e82cb ("dt-bindings: PCI: ti,j721e-pci-*: Add checks for num-lanes") >> Fixes: adc14d44d7cb ("dt-bindings: PCI: ti,j721e-pci-*: Add j784s4-pci-* compatible strings") >> Signed-off-by: Siddharth Vadapalli >> --- >> .../bindings/pci/ti,j721e-pci-ep.yaml | 26 ++++++++++++++----- >> .../bindings/pci/ti,j721e-pci-host.yaml | 26 ++++++++++++++----- >> 2 files changed, 38 insertions(+), 14 deletions(-) >> >> diff --git a/Documentation/devicetree/bindings/pci/ti,j721e-pci-ep.yaml b/Documentation/devicetree/bindings/pci/ti,j721e-pci-ep.yaml >> index 97f2579ea908..278e0892f8ac 100644 >> --- a/Documentation/devicetree/bindings/pci/ti,j721e-pci-ep.yaml >> +++ b/Documentation/devicetree/bindings/pci/ti,j721e-pci-ep.yaml >> @@ -68,8 +68,9 @@ allOf: >> - if: >> properties: >> compatible: > > Missing contains:, instead of your change. I did try the "contains" approach before determining that the implementation in this patch is more suitable. Please consider the following: For AM64 SoC the primary compatible is "ti,am64-pcie-ep" and fallback compatible is "ti,j721e-pcie-ep". For J7200 SoC the primary compatible is "ti,j7200-pcie-ep" while the fallback compatible is again "ti,j721e-pcie-ep". Therefore, the device-tree nodes for AM64 and J7200 look like: AM64: compatible = "ti,am64-pcie-ep", "ti,j721e-pcie-ep"; ... num-lanes = 1; J7200: compatible = "ti,j7200-pcie-ep", "ti,j721e-pcie-ep"; ... num-lanes = 4; This implies that when the check for "num-lanes" is performed on the device-tree node for PCIe in J7200, the fallback compatible of "ti,j721e-pcie-ep" within the AM64's "compatible: contains:" check will match the schema and it will check the existing "num-lanes" being described as "const: 1" against the value in J7200's PCIe node resulting in a warning. Therefore, using "contains" will result in errors if the check has to be performed for device-tree nodes with fallback compatibles. The "items" based approach I have used in this patch ensures that the schema matches *only* when both the primary and fallback compatible are present in the device-tree node. > >> - enum: >> - - ti,am64-pcie-ep >> + items: >> + - const: ti,am64-pcie-ep >> + - const: ti,j721e-pcie-ep > >> then: >> properties: >> num-lanes: >> @@ -78,9 +79,9 @@ allOf: >> - if: >> properties: >> compatible: >> - enum: >> - - ti,j7200-pcie-ep >> - - ti,j721e-pcie-ep >> + items: >> + - const: ti,j7200-pcie-ep >> + - const: ti,j721e-pcie-ep > > "Ditto Same explanation as above. > >> then: >> properties: >> num-lanes: >> @@ -90,8 +91,19 @@ allOf: >> - if: >> properties: >> compatible: >> - enum: >> - - ti,j784s4-pcie-ep >> + items: >> + - const: ti,j721e-pcie-ep >> + then: >> + properties: >> + num-lanes: >> + minimum: 1 >> + maximum: 4 >> + >> + - if: >> + properties: >> + compatible: >> + items: >> + - const: ti,j784s4-pcie-ep > > Why? Previous code was correct. Though I used "patience diff", for some reason the addition of "ti,j721e-pcie-ep" in the check has been treated as the removal of "ti,j784s4-pcie-ep" first followed by adding the same later for generating the diff in this patch. The diff above is equivalent to the addition of: - if: properties: compatible: items: - const: ti,j721e-pcie-ep then: properties: num-lanes: minimum: 1 maximum: 4 -- Regards, Siddharth.