From: "Marek Behún" <kabel@kernel•org>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas•com>
Cc: linux@armlinux•org.uk, andrew@lunn•ch, hkallweit1@gmail•com,
davem@davemloft•net, edumazet@google•com, kuba@kernel•org,
pabeni@redhat•com, netdev@vger•kernel.org,
linux-renesas-soc@vger•kernel.org
Subject: Re: [PATCH RFC 3/3] net: renesas: rswitch: Pass host parameters to phydev
Date: Wed, 19 Oct 2022 12:41:00 +0200 [thread overview]
Message-ID: <20221019124100.41c9bbaf@dellmb> (raw)
In-Reply-To: <20221019085052.933385-4-yoshihiro.shimoda.uh@renesas.com>
On Wed, 19 Oct 2022 17:50:52 +0900
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas•com> wrote:
> Use of_phy_connect_with_host_params() to pass host parameters to
> phydev. Otherwise, connected PHY cannot work correctly.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas•com>
> ---
> drivers/net/ethernet/renesas/rswitch.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
> index c604331bfd88..bb2f1e667210 100644
> --- a/drivers/net/ethernet/renesas/rswitch.c
> +++ b/drivers/net/ethernet/renesas/rswitch.c
> @@ -16,6 +16,7 @@
> #include <linux/of_irq.h>
> #include <linux/of_mdio.h>
> #include <linux/of_net.h>
> +#include <linux/phy.h>
> #include <linux/phy/phy.h>
> #include <linux/pm_runtime.h>
> #include <linux/slab.h>
> @@ -1234,11 +1235,19 @@ static void rswitch_phy_remove_link_mode(struct rswitch_device *rdev,
>
> static int rswitch_phy_init(struct rswitch_device *rdev, struct device_node *phy)
> {
> + DECLARE_PHY_INTERFACE_MASK(host_interfaces);
> struct phy_device *phydev;
> int err = 0;
>
> - phydev = of_phy_connect(rdev->ndev, phy, rswitch_adjust_link, 0,
> - rdev->etha->phy_interface);
> + phy_interface_zero(host_interfaces);
> + if (rdev->etha->phy_interface == PHY_INTERFACE_MODE_SGMII)
> + __set_bit(PHY_INTERFACE_MODE_SGMII, host_interfaces);
> +
> + phydev = of_phy_connect_with_host_params(rdev->ndev, phy,
> + rswitch_adjust_link, 0,
> + rdev->etha->phy_interface,
> + host_interfaces,
> + rdev->etha->speed);
> if (!phydev) {
> err = -ENOENT;
> goto out;
NAK. There already is API for doing this: phylink. Adding new, and so
much specific function for this is a waste. Just convert the rswitch
driver to phylink.
Please look at the documentation at
Documentation/networking/sfp-phylink.rst
Marek
next prev parent reply other threads:[~2022-10-19 11:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-19 8:50 [PATCH RFC 0/3] net: phy: marvell10g: Add host speed setting by an ethernet driver Yoshihiro Shimoda
2022-10-19 8:50 ` [PATCH RFC 1/3] net: mdio: Add of_phy_connect_with_host_param() Yoshihiro Shimoda
2022-10-19 8:50 ` [PATCH RFC 2/3] net: phy: marvell10g: Add host interface speed configuration Yoshihiro Shimoda
2022-10-19 10:48 ` Marek Behún
2022-10-19 10:55 ` Marek Behún
2022-10-19 11:58 ` Russell King (Oracle)
2022-10-20 1:26 ` Yoshihiro Shimoda
2022-10-20 1:15 ` Yoshihiro Shimoda
2022-10-19 8:50 ` [PATCH RFC 3/3] net: renesas: rswitch: Pass host parameters to phydev Yoshihiro Shimoda
2022-10-19 10:41 ` Marek Behún [this message]
2022-10-20 0:40 ` Yoshihiro Shimoda
2022-10-19 10:44 ` [PATCH RFC 0/3] net: phy: marvell10g: Add host speed setting by an ethernet driver Marek Behún
2022-10-19 11:39 ` Russell King (Oracle)
2022-10-20 1:20 ` Yoshihiro Shimoda
2022-10-20 1:04 ` Yoshihiro Shimoda
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=20221019124100.41c9bbaf@dellmb \
--to=kabel@kernel$(echo .)org \
--cc=andrew@lunn$(echo .)ch \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=hkallweit1@gmail$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=linux-renesas-soc@vger$(echo .)kernel.org \
--cc=linux@armlinux$(echo .)org.uk \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=yoshihiro.shimoda.uh@renesas$(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