linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sven Van Asbroeck <thesven73@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Jakub Kicinski <kuba@kernel.org>,
	Woojung Huh <woojung.huh@microchip.com>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	David S Miller <davem@davemloft.net>, Marek Vasut <marex@denx.de>,
	Tristram Ha <Tristram.Ha@microchip.com>,
	Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
	netdev <netdev@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net v1] net: dsa: ksz8795: use correct number of physical ports
Date: Sat, 5 Dec 2020 09:35:10 -0500	[thread overview]
Message-ID: <CAGngYiXYLnJUMrPqiJtRqFxF6xo01FYBvmn1Rq-wbjBDOuC-9Q@mail.gmail.com> (raw)
In-Reply-To: <20201204234321.GJ2400258@lunn.ch>

Jakub, Andrew,

On Fri, Dec 4, 2020 at 6:24 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> All the port counts here are -1 compared to datasheets, so I'm assuming
> the are not supposed to include the host facing port or something?
>
> Can you describe the exact problem you're trying to solve?
>

The ksz8795 driver refuses to accept my devicetree (see below). It doesn't like
the presence of the cpu node. But I really need a cpu node, because phy-mode is
crucially important to my application: without phy-mode = "rgmii-id", the
ksz8795's ingress bit does not get set, and communication fails.

I was already suspicious of my fix: why would such an important chip property
be wrong? But changing it was very seductive: after all, the ksz8795's headline
is "Integrated 5-Port 10/100-Managed Ethernet Switch", and the driver code says
this:

        .port_cnt = 4,          /* total physical port count */

I can see now that this should be fixed more generally. The of parsing code
is using the wrong port count variable. I'll submit that shortly.

That said, when I look at this driver, I get very confused between port_cnt,
num_ports, and whether they include or exclude the cpu port. Until this gets
cleaned up, maybe the comment above can be improved, so developers don't get
too confused at least? I'll submit a patch for that too.

ethernet-switch@0 {
        compatible = "microchip,ksz8795";
        spi-max-frequency = <1000000>;
        reg = <0>;

        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@3 {
                        reg = <3>;
                        label = "lan4";
                };
                port@4 {
                        /* driver errors out because
                         * reg >= dev->port_cnt (4)
                         */
                        reg = <4>;
                        label = "cpu";
                        ethernet = <&something>;
                        phy-mode = "rgmii-id";
                        fixed-link {
                                speed = <1000>;
                                full-duplex;
                        };
                };
        };
};

      reply	other threads:[~2020-12-05 15:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 21:46 [PATCH net v1] net: dsa: ksz8795: use correct number of physical ports Sven Van Asbroeck
2020-12-03 21:55 ` Florian Fainelli
2020-12-04 23:24 ` Jakub Kicinski
2020-12-04 23:43   ` Andrew Lunn
2020-12-05 14:35     ` Sven Van Asbroeck [this message]

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=CAGngYiXYLnJUMrPqiJtRqFxF6xo01FYBvmn1Rq-wbjBDOuC-9Q@mail.gmail.com \
    --to=thesven73@gmail.com \
    --cc=Tristram.Ha@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vivien.didelot@gmail.com \
    --cc=woojung.huh@microchip.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).