From: Andrew Lunn <andrew@lunn.ch>
To: Tony Lindgren <tony@atomide.com>
Cc: David Miller <davem@davemloft.net>,
netdev@vger.kernel.org, linux-omap@vger.kernel.org,
devicetree@vger.kernel.org,
Grygorii Strashko <grygorii.strashko@ti.com>,
Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>,
Mark Rutland <mark.rutland@arm.com>,
Murali Karicheri <m-karicheri2@ti.com>,
Rob Herring <robh+dt@kernel.org>
Subject: Re: [PATCH] net: ethernet: cpsw-phy-sel: prefer phandle for phy sel and update binding
Date: Wed, 8 Aug 2018 13:58:38 +0200 [thread overview]
Message-ID: <20180808115838.GA18314@lunn.ch> (raw)
In-Reply-To: <20180808080354.100146-1-tony@atomide.com>
> +++ b/Documentation/devicetree/bindings/net/cpsw.txt
> @@ -19,6 +19,9 @@ Required properties:
> - slaves : Specifies number for slaves
> - active_slave : Specifies the slave to use for time stamping,
> ethtool and SIOCGMIIPHY
> +- cpsw-phy-sel : Specifies the phandle to the CPSW phy mode selection
> + device. Note that in legacy cases cpsw-phy-sel may be
> + a child device instead of a phandle.
Hi Tony
It would be good to reference cpsw-phy-sel.txt.
> Optional properties:
> - ti,hwmods : Must be "cpgmac0"
> @@ -75,6 +78,7 @@ Examples:
> cpts_clock_mult = <0x80000000>;
> cpts_clock_shift = <29>;
> syscon = <&cm>;
> + cpsw-phy-sel = <&phy_sel>;
> cpsw_emac0: slave@0 {
> phy_id = <&davinci_mdio>, <0>;
> phy-mode = "rgmii-txid";
> @@ -103,6 +107,7 @@ Examples:
> cpts_clock_mult = <0x80000000>;
> cpts_clock_shift = <29>;
> syscon = <&cm>;
> + cpsw-phy-sel = <&phy_sel>;
> cpsw_emac0: slave@0 {
> phy_id = <&davinci_mdio>, <0>;
> phy-mode = "rgmii-txid";
> diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c
> --- a/drivers/net/ethernet/ti/cpsw-phy-sel.c
> +++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c
> @@ -170,10 +170,13 @@ void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave)
> struct device_node *node;
> struct cpsw_phy_sel_priv *priv;
>
> - node = of_get_child_by_name(dev->of_node, "cpsw-phy-sel");
> + node = of_parse_phandle(dev->of_node, "cpsw-phy-sel", 0);
> if (!node) {
Do you need to handle EPROBE_DEFER here? The phandle points to a
device which has not yet been loaded? I'm not sure exactly where it
will be returned, maybe it is bus_find_device(), but i expect to see
some handling of it somewhere in this function.
> - dev_err(dev, "Phy mode driver DT not found\n");
> - return;
> + node = of_get_child_by_name(dev->of_node, "cpsw-phy-sel");
> + if (!node) {
> + dev_err(dev, "Phy mode driver DT not found\n");
> + return;
> + }
> }
Andrew
next prev parent reply other threads:[~2018-08-08 11:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-08 8:03 [PATCH] net: ethernet: cpsw-phy-sel: prefer phandle for phy sel and update binding Tony Lindgren
2018-08-08 11:58 ` Andrew Lunn [this message]
2018-08-08 13:48 ` Tony Lindgren
2018-08-09 10:46 ` Tony Lindgren
2018-08-09 22:47 ` Grygorii Strashko
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=20180808115838.GA18314@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=grygorii.strashko@ti.com \
--cc=ivan.khoronzhuk@linaro.org \
--cc=linux-omap@vger.kernel.org \
--cc=m-karicheri2@ti.com \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=tony@atomide.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).