Message ID | 20221102185232.131168-1-krzysztof.kozlowski@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp81131wru; Wed, 2 Nov 2022 11:56:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4bi55lIN5c4u0YBcGOuQ4rhPMIMZjUW6Iyqbj+wR9EcPbGFgrquVzxvXoVRGEXYom4/UOZ X-Received: by 2002:a05:6402:5248:b0:461:f0fa:864e with SMTP id t8-20020a056402524800b00461f0fa864emr25645674edd.81.1667415389753; Wed, 02 Nov 2022 11:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667415389; cv=none; d=google.com; s=arc-20160816; b=dQppPgRdV2U+388A7oW7o9wgqLKJG6AoRa775/we+MgI15ZiGsyfMKAhMc53WPugTq YXcigj2V1hL8M988xTmbGKCnj+5SgH4bo3qVPGNdnoD5xu/HbSysP5FzzHipnO1CU60+ 5IuN0txetwzPkaaMKDoo9FgiqfLhhMetAP9pxbVq6412nZ615sA2z6xmKKEheHzq/1z6 1IoIZ6D8Fw4rylvdEGeWKUlJBx8Yui1he5x85HUdAzSlwExXFycTv3YSEoXf6pCoz9W6 ZKWERtqQYSIR3L7KTrrM+9QKkR7yR9Yzh4Ic/GdeSHTRL8gFIFoUH2n/IDNn9UWR0sKx M1tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=XY2P6DWTOMi8nIXSylwfx8faCY5gykzO71qEAStGHFM=; b=TBXc14b64ZGHi6ew6EhFTQKz1hR/gssvSF7zxhBS4I4O4PJSVSpVZEHVu18T0+iDiH hLeBWMH/PkSnbdOBMCkI1b8cC4snwZ7GxkSCYgbYxjr5viHVJXuzOSos5p+nhZSPrEgw 9B0Y4cK2sbhzji/jolDgAq2pAt9FObTisWXLgbmynAu9+6LE+jd108uPBqE+qR+ZJH41 Ni5e2nDx9O0an/LB7M8vBdK1S9fndRORcFzWgQm69sMDELq2yaN5XcpxbrshXVvytFRK Hk3X/lwpbWO2jIf3tL2Y5/KET1wilhYhOvaJRP0RD+lIS+glaE4FLDgqxacYardN5y4P Rm8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yAqMdJPr; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc36-20020a1709078a2400b007894b9de062si17525748ejc.631.2022.11.02.11.56.05; Wed, 02 Nov 2022 11:56: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=@linaro.org header.s=google header.b=yAqMdJPr; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231716AbiKBSwl (ORCPT <rfc822;yves.mi.zy@gmail.com> + 99 others); Wed, 2 Nov 2022 14:52:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231712AbiKBSwg (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 2 Nov 2022 14:52:36 -0400 Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 038BA1F624 for <linux-kernel@vger.kernel.org>; Wed, 2 Nov 2022 11:52:36 -0700 (PDT) Received: by mail-qv1-xf2a.google.com with SMTP id o8so13101569qvw.5 for <linux-kernel@vger.kernel.org>; Wed, 02 Nov 2022 11:52:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XY2P6DWTOMi8nIXSylwfx8faCY5gykzO71qEAStGHFM=; b=yAqMdJPrNsEmbfN+mOl6g9ycWDlQ/yIO59XvIUZPXnq3Uun4s2DZ7q+NSoJfCZENRt 8bhKEjU0tx7e6VqUoWIQyOyIAmKzqjbIowDZDxLfqXSLBE4KQt4nostkH051DJWkaMry 6zpvOt4ZlLT03dWICdlk/KHhI69Sq+PUqelBf265zcRIKWF0OyGHPH8FTjwgegoww0oz tSveV/FKqIKcGNB/qjHqZ4jFE7hfiSXRvTeKdeKFTtVQ4wiNnWVj+8IINkI22F4Btk+K KqB0V1CW+yV6koc9PrckEgPVRWjv5ih6Qa1WKdU0jvPXWH1jvZCbfLCevjUjyW4dRFUC MQTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XY2P6DWTOMi8nIXSylwfx8faCY5gykzO71qEAStGHFM=; b=T+nI6uMwyJhbelieQapkUbdGPbiLQCG2Wp2Db4aLmsSYVmwUDAV7n5x4h0MNdbNfEH wtaZGaKcURU4y6grE87VlOFWnsg2zvBJwiyIwq0HIW5lXt5Iz12YjZ8oM4YaaRgnpu9M OhcwfMEmqfGgY3Si6pGhrLlcNifBXzE7sVP4UdRtZcRtRX5TVKF6YL4ygXewENUhI1jG nQdBVV+kXpgDbjoUdC1S+rZquUzE9xHDka3wiuqD5YM0vsdgJgYJk09mjjkovq+98yuK HOA/V75t0193UOBldXp4t6TV5dhVVbQM02ELlnwENt+d3Q21T2w8KqrxtbrtXwpjwUiY G2qA== X-Gm-Message-State: ACrzQf0BJSjisGQmpV23D/hyHi5/QAUMLx0wvB5XukpYVL64OA3Rk9SF yrKQ+5KIGsI6eTXbKfi1SmgKSg== X-Received: by 2002:a05:6214:27ef:b0:4bb:f5db:39d5 with SMTP id jt15-20020a05621427ef00b004bbf5db39d5mr16664293qvb.43.1667415155208; Wed, 02 Nov 2022 11:52:35 -0700 (PDT) Received: from krzk-bin.. ([2601:586:5000:570:28d9:4790:bc16:cc93]) by smtp.gmail.com with ESMTPSA id ay7-20020a05620a178700b006cfc1d827cbsm8874387qkb.9.2022.11.02.11.52.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 11:52:34 -0700 (PDT) From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> To: Andrew Lunn <andrew@lunn.ch>, Vivien Didelot <vivien.didelot@gmail.com>, Florian Fainelli <f.fainelli@gmail.com>, Vladimir Oltean <olteanv@gmail.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Subject: [PATCH v2] dt-bindings: net: nxp,sja1105: document spi-cpol/cpha Date: Wed, 2 Nov 2022 14:52:32 -0400 Message-Id: <20221102185232.131168-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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?1748411760191045809?= X-GMAIL-MSGID: =?utf-8?q?1748411760191045809?= |
Series |
[v2] dt-bindings: net: nxp,sja1105: document spi-cpol/cpha
|
|
Commit Message
Krzysztof Kozlowski
Nov. 2, 2022, 6:52 p.m. UTC
Some boards use SJA1105 Ethernet Switch with SPI CPOL and CPHA, so
document this to fix dtbs_check warnings:
arch/arm64/boot/dts/freescale/fsl-lx2160a-bluebox3.dtb: ethernet-switch@0: Unevaluated properties are not allowed ('spi-cpol' was unexpected)
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
Changes since v1:
1. Add also cpha
---
Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml | 3 +++
1 file changed, 3 insertions(+)
Comments
Hi Krzysztof, On Wed, Nov 02, 2022 at 02:52:32PM -0400, Krzysztof Kozlowski wrote: > Some boards use SJA1105 Ethernet Switch with SPI CPOL and CPHA, so > document this to fix dtbs_check warnings: > > arch/arm64/boot/dts/freescale/fsl-lx2160a-bluebox3.dtb: ethernet-switch@0: Unevaluated properties are not allowed ('spi-cpol' was unexpected) > > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > > --- > > Changes since v1: > 1. Add also cpha > --- > Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml > index 1e26d876d146..3debbf0f3789 100644 > --- a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml > +++ b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml > @@ -36,6 +36,9 @@ properties: > reg: > maxItems: 1 > > + spi-cpha: true > + spi-cpol: true > + > # Optional container node for the 2 internal MDIO buses of the SJA1110 > # (one for the internal 100base-T1 PHYs and the other for the single > # 100base-TX PHY). The "reg" property does not have physical significance. > -- > 2.34.1 > Don't these belong to spi-peripheral-props.yaml?
On 03/11/2022 19:33, Vladimir Oltean wrote: > Hi Krzysztof, > > On Wed, Nov 02, 2022 at 02:52:32PM -0400, Krzysztof Kozlowski wrote: >> Some boards use SJA1105 Ethernet Switch with SPI CPOL and CPHA, so >> document this to fix dtbs_check warnings: >> >> arch/arm64/boot/dts/freescale/fsl-lx2160a-bluebox3.dtb: ethernet-switch@0: Unevaluated properties are not allowed ('spi-cpol' was unexpected) >> >> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> >> >> --- >> >> Changes since v1: >> 1. Add also cpha >> --- >> Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml >> index 1e26d876d146..3debbf0f3789 100644 >> --- a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml >> +++ b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml >> @@ -36,6 +36,9 @@ properties: >> reg: >> maxItems: 1 >> >> + spi-cpha: true >> + spi-cpol: true >> + >> # Optional container node for the 2 internal MDIO buses of the SJA1110 >> # (one for the internal 100base-T1 PHYs and the other for the single >> # 100base-TX PHY). The "reg" property does not have physical significance. >> -- >> 2.34.1 >> > > Don't these belong to spi-peripheral-props.yaml? No, they are device specific, not controller specific. Every device requiring them must explicitly include them. See: https://lore.kernel.org/all/20220816124321.67817-1-krzysztof.kozlowski@linaro.org/ Best regards, Krzysztof
On Thu, Nov 03, 2022 at 09:44:36PM -0400, Krzysztof Kozlowski wrote: > > Don't these belong to spi-peripheral-props.yaml? > > No, they are device specific, not controller specific. Every device > requiring them must explicitly include them. > > See: > https://lore.kernel.org/all/20220816124321.67817-1-krzysztof.kozlowski@linaro.org/ > > Best regards, > Krzysztof > I think you really mean to link to: https://lore.kernel.org/all/20220718220012.GA3625497-robh@kernel.org/ oh and btw, doesn't that mean that the patch is missing Fixes: 233363aba72a ("spi/panel: dt-bindings: drop CPHA and CPOL from common properties") ? but I'm not sure I understand the reasoning? I mean, from the perspective of the common schema, isn't it valid to put "spi-cpha" on a SPI peripheral OF node even if the hardware doesn't support it, in the same way that it's valid to put spi-max-frequency = 1 GHz even if the hardware doesn't support it? Or maybe I'm missing the point of spi-peripheral-props.yaml entirely? Since when is stacked-memories/ parallel-memories something that should be accepted by all schemas of all SPI peripherals (for example here, an Ethernet switch)? I think that spi-cpha/spi-cpol belongs to spi-peripheral-props.yaml just as much as the others do. The distinction "device specific, not controller specific" is arbitrary to me. These are settings that the controller has to make in order to talk to that specific peripheral. Same as many others in that file.
On 03/11/2022 22:03, Vladimir Oltean wrote: > On Thu, Nov 03, 2022 at 09:44:36PM -0400, Krzysztof Kozlowski wrote: >>> Don't these belong to spi-peripheral-props.yaml? >> >> No, they are device specific, not controller specific. Every device >> requiring them must explicitly include them. >> >> See: >> https://lore.kernel.org/all/20220816124321.67817-1-krzysztof.kozlowski@linaro.org/ >> >> Best regards, >> Krzysztof >> > > I think you really mean to link to: > https://lore.kernel.org/all/20220718220012.GA3625497-robh@kernel.org/ > > oh and btw, doesn't that mean that the patch is missing > Fixes: 233363aba72a ("spi/panel: dt-bindings: drop CPHA and CPOL from common properties") > ? > > but I'm not sure I understand the reasoning? I mean, from the > perspective of the common schema, isn't it valid to put "spi-cpha" on a > SPI peripheral OF node even if the hardware doesn't support it, in the > same way that it's valid to put spi-max-frequency = 1 GHz even if the It is not valid to put spi-max-frequency = 1 GHz in spi-peripheral-props.yaml. > hardware doesn't support it? Or maybe I'm missing the point of > spi-peripheral-props.yaml entirely? Since when is stacked-memories/ > parallel-memories something that should be accepted by all schemas of > all SPI peripherals (for example here, an Ethernet switch)? Since we discussed it last time. What is not clear in Rob's response? He nicely explained the purpose of spi-peripheral-props.yaml. > I think that spi-cpha/spi-cpol belongs to spi-peripheral-props.yaml just > as much as the others do. > > The distinction "device specific, not controller specific" is arbitrary > to me. These are settings that the controller has to make in order to > talk to that specific peripheral. Same as many others in that file. Not every fruit is an orange, but every orange is a fruit. You do not put "color: orange" to schema for fruits. You put it to the schema for oranges. IOW, CPHA/CPOL are not valid for most devices, so they cannot be in spi-peripheral-props.yaml. Best regards, Krzysztof
On Fri, Nov 04, 2022 at 09:09:02AM -0400, Krzysztof Kozlowski wrote: > > I think that spi-cpha/spi-cpol belongs to spi-peripheral-props.yaml just > > as much as the others do. > > > > The distinction "device specific, not controller specific" is arbitrary > > to me. These are settings that the controller has to make in order to > > talk to that specific peripheral. Same as many others in that file. > > Not every fruit is an orange, but every orange is a fruit. You do not > put "color: orange" to schema for fruits. You put it to the schema for > oranges. > > IOW, CPHA/CPOL are not valid for most devices, so they cannot be in > spi-peripheral-props.yaml. Ok, then this patch is not correct either. The "nxp,sja1105*" devices need to have only "spi-cpha", and the "nxp,sja1110*" devices need to have only "spi-cpol".
On Fri, Nov 04, 2022 at 09:09:02AM -0400, Krzysztof Kozlowski wrote: > It is not valid to put spi-max-frequency = 1 GHz in > spi-peripheral-props.yaml. ... > IOW, CPHA/CPOL are not valid for most devices, so they cannot be in > spi-peripheral-props.yaml. Your understanding of SPI clock polarity/phase is probably not the same as mine. "Not valid for most devices" is a gross misrepresentation. There are 4 electrical modes of communication between a SPI controller and a peripheral, formed by the 0/1 combination of the CPOL and CPHA bits. Some peripherals support only a subset of these modes of operation, that is completely true and I agree with it. But they're still SPI devices, and all 4 modes of communication apply to them all. That's why I made the comparison with the 1 GHz frequency. The spi-peripheral-props.yaml schema only says what properties are valid for a peripheral, and both CPOL and CPHA are valid for all SPI peripherals, even if some combos don't work (when neither spi-cpol nor spi-cpha is present, they are 0 and 0, so the connection works in SPI mode 0).
On 04/11/2022 12:52, Vladimir Oltean wrote: > On Fri, Nov 04, 2022 at 09:09:02AM -0400, Krzysztof Kozlowski wrote: >>> I think that spi-cpha/spi-cpol belongs to spi-peripheral-props.yaml just >>> as much as the others do. >>> >>> The distinction "device specific, not controller specific" is arbitrary >>> to me. These are settings that the controller has to make in order to >>> talk to that specific peripheral. Same as many others in that file. >> >> Not every fruit is an orange, but every orange is a fruit. You do not >> put "color: orange" to schema for fruits. You put it to the schema for >> oranges. >> >> IOW, CPHA/CPOL are not valid for most devices, so they cannot be in >> spi-peripheral-props.yaml. > > Ok, then this patch is not correct either. The "nxp,sja1105*" devices > need to have only "spi-cpha", and the "nxp,sja1110*" devices need to > have only "spi-cpol". Sure, I'll add allOf:if:then based on your input. Best regards, Krzysztof
On Fri, Nov 04, 2022 at 01:13:34PM -0400, Krzysztof Kozlowski wrote: > On 04/11/2022 12:52, Vladimir Oltean wrote: > > Ok, then this patch is not correct either. The "nxp,sja1105*" devices > > need to have only "spi-cpha", and the "nxp,sja1110*" devices need to > > have only "spi-cpol". > > Sure, I'll add allOf:if:then based on your input. No, actually my input is that removing such core properties as spi-cpol/ spi-cpha from spi-peripheral-props.yaml challenges the whole purpose of that schema fragment. I can go back at it and complain all day that my peripheral doesn't need spi-cs-high, spi-lsb-first, spi-rx-bus-width, spi-tx-bus-width, stacked-memories, parallel-memories and what not. Or that the SJA1105 switch will never need the properties of nvidia,tegra210-quad-peripheral-props.yaml#, because the former speaks SPI and the latter speaks QSPI (for flashes). By this logic, eventually that schema will be reduced to nothing. Yet I don't believe that including just the intersection of properties that actually lead to functional hardware for all peripherals was the *intention* of that schema. Just the properties which are semantically valid, and cpol/cpha are absolutely semantically valid. The justification that cpol/cpha are "not valid" for some peripherals (or correctly said, those peripherals only work in mode 0) is very weak to begin with, and restricting the SPI modes to only those that physically work should IMO be the duty of the hardware schema and not the common schema. The common schema just provides the type and description, the hardware gives the valid ranges.
diff --git a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml index 1e26d876d146..3debbf0f3789 100644 --- a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml +++ b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml @@ -36,6 +36,9 @@ properties: reg: maxItems: 1 + spi-cpha: true + spi-cpol: true + # Optional container node for the 2 internal MDIO buses of the SJA1110 # (one for the internal 100base-T1 PHYs and the other for the single # 100base-TX PHY). The "reg" property does not have physical significance.