2023-03-13 22:52:17

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 00/16] dt-bindings: net: dwmac: Extend clocks, props desc and constraints

This patchset is the fourth one in the series of updates implemented in
the framework of activity to simplify the DW MAC/STMMAC driver code and
provide Baikal GMAC/X-GMAC support after all:

[1: In-review v1]: net: stmmac: Fixes bundle #1
Link: https://lore.kernel.org/netdev/[email protected]/
[2: Stalled v1]: net: stmmac: Fixes bundle #2
Link: ---not submitted yet---
[3: Stalled v1]: net: stmmac: Fixes bundle #3
Link: ---not submitted yet---
+> [4: In-review v1]: dt-bindings: net: dwmac: Extend clocks, props desc and constraints
+> Link: ---you are looking at it---
[5: Stalled v1]: dt-bindings: net: dwmac: Fix MTL queues and AXI-bus props
Link: ---not submitted yet---
[6: Stalled v1]: net: stmmac: Generic platform res, props and DMA cleanups
Link: ---not submitted yet---
[7: Stalled v1]: net: stmmac: Generic platform rst, phy and clk cleanups
Link: ---not submitted yet---
[8: Stalled v1]: net: stmmac: Main driver code cleanups bundle #1
Link: ---not submitted yet---
[9: Stalled v1]: net: stmmac: Main driver code cleanups bundle #2
Link: ---not submitted yet---
[10: Stalled v1]: net: stmmac: DW MAC HW info init refactoring
Link: ---not submitted yet---
[11: Stalled v1]: net: stmmac: Convert to using HW capabilities bundle #1
Link: ---not submitted yet---
[12: Stalled v1]: net: stmmac: Convert to using HW capabilities bundle #2
Link: ---not submitted yet---
[13: Stalled v1]: net: stmmac: Convert to using HW capabilities bundle #3
Link: ---not submitted yet---
[14: Stalled v1]: net: stmmac: Convert to using HW capabilities bundle #4
Link: ---not submitted yet---
[15: Stalled v1]: net: stmmac: Unify/simplify HW-interface
Link: ---not submitted yet---
[16: Stalled v1]: net: stmmac: Norm/Enh/etc DMA descriptor init fixes
Link: ---not submitted yet---
[17: Stalled v1]: net: stmmac: Norm/Enh/etc DMA descriptor init cleanups
Link: ---not submitted yet---
[18: Stalled v1]: net: stmmac: Main driver code cleanups bundle #3
Link: ---not submitted yet---
[..: In-prep] to be continued (IRQ handling refactoring, SW-reset-less config,
generic GPIO support, ARP offload support,
In-band RGMII link state, etc)
[..: In-prep] to be continued (Baikal-{T,M,L,S} SoCs GMAC, X-GMAC and XPCS
support)

Please visit the next link for the detailed justification of the changes
series introduced in the list above:
Link: https://lore.kernel.org/netdev/[email protected]/

Here is a short summary of what is introduced in this patchset.

The series starts with fixes of the PBL (Programmable DMA Burst length)
DT-property, which is supposed to be defined for each DW *MAC IP-core, but
not only for a Allwinner sun* and Ingenic GMAC and DW xGMAC. The number of
possible PBL values need to be also extended in accordance with the DW
*MAC manual. Then the TSO flag property should be also declared free of
the vendor-specific conditional schema, because the driver expects the
compatible string to have the IP-core version specified anyway and none of
the glue-drivers refer to the property directly. Moreover the original
Allwinner sunXi bindings file didn't have the TSO-related property
declared. So we can freely do that.

Then in order to improve the DT-bindings maintainability we suggest to
split up the generic DT-properties and generic DT-nodes schema leaving the
properties definition in the "snps,dwmac.yaml" file and moving the generic
DW *MAC DT-nodes bindings validation in the dedicated DT-schema
"snps,dwmac-generic.yaml".

We've found out that the DW MAC bindings don't provide a correct description
of the System/CSR clocks and a comprehensive enough description of the
clock-related "snps,clk-csr" property. So in order to have more
descriptive bindings we suggest to add a bit more details about the
App/CSR clocks and CSR-MDC divider property.

Then seeing the any DW MAC IP-core revision can be equipped with an
external Tx/Rx clock sources we suggest to add the "tx"/"rx" clocks
declaration into the generic DW MAC DT-schema.

Afterwards a set of the AXI-bus config property cleanups are introduced.
First we suggest to drop the "snps,axi-config" property description since
it duplicates the stmmac-axi-config sub-node DT-bindings. Second the
unevaluatedProperties property is replaced with additionalProperties as
more suitable for the "stmmac-axi-config" schema. Third the proper
constraints are added to the properties of the "stmmac-axi-config"
sub-node.

Then three patches concerning the MTL Tx/Rx queue configs go, which add
the sub-nodes properties constraints and fix the MTL Tx queue properties
description.

The next patch converts the DW MAC DT-bindings to using the "flag"
definition instead of the native boolean type for relevant properties.
It's done for the sake of the DT-schema unification.

The series is closed with the two patches concerning the MTL queue config
properties dependencies. First one provides a simpler construction for the
MTL queue properties inter-dependencies. The second one adds the
dependencies definition for the MTL Tx queue CBS-algo properties.

Signed-off-by: Serge Semin <[email protected]>
Cc: Alexey Malahov <[email protected]>
Cc: Pavel Parkhomenko <[email protected]>
Cc: Christian Marangi <[email protected]>
Cc: Richard Cochran <[email protected]>
Cc: Biao Huang <[email protected]>
Cc: Yang Yingliang <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Serge Semin (16):
dt-bindings: net: dwmac: Validate PBL for all IP-cores
dt-bindings: net: dwmac: Extend number of PBL values
dt-bindings: net: dwmac: Fix the TSO property declaration
dt-bindings: net: dwmac: Detach Generic DW MAC bindings
dt-bindings: net: dwmac: Elaborate snps,clk-csr description
dt-bindings: net: dwmac: Elaborate stmmaceth/pclk clocks description
dt-bindings: net: dwmac: Add Tx/Rx clock sources
dt-bindings: net: dwmac: Drop prop names from snps,axi-config
description
dt-bindings: net: dwmac: Prohibit additional props in AXI-config
dt-bindings: net: dwmac: Add AXI-bus properties constraints
dt-bindings: net: dwmac: Add MTL Rx Queue properties constraints
dt-bindings: net: dwmac: Add MTL Tx Queue properties constraints
dt-bindings: net: dwmac: Fix MTL Tx Queue props description
dt-bindings: net: dwmac: Use flag definition instead of booleans
dt-bindings: net: dwmac: Simplify MTL queue props dependencies
dt-bindings: net: dwmac: Add MTL Tx queue CBS-algo props dependencies

.../bindings/net/snps,dwmac-generic.yaml | 155 +++++
.../devicetree/bindings/net/snps,dwmac.yaml | 586 +++++++-----------
MAINTAINERS | 1 +
3 files changed, 381 insertions(+), 361 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml

--
2.39.2




2023-03-13 22:52:21

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 01/16] dt-bindings: net: dwmac: Validate PBL for all IP-cores

Indeed the maximum DMA burst length can be programmed not only for DW
xGMACs, Allwinner EMACs and Spear SoC GMAC, but in accordance with [1]
for Generic DW *MAC IP-cores. Moreover the STMMAC set of drivers parse
the property and then apply the configuration for all supported DW MAC
devices. All of that makes the property being available for all IP-cores
the bindings supports. Let's make sure the PBL-related properties are
validated for all of them by the common DW MAC DT schema.

[1] DesignWare Cores Ethernet MAC Universal Databook, Revision 3.73a,
October 2013, p. 380.

Signed-off-by: Serge Semin <[email protected]>
Reviewed-by: Rob Herring <[email protected]>

---

Changelog v1:
- Use correct syntax of the JSON pointers, so the later would begin
with a '/' after the '#'.
---
.../devicetree/bindings/net/snps,dwmac.yaml | 77 +++++++------------
1 file changed, 26 insertions(+), 51 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index 16b7d2904696..a0a0437eb4f0 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -426,6 +426,32 @@ properties:
description:
Use Address-Aligned Beats

+ snps,pbl:
+ description:
+ Programmable Burst Length (tx and rx)
+ $ref: /schemas/types.yaml#/definitions/uint32
+ enum: [2, 4, 8]
+
+ snps,txpbl:
+ description:
+ Tx Programmable Burst Length. If set, DMA tx will use this
+ value rather than snps,pbl.
+ $ref: /schemas/types.yaml#/definitions/uint32
+ enum: [2, 4, 8]
+
+ snps,rxpbl:
+ description:
+ Rx Programmable Burst Length. If set, DMA rx will use this
+ value rather than snps,pbl.
+ $ref: /schemas/types.yaml#/definitions/uint32
+ enum: [2, 4, 8]
+
+ snps,no-pbl-x8:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description:
+ Don\'t multiply the pbl/txpbl/rxpbl values by 8. For core
+ rev < 3.50, don\'t multiply the values by 4.
+
snps,fixed-burst:
$ref: /schemas/types.yaml#/definitions/flag
description:
@@ -556,57 +582,6 @@ dependencies:

allOf:
- $ref: "ethernet-controller.yaml#"
- - if:
- properties:
- compatible:
- contains:
- enum:
- - allwinner,sun7i-a20-gmac
- - allwinner,sun8i-a83t-emac
- - allwinner,sun8i-h3-emac
- - allwinner,sun8i-r40-gmac
- - allwinner,sun8i-v3s-emac
- - allwinner,sun50i-a64-emac
- - ingenic,jz4775-mac
- - ingenic,x1000-mac
- - ingenic,x1600-mac
- - ingenic,x1830-mac
- - ingenic,x2000-mac
- - snps,dwmac-3.50a
- - snps,dwmac-4.10a
- - snps,dwmac-4.20a
- - snps,dwxgmac
- - snps,dwxgmac-2.10
- - st,spear600-gmac
-
- then:
- properties:
- snps,pbl:
- description:
- Programmable Burst Length (tx and rx)
- $ref: /schemas/types.yaml#/definitions/uint32
- enum: [1, 2, 4, 8, 16, 32]
-
- snps,txpbl:
- description:
- Tx Programmable Burst Length. If set, DMA tx will use this
- value rather than snps,pbl.
- $ref: /schemas/types.yaml#/definitions/uint32
- enum: [1, 2, 4, 8, 16, 32]
-
- snps,rxpbl:
- description:
- Rx Programmable Burst Length. If set, DMA rx will use this
- value rather than snps,pbl.
- $ref: /schemas/types.yaml#/definitions/uint32
- enum: [1, 2, 4, 8, 16, 32]
-
- snps,no-pbl-x8:
- $ref: /schemas/types.yaml#/definitions/flag
- description:
- Don\'t multiply the pbl/txpbl/rxpbl values by 8. For core
- rev < 3.50, don\'t multiply the values by 4.
-
- if:
properties:
compatible:
--
2.39.2



2023-03-13 22:52:25

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 03/16] dt-bindings: net: dwmac: Fix the TSO property declaration

Indeed the STMMAC driver doesn't take the vendor-specific compatible
string into account to parse the "snps,tso" boolean property. It just
makes sure the node is compatible with DW MAC 4.x, 5.x and DW xGMAC
IP-cores. The original allwinner sunXi bindings file also didn't have the
TSO-related property declared. Neither Ingenic nor Loongson LLD drivers
activate the GMAC4/5/etc-specific core code. Taking all of that into
account fix the conditional statement so the TSO-property would be
evaluated for the compatibles having the corresponding IP-core version by
dropping all of the vendor-specific compatibles from the property
conditional statement.

Signed-off-by: Serge Semin <[email protected]>
Reviewed-by: Rob Herring <[email protected]>

---

Note this won't break the bindings description, since the "snps,tso"
property isn't parsed by the denoted glue drivers, but only by the generic
platform DT-parser.

