linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: "René van Dorst" <opensource@vdorst.com>, netdev@vger.kernel.org
Cc: frank-w@public-files.de, sean.wang@mediatek.com,
	linux@armlinux.org.uk, davem@davemloft.net,
	matthias.bgg@gmail.com, andrew@lunn.ch, vivien.didelot@gmail.com,
	john@phrozen.org, linux-mediatek@lists.infradead.org,
	linux-mips@vger.kernel.org, robh+dt@kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH net-next 3/3] net: dsa: mt7530: Add support for port 5
Date: Sat, 27 Jul 2019 10:42:27 +0200	[thread overview]
Message-ID: <f4a9e219-cd03-1512-874d-925c43e3c44f@gmail.com> (raw)
In-Reply-To: <20190724192549.24615-4-opensource@vdorst.com>



On 7/24/2019 9:25 PM, René van Dorst wrote:
> Adding support for port 5.
> 
> Port 5 can muxed/interface to:
> - internal 5th GMAC of the switch; can be used as 2nd CPU port or as
>   extra port with an external phy for a 6th ethernet port.
> - internal PHY of port 0 or 4; Used in most applications so that port 0
>   or 4 is the WAN port and interfaces with the 2nd GMAC of the SOC.
> 
> Signed-off-by: René van Dorst <opensource@vdorst.com>

[snip]

> +	/* Setup port 5 */
> +	priv->p5_intf_sel = P5_DISABLED;
> +	interface = PHY_INTERFACE_MODE_NA;
> +
> +	if (!dsa_is_unused_port(ds, 5)) {
> +		priv->p5_intf_sel = P5_INTF_SEL_GMAC5;
> +		interface = of_get_phy_mode(ds->ports[5].dn);
> +	} else {
> +		/* Scan the ethernet nodes. Look for GMAC1, Lookup used phy */
> +		for_each_child_of_node(dn, mac_np) {
> +			if (!of_device_is_compatible(mac_np,
> +						     "mediatek,eth-mac"))
> +				continue;
> +			_id = of_get_property(mac_np, "reg", NULL);
> +			if (be32_to_cpup(_id)  != 1)
> +				continue;
> +
> +			interface = of_get_phy_mode(mac_np);
> +			phy_node = of_parse_phandle(mac_np, "phy-handle", 0);
> +
> +			if (phy_node->parent == priv->dev->of_node->parent) {
> +				_id = of_get_property(phy_node, "reg", NULL);
> +				id = be32_to_cpup(_id);
> +				if (id == 0)
> +					priv->p5_intf_sel = P5_INTF_SEL_PHY_P0;
> +				if (id == 4)
> +					priv->p5_intf_sel = P5_INTF_SEL_PHY_P4;

Can you use of_mdio_parse_addr() here?
-- 
Florian

  parent reply	other threads:[~2019-07-27  8:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24 19:25 [PATCH net-next 0/3] net: dsa: MT7530: Convert to PHYLINK and add support for port 5 René van Dorst
2019-07-24 19:25 ` [PATCH net-next 1/3] net: dsa: mt7530: Convert to PHYLINK API René van Dorst
2019-07-27 18:48   ` Russell King - ARM Linux admin
2019-08-01 17:21     ` René van Dorst
2019-08-01 17:22       ` David Miller
2019-07-24 19:25 ` [PATCH net-next 2/3] dt-bindings: net: dsa: mt7530: Add support for port 5 René van Dorst
2019-07-24 19:25 ` [PATCH net-next 3/3] " René van Dorst
2019-07-26 21:04   ` David Miller
2019-07-27 18:43     ` René van Dorst
2019-07-27  8:42   ` Florian Fainelli [this message]
2019-07-27 18:38     ` René van Dorst
2019-07-27 18:53   ` Russell King - ARM Linux admin
2019-07-27 21:26     ` René van Dorst

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=f4a9e219-cd03-1512-874d-925c43e3c44f@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=frank-w@public-files.de \
    --cc=john@phrozen.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=matthias.bgg@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=opensource@vdorst.com \
    --cc=robh+dt@kernel.org \
    --cc=sean.wang@mediatek.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).