[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170104141231.GM10768@lunn.ch>
Date: Wed, 4 Jan 2017 15:12:31 +0100
From: Andrew Lunn <andrew@...n.ch>
To: John Crispin <john@...ozen.org>
Cc: "David S. Miller" <davem@...emloft.net>,
Florian Fainelli <f.fainelli@...il.com>,
Vivien Didelot <vivien.didelot@...oirfairelinux.com>,
netdev@...r.kernel.org
Subject: Re: [RFC 4/4] net-next: dsa: qca8k: add support for multiple cpu
ports
> + /* Setup the cpu ports */
> + for (i = 0; i < DSA_MAX_PORTS; i++) {
> + struct net_device *netdev;
> + int phy_mode = -1;
> +
> + if (!dsa_is_cpu_port(ds, i))
> + continue;
> +
> + netdev = ds->dst->pd->chip->port_ethernet[i];
> + if (!netdev) {
> + pr_err("Can't find netdev for port%d\n", i);
> + return -ENODEV;
> + }
> +
> + /* Initialize CPU port pad mode (xMII type, delays...) */
> + phy_mode = of_get_phy_mode(netdev->dev.parent->of_node);
> + if (phy_mode < 0) {
> + pr_err("Can't find phy-mode for port:%d\n", i);
> + return phy_mode;
> + }
Hi John
We try to avoid having the switch drivers parse the DSA device
tree. There is code in the DSA core to do what you want here.
dsa.c: dsa_cpu_dsa_setup() will parse the phy-mode property, if you
have a fixed-phy node in the "cpu" or "dsa" node. It will then call
the drivers adjust_list_() function, which can then set the xMII type
etc.
The problem might be how to make use of this without breaking
backwards compatibility with older device tree blobs.
Andrew
Powered by blists - more mailing lists