Changelog v1:
- Use correct syntax of the JSON pointers, so the later would begin
with a '/' after the '#'.
---
.../devicetree/bindings/net/snps,dwmac.yaml | 15 ---------------
1 file changed, 15 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index fb9b8506a48f..92feed3c29bc 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -590,27 +590,12 @@ allOf:
compatible:
contains:
enum:
- - allwinner,sun7i-a20-gmac
- - allwinner,sun8i-a83t-emac
- - allwinner,sun8i-h3-emac
- - allwinner,sun8i-r40-gmac
- - allwinner,sun8i-v3s-emac
- - allwinner,sun50i-a64-emac
- - loongson,ls2k-dwmac
- - loongson,ls7a-dwmac
- - ingenic,jz4775-mac
- - ingenic,x1000-mac
- - ingenic,x1600-mac
- - ingenic,x1830-mac
- - ingenic,x2000-mac
- snps,dwmac-4.00
- snps,dwmac-4.10a
- snps,dwmac-4.20a
- snps,dwmac-5.10a
- snps,dwxgmac
- snps,dwxgmac-2.10
- - st,spear600-gmac
-
then:
properties:
snps,tso:
--
2.39.2



2023-03-13 22:52:28

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 02/16] dt-bindings: net: dwmac: Extend number of PBL values

In accordance with [1] the permitted PBL values can be set as one of [1,
2, 4, 8, 16, 32]. The rest of the values result in undefined behavior. At
the same time some of the permitted values can be also invalid depending
on the controller FIFOs size and the data bus width. Due to having too
many variables all the possible PBL property constraints can't be
implemented in the bindings schema, let's extend the set of permitted PBL
values to be as much as the configuration register supports leaving the
undefined behaviour cases for developers to handle.

[1] DesignWare Cores Ethernet MAC Universal Databook, Revision 3.73a,
October 2013, p. 380.

Signed-off-by: Serge Semin <[email protected]>
Reviewed-by: Rob Herring <[email protected]>

---

Changelog v1:
- Use correct syntax of the JSON pointers, so the later would begin
with a '/' after the '#'.
---
Documentation/devicetree/bindings/net/snps,dwmac.yaml | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index a0a0437eb4f0..fb9b8506a48f 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -428,23 +428,26 @@ properties:

snps,pbl:
description:
- Programmable Burst Length (tx and rx)
+ Programmable Burst Length (tx and rx). Note some of these values
+ can be still invalid due to HW limitations connected with the data
+ bus width and the FIFOs depth, so a total length of a single DMA
+ burst shouldn't exceed half the FIFO depth.
$ref: /schemas/types.yaml#/definitions/uint32
- enum: [2, 4, 8]
+ enum: [1, 2, 4, 8, 16, 32]

snps,txpbl:
description:
Tx Programmable Burst Length. If set, DMA tx will use this
value rather than snps,pbl.
$ref: /schemas/types.yaml#/definitions/uint32
- enum: [2, 4, 8]
+ enum: [1, 2, 4, 8, 16, 32]

snps,rxpbl:
description:
Rx Programmable Burst Length. If set, DMA rx will use this
value rather than snps,pbl.
$ref: /schemas/types.yaml#/definitions/uint32
- enum: [2, 4, 8]
+ enum: [1, 2, 4, 8, 16, 32]

snps,no-pbl-x8:
$ref: /schemas/types.yaml#/definitions/flag
--
2.39.2



2023-03-13 22:53:08

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 05/16] dt-bindings: net: dwmac: Elaborate snps,clk-csr description

The property is utilized to set the CSR-MDC clock selector in the STMMAC
driver. The specified value is used instead of auto-detecting the
CSR/application clocks divider based on the reference clock rate. Let's
add a more detailed description to clarify the property purpose and
permitted values. In the later case the constraints are specified based on
the DW *MAC CR registers permitted values.

Signed-off-by: Serge Semin <[email protected]>
---
Documentation/devicetree/bindings/net/snps,dwmac.yaml | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index 224f8f70db85..edef405766e4 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -427,7 +427,15 @@ properties:
snps,clk-csr:
$ref: /schemas/types.yaml#/definitions/uint32
description:
- Frequency division factor for MDC clock.
+ CSR-MDC clock selector. It sets up a divider of the CSR/application
+ clock to create an MDC signal with desired frequency. Note the
+ property value doesn't specify the divider itself by encodes the
+ corresponding divider value specific to the IP-core.
+ DW GMAC 0 - 42, 1 - 62, 2 - 16, 3 - 26, 4 - 102, 5 - 124, 8 - 4,
+ 9 - 6, 10 - 8, 11 - 10, 12 - 12, 13 - 14, 14 - 16, 15 - 18.
+ DW xGMAC 0 - 62, 1 - 102, 2 - 122, 3 - 142, 4 - 162, 5 - 202.
+ minimum: 0
+ maximum: 15

mdio:
$ref: mdio.yaml#
--
2.39.2



2023-03-13 22:53:12

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 07/16] dt-bindings: net: dwmac: Add Tx/Rx clock sources

Generic DW *MAC can be connected to an external Transmit and Receive clock
generators. Add the corresponding clocks description and clock-names to
the generic bindings schema so new DW *MAC-based bindings wouldn't declare
its own names of the same clocks.

Signed-off-by: Serge Semin <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---
.../devicetree/bindings/net/snps,dwmac.yaml | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index 3e3fbc1dfafa..01f385867c3a 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -47,6 +47,18 @@ properties:
MCI, CSR and SMA interfaces run on this clock. If it's omitted,
the CSR interfaces are considered as synchronous to the system
clock domain.
+ - description:
+ GMAC Tx clock or so called Transmit clock. The clock is supplied
+ by an external with respect to the DW MAC clock generator.
+ The clock source and its frequency depends on the DW MAC xMII mode.
+ In case if it's supplied by PHY/SerDes this property can be
+ omitted.
+ - description:
+ GMAC Rx clock or so called Receive clock. The clock is supplied
+ by an external with respect to the DW MAC clock generator.
+ The clock source and its frequency depends on the DW MAC xMII mode.
+ In case if it's supplied by PHY/SerDes or it's synchronous to
+ the Tx clock this property can be omitted.
- description:
PTP reference clock. This clock is used for programming the
Timestamp Addend Register. If not passed then the system
@@ -60,6 +72,8 @@ properties:
enum:
- stmmaceth
- pclk
+ - tx
+ - rx
- ptp_ref

resets:
--
2.39.2



2023-03-13 22:53:18

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 06/16] dt-bindings: net: dwmac: Elaborate stmmaceth/pclk clocks description

Current clocks description doesn't provide a comprehensive notion about
what "stmmaceth" and "pclk" actually represent from the IP-core manual
point of view. The bindings file states:
stmmaceth - "GMAC main clock",
apb - "Peripheral registers interface clock".
It isn't that easy to understand what they actually mean especially seeing
the DW *MAC manual operates with clock definitions like Application,
System, Host, CSR, Transmit, Receive, etc clocks. Moreover the clocks
usage in the driver doesn't shade a full light on their essence. What
inferred from there is that the "stmmaceth" name has been assigned to the
common clock, which feeds both system and CSR interfaces. But what about
"apb"? The bindings defines it as the clock for "peripheral registers
interface". So it's close to the CSR clock in the IP-core manual notation.
If so then when "apb" clock is specified aside with the "stmmaceth", it
represents a case when the DW *MAC is synthesized with CSR_SLV_CLK=y
(separate system and CSR clocks). But even though the "apb" clock is
requested in the MAC driver, the driver doesn't actually use it as a
separate CSR clock where the IP-core manual requires. All of that makes me
thinking that the case of separate system and CSR clocks isn't correctly
implemented in the driver.

Let's start with elaborating the clocks description so anyone reading
the DW *MAC bindings file would understand that "stmmaceth" is the
system clock and "pclk" is actually the CSR clock. Indeed in accordance
with sheets depicted in [1]:
system/application clock can be either of: hclk_i, aclk_i, clk_app_i;
CSR clock can be either of: hclk_i, aclk_i, clk_app_i, clk_csr_i.
(Similar definitions present in the others IP-core manuals.) So the CSR
clock can be tied to the application clock considering the later as the
main clock, but not the other way around. In case if there is only
"stmmaceth" clock specified in a DT node, then it will be considered as a
source of clock signal for both application and CSR. But if "pclk" is also
specified in the list of the device clocks, then it will be perceived as
the separate CSR clock.

[1] DesignWare Cores Ethernet MAC Universal Databook, Revision 3.73a,
October 2013, p. 564.

Signed-off-by: Serge Semin <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---
.../devicetree/bindings/net/snps,dwmac.yaml | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index edef405766e4..3e3fbc1dfafa 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -37,8 +37,16 @@ properties:
maxItems: 8
additionalItems: true
items:
- - description: GMAC main clock
- - description: Peripheral registers interface clock
+ - description:
+ GMAC main clock, also called as system/application clock.
+ This clock is used to provide a periodic signal for the DMA/MTL
+ interface and optionally for CSR, if the later isn't separately
+ clocked.
+ - description:
+ Peripheral registers interface clock, also called as CSR clock.
+ MCI, CSR and SMA interfaces run on this clock. If it's omitted,
+ the CSR interfaces are considered as synchronous to the system
+ clock domain.
- description:
PTP reference clock. This clock is used for programming the
Timestamp Addend Register. If not passed then the system
--
2.39.2



2023-03-13 22:53:22

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 08/16] dt-bindings: net: dwmac: Drop prop names from snps,axi-config description

The property is supposed to contain a phandle reference to the DT-node
with the AXI-bus parameters. Such DT-node is described in the same
DT-bindings schema by means of the sub-node with the name
"stmmac-axi-config". Similarly to MTL Tx/Rx config phandle properties
let's drop the target DT-node properties list from the "snps,axi-config"
property description since having that duplicate is not only pointless,
but also worsens the bindings maintainability by causing a need to support
the two identical lists. Instead the reference to the target DT-node is
added to the description.

Signed-off-by: Serge Semin <[email protected]>
---
.../devicetree/bindings/net/snps,dwmac.yaml | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index 01f385867c3a..89be67e55c3e 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -98,17 +98,9 @@ properties:
snps,axi-config:
$ref: /schemas/types.yaml#/definitions/phandle
description:
- AXI BUS Mode parameters. Phandle to a node that can contain the
- following properties
- * snps,lpi_en, enable Low Power Interface
- * snps,xit_frm, unlock on WoL
- * snps,wr_osr_lmt, max write outstanding req. limit
- * snps,rd_osr_lmt, max read outstanding req. limit
- * snps,kbbe, do not cross 1KiB boundary.
- * snps,blen, this is a vector of supported burst length.
- * snps,fb, fixed-burst
- * snps,mb, mixed-burst
- * snps,rb, rebuild INCRx Burst
+ AXI BUS Mode parameters. Phandle to a node that
+ implements the 'stmmac-axi-config' object described in
+ this binding.

snps,mtl-rx-config:
$ref: /schemas/types.yaml#/definitions/phandle
--
2.39.2



2023-03-13 22:53:36

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 09/16] dt-bindings: net: dwmac: Prohibit additional props in AXI-config

Currently DT-schema of the AXI-bus config sub-node prohibits to have
unknown properties by using the unevaluatedProperties property. It's
overkill for the sub-node which doesn't use any combining schemas
keywords (allOf, anyOf, etc). Instead more natural is to use
additionalProperties to prohibit for that.

Signed-off-by: Serge Semin <[email protected]>
---
Documentation/devicetree/bindings/net/snps,dwmac.yaml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index 89be67e55c3e..d1b2910b799b 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -466,7 +466,6 @@ properties:

stmmac-axi-config:
type: object
- unevaluatedProperties: false
description:
AXI BUS Mode parameters.

@@ -518,6 +517,8 @@ properties:
description:
rebuild INCRx Burst

+ additionalProperties: false
+
required:
- compatible
- reg
--
2.39.2



2023-03-13 22:53:40

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 11/16] dt-bindings: net: dwmac: Add MTL Rx Queue properties constraints

