Re: [PATCH net-next 09/12] ARM: dts: r9a06g032: describe MII converter

Clément Léger
2022-04-15T15:33:43Z

Le Fri, 15 Apr 2022 17:12:26 +0200,
Andrew Lunn <andrew@lunn.ch> a écrit :

> > Ok, looks like a more flexible way to doing it. Let's go with something
> > like this:
> >
> > renesas,miic-port-connection = <PORTIN_GMAC2>, <MAC2>, <SWITCH_PORTC>,
> > <SWITCH_PORTB>, <SWITCH_PORTA>;
>
> Not all combinations are possible. In fact, there is a limited choice
> for each value. So consider getting the yaml tools to help you by
> listing what is valid for each setting. You might need a different
> format than. Also, this format it is not clear what each value refers
> to.
>
> renesas,miic-port-connection-mii-conv1 = <PORTIN_GMAC2>;
> renesas,miic-port-connection-mii-conv2 = <MAC2>;
> renesas,miic-port-connection-mii-conv3 = <SWITCH_PORTC>;
> renesas,miic-port-connection-mii-conv4 = <SWITCH_PORTB>;
> renesas,miic-port-connection-mii-conv5 = <SWITCH_PORTA>;
>
> is more sense documenting, and i suspect easier to make the validator
> work for you.

While doing it, I think it probably even makes more sense to have
something more structured. I currently have the following:

eth-miic@44030000 {
...

mii_conv0: mii-conv@0 {
reg = <0>;
};

mii_conv1: mii-conv@1 {
reg = <1>;
};
...
};

I think it would be good to modify it like this:

eth-miic@44030000 {
...
converters {
mii_conv0: mii-conv@0 {
// Even if useless, maybe keeping it for the sake of coherency
renesas,miic-input = <MIIC_GMAC1>;
reg = <0>;
};
mii_conv1: mii-conv@1 {
renesas,miic-input = <SWITCH_PORTA>;
reg = <1>;
};
mii_conv2: mii-conv@2 {
renesas,miic-input = <SWITCH_PORTB>;
reg = <2>;
};
mii_conv3: mii-conv@3 {
renesas,miic-input = <SWITCH_PORTC>;
reg = <3>;
};
mii_conv4: mii-conv@4 {
renesas,miic-input = <SWITCH_PORTD>;
reg = <4>;
};
};

This way, it remains tied to the MII converter output port definition. I
guess that the yaml definitions would still allow to restrict the values
available per nodes. Validation for the final combination is probably
more difficult to do using yaml.

Regarding the SWITCH_PORTIN, I don't see any way to use the same
definition than for the converter port and thus, a
"renesas,miic-switch-portin" property seems mandatory.

--
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin