diff mbox series

[4/5] dt-bindings: net: document loongson.pci-gmac

Message ID 20191030135347.3636-5-jiaxun.yang@flygoat.com
State Changes Requested, archived
Headers show
Series PCI Devices for Loongson PCH | expand

Checks

Context Check Description
robh/checkpatch success
robh/dt-meta-schema fail build log

Commit Message

Jiaxun Yang Oct. 30, 2019, 1:53 p.m. UTC
This binding will provide extra information for PCI enabled
device.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 .../net/wireless/loongson,pci-gmac.yaml       | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml

Comments

Simon Horman Oct. 31, 2019, 8:35 a.m. UTC | #1
Hi Jiaxun,

thanks for your patch.

On Wed, Oct 30, 2019 at 09:53:46PM +0800, Jiaxun Yang wrote:
> This binding will provide extra information for PCI enabled
> device.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>

Please verify the bindings using dtbs_check as described in
Documentation/devicetree/writing-schema.rst

> ---
>  .../net/wireless/loongson,pci-gmac.yaml       | 71 +++++++++++++++++++
>  1 file changed, 71 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml
> new file mode 100644
> index 000000000000..5f764bd46735
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml
> @@ -0,0 +1,71 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/allwinner,sun7i-a20-gmac.yaml#

The id does not match the filename of the schema.

i.e. the above should be:

	$id: http://devicetree.org/schemas/net/wireless/loongson,pci-gmac.yaml#

> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Loongson PCI GMAC Device Tree Bindings
> +
> +allOf:
> +  - $ref: "snps,dwmac.yaml#"

snps,dwmac.yaml# is in the parent directory relative to loongson,pci-gmac.yaml.
So I think the above needs to be:

	$ref: "../snps,dwmac.yaml#"