Currently none of the MTL Rx Queues QoS-related DT-properties have been
equipped with the proper constraints. Meanwhile they can be specified at
least based on the corresponding CSR field sizes or the DW (x|xG)MAC
IP-core synthesize parameter constraints. Let's do that:
+ snps,rx-queues-to-use - number of Rx queues to utilise is limited with a
number of available queues. DW MAC/GMAC: no queues, DW Eth QoS: <= 8, DW
xGMAC: <= 12.
+ snps,map-to-dma-channel - DMA channel ID is limited with a number of
available DMA-channels. DW MAC/GMAC: <= 3, DW Eth QoS: <= 8, DW xGMAC: <=
16.
+ snps,priority - bitfield of the USP (user Priority) values of the tagged
packets is limited with the corresponding CSR field width or a maximum
possible VLAN tag PRI field value (it's 7). DW MAC/GMAC: no queues, DW Eth
QoS: 0xff, DW xGMAC: 0xff.

Since the constraints vary for different IP-cores and the DT-schema is
common for all of them the least restrictive values are chosen. The info
above can be used for the IP-core specific DT-schemas if anybody ever is
bothered with one to create.

Signed-off-by: Serge Semin <[email protected]>
---
.../devicetree/bindings/net/snps,dwmac.yaml | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index f24718a8d184..e5662b1498b7 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -115,6 +115,10 @@ properties:
snps,rx-queues-to-use:
$ref: /schemas/types.yaml#/definitions/uint32
description: number of RX queues to be used in the driver
+ default: 1
+ minimum: 1
+ maximum: 12
+
snps,rx-sched-sp:
type: boolean
description: Strict priority
@@ -135,7 +139,7 @@ properties:
properties:
snps,rx-sched-sp: false
patternProperties:
- "^queue[0-9]$":
+ "^queue([0-9]|1[0-1])$":
description: Each subnode represents a queue.
type: object
properties:
@@ -148,6 +152,9 @@ properties:
snps,map-to-dma-channel:
$ref: /schemas/types.yaml#/definitions/uint32
description: DMA channel id to map
+ minimum: 0
+ maximum: 15
+
snps,route-avcp:
type: boolean
description: AV Untagged Control packets
@@ -166,6 +173,9 @@ properties:
snps,priority:
$ref: /schemas/types.yaml#/definitions/uint32
description: Bitmask of the tagged frames priorities assigned to the queue
+ minimum: 0
+ maximum: 0xFF
+
allOf:
- if:
required:
--
2.39.2



2023-03-13 22:53:43

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 10/16] dt-bindings: net: dwmac: Add AXI-bus properties constraints

Currently none of the AXI-bus non-boolean DT-properties have constraints
defined meanwhile they can be specified at least based on the
corresponding device configs. Let's do that:
+ snps,wr_osr_lm/snps,rd_osr_lmt - maximum number of outstanding AXI-bus
read/write requests is limited with the IP-core synthesize parameter
AXI_MAX_{RD,WR}_REQ. DW MAC/GMAC: <= 16, DW Eth QoS: <= 32, DW xGMAC: <=
64. The least restrictive constraint is defined since the DT-schema is
common for all IP-cores.
+ snps,blen - array of the burst lengths supported by the AXI-bus. Values
are limited by the AXI3/4 bus standard, available AXI/System bus CSR flags
and the AXI-bus IP-core synthesize config . All DW *MACs support setting
the burst length within the set: 4, 8, 16, 32, 64, 128, 256. If some burst
length is unsupported a zero value can be specified instead in the array.

Signed-off-by: Serge Semin <[email protected]>
---
Documentation/devicetree/bindings/net/snps,dwmac.yaml | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index d1b2910b799b..f24718a8d184 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -484,11 +484,17 @@ properties:
$ref: /schemas/types.yaml#/definitions/uint32
description:
max write outstanding req. limit
+ default: 1
+ minimum: 1
+ maximum: 64

snps,rd_osr_lmt:
$ref: /schemas/types.yaml#/definitions/uint32
description:
max read outstanding req. limit
+ default: 1
+ minimum: 1
+ maximum: 64

snps,kbbe:
$ref: /schemas/types.yaml#/definitions/uint32
@@ -501,6 +507,8 @@ properties:
this is a vector of supported burst length.
minItems: 7
maxItems: 7
+ items:
+ enum: [256, 128, 64, 32, 16, 8, 4, 0]

snps,fb:
$ref: /schemas/types.yaml#/definitions/flag
--
2.39.2



2023-03-13 22:54:11

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 13/16] dt-bindings: net: dwmac: Fix MTL Tx Queue props description

Invalid MTL Tx Queues DT-properties description was added right at the
initial DCB/AVB features patch. Most likely due to copy-paste mistake the
text currently matches to what is specified for the AXI-bus config
properties. Let's fix that by providing correct descriptions for MTL Tx
Queue DT-properties utilized for the AVB feature (CBS algorithm) tuning.

Fixes: 19d918731797 ("net: stmmac: configuration of CBS in case of a TX AVB queue")
Signed-off-by: Serge Semin <[email protected]>
---
.../devicetree/bindings/net/snps,dwmac.yaml | 20 +++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index 2ebf7995426b..69be39d55403 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -321,25 +321,37 @@ properties:
available in this queue.
snps,send_slope:
$ref: /schemas/types.yaml#/definitions/uint32
- description: enable Low Power Interface
+ description:
+ Send-Slope credit value subtracted from the accumulated credit
+ in the Queue for the Audio/Video bridging traffic. This is the
+ rate of the credit change in bits per cycle (40 ns, 8 ns and
+ 3.2 ns for 100 Mbps, 1000 Mbps and 2.5/10 Gbps respectively).
minimum: 0
maximum: 0x3FFF

snps,idle_slope:
$ref: /schemas/types.yaml#/definitions/uint32
- description: unlock on WoL
+ description:
+ Idle-Slope credit value added to the accumulated credit in the
+ Queue with the Audio/Video bridging enabled. This is the
+ rate of the credit change in bits per cycle (40 ns, 8 ns and
+ 3.2 ns for 100 Mbps, 1000 Mbps and 2.5/10 Gbps respectively).
minimum: 0
maximum: 0x8000

snps,high_credit:
$ref: /schemas/types.yaml#/definitions/uint32
- description: max write outstanding req. limit
+ description:
+ Maximum value accumulated in the credit parameter for the
+ Audio/Video bridging feature (specified in bits scaled by 1,024).
minimum: 0
maximum: 0x1FFFFFFF

snps,low_credit:
$ref: /schemas/types.yaml#/definitions/uint32
- description: max read outstanding req. limit
+ description:
+ Minimum value accumulated in the credit parameter for the
+ Audio/Video bridging feature (specified in bits scaled by 1,024).
minimum: 0
maximum: 0x1FFFFFFF

--
2.39.2



2023-03-13 22:54:13

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 14/16] dt-bindings: net: dwmac: Use flag definition instead of booleans

Currently some of the boolean properties defined in the DT-schema are
marked to have the basic boolean type meanwhile the rest referencing the
/schemas/types.yaml#/definitions/flag schema. For the sake of unification
let's convert the first group to referencing the pre-defined flag schema.
Thus bindings will look a bit more coherent and the DT-bindings
maintainers will have a better control over the booleans defined in the
schema (if ever needed).

Signed-off-by: Serge Semin <[email protected]>
---
.../devicetree/bindings/net/snps,dwmac.yaml | 45 ++++++++++++-------
1 file changed, 30 insertions(+), 15 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index 69be39d55403..a863b5860566 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -120,11 +120,13 @@ properties:
maximum: 12

snps,rx-sched-sp:
- type: boolean
+ $ref: /schemas/types.yaml#/definitions/flag
description: Strict priority
+
snps,rx-sched-wsp:
- type: boolean
+ $ref: /schemas/types.yaml#/definitions/flag
description: Weighted Strict priority
+
allOf:
- if:
required:
@@ -144,11 +146,13 @@ properties:
type: object
properties:
snps,dcb-algorithm:
- type: boolean
+ $ref: /schemas/types.yaml#/definitions/flag
description: Queue to be enabled as DCB
+
snps,avb-algorithm:
- type: boolean
+ $ref: /schemas/types.yaml#/definitions/flag
description: Queue to be enabled as AVB
+
snps,map-to-dma-channel:
$ref: /schemas/types.yaml#/definitions/uint32
description: DMA channel id to map
@@ -156,20 +160,25 @@ properties:
maximum: 15

snps,route-avcp:
- type: boolean
+ $ref: /schemas/types.yaml#/definitions/flag
description: AV Untagged Control packets
+
snps,route-ptp:
- type: boolean
+ $ref: /schemas/types.yaml#/definitions/flag
description: PTP Packets
+
snps,route-dcbcp:
- type: boolean
+ $ref: /schemas/types.yaml#/definitions/flag
description: DCB Control Packets
+
snps,route-up:
- type: boolean
+ $ref: /schemas/types.yaml#/definitions/flag
description: Untagged Packets
+
snps,route-multi-broad:
- type: boolean
+ $ref: /schemas/types.yaml#/definitions/flag
description: Multicast & Broadcast Packets
+
snps,priority:
$ref: /schemas/types.yaml#/definitions/uint32
description: Bitmask of the tagged frames priorities assigned to the queue
@@ -255,17 +264,21 @@ properties:
maximum: 16

snps,tx-sched-wrr:
- type: boolean
+ $ref: /schemas/types.yaml#/definitions/flag
description: Weighted Round Robin
+
snps,tx-sched-wfq:
- type: boolean
+ $ref: /schemas/types.yaml#/definitions/flag
description: Weighted Fair Queuing
+
snps,tx-sched-dwrr:
- type: boolean
+ $ref: /schemas/types.yaml#/definitions/flag
description: Deficit Weighted Round Robin
+
snps,tx-sched-sp:
- type: boolean
+ $ref: /schemas/types.yaml#/definitions/flag
description: Strict priority
+
allOf:
- if:
required:
@@ -311,14 +324,16 @@ properties:
maximum: 0x1312D0

snps,dcb-algorithm:
- type: boolean
+ $ref: /schemas/types.yaml#/definitions/flag
description: TX queue will be working in DCB
+
snps,avb-algorithm:
- type: boolean
+ $ref: /schemas/types.yaml#/definitions/flag
description:
TX queue will be working in AVB.
Queue 0 is reserved for legacy traffic and so no AVB is
available in this queue.
+
snps,send_slope:
$ref: /schemas/types.yaml#/definitions/uint32
description:
--
2.39.2



2023-03-13 22:54:17

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 16/16] dt-bindings: net: dwmac: Add MTL Tx queue CBS-algo props dependencies

Currently the CBS algorithm specific properties could be used
unconditionally in the MTL Tx queue sub-nodes. It's definitely wrong from
the correct Tx queue description point of view. Let's fix that in a way so
the "snps,send_slope", "snps,idle_slope", "snps,high_credit" and
"snps,low_credit" properties would be allowed only if the CBS TC algorithm
is enabled for the MTL Tx queue.

Signed-off-by: Serge Semin <[email protected]>
---
Documentation/devicetree/bindings/net/snps,dwmac.yaml | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index 9df301cf674e..c6a9b44650c3 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -322,7 +322,12 @@ properties:
- snps,dcb-algorithm
- snps,avb-algorithm

+ # Credit Base Shaper is configurable for AVB algo only
dependencies:
+ snps,send_slope: ["snps,avb-algorithm"]
+ snps,idle_slope: ["snps,avb-algorithm"]
+ snps,high_credit: ["snps,avb-algorithm"]
+ snps,low_credit: ["snps,avb-algorithm"]
snps,weight: ["snps,dcb-algorithm"]

additionalProperties: false
--
2.39.2



2023-03-13 23:00:48

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 12/16] dt-bindings: net: dwmac: Add MTL Tx Queue properties constraints

