netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: netdev@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	kernel@pengutronix.de
Subject: ethernet-phy-ieee802.3-c22 binding and reset-gpios
Date: Tue, 25 Aug 2020 11:09:33 +0200	[thread overview]
Message-ID: <20200825090933.GN13023@pengutronix.de> (raw)

Hi All,

I am using the ethernet phy binding here that looks like:

ethphy1: ethernet-phy@1 {
	compatible = "ethernet-phy-ieee802.3-c22";
	reg = <1>;
	eee-broken-1000t;
	reset-gpios = <&gpio4 2 GPIO_ACTIVE_LOW>;
};

It seems the "reset-gpios" is inherently broken in Linux. With the above
in one way or the other we end up in of_mdiobus_register_phy() where we
have:

        if (!is_c45 && !of_get_phy_id(child, &phy_id))
                phy = phy_device_create(mdio, addr, phy_id, 0, NULL);
        else
                phy = get_phy_device(mdio, addr, is_c45);

get_phy_device() tries to read the phy_id from the MDIO bus.
Unfortunately the "reset-gpios" property is only handled later in
phy_device_register(), so it can only work when the bootloader has left
the reset GPIO deasserted.  Note it works when of_get_phy_id() returns
the phy_id, which is the case when the phy_id is explicitly given with
"ethernet-phy-idxxxx.yyyy", but giving the exact phy_id shouldn't be
mandatory, right?

I think the phy_id is unknown at phy_device_create() time, so I looked
into removing the phy_id argument there and specifying it elsewhere,
maybe by adding a phy_device_set_id() function. Another point is that
phy_device_create() currently calls phy_request_driver_module() to get
the driver modules for a given phy_id. That would have to be called
later as well. Is this the path to go or are there any other ideas how
to solve this issue?

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

             reply	other threads:[~2020-08-25  9:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25  9:09 Sascha Hauer [this message]
2020-08-25 13:14 ` ethernet-phy-ieee802.3-c22 binding and reset-gpios Andrew Lunn
2020-08-26  8:58   ` Sascha Hauer
2020-08-26 12:56     ` 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=20200825090933.GN13023@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    /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).