From: Lukasz Majewski <lukma@denx.de>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org,
Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Subject: Re: [PATCH 3/9] net: dsa: mv88e6xxx: implement get_phy_address
Date: Thu, 10 Nov 2022 17:37:14 +0100 [thread overview]
Message-ID: <20221110173714.6ea59de5@wsk> (raw)
In-Reply-To: <20221108091220.zpxsduscpvgr3zna@skbuf>
[-- Attachment #1: Type: text/plain, Size: 5521 bytes --]
Hi Vladimir,
> On Tue, Nov 08, 2022 at 09:23:24AM +0100, Lukasz Majewski wrote:
> > From: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
> >
> > Avoid the need to specify a PHY for each physical port in the
> > device tree when phy_base_addr is not 0 (6250 and 6341 families).
> >
> > This change should be backwards-compatible with existing device
> > trees, as it only adds sensible defaults where explicit definitions
> > were required before.
> >
> > Signed-off-by: Matthias Schiffer
> > <matthias.schiffer@ew.tq-group.com>
>
> Needs your Signed-off-by tag as well.
Ok.
>
> > ---
>
> Would it be possible to do like armada-3720-turris-mox.dts does, and
> put the phy-handle in the device tree, avoiding the need for so many
> PHY address translation quirks?
As far as I can tell - the mv88e6xxx driver
(./drivers/net/dsa/mv88e6xxx) now uses hardcoded values for each member
of mv88e6xxx_info struct.
Those values are "port_base_addr" and "phy_base_addr". Those values
could be read from DTS description as pasted below.
>
> If you're going to have U-Boot support for this switch as well, the
> phy-handle mechanism is the only thing that U-Boot supports, so device
> trees written in this way will work for both (and can be passed by
> U-Boot to Linux):
>
> switch1@11 {
> compatible = "marvell,mv88e6190";
> reg = <0x11>;
> dsa,member = <0 1>;
> interrupt-parent = <&moxtet>;
> interrupts = <MOXTET_IRQ_PERIDOT(1)>;
> status = "disabled";
>
> mdio {
> #address-cells = <1>;
> #size-cells = <0>;
>
> switch1phy1: switch1phy1@1 {
> reg = <0x1>;
> };
>
> switch1phy2: switch1phy2@2 {
> reg = <0x2>;
> };
>
> switch1phy3: switch1phy3@3 {
> reg = <0x3>;
> };
>
> switch1phy4: switch1phy4@4 {
> reg = <0x4>;
> };
>
> switch1phy5: switch1phy5@5 {
> reg = <0x5>;
> };
>
> switch1phy6: switch1phy6@6 {
> reg = <0x6>;
> };
>
> switch1phy7: switch1phy7@7 {
> reg = <0x7>;
> };
>
> switch1phy8: switch1phy8@8 {
> reg = <0x8>;
> };
> };
>
> ports {
> #address-cells = <1>;
> #size-cells = <0>;
>
> port@1 {
> reg = <0x1>;
> label = "lan9";
> phy-handle = <&switch1phy1>;
> };
>
> port@2 {
> reg = <0x2>;
> label = "lan10";
> phy-handle = <&switch1phy2>;
> };
>
> port@3 {
> reg = <0x3>;
> label = "lan11";
> phy-handle = <&switch1phy3>;
> };
>
> port@4 {
> reg = <0x4>;
> label = "lan12";
> phy-handle = <&switch1phy4>;
> };
>
> port@5 {
> reg = <0x5>;
> label = "lan13";
> phy-handle = <&switch1phy5>;
> };
>
> port@6 {
> reg = <0x6>;
> label = "lan14";
> phy-handle = <&switch1phy6>;
> };
>
> port@7 {
> reg = <0x7>;
> label = "lan15";
> phy-handle = <&switch1phy7>;
> };
>
> port@8 {
> reg = <0x8>;
> label = "lan16";
> phy-handle = <&switch1phy8>;
> };
>
> switch1port9: port@9 {
> reg = <0x9>;
> label = "dsa";
> phy-mode = "2500base-x";
> managed = "in-band-status";
> link = <&switch0port10>;
> };
>
> switch1port10: port@a {
> reg = <0xa>;
> label = "dsa";
> phy-mode = "2500base-x";
> managed = "in-band-status";
> link = <&switch2port9>;
> status = "disabled";
> };
>
> port-sfp@a {
> reg = <0xa>;
> label = "sfp";
> sfp = <&sfp>;
> phy-mode = "sgmii";
> managed = "in-band-status";
> status = "disabled";
> };
> };
> };
The u-boot mailine has basic support for mv88e6071 and mv88e6020 (and
also some 'extension' patches which are floating around [1]).
For the current code - I'm using:
mdio {
#address-cells = <1>;
#size-cells = <0>;
switch@0 {
compatible = "marvell,mv88e6250";
reg = <0x00>;
interrupt-parent = <&gpio2>;
interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
interrupt-controller;
#interrupt-cells = <2>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "lan1";
};
port@1 {
reg = <1>;
label = "lan2";
};
port@2 {
reg = <2>;
label = "lan3";
};
port@5 {
reg = <5>;
label = "cpu";
phy-mode = "rgmii-id";
ethernet = <&fec1>;
fixed-link {
speed = <100>;
full-duplex;
};
};
};
The only "hack" which I see from time to time is the replacement of
'switch@0' with 'switch@8' to take into account the R0_LED/ADDRES4
bootstrap pin value (to shift up ports addresses).
Links:
[1] - https://lists.denx.de/pipermail/u-boot/2021-March/444827.html
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-11-10 16:38 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 8:23 [PATCH 0/9] net: dsa: Add support for mv88e6020 and mv88e6071 Lukasz Majewski
2022-11-08 8:23 ` [PATCH 1/9] net: dsa: allow switch drivers to override default slave PHY addresses Lukasz Majewski
2022-11-08 9:12 ` Vladimir Oltean
2022-11-08 10:34 ` Lukasz Majewski
2022-11-08 13:21 ` Andrew Lunn
2022-11-10 15:34 ` Lukasz Majewski
2022-11-10 22:05 ` Andrew Lunn
2022-11-14 8:51 ` Lukasz Majewski
2022-11-08 18:10 ` Florian Fainelli
2022-11-08 8:23 ` [PATCH 2/9] net: dsa: mv88e6xxx: account for PHY base address offset in dual chip mode Lukasz Majewski
2022-11-08 13:26 ` Andrew Lunn
2022-11-10 17:02 ` Lukasz Majewski
2022-11-08 8:23 ` [PATCH 3/9] net: dsa: mv88e6xxx: implement get_phy_address Lukasz Majewski
2022-11-08 9:12 ` Vladimir Oltean
2022-11-08 13:36 ` Andrew Lunn
2022-11-10 17:00 ` Lukasz Majewski
2022-11-11 21:38 ` Vladimir Oltean
2022-11-14 10:10 ` Lukasz Majewski
2022-11-10 16:37 ` Lukasz Majewski [this message]
2022-11-08 8:23 ` [PATCH 4/9] net: dsa: mv88e6xxx: add support for MV88E6020 switch Lukasz Majewski
2022-11-08 8:23 ` [PATCH 5/9] net: dsa: mv88e6xxx: Add support for MV88E6071 switch Lukasz Majewski
2022-11-08 8:23 ` [PATCH 6/9] net: dsa: marvell: Provide per device information about max frame size Lukasz Majewski
2022-11-08 13:47 ` Andrew Lunn
2022-11-10 15:36 ` Lukasz Majewski
2022-11-10 22:10 ` Andrew Lunn
2022-11-14 8:52 ` Lukasz Majewski
2022-11-08 8:23 ` [PATCH 7/9] net: dsa: mv88e6071: Define max frame size (2048 bytes) Lukasz Majewski
2022-11-08 13:49 ` Andrew Lunn
2022-11-10 15:42 ` Lukasz Majewski
2022-11-10 22:12 ` Andrew Lunn
2022-11-14 9:06 ` Lukasz Majewski
2022-11-08 8:23 ` [PATCH 8/9] net: dsa: mv88e6071: Provide struct mv88e6xxx_ops Lukasz Majewski
2022-11-08 8:23 ` [PATCH 9/9] net: dsa: mv88e6071: Set .set_max_frame_size callback Lukasz Majewski
2022-11-08 14:03 ` Andrew Lunn
2022-11-10 16:00 ` Lukasz Majewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221110173714.6ea59de5@wsk \
--to=lukma@denx.de \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=matthias.schiffer@ew.tq-group.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=vivien.didelot@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).