Currently none of the MTL Tx Queues QoS-related DT-properties have been
equipped with the proper constraints meanwhile they can be specified at
least based on the corresponding CSR field sizes or the DW (x|xG)MAC
IP-core synthesize parameter constraints. Let's do that:
+ snps,tx-queues-to-use - number of Tx queues to utilise is limited with a
number of available queues. DW MAC/GMAC: no queues, DW Eth QoS: <= 8, DW
xGMAC: <= 16.
+ snps,weight - Tx Queue/Traffic Class quantum/weight utilised depending
on enabled algorithm for the Data Center Bridging feature: DWRR (up to
0x1312D0 bytes to add to credit) or WFQ (up to 0x3FFF - least bandwidth)
or WFQ (up to 0x64). DW MAC/GMAC: no queues, DW Eth QoS: <= 0x1312D0, DW
xGMAC: <= 0x1312D0.
+ snps,send_slope - Tx Queue/Traffic Class Send-Slope credit value
subtracted from the accumulated credit for the Audio/Video bridging
feature (CBS algorithm, bits per cycle scaled up by 1,024). DW MAC/GMAC:
no queues, DW Eth QoS: <= 0x2000, DW xGMAC: <= 0x3FFF.
+ snps,idle_slope - same meaning as snps,send_slope except it's determines
the Idle-Slope credit of CBS algorithm. DW MAC/GMAC: no queues, DW Eth
QoS: <= 0x2000, DW xGMAC: <= 0x8000.
+ snps,high_credit/snps,low_credit - maximum and minimum values
accumulated in the credit for the Audio/Video bridging feature (CBS
algorithm, bits scaled up by 1,024). DW MAC/GMAC: no queues, DW Eth
QoS: <= 0x1FFFFFFF, DW xGMAC: <= 0x1FFFFFFF.
+ snps,priority - Tx Queue/Traffic Class priority (enabled by the
PFC-packets) limits determined by the VLAN tag PRI field width (it's 7).
DW MAC/GMAC: no queues, DW Eth QoS: 0xff, DW xGMAC: 0xff.

Since the constraints vary for different IP-cores and the DT-schema is
common for all of them the least restrictive values are chosen. The info
above can be used for the IP-core specific DT-schemas if anybody ever is
bothered with one to create.

Signed-off-by: Serge Semin <[email protected]>
---
.../bindings/net/snps,dwmac-generic.yaml | 2 +-
.../devicetree/bindings/net/snps,dwmac.yaml | 24 ++++++++++++++++++-
2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml b/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
index ae740a1ab213..2974af79511d 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
@@ -137,7 +137,7 @@ examples:
snps,send_slope = <0x1000>;
snps,idle_slope = <0x1000>;
snps,high_credit = <0x3E800>;
- snps,low_credit = <0xFFC18000>;
+ snps,low_credit = <0x1FC18000>;
snps,priority = <0x1>;
};
};
diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index e5662b1498b7..2ebf7995426b 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -250,6 +250,10 @@ properties:
snps,tx-queues-to-use:
$ref: /schemas/types.yaml#/definitions/uint32
description: number of TX queues to be used in the driver
+ default: 1
+ minimum: 1
+ maximum: 16
+
snps,tx-sched-wrr:
type: boolean
description: Weighted Round Robin
@@ -296,13 +300,16 @@ properties:
snps,tx-sched-wfq: false
snps,tx-sched-dwrr: false
patternProperties:
- "^queue[0-9]$":
+ "^queue([0-9]|1[0-5])$":
description: Each subnode represents a queue.
type: object
properties:
snps,weight:
$ref: /schemas/types.yaml#/definitions/uint32
description: TX queue weight (if using a DCB weight algorithm)
+ minimum: 0
+ maximum: 0x1312D0
+
snps,dcb-algorithm:
type: boolean
description: TX queue will be working in DCB
@@ -315,15 +322,27 @@ properties:
snps,send_slope:
$ref: /schemas/types.yaml#/definitions/uint32
description: enable Low Power Interface
+ minimum: 0
+ maximum: 0x3FFF
+
snps,idle_slope:
$ref: /schemas/types.yaml#/definitions/uint32
description: unlock on WoL
+ minimum: 0
+ maximum: 0x8000
+
snps,high_credit:
$ref: /schemas/types.yaml#/definitions/uint32
description: max write outstanding req. limit
+ minimum: 0
+ maximum: 0x1FFFFFFF
+
snps,low_credit:
$ref: /schemas/types.yaml#/definitions/uint32
description: max read outstanding req. limit
+ minimum: 0
+ maximum: 0x1FFFFFFF
+
snps,priority:
$ref: /schemas/types.yaml#/definitions/uint32
description:
@@ -331,6 +350,9 @@ properties:
When a PFC frame is received with priorities matching the bitmask,
the queue is blocked from transmitting for the pause time specified
in the PFC frame.
+ minimum: 0
+ maximum: 0xFF
+
allOf:
- if:
required:
--
2.39.2



2023-03-13 23:00:48

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 15/16] dt-bindings: net: dwmac: Simplify MTL queue props dependencies

Currently the Tx/Rx queues properties interdependencies are described by
means of the pattern: "if: required: X, then: properties: Y: false, Z:
false, etc". Due to very unfortunate MTL Tx/Rx queue DT-node design the
resultant sub-nodes schemas look very bulky and thus hard to read. The
situation can be improved by using the "allOf:/oneOf: required: X,
required: Y, etc" pattern instead thus getting shorter and a bit easier to
comprehend constructions.

Signed-off-by: Serge Semin <[email protected]>

---

Note the solution can be shortened out a bit further by replacing the
single-entry allOf statements with just the "not: required: etc" pattern.
But in order to do that the DT-schema validation tool must be fixed like
this:

--- a/meta-schemas/nodes.yaml 2021-02-08 14:20:56.732447780 +0300
+++ b/meta-schemas/nodes.yaml 2021-02-08 14:21:00.736492245 +0300
@@ -22,6 +22,7 @@
- unevaluatedProperties
- deprecated
- required
+ - not
- allOf
- anyOf
- oneOf

Thus all the patterns like
allOf:
- not:
required:
- X
could be replaced with just
not:
required:
- X
---
.../devicetree/bindings/net/snps,dwmac.yaml | 175 +++++++-----------
1 file changed, 63 insertions(+), 112 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index a863b5860566..9df301cf674e 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -127,19 +127,6 @@ properties:
$ref: /schemas/types.yaml#/definitions/flag
description: Weighted Strict priority

- allOf:
- - if:
- required:
- - snps,rx-sched-sp
- then:
- properties:
- snps,rx-sched-wsp: false
- - if:
- required:
- - snps,rx-sched-wsp
- then:
- properties:
- snps,rx-sched-sp: false
patternProperties:
"^queue([0-9]|1[0-1])$":
description: Each subnode represents a queue.
@@ -185,67 +172,46 @@ properties:
minimum: 0
maximum: 0xFF

+ additionalProperties: false
+
+ # Choose only one of the bridging algorithm and the packets routing
allOf:
- - if:
+ - not:
required:
- snps,dcb-algorithm
- then:
- properties:
- snps,avb-algorithm: false
- - if:
- required:
- snps,avb-algorithm
- then:
- properties:
- snps,dcb-algorithm: false
- - if:
- required:
- - snps,route-avcp
- then:
- properties:
- snps,route-ptp: false
- snps,route-dcbcp: false
- snps,route-up: false
- snps,route-multi-broad: false
- - if:
- required:
- - snps,route-ptp
- then:
- properties:
- snps,route-avcp: false
- snps,route-dcbcp: false
- snps,route-up: false
- snps,route-multi-broad: false
- - if:
- required:
- - snps,route-dcbcp
- then:
- properties:
- snps,route-avcp: false
- snps,route-ptp: false
- snps,route-up: false
- snps,route-multi-broad: false
- - if:
- required:
- - snps,route-up
- then:
- properties:
- snps,route-avcp: false
- snps,route-ptp: false
- snps,route-dcbcp: false
- snps,route-multi-broad: false
- - if:
- required:
- - snps,route-multi-broad
- then:
- properties:
- snps,route-avcp: false
- snps,route-ptp: false
- snps,route-dcbcp: false
- snps,route-up: false
- additionalProperties: false
+ - oneOf:
+ - required:
+ - snps,route-avcp
+ - required:
+ - snps,route-ptp
+ - required:
+ - snps,route-dcbcp
+ - required:
+ - snps,route-up
+ - required:
+ - snps,route-multi-broad
+ - not:
+ anyOf:
+ - required:
+ - snps,route-avcp
+ - required:
+ - snps,route-ptp
+ - required:
+ - snps,route-dcbcp
+ - required:
+ - snps,route-up
+ - required:
+ - snps,route-multi-broad
+
additionalProperties: false

+ allOf:
+ - not:
+ required:
+ - snps,rx-sched-sp
+ - snps,rx-sched-wsp
+
snps,mtl-tx-config:
$ref: /schemas/types.yaml#/definitions/phandle
description:
@@ -279,39 +245,6 @@ properties:
$ref: /schemas/types.yaml#/definitions/flag
description: Strict priority

- allOf:
- - if:
- required:
- - snps,tx-sched-wrr
- then:
- properties:
- snps,tx-sched-wfq: false
- snps,tx-sched-dwrr: false
- snps,tx-sched-sp: false
- - if:
- required:
- - snps,tx-sched-wfq
- then:
- properties:
- snps,tx-sched-wrr: false
- snps,tx-sched-dwrr: false
- snps,tx-sched-sp: false
- - if:
- required:
- - snps,tx-sched-dwrr
- then:
- properties:
- snps,tx-sched-wrr: false
- snps,tx-sched-wfq: false
- snps,tx-sched-sp: false
- - if:
- required:
- - snps,tx-sched-sp
- then:
- properties:
- snps,tx-sched-wrr: false
- snps,tx-sched-wfq: false
- snps,tx-sched-dwrr: false
patternProperties:
"^queue([0-9]|1[0-5])$":
description: Each subnode represents a queue.
@@ -380,23 +313,41 @@ properties:
minimum: 0
maximum: 0xFF

+ additionalProperties: false
+
+ # Choose only one of the Queue TC algo
allOf:
- - if:
+ - not:
required:
- snps,dcb-algorithm
- then:
- properties:
- snps,avb-algorithm: false
- - if:
- required:
- snps,avb-algorithm
- then:
- properties:
- snps,dcb-algorithm: false
- snps,weight: false
- additionalProperties: false
+
+ dependencies:
+ snps,weight: ["snps,dcb-algorithm"]
+
additionalProperties: false

+ # Choose one of the TX scheduling algorithms
+ oneOf:
+ - required:
+ - snps,tx-sched-wrr
+ - required:
+ - snps,tx-sched-wfq
+ - required:
+ - snps,tx-sched-dwrr
+ - required:
+ - snps,tx-sched-sp
+ - not:
+ anyOf:
+ - required:
+ - snps,tx-sched-wrr
+ - required:
+ - snps,tx-sched-wfq
+ - required:
+ - snps,tx-sched-dwrr
+ - required:
+ - snps,tx-sched-sp
+
snps,reset-gpio:
deprecated: true
maxItems: 1
--
2.39.2



2023-03-13 23:00:53

by Serge Semin

[permalink] [raw]
Subject: [PATCH net-next 04/16] dt-bindings: net: dwmac: Detach Generic DW MAC bindings

Currently the snps,dwmac.yaml DT bindings file is used for both DT nodes
describing generic DW MAC devices and as DT schema with common properties
to be evaluated against a vendor-specific DW MAC IP-cores. Due to such
dual-purpose design the "compatible" property of the common DW MAC schema
needs to contain the vendor-specific strings to successfully pass the
schema evaluation in case if it's referenced from the vendor-specific DT
bindings. That's a bad design from maintainability point of view, since
adding/removing any DW MAC-based device bindings requires the common
schema modification. In order to fix that let's detach the schema which
provides the generic DW MAC DT nodes evaluation into a dedicated DT
bindings file preserving the common DW MAC properties declaration in the
snps,dwmac.yaml file. By doing so we'll still provide a common properties
evaluation for each vendor-specific MAC bindings which refer to the
common bindings file, while the generic DW MAC DT nodes will be checked
against the new snps,dwmac-generic.yaml DT schema.

While at it extend the DW GMAC and xGMAC compatibles set with known to be
released DW GMAC v3.72a, 3.73a, 3.74a and DW xGMAC v2.11a IP-cores.

Signed-off-by: Serge Semin <[email protected]>
Reviewed-by: Rob Herring <[email protected]>

---

Changelog v1:
- Add a note to the snps,dwmac-generic.yaml bindings file description of
a requirement to create a new DT bindings file for the vendor-specific
versions of the DW MAC.

