mbox series

[net-next,0/4] net: lan966x: hardcode port count

Message ID 20220630140237.692986-1-michael@walle.cc
Headers show
Series net: lan966x: hardcode port count | expand

Message

Michael Walle June 30, 2022, 2:02 p.m. UTC
Don't rely on the device tree to count the number of physical port. Instead
introduce a new compatible string which the driver can use to select the
correct port count.

This also hardcodes the generic compatible string to 8. The rationale is
that this compatible string was just used for the LAN9668 for now and I'm
not even sure the current driver would support the LAN9662.

Michael Walle (4):
  net: lan966x: hardcode the number of external ports
  dt-bindings: net: lan966x: add specific compatible string
  net: lan966x: add new compatible microchip,lan9668-switch
  ARM: dts: lan966x: use new microchip,lan9668-switch compatible

 .../net/microchip,lan966x-switch.yaml         |  5 +++-
 arch/arm/boot/dts/lan966x.dtsi                |  2 +-
 .../ethernet/microchip/lan966x/lan966x_main.c | 24 +++++++++++++------
 3 files changed, 22 insertions(+), 9 deletions(-)

Comments

Krzysztof Kozlowski June 30, 2022, 7:18 p.m. UTC | #1
On 30/06/2022 16:02, Michael Walle wrote:
> The old generic microchip,lan966x-switch compatible string was
> deprecated. Use the new one.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
>  arch/arm/boot/dts/lan966x.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/lan966x.dtsi b/arch/arm/boot/dts/lan966x.dtsi
> index 48971d80c82c..da0657c57cdf 100644
> --- a/arch/arm/boot/dts/lan966x.dtsi
> +++ b/arch/arm/boot/dts/lan966x.dtsi
> @@ -85,7 +85,7 @@ soc {
>  		ranges;
>  
>  		switch: switch@e0000000 {
> -			compatible = "microchip,lan966x-switch";
> +			compatible = "microchip,lan9668-switch";

While technically correct, the change cannot go via independent trees
and may break out-of-tree users of this DTS.

Usually the nicer way is to use two compatibles (the old as fallback).
Anyway, this one is fine with me - up to subarch maintainer.

Best regards,
Krzysztof
Horatiu Vultur June 30, 2022, 8:44 p.m. UTC | #2
The 06/30/2022 16:02, Michael Walle wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Don't rely on the device tree to count the number of physical port. Instead
> introduce a new compatible string which the driver can use to select the
> correct port count.
> 
> This also hardcodes the generic compatible string to 8. The rationale is
> that this compatible string was just used for the LAN9668 for now and I'm
> not even sure the current driver would support the LAN9662.

It works also on LAN9662, but I didn't have time to send patches for
DTs. Then when I send patches for LAN9662, do I need to go in all dts
files to change the compatible string for the 'switch' node?

> 
> Michael Walle (4):
>   net: lan966x: hardcode the number of external ports
>   dt-bindings: net: lan966x: add specific compatible string
>   net: lan966x: add new compatible microchip,lan9668-switch
>   ARM: dts: lan966x: use new microchip,lan9668-switch compatible
> 
>  .../net/microchip,lan966x-switch.yaml         |  5 +++-
>  arch/arm/boot/dts/lan966x.dtsi                |  2 +-
>  .../ethernet/microchip/lan966x/lan966x_main.c | 24 +++++++++++++------
>  3 files changed, 22 insertions(+), 9 deletions(-)
> 
> --
> 2.30.2
>
Michael Walle June 30, 2022, 8:56 p.m. UTC | #3
Am 2022-06-30 22:44, schrieb Horatiu Vultur:
> The 06/30/2022 16:02, Michael Walle wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know 
>> the content is safe
>> 
>> Don't rely on the device tree to count the number of physical port. 
>> Instead
>> introduce a new compatible string which the driver can use to select 
>> the
>> correct port count.
>> 
>> This also hardcodes the generic compatible string to 8. The rationale 
>> is
>> that this compatible string was just used for the LAN9668 for now and 
>> I'm
>> not even sure the current driver would support the LAN9662.
> 
> It works also on LAN9662, but I didn't have time to send patches for
> DTs. Then when I send patches for LAN9662, do I need to go in all dts
> files to change the compatible string for the 'switch' node?

I'd assume there is one lan9662.dtsi and yes, there should then be
   compatible = "microchip,lan9662-switch";
or
   compatible = "microchip,lan9662-switch", "microchip,lan966x-switch";
depending on the outcome of the question Krzysztof raised.

And of course adding the compatible string to the driver with a port
count of 4 (?). I can't find anything about the lan9662, and you've
mentioned it has 4 ports. Are there four external ports? I was
under the impression the last digit of the SoC name stands for the
number of ports.

-michael
Andrew Lunn June 30, 2022, 9:08 p.m. UTC | #4
On Thu, Jun 30, 2022 at 04:02:33PM +0200, Michael Walle wrote:
> Don't rely on the device tree to count the number of physical port. Instead
> introduce a new compatible string which the driver can use to select the
> correct port count.

Does the silicon have an ID register which identifies what the device
is?

	Andrew
Horatiu Vultur June 30, 2022, 9:21 p.m. UTC | #5
The 06/30/2022 22:56, Michael Walle wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Am 2022-06-30 22:44, schrieb Horatiu Vultur:
> > The 06/30/2022 16:02, Michael Walle wrote:
> > > EXTERNAL EMAIL: Do not click links or open attachments unless you know
> > > the content is safe
> > > 
> > > Don't rely on the device tree to count the number of physical port.
> > > Instead
> > > introduce a new compatible string which the driver can use to select
> > > the
> > > correct port count.
> > > 
> > > This also hardcodes the generic compatible string to 8. The rationale
> > > is
> > > that this compatible string was just used for the LAN9668 for now and
> > > I'm
> > > not even sure the current driver would support the LAN9662.
> > 
> > It works also on LAN9662, but I didn't have time to send patches for
> > DTs. Then when I send patches for LAN9662, do I need to go in all dts
> > files to change the compatible string for the 'switch' node?
> 
> I'd assume there is one lan9662.dtsi and yes, there should then be
>   compatible = "microchip,lan9662-switch";
> or
>   compatible = "microchip,lan9662-switch", "microchip,lan966x-switch";
> depending on the outcome of the question Krzysztof raised.
> 
> And of course adding the compatible string to the driver with a port
> count of 4 (?). I can't find anything about the lan9662,

I am not sure why they have not upload yet the datasheet for lan9662.

>and you've > mentioned it has 4 ports.  Are there four external ports? 

You can have up to 4 ports.
You can have 4 external ports or you can use the internal ones plus two
external.

> I was  under the impression the last digit of the SoC name stands for the
> number of ports.

That would make much more sense but I don't understand why they have
name it like this.

> 
> -michael