netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alvin Šipraga" <ALSI@bang-olufsen.dk>
To: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"andrew@lunn.ch" <andrew@lunn.ch>,
	"vivien.didelot@gmail.com" <vivien.didelot@gmail.com>,
	"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
	"olteanv@gmail.com" <olteanv@gmail.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"arinc.unal@arinc9.com" <arinc.unal@arinc9.com>
Subject: Re: [PATCH net-next] net: dsa: OF-ware slave_mii_bus (RFC)
Date: Fri, 11 Feb 2022 09:35:01 +0000	[thread overview]
Message-ID: <87fsopwxtn.fsf@bang-olufsen.dk> (raw)
In-Reply-To: <20220211051140.3785-1-luizluca@gmail.com> (Luiz Angelo Daros de Luca's message of "Fri, 11 Feb 2022 02:11:41 -0300")

Luiz Angelo Daros de Luca <luizluca@gmail.com> writes:

> If found, register the DSA internal allocated slave_mii_bus with an OF
> "mdio" child object. It can save some drivers from creating their
> internal MDIO bus.
>
> Some doubts:
> 1) is there any special reason for the absence of a "device_node dn" in
>    dsa_switch? Is there any constraint on where to place it?
> 2) Is looking for "mdio" the best solution?
>
> Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
> ---
>  include/net/dsa.h | 2 ++
>  net/dsa/dsa2.c    | 8 +++++++-
>  2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index b688ced04b0e..c01c059c5335 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -421,6 +421,8 @@ struct dsa_switch {
>  	u32			phys_mii_mask;
>  	struct mii_bus		*slave_mii_bus;
>  
> +	struct device_node	*dn;
> +
>  	/* Ageing Time limits in msecs */
>  	unsigned int ageing_time_min;
>  	unsigned int ageing_time_max;
> diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
> index 909b045c9b11..db1aeb6b8352 100644
> --- a/net/dsa/dsa2.c
> +++ b/net/dsa/dsa2.c
> @@ -13,6 +13,7 @@
>  #include <linux/slab.h>
>  #include <linux/rtnetlink.h>
>  #include <linux/of.h>
> +#include <linux/of_mdio.h>
>  #include <linux/of_net.h>
>  #include <net/devlink.h>
>  #include <net/sch_generic.h>
> @@ -869,6 +870,7 @@ static int dsa_switch_setup_tag_protocol(struct dsa_switch *ds)
>  static int dsa_switch_setup(struct dsa_switch *ds)
>  {
>  	struct dsa_devlink_priv *dl_priv;
> +	struct device_node *dn;
>  	struct dsa_port *dp;
>  	int err;
>  
> @@ -924,7 +926,9 @@ static int dsa_switch_setup(struct dsa_switch *ds)
>  
>  		dsa_slave_mii_bus_init(ds);
>  
> -		err = mdiobus_register(ds->slave_mii_bus);
> +		dn = of_get_child_by_name(ds->dn, "mdio");

of_node_put(dn) after registration? Or else who will put it?

> +
> +		err = of_mdiobus_register(ds->slave_mii_bus, dn);
>  		if (err < 0)
>  			goto free_slave_mii_bus;
>  	}
> @@ -1610,6 +1614,8 @@ static int dsa_switch_parse_of(struct dsa_switch *ds, struct device_node *dn)
>  {
>  	int err;
>  
> +	ds->dn = dn;
> +
>  	err = dsa_switch_parse_member_of(ds, dn);
>  	if (err)
>  		return err;

  reply	other threads:[~2022-02-11  9:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 22:45 [PATCH net-next] net: dsa: realtek: rtl8365mb: irq with realtek-mdio Luiz Angelo Daros de Luca
2022-02-10  3:30 ` Florian Fainelli
2022-02-10 22:15   ` Luiz Angelo Daros de Luca
2022-02-10 23:48     ` Alvin Šipraga
2022-02-11  4:51       ` Luiz Angelo Daros de Luca
2022-02-11  5:11         ` [PATCH net-next] net: dsa: OF-ware slave_mii_bus (RFC) Luiz Angelo Daros de Luca
2022-02-11  9:35           ` Alvin Šipraga [this message]
2022-02-12  3:39             ` Luiz Angelo Daros de Luca
2022-02-11  9:03         ` [PATCH net-next] net: dsa: realtek: rtl8365mb: irq with realtek-mdio Alvin Šipraga

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=87fsopwxtn.fsf@bang-olufsen.dk \
    --to=alsi@bang-olufsen.dk \
    --cc=andrew@lunn.ch \
    --cc=arinc.unal@arinc9.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=luizluca@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.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).