Link: https://lore.kernel.org/linux-arm-kernel/[email protected]
Changelog v2:
- Replace double quotes with single ones in the select pattern strings.
After doing so we can discard escaping the backslash in the regexpes.
- Add DW GMAC v3.72a, 3.73a, 3.74a and DW xGMAC v2.11a compatibles.
---
.../bindings/net/snps,dwmac-generic.yaml | 155 ++++++++++++++++++
.../devicetree/bindings/net/snps,dwmac.yaml | 149 +----------------
MAINTAINERS | 1 +
3 files changed, 158 insertions(+), 147 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml b/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
new file mode 100644
index 000000000000..ae740a1ab213
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
@@ -0,0 +1,155 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/snps,dwmac-generic.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synopsys DesignWare Generic MAC Device Tree Bindings
+
+maintainers:
+ - Alexandre Torgue <[email protected]>
+ - Giuseppe Cavallaro <[email protected]>
+ - Jose Abreu <[email protected]>
+
+description:
+ The primary purpose of this bindings file is to validate the Generic
+ Synopsys Desginware MAC DT nodes defined in accordance with the select
+ schema. All new vendor-specific versions of the DW *MAC IP-cores must
+ be described in a dedicated DT bindings file.
+
+# Select the DT nodes, which have got compatible strings either as just a
+# single string with IP-core name optionally followed by the IP version or
+# two strings: one with IP-core name plus the IP version, another as just
+# the IP-core name.
+select:
+ properties:
+ compatible:
+ oneOf:
+ - items:
+ - pattern: '^snps,dw(xg)+mac(-[0-9]+\.[0-9]+a?)?$'
+ - items:
+ - pattern: '^snps,dwmac-[0-9]+\.[0-9]+a?$'
+ - const: snps,dwmac
+ - items:
+ - pattern: '^snps,dwxgmac-[0-9]+\.[0-9]+a?$'
+ - const: snps,dwxgmac
+
+ required:
+ - compatible
+
+allOf:
+ - $ref: snps,dwmac.yaml#
+
+properties:
+ compatible:
+ oneOf:
+ - description: Generic Synopsys DW MAC
+ oneOf:
+ - items:
+ - enum:
+ - snps,dwmac-3.40a
+ - snps,dwmac-3.50a
+ - snps,dwmac-3.610
+ - snps,dwmac-3.70a
+ - snps,dwmac-3.710
+ - snps,dwmac-3.72a
+ - snps,dwmac-3.73a
+ - snps,dwmac-3.74a
+ - snps,dwmac-4.00
+ - snps,dwmac-4.10a
+ - snps,dwmac-4.20a
+ - const: snps,dwmac
+ - const: snps,dwmac
+ - description: Generic Synopsys DW xGMAC
+ oneOf:
+ - items:
+ - enum:
+ - snps,dwxgmac-2.10
+ - snps,dwxgmac-2.11a
+ - const: snps,dwxgmac
+ - const: snps,dwxgmac
+ - description: ST SPEAr SoC Family GMAC
+ deprecated: true
+ const: st,spear600-gmac
+
+ reg:
+ maxItems: 1
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ ethernet@e0800000 {
+ compatible = "snps,dwxgmac-2.10", "snps,dwxgmac";
+ reg = <0xe0800000 0x8000>;
+
+ interrupt-parent = <&vic1>;
+ interrupts = <24 23 22>;
+ interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
+
+ mac-address = [000000000000]; /* Filled in by U-Boot */
+ max-frame-size = <3800>;
+
+ snps,multicast-filter-bins = <256>;
+ snps,perfect-filter-entries = <128>;
+
+ rx-fifo-depth = <16384>;
+ tx-fifo-depth = <16384>;
+
+ clocks = <&clock>;
+ clock-names = "stmmaceth";
+
+ phy-mode = "gmii";
+
+ snps,axi-config = <&stmmac_axi_setup>;
+ snps,mtl-rx-config = <&mtl_rx_setup>;
+ snps,mtl-tx-config = <&mtl_tx_setup>;
+
+ stmmac_axi_setup: stmmac-axi-config {
+ snps,wr_osr_lmt = <0xf>;
+ snps,rd_osr_lmt = <0xf>;
+ snps,blen = <256 128 64 32 0 0 0>;
+ };
+
+ mtl_rx_setup: rx-queues-config {
+ snps,rx-queues-to-use = <1>;
+ snps,rx-sched-sp;
+
+ queue0 {
+ snps,dcb-algorithm;
+ snps,map-to-dma-channel = <0x0>;
+ snps,priority = <0x0>;
+ };
+ };
+
+ mtl_tx_setup: tx-queues-config {
+ snps,tx-queues-to-use = <2>;
+ snps,tx-sched-wrr;
+
+ queue0 {
+ snps,weight = <0x10>;
+ snps,dcb-algorithm;
+ snps,priority = <0x0>;
+ };
+
+ queue1 {
+ snps,avb-algorithm;
+ snps,send_slope = <0x1000>;
+ snps,idle_slope = <0x1000>;
+ snps,high_credit = <0x3E800>;
+ snps,low_credit = <0xFFC18000>;
+ snps,priority = <0x1>;
+ };
+ };
+
+ mdio {
+ compatible = "snps,dwmac-mdio";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ phy0: ethernet-phy@0 {
+ reg = <0>;
+ };
+ };
+ };
+...
diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index 92feed3c29bc..224f8f70db85 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -11,85 +11,9 @@ maintainers:
- Giuseppe Cavallaro <[email protected]>
- Jose Abreu <[email protected]>

-# Select every compatible, including the deprecated ones. This way, we
-# will be able to report a warning when we have that compatible, since
-# we will validate the node thanks to the select, but won't report it
-# as a valid value in the compatible property description
-select:
- properties:
- compatible:
- contains:
- enum:
- - snps,dwmac
- - snps,dwmac-3.40a
- - snps,dwmac-3.50a
- - snps,dwmac-3.610
- - snps,dwmac-3.70a
- - snps,dwmac-3.710
- - snps,dwmac-4.00
- - snps,dwmac-4.10a
- - snps,dwmac-4.20a
- - snps,dwmac-5.10a
- - snps,dwxgmac
- - snps,dwxgmac-2.10
-
- # Deprecated
- - st,spear600-gmac
-
- required:
- - compatible
+select: false

properties:
-
- # We need to include all the compatibles from schemas that will
- # include that schemas, otherwise compatible won't validate for
- # those.
- compatible:
- contains:
- enum:
- - allwinner,sun7i-a20-gmac
- - allwinner,sun8i-a83t-emac
- - allwinner,sun8i-h3-emac
- - allwinner,sun8i-r40-gmac
- - allwinner,sun8i-v3s-emac
- - allwinner,sun50i-a64-emac
- - amlogic,meson6-dwmac
- - amlogic,meson8b-dwmac
- - amlogic,meson8m2-dwmac
- - amlogic,meson-gxbb-dwmac
- - amlogic,meson-axg-dwmac
- - ingenic,jz4775-mac
- - ingenic,x1000-mac
- - ingenic,x1600-mac
- - ingenic,x1830-mac
- - ingenic,x2000-mac
- - loongson,ls2k-dwmac
- - loongson,ls7a-dwmac
- - renesas,r9a06g032-gmac
- - renesas,rzn1-gmac
- - rockchip,px30-gmac
- - rockchip,rk3128-gmac
- - rockchip,rk3228-gmac
- - rockchip,rk3288-gmac
- - rockchip,rk3328-gmac
- - rockchip,rk3366-gmac
- - rockchip,rk3368-gmac
- - rockchip,rk3588-gmac
- - rockchip,rk3399-gmac
- - rockchip,rv1108-gmac
- - snps,dwmac
- - snps,dwmac-3.40a
- - snps,dwmac-3.50a
- - snps,dwmac-3.610
- - snps,dwmac-3.70a
- - snps,dwmac-3.710
- - snps,dwmac-4.00
- - snps,dwmac-4.10a
- - snps,dwmac-4.20a
- - snps,dwmac-5.10a
- - snps,dwxgmac
- - snps,dwxgmac-2.10
-
reg:
minItems: 1
maxItems: 2
@@ -596,6 +520,7 @@ allOf:
- snps,dwmac-5.10a
- snps,dwxgmac
- snps,dwxgmac-2.10
+ - snps,dwxgmac-2.11a
then:
properties:
snps,tso:
@@ -606,74 +531,4 @@ allOf:

additionalProperties: true

-examples:
- - |
- gmac0: ethernet@e0800000 {
- compatible = "snps,dwxgmac-2.10", "snps,dwxgmac";
- reg = <0xe0800000 0x8000>;
- interrupt-parent = <&vic1>;
- interrupts = <24 23 22>;
- interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
- mac-address = [000000000000]; /* Filled in by U-Boot */
- max-frame-size = <3800>;
- phy-mode = "gmii";
- snps,multicast-filter-bins = <256>;
- snps,perfect-filter-entries = <128>;
- rx-fifo-depth = <16384>;
- tx-fifo-depth = <16384>;
- clocks = <&clock>;
- clock-names = "stmmaceth";
- snps,axi-config = <&stmmac_axi_setup>;
- snps,mtl-rx-config = <&mtl_rx_setup>;
- snps,mtl-tx-config = <&mtl_tx_setup>;
-
- stmmac_axi_setup: stmmac-axi-config {
- snps,wr_osr_lmt = <0xf>;
- snps,rd_osr_lmt = <0xf>;
- snps,blen = <256 128 64 32 0 0 0>;
- };
-
- mtl_rx_setup: rx-queues-config {
- snps,rx-queues-to-use = <1>;
- snps,rx-sched-sp;
- queue0 {
- snps,dcb-algorithm;
- snps,map-to-dma-channel = <0x0>;
- snps,priority = <0x0>;
- };
- };
-
- mtl_tx_setup: tx-queues-config {
- snps,tx-queues-to-use = <2>;
- snps,tx-sched-wrr;
- queue0 {
- snps,weight = <0x10>;
- snps,dcb-algorithm;
- snps,priority = <0x0>;
- };
-
- queue1 {
- snps,avb-algorithm;
- snps,send_slope = <0x1000>;
- snps,idle_slope = <0x1000>;
- snps,high_credit = <0x3E800>;
- snps,low_credit = <0xFFC18000>;
- snps,priority = <0x1>;
- };
- };
-
- mdio0 {
- #address-cells = <1>;
- #size-cells = <0>;
- compatible = "snps,dwmac-mdio";
- phy1: ethernet-phy@0 {
- reg = <0>;
- };
- };
- };
-
-# FIXME: We should set it, but it would report all the generic
-# properties as additional properties.
-# additionalProperties: false
-
...
diff --git a/MAINTAINERS b/MAINTAINERS
index ec57c42ed544..30d90d9daa9c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -20017,6 +20017,7 @@ M: Jose Abreu <[email protected]>
L: [email protected]
S: Supported
W: http://www.stlinux.com
+F: Documentation/devicetree/bindings/net/snps,dwmac*.yaml
F: Documentation/networking/device_drivers/ethernet/stmicro/
F: drivers/net/ethernet/stmicro/stmmac/

--
2.39.2



2023-03-14 14:10:41

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH net-next 01/16] dt-bindings: net: dwmac: Validate PBL for all IP-cores


On Tue, 14 Mar 2023 01:50:48 +0300, Serge Semin wrote:
> Indeed the maximum DMA burst length can be programmed not only for DW
> xGMACs, Allwinner EMACs and Spear SoC GMAC, but in accordance with [1]
> for Generic DW *MAC IP-cores. Moreover the STMMAC set of drivers parse
> the property and then apply the configuration for all supported DW MAC
> devices. All of that makes the property being available for all IP-cores
> the bindings supports. Let's make sure the PBL-related properties are
> validated for all of them by the common DW MAC DT schema.
>
> [1] DesignWare Cores Ethernet MAC Universal Databook, Revision 3.73a,
> October 2013, p. 380.
>
> Signed-off-by: Serge Semin <[email protected]>
> Reviewed-by: Rob Herring <[email protected]>
>
> ---
>
> Changelog v1:
> - Use correct syntax of the JSON pointers, so the later would begin
> with a '/' after the '#'.
> ---
> .../devicetree/bindings/net/snps,dwmac.yaml | 77 +++++++------------
> 1 file changed, 26 insertions(+), 51 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/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,txpbl:0:0: 1 is not one of [2, 4, 8]
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/snps,dwmac.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,rxpbl:0:0: 1 is not one of [2, 4, 8]
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/snps,dwmac.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,txpbl:0:0: 1 is not one of [2, 4, 8]
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,rxpbl:0:0: 1 is not one of [2, 4, 8]
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: Unevaluated properties are not allowed ('interrupt-names', 'interrupts', 'mac-address', 'phy-mode', 'reg', 'snps,reset-delays-us', 'snps,reset-gpio', 'snps,rxpbl', 'snps,txpbl' were unexpected)
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

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.


2023-03-14 15:07:15

by Serge Semin

[permalink] [raw]
Subject: Re: [PATCH net-next 01/16] dt-bindings: net: dwmac: Validate PBL for all IP-cores

