Re: [PATCH] dt-bindings: net: dsa: realtek-smi: convert to YAML schema

From: Florian Fainelli
Date: Wed Feb 09 2022 - 13:57:23 EST


On 2/9/22 10:43 AM, Luiz Angelo Daros de Luca wrote:
>>> However, the linux driver today does not care about any of these
>>> interruptions but INT_TYPE_LINK_STATUS. So it simply multiplex only
>>> this the interruption to each port, in a n-cell map (n being number of
>>> ports).
>>> I don't know what to describe here as device-tree should be something
>>> independent of a particular OS or driver.
>>
>> You shouldn't need to know what Linux does to figure this out.
>
> The Linux driver is masquerading all those interruptions into a single
> "link status changed". If interrupts property is about what the HW
> sends to us, it is a single pin.
>
> interrupt-controller:
> type: object
> description: |
> This defines an interrupt controller with an IRQ line (typically
> a GPIO) that will demultiplex and handle the interrupt from the single
> interrupt line coming out of one of the Realtek switch chips. It most
> importantly provides link up/down interrupts to the PHY blocks inside
> the ASIC.

The de-multiplexing is a software construct/operation, in fact, what the
GPIO line does is multiplex since the line is used as an output to the
next level interrupt controller it connects to.

>
> properties:
>
> interrupt-controller: true
>
> interrupts:
> maxItems: 1
> description:
> A single IRQ line from the switch, either active LOW or HIGH
>
> '#address-cells':
> const: 0
>
> '#interrupt-cells':
> const: 1
>
> required:
> - interrupt-controller
> - '#address-cells'
> - '#interrupt-cells'
>
> Now as it is also an interrupt-controller, shouldn't I document what it emits?

The interrupt controller emits a single output towards the next level,
and you documented that already with these properties. If you want to go
ahead and define what the various interrupt bits map to within the
switch's interrupt controller, you can do that in an
include/dt-bindings/ header file, or you can just open code the numbers.
Up to you.

> I've just sent the new version and we can discuss it there.
>
>>> - one interrupt for the switch
>>> - the switch is an interrupt-controller
>>> - ... and is the interrupt-parent for the phy nodes.
>>
>> This pattern is pretty common for DSA switches, which have internal
>> PHYs. You can see this in the mv88e6xxx binding for example.
>
> The issue is that those similar devices are still not in yaml format.

That does not mean we could not update dsa.yaml to list the
'interrupts', 'interrupt-controller' and '#interrupt-cells' properties
and just leave it to the individual YAML bindings to specify the shape
and size of those properties so they don't have to repeat them.
--
Florian