public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn•ch>
To: Joakim Zhang <qiangqing.zhang@nxp•com>
Cc: Florian Fainelli <f.fainelli@gmail•com>,
	"hkallweit1@gmail•com" <hkallweit1@gmail•com>,
	"netdev@vger•kernel.org" <netdev@vger•kernel.org>
Subject: Re: FEC unbind/bind feature
Date: Thu, 25 Mar 2021 13:45:05 +0100	[thread overview]
Message-ID: <YFyF0dEgjN562aT8@lunn.ch> (raw)
In-Reply-To: <DB8PR04MB6795E5896375A9A9FED55A84E6629@DB8PR04MB6795.eurprd04.prod.outlook.com>

On Thu, Mar 25, 2021 at 08:04:58AM +0000, Joakim Zhang wrote:
> 
> Hi Andrew, Florian, Heiner
> 
> You are all Ethernet MDIO bus and PHY experts, I have some questions may need your help, thanks a lot in advance.
> 
> For many board designs, if it has dual MAC instances, they always share one MDIO bus to save PINs. Such as, i.MX6UL EVK board:

Please wrap your lines at around 75 characters. Standard netiquette
rules for emails apply to all Linux lists.

> 
> &fec1 {
> 	pinctrl-names = "default";
> 	pinctrl-0 = <&pinctrl_enet1>;
> 	phy-mode = "rmii";
> 	phy-handle = <&ethphy0>;
> 	phy-supply = <&reg_peri_3v3>;
> 	status = "okay";
> };
> 
> &fec2 {
> 	pinctrl-names = "default";
> 	pinctrl-0 = <&pinctrl_enet2>;
> 	phy-mode = "rmii";
> 	phy-handle = <&ethphy1>;
> 	phy-supply = <&reg_peri_3v3>;
> 	status = "okay";
> 
> 	mdio {
> 		#address-cells = <1>;
> 		#size-cells = <0>;
> 
> 		ethphy0: ethernet-phy@2 {
> 			compatible = "ethernet-phy-id0022.1560";
> 			reg = <2>;
> 			micrel,led-mode = <1>;
> 			clocks = <&clks IMX6UL_CLK_ENET_REF>;
> 			clock-names = "rmii-ref";
> 
> 		};
> 
> 		ethphy1: ethernet-phy@1 {
> 			compatible = "ethernet-phy-id0022.1560";
> 			reg = <1>;
> 			micrel,led-mode = <1>;
> 			clocks = <&clks IMX6UL_CLK_ENET2_REF>;
> 			clock-names = "rmii-ref";
> 		};
> 	};
> };
> 
> For FEC driver now, there is a patch from Fabio to prevent unbind/bind feature since dual FEC controllers share one MDIO bus. (https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/net/ethernet/freescale/fec_main.c?h=next-20210324&id=272bb0e9e8cdc76e04baeefa0cd43019daa0841b)
> If we unbind fec2 and then fec1 can't work since MDIO bus is controlled by FEC1, FEC2 can't use it independently.
> 
> My question is that if we want to implement unbind/bind feature, what need we do?

One option is you unbind FEC1 first, and then FEC2.

> It seems to abstract an independent MDIO bus for dual FEC
> instances. I look at the MDIO dt bindings, it seems support such
> case as it has "reg"
> property. (Documentation/devicetree/bindings/net/mdio.yaml)

You can have fully standalone MDIO bus drivers. You generally do this
when the MDIO bus registers are in their own address space, which you
can ioremap() separately from the MAC registers. Take a look in
drivers/net/mdio/.

> From your opinions, do you think it is necessary to improve it?

What is you use case for unbinding/binding the FEC?

     Andrew

  reply	other threads:[~2021-03-25 12:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25  8:04 FEC unbind/bind feature Joakim Zhang
2021-03-25 12:45 ` Andrew Lunn [this message]
2021-03-26  8:02   ` Joakim Zhang
2021-03-26  8:36     ` Joakim Zhang
2021-03-26 12:34       ` Andrew Lunn
2021-03-26 13:18         ` Joakim Zhang
2021-03-26 13:36           ` Andrew Lunn
2021-03-29  9:12         ` Joakim Zhang
2021-03-26 12:27     ` Andrew Lunn

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=YFyF0dEgjN562aT8@lunn.ch \
    --to=andrew@lunn$(echo .)ch \
    --cc=f.fainelli@gmail$(echo .)com \
    --cc=hkallweit1@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=qiangqing.zhang@nxp$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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