On Tue, Mar 14, 2023 at 09:10:19AM -0500, Rob Herring wrote:
>
> On Tue, 14 Mar 2023 01:50:48 +0300, Serge Semin wrote:
> > Indeed the maximum DMA burst length can be programmed not only for DW
> > xGMACs, Allwinner EMACs and Spear SoC GMAC, but in accordance with [1]
> > for Generic DW *MAC IP-cores. Moreover the STMMAC set of drivers parse
> > the property and then apply the configuration for all supported DW MAC
> > devices. All of that makes the property being available for all IP-cores
> > the bindings supports. Let's make sure the PBL-related properties are
> > validated for all of them by the common DW MAC DT schema.
> >
> > [1] DesignWare Cores Ethernet MAC Universal Databook, Revision 3.73a,
> > October 2013, p. 380.
> >
> > Signed-off-by: Serge Semin <[email protected]>
> > Reviewed-by: Rob Herring <[email protected]>
> >
> > ---
> >
> > Changelog v1:
> > - Use correct syntax of the JSON pointers, so the later would begin
> > with a '/' after the '#'.
> > ---
> > .../devicetree/bindings/net/snps,dwmac.yaml | 77 +++++++------------
> > 1 file changed, 26 insertions(+), 51 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/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,txpbl:0:0: 1 is not one of [2, 4, 8]
> From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,rxpbl:0:0: 1 is not one of [2, 4, 8]
> From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,txpbl:0:0: 1 is not one of [2, 4, 8]
> From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.yaml
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,rxpbl:0:0: 1 is not one of [2, 4, 8]
> From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.yaml
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: Unevaluated properties are not allowed ('interrupt-names', 'interrupts', 'mac-address', 'phy-mode', 'reg', 'snps,reset-delays-us', 'snps,reset-gpio', 'snps,rxpbl', 'snps,txpbl' were unexpected)
> From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.yaml

Oops, on rebasing my work from older kernel I missed that the PBL
properties constraints have already been extended. I'll drop the next
patch in the series then and fix this one so the already defined
constraints would be preserved.

-Serge(y)

>
> doc reference errors (make refcheckdocs):
>
> See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
>
> 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.
>

2023-03-14 17:10:00

by Serge Semin

[permalink] [raw]
Subject: Re: [PATCH net-next 01/16] dt-bindings: net: dwmac: Validate PBL for all IP-cores

On Tue, Mar 14, 2023 at 06:07:01PM +0300, Serge Semin wrote:
> On Tue, Mar 14, 2023 at 09:10:19AM -0500, Rob Herring wrote:
> >
> > On Tue, 14 Mar 2023 01:50:48 +0300, Serge Semin wrote:
> > > Indeed the maximum DMA burst length can be programmed not only for DW
> > > xGMACs, Allwinner EMACs and Spear SoC GMAC, but in accordance with [1]
> > > for Generic DW *MAC IP-cores. Moreover the STMMAC set of drivers parse
> > > the property and then apply the configuration for all supported DW MAC
> > > devices. All of that makes the property being available for all IP-cores
> > > the bindings supports. Let's make sure the PBL-related properties are
> > > validated for all of them by the common DW MAC DT schema.
> > >
> > > [1] DesignWare Cores Ethernet MAC Universal Databook, Revision 3.73a,
> > > October 2013, p. 380.
> > >
> > > Signed-off-by: Serge Semin <[email protected]>
> > > Reviewed-by: Rob Herring <[email protected]>
> > >
> > > ---
> > >
> > > Changelog v1:
> > > - Use correct syntax of the JSON pointers, so the later would begin
> > > with a '/' after the '#'.
> > > ---
> > > .../devicetree/bindings/net/snps,dwmac.yaml | 77 +++++++------------
> > > 1 file changed, 26 insertions(+), 51 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/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,txpbl:0:0: 1 is not one of [2, 4, 8]
> > From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,rxpbl:0:0: 1 is not one of [2, 4, 8]
> > From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,txpbl:0:0: 1 is not one of [2, 4, 8]
> > From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.yaml
> > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,rxpbl:0:0: 1 is not one of [2, 4, 8]
> > From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.yaml
> > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: Unevaluated properties are not allowed ('interrupt-names', 'interrupts', 'mac-address', 'phy-mode', 'reg', 'snps,reset-delays-us', 'snps,reset-gpio', 'snps,rxpbl', 'snps,txpbl' were unexpected)
> > From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.yaml
>
> Oops, on rebasing my work from older kernel I missed that the PBL
> properties constraints have already been extended. I'll drop the next
> patch in the series then and fix this one so the already defined
> constraints would be preserved.

BTW it's strange I didn't have that bug spotted during my
dt_binding_check run...

-Serge(y)

>
> -Serge(y)
>
> >
> > doc reference errors (make refcheckdocs):
> >
> > See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
> >
> > 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.
> >

2023-03-16 08:05:10

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH net-next 05/16] dt-bindings: net: dwmac: Elaborate snps,clk-csr description

On 13/03/2023 23:50, Serge Semin wrote:
> The property is utilized to set the CSR-MDC clock selector in the STMMAC
> driver. The specified value is used instead of auto-detecting the
> CSR/application clocks divider based on the reference clock rate. Let's
> add a more detailed description to clarify the property purpose and
> permitted values. In the later case the constraints are specified based on
> the DW *MAC CR registers permitted values.
>
> Signed-off-by: Serge Semin <[email protected]>
> ---
> Documentation/devicetree/bindings/net/snps,dwmac.yaml | 10 +++++


Acked-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


2023-03-16 08:06:14

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH net-next 08/16] dt-bindings: net: dwmac: Drop prop names from snps,axi-config description

On 13/03/2023 23:50, Serge Semin wrote:
> The property is supposed to contain a phandle reference to the DT-node
> with the AXI-bus parameters. Such DT-node is described in the same
> DT-bindings schema by means of the sub-node with the name
> "stmmac-axi-config". Similarly to MTL Tx/Rx config phandle properties
> let's drop the target DT-node properties list from the "snps,axi-config"
> property description since having that duplicate is not only pointless,
> but also worsens the bindings maintainability by causing a need to support
> the two identical lists. Instead the reference to the target DT-node is
> added to the description.
>


Acked-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


2023-03-16 08:06:32

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH net-next 09/16] dt-bindings: net: dwmac: Prohibit additional props in AXI-config

On 13/03/2023 23:50, Serge Semin wrote:
> Currently DT-schema of the AXI-bus config sub-node prohibits to have
> unknown properties by using the unevaluatedProperties property. It's
> overkill for the sub-node which doesn't use any combining schemas
> keywords (allOf, anyOf, etc). Instead more natural is to use
> additionalProperties to prohibit for that.
>
> Signed-off-by: Serge Semin <[email protected]>
> ---
> Documentation/devicetree/bindings/net/snps,dwmac.yaml | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> index 89be67e55c3e..d1b2910b799b 100644
> --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> @@ -466,7 +466,6 @@ properties:
>
> stmmac-axi-config:
> type: object
> - unevaluatedProperties: false
> description:
> AXI BUS Mode parameters.
>
> @@ -518,6 +517,8 @@ properties:
> description:
> rebuild INCRx Burst
>
> + additionalProperties: false

But why moving it? Keep the same placement.

Best regards,
Krzysztof


2023-03-16 08:06:59

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH net-next 10/16] dt-bindings: net: dwmac: Add AXI-bus properties constraints

On 13/03/2023 23:50, Serge Semin wrote:
> Currently none of the AXI-bus non-boolean DT-properties have constraints
> defined meanwhile they can be specified at least based on the
> corresponding device configs. Let's do that:
> + snps,wr_osr_lm/snps,rd_osr_lmt - maximum number of outstanding AXI-bus
> read/write requests is limited with the IP-core synthesize parameter
> AXI_MAX_{RD,WR}_REQ. DW MAC/GMAC: <= 16, DW Eth QoS: <= 32, DW xGMAC: <=
> 64. The least restrictive constraint is defined since the DT-schema is
> common for all IP-cores.
> + snps,blen - array of the burst lengths supported by the AXI-bus. Values
> are limited by the AXI3/4 bus standard, available AXI/System bus CSR flags
> and the AXI-bus IP-core synthesize config . All DW *MACs support setting
> the burst length within the set: 4, 8, 16, 32, 64, 128, 256. If some burst
> length is unsupported a zero value can be specified instead in the array.
>
> Signed-off-by: Serge Semin <[email protected]>


>
> snps,kbbe:
> $ref: /schemas/types.yaml#/definitions/uint32
> @@ -501,6 +507,8 @@ properties:
> this is a vector of supported burst length.
> minItems: 7
> maxItems: 7
> + items:
> + enum: [256, 128, 64, 32, 16, 8, 4, 0]

Increasing order.

Best regards,
Krzysztof


2023-03-16 08:07:48

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH net-next 11/16] dt-bindings: net: dwmac: Add MTL Rx Queue properties constraints

On 13/03/2023 23:50, Serge Semin wrote:
> Currently none of the MTL Rx Queues QoS-related DT-properties have been
> equipped with the proper constraints. Meanwhile they can be specified at
> least based on the corresponding CSR field sizes or the DW (x|xG)MAC
> IP-core synthesize parameter constraints. Let's do that:
> + snps,rx-queues-to-use - number of Rx queues to utilise is limited w

(...)

> +
> snps,route-avcp:
> type: boolean
> description: AV Untagged Control packets
> @@ -166,6 +173,9 @@ properties:
> snps,priority:
> $ref: /schemas/types.yaml#/definitions/uint32
> description: Bitmask of the tagged frames priorities assigned to the queue
> + minimum: 0
> + maximum: 0xFF
> +

lowercase hex

Acked-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


2023-03-16 08:08:27

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH net-next 12/16] dt-bindings: net: dwmac: Add MTL Tx Queue properties constraints

On 13/03/2023 23:50, Serge Semin wrote:
> Currently none of the MTL Tx Queues QoS-related DT-properties have been
> equipped with the proper constraints meanwhile they can be specified at
> least based on the corresponding CSR field sizes or the DW (x|xG)MAC
> IP-core synthesize parameter constraints. Let's do that:
> + snps,tx-queues-to-use - number of Tx queues to utilise is limited with a
> number of available queues. DW MAC/GMAC: no queues, DW Eth QoS: <= 8, DW
> xGMAC: <= 16.
> + snps,weight - Tx Queue/Traffic Class quantum/weight utilised depending
> on enabled algorithm for the Data Center Bridging feature: DWRR (up to
> 0x1312D0 bytes to add to credit) or WFQ (up to 0x3FFF - least bandwidth)
> or WFQ (up to 0x64). DW MAC/GMAC: no queues, DW Eth QoS: <= 0x1312D0, DW
> xGMAC: <= 0x1312D0.
> + snps,send_slope - Tx Queue/Traffic Class Send-Slope credit value
> subtracted from the accumulated credit for the Audio/Video bridging
> feature (CBS algorithm, bits per cycle scaled up by 1,024). DW MAC/GMAC:
> no queues, DW Eth QoS: <= 0x2000, DW xGMAC: <= 0x3FFF.
> + snps,idle_slope - same meaning as snps,send_slope except it's determines
> the Idle-Slope credit of CBS algorithm. DW MAC/GMAC: no queues, DW Eth
> QoS: <= 0x2000, DW xGMAC: <= 0x8000.
> + snps,high_credit/snps,low_credit - maximum and minimum values
> accumulated in the credit for the Audio/Video bridging feature (CBS
> algorithm, bits scaled up by 1,024). DW MAC/GMAC: no queues, DW Eth
> QoS: <= 0x1FFFFFFF, DW xGMAC: <= 0x1FFFFFFF.
> + snps,priority - Tx Queue/Traffic Class priority (enabled by the
> PFC-packets) limits determined by the VLAN tag PRI field width (it's 7).
> DW MAC/GMAC: no queues, DW Eth QoS: 0xff, DW xGMAC: 0xff.
>
> Since the constraints vary for different IP-cores and the DT-schema is
> common for all of them the least restrictive values are chosen. The info
> above can be used for the IP-core specific DT-schemas if anybody ever is
> bothered with one to create.
>
> Signed-off-by: Serge Semin <[email protected]>
> ---
> .../bindings/net/snps,dwmac-generic.yaml | 2 +-
> .../devicetree/bindings/net/snps,dwmac.yaml | 24 ++++++++++++++++++-
> 2 files changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml b/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
> index ae740a1ab213..2974af79511d 100644
> --- a/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
> +++ b/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
> @@ -137,7 +137,7 @@ examples:
> snps,send_slope = <0x1000>;
> snps,idle_slope = <0x1000>;
> snps,high_credit = <0x3E800>;
> - snps,low_credit = <0xFFC18000>;
> + snps,low_credit = <0x1FC18000>;
> snps,priority = <0x1>;
> };
> };
> diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> index e5662b1498b7..2ebf7995426b 100644
> --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> @@ -250,6 +250,10 @@ properties:
> snps,tx-queues-to-use:
> $ref: /schemas/types.yaml#/definitions/uint32
> description: number of TX queues to be used in the driver
> + default: 1
> + minimum: 1
> + maximum: 16
> +
> snps,tx-sched-wrr:
> type: boolean
> description: Weighted Round Robin
> @@ -296,13 +300,16 @@ properties:
> snps,tx-sched-wfq: false
> snps,tx-sched-dwrr: false
> patternProperties:
> - "^queue[0-9]$":
> + "^queue([0-9]|1[0-5])$":
> description: Each subnode represents a queue.
> type: object
> properties:
> snps,weight:
> $ref: /schemas/types.yaml#/definitions/uint32
> description: TX queue weight (if using a DCB weight algorithm)
> + minimum: 0
> + maximum: 0x1312D0
> +
> snps,dcb-algorithm:
> type: boolean
> description: TX queue will be working in DCB
> @@ -315,15 +322,27 @@ properties:
> snps,send_slope:
> $ref: /schemas/types.yaml#/definitions/uint32
> description: enable Low Power Interface
> + minimum: 0
> + maximum: 0x3FFF

