mbox series

[0/6] Marvell nvmem mac addresses support

Message ID 20221117215557.1277033-1-miquel.raynal@bootlin.com
Headers show
Series Marvell nvmem mac addresses support | expand

Message

Miquel Raynal Nov. 17, 2022, 9:55 p.m. UTC
Hello,

Now that we are aligned on how to make information available from static
storage media to drivers like Ethernet controller drivers or switch
drivers by using nvmem cells and going through the whole nvmem
infrastructure, here are two driver updates to reflect these changes.

Prior to the driver updates, I propose:
* Reverting binding changes which should have never been accepted like
  that.
* A conversion of the (old) Prestera and DFX server bindings (optional,
  can be dropped if not considered necessary).
* A better description of the more recent Prestera PCI switch.

Please mind that this series cannot break anything since retrieving the
MAC address Prestera driver has never worked upstream, because the (ONIE
tlv) driver supposed to export the MAC address has not been accepted in
its original form and has been updated to the nvmem-layout
infrastructure (bindings have been merged, the code remains to be
applied).

Thanks,
Miquèl

Miquel Raynal (6):
  Revert "dt-bindings: marvell,prestera: Add description for device-tree
    bindings"
  dt-bindings: net: marvell,dfx-server: Convert to yaml
  dt-bindings: net: marvell,prestera: Convert to yaml
  dt-bindings: net: marvell,prestera: Describe PCI devices of the
    prestera family
  net: marvell: prestera: Avoid unnecessary DT lookups
  net: mvpp2: Consider NVMEM cells as possible MAC address source

 .../bindings/net/marvell,dfx-server.yaml      | 60 +++++++++++++
 .../bindings/net/marvell,prestera.txt         | 81 -----------------
 .../bindings/net/marvell,prestera.yaml        | 86 +++++++++++++++++++
 .../net/ethernet/marvell/mvpp2/mvpp2_main.c   |  6 ++
 .../ethernet/marvell/prestera/prestera_main.c | 15 +---
 5 files changed, 156 insertions(+), 92 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/marvell,dfx-server.yaml
 delete mode 100644 Documentation/devicetree/bindings/net/marvell,prestera.txt
 create mode 100644 Documentation/devicetree/bindings/net/marvell,prestera.yaml

Comments

Rob Herring Nov. 23, 2022, 10:02 p.m. UTC | #1
On Thu, 17 Nov 2022 22:55:52 +0100, Miquel Raynal wrote:
> This reverts commit 40acc05271abc2852c32622edbebd75698736b9b.
> 
> marvell,prestera.txt is an old file describing the old Alleycat3
> standalone switches. The commit mentioned above actually hacked these
> bindings to add support for a device tree property for a more modern
> version of the IP connected over PCI, using only the generic compatible
> in order to retrieve the device node from the prestera driver to read
> one static property.
> 
> The problematic property discussed here is "base-mac-provider". The
> original intent was to point to a nvmem device which could produce the
> relevant nvmem-cell. This property has never been acked by DT
> maintainers and fails all the layering that has been brought with the nvmem
> bindings by pointing at a nvmem producer, bypassing the existing nvmem
> bindings, rather than a nvmem cell directly. Furthermore, the property
> cannot even be used upstream because it expected the ONIE tlv driver to
> produce a specific cell, driver which used nacked bindings and thus was
> never merged, replaced by a more integrated concept: the nvmem-layout.
> 
> So let's forget about this temporary addition, safely avoiding the need
> for any backward compatibility handling. A new (yaml) binding file will
> be brought with the prestera bindings, and there we will actually
> include a description of the modern IP over PCI, including the right way
> to point to a nvmem cell.
> 
> Cc: Vadym Kochan <vadym.kochan@plvision.eu>
> Cc: Taras Chornyi <tchornyi@marvell.com>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  .../bindings/net/marvell,prestera.txt         | 34 -------------------
>  1 file changed, 34 deletions(-)
> 

Acked-by: Rob Herring <robh@kernel.org>
Miquel Raynal Nov. 23, 2022, 11:34 p.m. UTC | #2
Hi Rob,

robh@kernel.org wrote on Wed, 23 Nov 2022 16:10:23 -0600:

> On Thu, Nov 17, 2022 at 10:55:53PM +0100, Miquel Raynal wrote:
> > Even though this description is not used anywhere upstream (no matching
> > driver), while on this file I decided I would try a conversion to yaml
> > in order to clarify the prestera family description.
> > 
> > I cannot keep the nodename dfx-server@xxxx so I switched to dfx-bus@xxxx
> > which matches simple-bus.yaml. Otherwise I took the example context from
> > the only user of this compatible: armada-xp-98dx3236.dtsi, which is a
> > rather old and not perfect DT.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> > I am fine dropping this file entirely as well, if judged useless.
> > ---
> >  .../bindings/net/marvell,dfx-server.yaml      | 60 +++++++++++++++++++
> >  .../bindings/net/marvell,prestera.txt         | 18 ------
> >  2 files changed, 60 insertions(+), 18 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/net/marvell,dfx-server.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/net/marvell,dfx-server.yaml b/Documentation/devicetree/bindings/net/marvell,dfx-server.yaml
> > new file mode 100644
> > index 000000000000..72151a78396f
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/net/marvell,dfx-server.yaml
> > @@ -0,0 +1,60 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/net/marvell,dfx-server.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Marvell Prestera DFX server
> > +
> > +maintainers:
> > +  - Miquel Raynal <miquel.raynal@bootlin.com>
> > +
> > +select:
> > +  properties:
> > +    compatible:
> > +      contains:
> > +        const: marvell,dfx-server
> > +  required:
> > +    - compatible
> > +
> > +properties:
> > +  compatible:
> > +    items:
> > +      - const: marvell,dfx-server
> > +      - const: simple-bus
> > +
> > +  reg: true  
> 
> How many entries?

Right, there is a single one, I'll constrain reg properly in v2.

> > +
> > +  ranges: true
> > +
> > +  '#address-cells':
> > +    const: 1
> > +
> > +  '#size-cells':
> > +    const: 1
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - ranges
> > +
> > +# The DFX server may expose clocks described as subnodes
> > +additionalProperties: true  
> 
> addtionalProperties:
>   type: object
> 
> So that only nodes can be added.

Excellent, I never thought about this possibility, but of course that
works. Thanks a lot!

> 
> > +
> > +examples:
> > +  - |
> > +
> > +    #define MBUS_ID(target,attributes) (((target) << 24) | ((attributes) << 16))
> > +    bus@0 {
> > +        reg = <0 0>;
> > +        #address-cells = <2>;
> > +        #size-cells = <1>;
> > +
> > +        dfx-bus@ac000000 {
> > +            compatible = "marvell,dfx-server", "simple-bus";
> > +            #address-cells = <1>;
> > +            #size-cells = <1>;
> > +            ranges = <0 MBUS_ID(0x08, 0x00) 0 0x100000>;
> > +            reg = <MBUS_ID(0x08, 0x00) 0 0x100000>;
> > +        };
> > +    };  


Thanks,
Miquèl