From: Simon Horman <simon.horman@corigine.com>
To: Yan Wang <rk.code@outlook.com>
Cc: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux@armlinux.org.uk
Subject: Re: [PATCH v3] net: mdiobus: Add a function to deassert reset
Date: Wed, 10 May 2023 12:22:11 +0200 [thread overview]
Message-ID: <ZFtwU1svXhZ/xrnJ@corigine.com> (raw)
In-Reply-To: <KL1PR01MB5448A33A549CDAD7D68945B9E6779@KL1PR01MB5448.apcprd01.prod.exchangelabs.com>
On Wed, May 10, 2023 at 04:15:22PM +0800, Yan Wang wrote:
> It is possible to mount multiple sub-devices on the mido bus.
> The hardware power-on does not necessarily reset these devices.
> The device may be in an uncertain state, causing the device's ID
> to not be scanned.
>
> So, before adding a reset to the scan, make sure the device is in
> normal working mode.
>
> I found that the subsequent drive registers the reset pin into the
> structure of the sub-device to prevent conflicts, so release the
> reset pin.
>
> Signed-off-by: Yan Wang <rk.code@outlook.com>
> ---
> v3:
> - fixed commit message
> v2: https://lore.kernel.org/all/KL1PR01MB54482416A8BE0D80EA27223CE6779@KL1PR01MB5448.apcprd01.prod.exchangelabs.com/
> - fixed commit message
> - Using gpiod_ replace gpio_
> v1: https://lore.kernel.org/all/KL1PR01MB5448631F2D6F71021602117FE6769@KL1PR01MB5448.apcprd01.prod.exchangelabs.com/
> - Incorrect description of commit message.
> - The gpio-api too old
> ---
> drivers/net/mdio/fwnode_mdio.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c
> index 1183ef5e203e..6695848b8ef2 100644
> --- a/drivers/net/mdio/fwnode_mdio.c
> +++ b/drivers/net/mdio/fwnode_mdio.c
> @@ -57,6 +57,20 @@ fwnode_find_mii_timestamper(struct fwnode_handle *fwnode)
> return register_mii_timestamper(arg.np, arg.args[0]);
> }
>
> +static void fwnode_mdiobus_pre_enable_phy(struct fwnode_handle *fwnode)
> +{
> + struct gpio_desc *reset;
> +
> + reset = fwnode_gpiod_get_index(fwnode, "reset", 0, GPIOD_OUT_HIGH, NULL);
Hi Yan,
As this calls fwnode_gpiod_get_index()
do you need to include linux/gpio/consumer.h ?
> + if (IS_ERR(reset) && PTR_ERR(reset) != -EPROBE_DEFER)
> + return;
> +
> + usleep_range(100, 200);
> + gpiod_set_value_cansleep(reset, 0);
> + /*Release the reset pin,it needs to be registered with the PHY.*/
> + gpiod_put(reset);
> +}
> +
...
next prev parent reply other threads:[~2023-05-10 10:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-10 8:15 [PATCH v3] net: mdiobus: Add a function to deassert reset Yan Wang
2023-05-10 9:52 ` kernel test robot
2023-05-10 10:03 ` Simon Horman
2023-05-10 10:22 ` Simon Horman [this message]
2023-05-10 10:30 ` Yan Wang
2023-05-10 11:36 ` kernel test robot
2023-05-10 22:15 ` Andrew Lunn
2023-05-11 3:19 ` Yan Wang
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=ZFtwU1svXhZ/xrnJ@corigine.com \
--to=simon.horman@corigine.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rk.code@outlook.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.