lowercase hex everywhere.

Best regards,
Krzysztof


2023-03-16 08:08:58

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH net-next 13/16] dt-bindings: net: dwmac: Fix MTL Tx Queue props description

On 13/03/2023 23:51, Serge Semin wrote:
> Invalid MTL Tx Queues DT-properties description was added right at the
> initial DCB/AVB features patch. Most likely due to copy-paste mistake the
> text currently matches to what is specified for the AXI-bus config
> properties. Let's fix that by providing correct descriptions for MTL Tx
> Queue DT-properties utilized for the AVB feature (CBS algorithm) tuning.
>
> Fixes: 19d918731797 ("net: stmmac: configuration of CBS in case of a TX AVB queue")

Fixes must be first in the patchset.

> Signed-off-by: Serge Semin <[email protected]>
> ---


Best regards,
Krzysztof


2023-03-16 08:09:46

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH net-next 14/16] dt-bindings: net: dwmac: Use flag definition instead of booleans

On 13/03/2023 23:51, Serge Semin wrote:
> Currently some of the boolean properties defined in the DT-schema are
> marked to have the basic boolean type meanwhile the rest referencing the
> /schemas/types.yaml#/definitions/flag schema. For the sake of unification
> let's convert the first group to referencing the pre-defined flag schema.
> Thus bindings will look a bit more coherent and the DT-bindings
> maintainers will have a better control over the booleans defined in the
> schema (if ever needed).
>
> Signed-off-by: Serge Semin <[email protected]>
> ---
> .../devicetree/bindings/net/snps,dwmac.yaml | 45 ++++++++++++-------
> 1 file changed, 30 insertions(+), 15 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> index 69be39d55403..a863b5860566 100644
> --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> @@ -120,11 +120,13 @@ properties:
> maximum: 12
>
> snps,rx-sched-sp:
> - type: boolean
> + $ref: /schemas/types.yaml#/definitions/flag
> description: Strict priority

If ever touching this, it should be other way -> boolean.

Best regards,
Krzysztof


2023-03-16 20:40:49

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH net-next 01/16] dt-bindings: net: dwmac: Validate PBL for all IP-cores

On Tue, Mar 14, 2023 at 08:09:45PM +0300, Serge Semin wrote:
> On Tue, Mar 14, 2023 at 06:07:01PM +0300, Serge Semin wrote:
> > On Tue, Mar 14, 2023 at 09:10:19AM -0500, Rob Herring wrote:
> > >
> > > On Tue, 14 Mar 2023 01:50:48 +0300, Serge Semin wrote:
> > > > Indeed the maximum DMA burst length can be programmed not only for DW
> > > > xGMACs, Allwinner EMACs and Spear SoC GMAC, but in accordance with [1]
> > > > for Generic DW *MAC IP-cores. Moreover the STMMAC set of drivers parse
> > > > the property and then apply the configuration for all supported DW MAC
> > > > devices. All of that makes the property being available for all IP-cores
> > > > the bindings supports. Let's make sure the PBL-related properties are
> > > > validated for all of them by the common DW MAC DT schema.
> > > >
> > > > [1] DesignWare Cores Ethernet MAC Universal Databook, Revision 3.73a,
> > > > October 2013, p. 380.
> > > >
> > > > Signed-off-by: Serge Semin <[email protected]>
> > > > Reviewed-by: Rob Herring <[email protected]>
> > > >
> > > > ---
> > > >
> > > > Changelog v1:
> > > > - Use correct syntax of the JSON pointers, so the later would begin
> > > > with a '/' after the '#'.
> > > > ---
> > > > .../devicetree/bindings/net/snps,dwmac.yaml | 77 +++++++------------
> > > > 1 file changed, 26 insertions(+), 51 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/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,txpbl:0:0: 1 is not one of [2, 4, 8]
> > > From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,rxpbl:0:0: 1 is not one of [2, 4, 8]
> > > From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,txpbl:0:0: 1 is not one of [2, 4, 8]
> > > From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.yaml
> > > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,rxpbl:0:0: 1 is not one of [2, 4, 8]
> > > From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.yaml
> > > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: Unevaluated properties are not allowed ('interrupt-names', 'interrupts', 'mac-address', 'phy-mode', 'reg', 'snps,reset-delays-us', 'snps,reset-gpio', 'snps,rxpbl', 'snps,txpbl' were unexpected)
> > > From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.yaml
> >
> > Oops, on rebasing my work from older kernel I missed that the PBL
> > properties constraints have already been extended. I'll drop the next
> > patch in the series then and fix this one so the already defined
> > constraints would be preserved.
>
> BTW it's strange I didn't have that bug spotted during my
> dt_binding_check run...

Perhaps because you set DT_SCHEMA_FILES?

2023-03-16 20:50:53

by Serge Semin

[permalink] [raw]
Subject: Re: [PATCH net-next 01/16] dt-bindings: net: dwmac: Validate PBL for all IP-cores

On Thu, Mar 16, 2023 at 03:40:37PM -0500, Rob Herring wrote:
> On Tue, Mar 14, 2023 at 08:09:45PM +0300, Serge Semin wrote:
> > On Tue, Mar 14, 2023 at 06:07:01PM +0300, Serge Semin wrote:
> > > On Tue, Mar 14, 2023 at 09:10:19AM -0500, Rob Herring wrote:
> > > >
> > > > On Tue, 14 Mar 2023 01:50:48 +0300, Serge Semin wrote:
> > > > > Indeed the maximum DMA burst length can be programmed not only for DW
> > > > > xGMACs, Allwinner EMACs and Spear SoC GMAC, but in accordance with [1]
> > > > > for Generic DW *MAC IP-cores. Moreover the STMMAC set of drivers parse
> > > > > the property and then apply the configuration for all supported DW MAC
> > > > > devices. All of that makes the property being available for all IP-cores
> > > > > the bindings supports. Let's make sure the PBL-related properties are
> > > > > validated for all of them by the common DW MAC DT schema.
> > > > >
> > > > > [1] DesignWare Cores Ethernet MAC Universal Databook, Revision 3.73a,
> > > > > October 2013, p. 380.
> > > > >
> > > > > Signed-off-by: Serge Semin <[email protected]>
> > > > > Reviewed-by: Rob Herring <[email protected]>
> > > > >
> > > > > ---
> > > > >
> > > > > Changelog v1:
> > > > > - Use correct syntax of the JSON pointers, so the later would begin
> > > > > with a '/' after the '#'.
> > > > > ---
> > > > > .../devicetree/bindings/net/snps,dwmac.yaml | 77 +++++++------------
> > > > > 1 file changed, 26 insertions(+), 51 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/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,txpbl:0:0: 1 is not one of [2, 4, 8]
> > > > From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > > > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,rxpbl:0:0: 1 is not one of [2, 4, 8]
> > > > From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > > > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,txpbl:0:0: 1 is not one of [2, 4, 8]
> > > > From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.yaml
> > > > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: snps,rxpbl:0:0: 1 is not one of [2, 4, 8]
> > > > From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.yaml
> > > > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: Unevaluated properties are not allowed ('interrupt-names', 'interrupts', 'mac-address', 'phy-mode', 'reg', 'snps,reset-delays-us', 'snps,reset-gpio', 'snps,rxpbl', 'snps,txpbl' were unexpected)
> > > > From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.yaml
> > >
> > > Oops, on rebasing my work from older kernel I missed that the PBL
> > > properties constraints have already been extended. I'll drop the next
> > > patch in the series then and fix this one so the already defined
> > > constraints would be preserved.
> >
> > BTW it's strange I didn't have that bug spotted during my
> > dt_binding_check run...
>

> Perhaps because you set DT_SCHEMA_FILES?

Can't remember now. I might have missed that in the long log as well.
Anyway I'll test it out one more time before fixing.
Thanks for your response.

-Serge(y)


2023-03-17 20:56:17

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH net-next 15/16] dt-bindings: net: dwmac: Simplify MTL queue props dependencies

On Tue, Mar 14, 2023 at 01:51:02AM +0300, Serge Semin wrote:
> Currently the Tx/Rx queues properties interdependencies are described by
> means of the pattern: "if: required: X, then: properties: Y: false, Z:
> false, etc". Due to very unfortunate MTL Tx/Rx queue DT-node design the
> resultant sub-nodes schemas look very bulky and thus hard to read. The
> situation can be improved by using the "allOf:/oneOf: required: X,
> required: Y, etc" pattern instead thus getting shorter and a bit easier to
> comprehend constructions.
>
> Signed-off-by: Serge Semin <[email protected]>
>
> ---

Reviewed-by: Rob Herring <[email protected]>

>
> Note the solution can be shortened out a bit further by replacing the
> single-entry allOf statements with just the "not: required: etc" pattern.
> But in order to do that the DT-schema validation tool must be fixed like
> this:
>
> --- a/meta-schemas/nodes.yaml 2021-02-08 14:20:56.732447780 +0300
> +++ b/meta-schemas/nodes.yaml 2021-02-08 14:21:00.736492245 +0300
> @@ -22,6 +22,7 @@
> - unevaluatedProperties
> - deprecated
> - required
> + - not
> - allOf
> - anyOf
> - oneOf

This should be added regardless. Can you send a patch to devicetree-spec
or a GH PR. But I'd skip using that here for now because then we require
a new version of dtschema.

Rob

2023-03-17 20:57:18

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH net-next 16/16] dt-bindings: net: dwmac: Add MTL Tx queue CBS-algo props dependencies


On Tue, 14 Mar 2023 01:51:03 +0300, Serge Semin wrote:
> Currently the CBS algorithm specific properties could be used
> unconditionally in the MTL Tx queue sub-nodes. It's definitely wrong from
> the correct Tx queue description point of view. Let's fix that in a way so
> the "snps,send_slope", "snps,idle_slope", "snps,high_credit" and
> "snps,low_credit" properties would be allowed only if the CBS TC algorithm
> is enabled for the MTL Tx queue.
>
> Signed-off-by: Serge Semin <[email protected]>
> ---
> Documentation/devicetree/bindings/net/snps,dwmac.yaml | 5 +++++
> 1 file changed, 5 insertions(+)
>

Reviewed-by: Rob Herring <[email protected]>


2023-03-23 11:42:05

by Serge Semin

[permalink] [raw]
Subject: Re: [PATCH net-next 09/16] dt-bindings: net: dwmac: Prohibit additional props in AXI-config