> +
> +maintainers:
> +  - Jiaxun Yang <jiaxun.yang@flygoat.com>
> +
> +properties:
> +  compatible:
> +    const: loongson,pci-gmac
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    minItems: 1
> +    maxItems: 3
> +    items:
> +      - description: Combined signal for various interrupt events
> +      - description: The interrupt to manage the remote wake-up packet detection
> +      - description: The interrupt that occurs when Rx exits the LPI state
> +
> +  interrupt-names:
> +    minItems: 1
> +    maxItems: 3
> +    items:
> +      - const: macirq
> +      - const: eth_wake_irq
> +      - const: eth_lpi
> +
> +  clocks:
> +    items:
> +      - description: GMAC main clock
> +
> +  clock-names:
> +    items:
> +      - const: stmmaceth
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - interrupt-names
> +  - clocks
> +  - clock-names
> +  - phy-mode
> +
> +examples:
> +  - |
> +    gmac: ethernet@ {

I would have expected a bus address here, f.e.:

	gmac: ethernet@0x00001800

> +        compatible = "loongson,pci-irq";
> +        reg = <0x00001800 0 0 0 0>;

I think there is one to many cell in the above, perhaps it should be.

	reg = <0x00001800 0 0 0>;

Also, I would expect the registers to be wider than 0, i.e. no registers.

`
> +        interrupts = <12>, <13>;
> +        interrupt-names = "macirq", "eth_lpi";
> +        clocks =  <&clk_pch_gmac>;
> +        clock-names = "stmmaceth";
> +        phy-mode = "rgmii";
> +    };
> +
> +# FIXME: We should set it, but it would report all the generic
> +# properties as additional properties.
> +# additionalProperties: false
> +
> +...
> -- 
> 2.23.0
>
Jiaxun Yang Oct. 31, 2019, 10:57 a.m. UTC | #2
在 2019/10/31 下午4:35, Simon Horman 写道:
> Hi Jiaxun,
>
> thanks for your patch.
>
> On Wed, Oct 30, 2019 at 09:53:46PM +0800, Jiaxun Yang wrote:
>> This binding will provide extra information for PCI enabled
>> device.
>>
>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Please verify the bindings using dtbs_check as described in
> Documentation/devicetree/writing-schema.rst
>
>> ---
>>   .../net/wireless/loongson,pci-gmac.yaml       | 71 +++++++++++++++++++
>>   1 file changed, 71 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml
>> new file mode 100644
>> index 000000000000..5f764bd46735
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml
>> @@ -0,0 +1,71 @@
>> +# SPDX-License-Identifier: GPL-2.0
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/net/allwinner,sun7i-a20-gmac.yaml#
> The id does not match the filename of the schema.
>
> i.e. the above should be:
>
> 	$id: http://devicetree.org/schemas/net/wireless/loongson,pci-gmac.yaml#
>
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Loongson PCI GMAC Device Tree Bindings
>> +
>> +allOf:
>> +  - $ref: "snps,dwmac.yaml#"
> snps,dwmac.yaml# is in the parent directory relative to loongson,pci-gmac.yaml.
> So I think the above needs to be:
>
> 	$ref: "../snps,dwmac.yaml#"
>
>> +
>> +maintainers:
>> +  - Jiaxun Yang <jiaxun.yang@flygoat.com>
>> +
>> +properties:
>> +  compatible:
>> +    const: loongson,pci-gmac
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  interrupts:
>> +    minItems: 1
>> +    maxItems: 3
>> +    items:
>> +      - description: Combined signal for various interrupt events
>> +      - description: The interrupt to manage the remote wake-up packet detection
>> +      - description: The interrupt that occurs when Rx exits the LPI state
>> +
>> +  interrupt-names:
>> +    minItems: 1
>> +    maxItems: 3
>> +    items:
>> +      - const: macirq
>> +      - const: eth_wake_irq
>> +      - const: eth_lpi
>> +
>> +  clocks:
>> +    items:
>> +      - description: GMAC main clock
>> +
>> +  clock-names:
>> +    items:
>> +      - const: stmmaceth
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - interrupts
>> +  - interrupt-names
>> +  - clocks
>> +  - clock-names
>> +  - phy-mode
>> +
>> +examples:
>> +  - |
>> +    gmac: ethernet@ {
> I would have expected a bus address here, f.e.:
>
> 	gmac: ethernet@0x00001800
>
>> +        compatible = "loongson,pci-irq";
>> +        reg = <0x00001800 0 0 0 0>;
> I think there is one to many cell in the above, perhaps it should be.
>
> 	reg = <0x00001800 0 0 0>;
>
> Also, I would expect the registers to be wider than 0, i.e. no registers.

Hi Simon,

Thanks for your suggestions above, will fix in v1.

Here, the reg domain is a standard 5-cell representing a PCI device,

See: Documentation/devicetree/bindings/pci/pci.txt and IEEE Std 
1275-1994,<https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/pci/pci.txt>

Should I add some description?

Jiaxun
Simon Horman Oct. 31, 2019, 8:42 p.m. UTC | #3
On Thu, Oct 31, 2019 at 06:57:16PM +0800, Jiaxun Yang wrote:
> 
> 在 2019/10/31 下午4:35, Simon Horman 写道:
> > Hi Jiaxun,
> > 
> > thanks for your patch.
> > 
> > On Wed, Oct 30, 2019 at 09:53:46PM +0800, Jiaxun Yang wrote:
> > > This binding will provide extra information for PCI enabled
> > > device.
> > > 
> > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > Please verify the bindings using dtbs_check as described in
> > Documentation/devicetree/writing-schema.rst
> > 
> > > ---
> > >   .../net/wireless/loongson,pci-gmac.yaml       | 71 +++++++++++++++++++
> > >   1 file changed, 71 insertions(+)
> > >   create mode 100644 Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml
> > > 
> > > diff --git a/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml
> > > new file mode 100644
> > > index 000000000000..5f764bd46735
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml
> > > @@ -0,0 +1,71 @@
> > > +# SPDX-License-Identifier: GPL-2.0
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/net/allwinner,sun7i-a20-gmac.yaml#
> > The id does not match the filename of the schema.
> > 
> > i.e. the above should be:
> > 
> > 	$id: http://devicetree.org/schemas/net/wireless/loongson,pci-gmac.yaml#
> > 
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Loongson PCI GMAC Device Tree Bindings
> > > +
> > > +allOf:
> > > +  - $ref: "snps,dwmac.yaml#"
> > snps,dwmac.yaml# is in the parent directory relative to loongson,pci-gmac.yaml.
> > So I think the above needs to be:
> > 
> > 	$ref: "../snps,dwmac.yaml#"
> > 
> > > +
> > > +maintainers:
> > > +  - Jiaxun Yang <jiaxun.yang@flygoat.com>
> > > +
> > > +properties:
> > > +  compatible:
> > > +    const: loongson,pci-gmac
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  interrupts:
> > > +    minItems: 1
> > > +    maxItems: 3
> > > +    items:
> > > +      - description: Combined signal for various interrupt events
> > > +      - description: The interrupt to manage the remote wake-up packet detection
> > > +      - description: The interrupt that occurs when Rx exits the LPI state
> > > +
> > > +  interrupt-names:
> > > +    minItems: 1
> > > +    maxItems: 3
> > > +    items:
> > > +      - const: macirq
> > > +      - const: eth_wake_irq
> > > +      - const: eth_lpi
> > > +
> > > +  clocks:
> > > +    items:
> > > +      - description: GMAC main clock
> > > +
> > > +  clock-names:
> > > +    items:
> > > +      - const: stmmaceth
> > > +
> > > +required:
> > > +  - compatible
> > > +  - reg
> > > +  - interrupts
> > > +  - interrupt-names
> > > +  - clocks
> > > +  - clock-names
> > > +  - phy-mode
> > > +
> > > +examples:
> > > +  - |
> > > +    gmac: ethernet@ {
> > I would have expected a bus address here, f.e.:
> > 
> > 	gmac: ethernet@0x00001800
> > 
> > > +        compatible = "loongson,pci-irq";
> > > +        reg = <0x00001800 0 0 0 0>;
> > I think there is one to many cell in the above, perhaps it should be.
> > 
> > 	reg = <0x00001800 0 0 0>;
> > 
> > Also, I would expect the registers to be wider than 0, i.e. no registers.
> 
> Hi Simon,
> 
> Thanks for your suggestions above, will fix in v1.
> 
> Here, the reg domain is a standard 5-cell representing a PCI device,
> 
> See: Documentation/devicetree/bindings/pci/pci.txt and IEEE Std 1275-1994,<https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/pci/pci.txt>
> 
> Should I add some description?

Thanks, sorry for missing that.
As that is the case I think you need something like the following
as an example that compiles.

examples:
  - |
    pcie@0 {
        reg = <0 0 0 0>;
        #size-cells = <2>;
        #address-cells = <3>;
        ranges = <0 0 0 0 0 0>;
        device_type = "pci";

        gmac: ethernet@1800 {
            compatible = "loongson,pci-irq";
            reg = <0x00001800 0 0 0 0>;
            interrupts = <12>, <13>;
            interrupt-names = "macirq", "eth_lpi";
            clocks =  <&clk_pch_gmac>;
            clock-names = "stmmaceth";
            phy-mode = "rgmii";
        };
    };
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml
new file mode 100644
index 000000000000..5f764bd46735
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml
@@ -0,0 +1,71 @@ 
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/allwinner,sun7i-a20-gmac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Loongson PCI GMAC Device Tree Bindings
+
+allOf:
+  - $ref: "snps,dwmac.yaml#"
+
+maintainers:
+  - Jiaxun Yang <jiaxun.yang@flygoat.com>
+
+properties:
+  compatible:
+    const: loongson,pci-gmac
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    minItems: 1
+    maxItems: 3
+    items:
+      - description: Combined signal for various interrupt events
+      - description: The interrupt to manage the remote wake-up packet detection
+      - description: The interrupt that occurs when Rx exits the LPI state
+
+  interrupt-names:
+    minItems: 1
+    maxItems: 3
+    items:
+      - const: macirq
+      - const: eth_wake_irq
+      - const: eth_lpi
+
+  clocks:
+    items:
+      - description: GMAC main clock
+
+  clock-names:
+    items:
+      - const: stmmaceth
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-names
+  - clocks
+  - clock-names
+  - phy-mode
+
+examples:
+  - |
+    gmac: ethernet@ {
+        compatible = "loongson,pci-irq";
+        reg = <0x00001800 0 0 0 0>;
+        interrupts = <12>, <13>;
+        interrupt-names = "macirq", "eth_lpi";
+        clocks =  <&clk_pch_gmac>;
+        clock-names = "stmmaceth";
+        phy-mode = "rgmii";
+    };
+
+# FIXME: We should set it, but it would report all the generic
+# properties as additional properties.
+# additionalProperties: false
+
+...