On Thu, Mar 16, 2023 at 09:06:04AM +0100, Krzysztof Kozlowski wrote:
> On 13/03/2023 23:50, Serge Semin wrote:
> > Currently DT-schema of the AXI-bus config sub-node prohibits to have
> > unknown properties by using the unevaluatedProperties property. It's
> > overkill for the sub-node which doesn't use any combining schemas
> > keywords (allOf, anyOf, etc). Instead more natural is to use
> > additionalProperties to prohibit for that.
> >
> > Signed-off-by: Serge Semin <[email protected]>
> > ---
> > Documentation/devicetree/bindings/net/snps,dwmac.yaml | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > index 89be67e55c3e..d1b2910b799b 100644
> > --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > @@ -466,7 +466,6 @@ properties:
> >
> > stmmac-axi-config:
> > type: object
> > - unevaluatedProperties: false
> > description:
> > AXI BUS Mode parameters.
> >
> > @@ -518,6 +517,8 @@ properties:
> > description:
> > rebuild INCRx Burst
> >
> > + additionalProperties: false
>
> But why moving it? Keep the same placement.

No firm justification except that vast majority of DT bindings have
that keyword placed at the tail of the schema body. Anyway I'll get
the it back to the original line.

-Serge(y)

>
> Best regards,
> Krzysztof
>

2023-03-23 11:50:02

by Serge Semin

[permalink] [raw]
Subject: Re: [PATCH net-next 10/16] dt-bindings: net: dwmac: Add AXI-bus properties constraints

On Thu, Mar 16, 2023 at 09:06:32AM +0100, Krzysztof Kozlowski wrote:
> On 13/03/2023 23:50, Serge Semin wrote:
> > Currently none of the AXI-bus non-boolean DT-properties have constraints
> > defined meanwhile they can be specified at least based on the
> > corresponding device configs. Let's do that:
> > + snps,wr_osr_lm/snps,rd_osr_lmt - maximum number of outstanding AXI-bus
> > read/write requests is limited with the IP-core synthesize parameter
> > AXI_MAX_{RD,WR}_REQ. DW MAC/GMAC: <= 16, DW Eth QoS: <= 32, DW xGMAC: <=
> > 64. The least restrictive constraint is defined since the DT-schema is
> > common for all IP-cores.
> > + snps,blen - array of the burst lengths supported by the AXI-bus. Values
> > are limited by the AXI3/4 bus standard, available AXI/System bus CSR flags
> > and the AXI-bus IP-core synthesize config . All DW *MACs support setting
> > the burst length within the set: 4, 8, 16, 32, 64, 128, 256. If some burst
> > length is unsupported a zero value can be specified instead in the array.
> >
> > Signed-off-by: Serge Semin <[email protected]>
>
>
> >
> > snps,kbbe:
> > $ref: /schemas/types.yaml#/definitions/uint32
> > @@ -501,6 +507,8 @@ properties:
> > this is a vector of supported burst length.
> > minItems: 7
> > maxItems: 7
> > + items:
> > + enum: [256, 128, 64, 32, 16, 8, 4, 0]
>

> Increasing order.

Ok.

-Serge(y)

>
> Best regards,
> Krzysztof
>

2023-03-23 11:58:26

by Serge Semin

[permalink] [raw]
Subject: Re: [PATCH net-next 12/16] dt-bindings: net: dwmac: Add MTL Tx Queue properties constraints

On Thu, Mar 16, 2023 at 09:08:02AM +0100, Krzysztof Kozlowski wrote:
> On 13/03/2023 23:50, Serge Semin wrote:
> > Currently none of the MTL Tx Queues QoS-related DT-properties have been
> > equipped with the proper constraints meanwhile they can be specified at
> > least based on the corresponding CSR field sizes or the DW (x|xG)MAC
> > IP-core synthesize parameter constraints. Let's do that:
> > + snps,tx-queues-to-use - number of Tx queues to utilise is limited with a
> > number of available queues. DW MAC/GMAC: no queues, DW Eth QoS: <= 8, DW
> > xGMAC: <= 16.
> > + snps,weight - Tx Queue/Traffic Class quantum/weight utilised depending
> > on enabled algorithm for the Data Center Bridging feature: DWRR (up to
> > 0x1312D0 bytes to add to credit) or WFQ (up to 0x3FFF - least bandwidth)
> > or WFQ (up to 0x64). DW MAC/GMAC: no queues, DW Eth QoS: <= 0x1312D0, DW
> > xGMAC: <= 0x1312D0.
> > + snps,send_slope - Tx Queue/Traffic Class Send-Slope credit value
> > subtracted from the accumulated credit for the Audio/Video bridging
> > feature (CBS algorithm, bits per cycle scaled up by 1,024). DW MAC/GMAC:
> > no queues, DW Eth QoS: <= 0x2000, DW xGMAC: <= 0x3FFF.
> > + snps,idle_slope - same meaning as snps,send_slope except it's determines
> > the Idle-Slope credit of CBS algorithm. DW MAC/GMAC: no queues, DW Eth
> > QoS: <= 0x2000, DW xGMAC: <= 0x8000.
> > + snps,high_credit/snps,low_credit - maximum and minimum values
> > accumulated in the credit for the Audio/Video bridging feature (CBS
> > algorithm, bits scaled up by 1,024). DW MAC/GMAC: no queues, DW Eth
> > QoS: <= 0x1FFFFFFF, DW xGMAC: <= 0x1FFFFFFF.
> > + snps,priority - Tx Queue/Traffic Class priority (enabled by the
> > PFC-packets) limits determined by the VLAN tag PRI field width (it's 7).
> > DW MAC/GMAC: no queues, DW Eth QoS: 0xff, DW xGMAC: 0xff.
> >
> > Since the constraints vary for different IP-cores and the DT-schema is
> > common for all of them the least restrictive values are chosen. The info
> > above can be used for the IP-core specific DT-schemas if anybody ever is
> > bothered with one to create.
> >
> > Signed-off-by: Serge Semin <[email protected]>
> > ---
> > .../bindings/net/snps,dwmac-generic.yaml | 2 +-
> > .../devicetree/bindings/net/snps,dwmac.yaml | 24 ++++++++++++++++++-
> > 2 files changed, 24 insertions(+), 2 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml b/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
> > index ae740a1ab213..2974af79511d 100644
> > --- a/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
> > +++ b/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
> > @@ -137,7 +137,7 @@ examples:
> > snps,send_slope = <0x1000>;
> > snps,idle_slope = <0x1000>;
> > snps,high_credit = <0x3E800>;
> > - snps,low_credit = <0xFFC18000>;
> > + snps,low_credit = <0x1FC18000>;
> > snps,priority = <0x1>;
> > };
> > };
> > diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > index e5662b1498b7..2ebf7995426b 100644
> > --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > @@ -250,6 +250,10 @@ properties:
> > snps,tx-queues-to-use:
> > $ref: /schemas/types.yaml#/definitions/uint32
> > description: number of TX queues to be used in the driver
> > + default: 1
> > + minimum: 1
> > + maximum: 16
> > +
> > snps,tx-sched-wrr:
> > type: boolean
> > description: Weighted Round Robin
> > @@ -296,13 +300,16 @@ properties:
> > snps,tx-sched-wfq: false
> > snps,tx-sched-dwrr: false
> > patternProperties:
> > - "^queue[0-9]$":
> > + "^queue([0-9]|1[0-5])$":
> > description: Each subnode represents a queue.
> > type: object
> > properties:
> > snps,weight:
> > $ref: /schemas/types.yaml#/definitions/uint32
> > description: TX queue weight (if using a DCB weight algorithm)
> > + minimum: 0
> > + maximum: 0x1312D0
> > +
> > snps,dcb-algorithm:
> > type: boolean
> > description: TX queue will be working in DCB
> > @@ -315,15 +322,27 @@ properties:
> > snps,send_slope:
> > $ref: /schemas/types.yaml#/definitions/uint32
> > description: enable Low Power Interface
> > + minimum: 0
> > + maximum: 0x3FFF
>
> lowercase hex everywhere.

Got it. Thanks.

-Serge(y)

>
> Best regards,
> Krzysztof
>

2023-03-23 12:15:08

by Serge Semin

[permalink] [raw]
Subject: Re: [PATCH net-next 13/16] dt-bindings: net: dwmac: Fix MTL Tx Queue props description

On Thu, Mar 16, 2023 at 09:08:48AM +0100, Krzysztof Kozlowski wrote:
> On 13/03/2023 23:51, Serge Semin wrote:
> > Invalid MTL Tx Queues DT-properties description was added right at the
> > initial DCB/AVB features patch. Most likely due to copy-paste mistake the
> > text currently matches to what is specified for the AXI-bus config
> > properties. Let's fix that by providing correct descriptions for MTL Tx
> > Queue DT-properties utilized for the AVB feature (CBS algorithm) tuning.
> >
> > Fixes: 19d918731797 ("net: stmmac: configuration of CBS in case of a TX AVB queue")
>
> Fixes must be first in the patchset.

Ok.

-Serge(y)

>
> > Signed-off-by: Serge Semin <[email protected]>
> > ---
>
>
> Best regards,
> Krzysztof
>

2023-03-23 12:15:45

by Serge Semin

[permalink] [raw]
Subject: Re: [PATCH net-next 14/16] dt-bindings: net: dwmac: Use flag definition instead of booleans

On Thu, Mar 16, 2023 at 09:09:37AM +0100, Krzysztof Kozlowski wrote:
> On 13/03/2023 23:51, Serge Semin wrote:
> > Currently some of the boolean properties defined in the DT-schema are
> > marked to have the basic boolean type meanwhile the rest referencing the
> > /schemas/types.yaml#/definitions/flag schema. For the sake of unification
> > let's convert the first group to referencing the pre-defined flag schema.
> > Thus bindings will look a bit more coherent and the DT-bindings
> > maintainers will have a better control over the booleans defined in the
> > schema (if ever needed).
> >
> > Signed-off-by: Serge Semin <[email protected]>
> > ---
> > .../devicetree/bindings/net/snps,dwmac.yaml | 45 ++++++++++++-------
> > 1 file changed, 30 insertions(+), 15 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > index 69be39d55403..a863b5860566 100644
> > --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > @@ -120,11 +120,13 @@ properties:
> > maximum: 12
> >
> > snps,rx-sched-sp:
> > - type: boolean
> > + $ref: /schemas/types.yaml#/definitions/flag
> > description: Strict priority
>

> If ever touching this, it should be other way -> boolean.

Ok. I'll drop the patch then.

-Serge(y)

>
> Best regards,
> Krzysztof
>

2023-03-23 15:15:50

by Serge Semin

[permalink] [raw]
Subject: Re: [PATCH net-next 15/16] dt-bindings: net: dwmac: Simplify MTL queue props dependencies

On Fri, Mar 17, 2023 at 03:56:04PM -0500, Rob Herring wrote:
> On Tue, Mar 14, 2023 at 01:51:02AM +0300, Serge Semin wrote:
> > Currently the Tx/Rx queues properties interdependencies are described by
> > means of the pattern: "if: required: X, then: properties: Y: false, Z:
> > false, etc". Due to very unfortunate MTL Tx/Rx queue DT-node design the
> > resultant sub-nodes schemas look very bulky and thus hard to read. The
> > situation can be improved by using the "allOf:/oneOf: required: X,
> > required: Y, etc" pattern instead thus getting shorter and a bit easier to
> > comprehend constructions.
> >
> > Signed-off-by: Serge Semin <[email protected]>
> >
> > ---
>
> Reviewed-by: Rob Herring <[email protected]>
>
> >
> > Note the solution can be shortened out a bit further by replacing the
> > single-entry allOf statements with just the "not: required: etc" pattern.
> > But in order to do that the DT-schema validation tool must be fixed like
> > this:
> >
> > --- a/meta-schemas/nodes.yaml 2021-02-08 14:20:56.732447780 +0300
> > +++ b/meta-schemas/nodes.yaml 2021-02-08 14:21:00.736492245 +0300
> > @@ -22,6 +22,7 @@
> > - unevaluatedProperties
> > - deprecated
> > - required
> > + - not
> > - allOf
> > - anyOf
> > - oneOf
>

> This should be added regardless. Can you send a patch to devicetree-spec
> or a GH PR. But I'd skip using that here for now because then we require
> a new version of dtschema.

Ok. I'll send the patch to the devicetree-spec mailing list.

* Note meta-schemas/base.yaml will be fixed in the similar way.

-Serge(y)

>
> Rob