All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Michael Walle <michael@walle.cc>,
	bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Russell King <linux@armlinux.org.uk>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH net-next] net: phy: introduce phydev->port
Date: Wed, 10 Feb 2021 10:34:13 -0800	[thread overview]
Message-ID: <558e057f-69a4-cb16-ef0f-9e3d005060ea@gmail.com> (raw)
In-Reply-To: <41e4f35c87607e69cb87c4ef421d4a77@walle.cc>

On 2/10/21 3:20 AM, Michael Walle wrote:
> 
> Am 2021-02-09 17:38, schrieb Michael Walle:
>> --- a/drivers/net/phy/phy.c
>> +++ b/drivers/net/phy/phy.c
>> @@ -308,7 +308,7 @@ void phy_ethtool_ksettings_get(struct phy_device
>> *phydev,
>>      if (phydev->interface == PHY_INTERFACE_MODE_MOCA)
>>          cmd->base.port = PORT_BNC;
>>      else
>> -        cmd->base.port = PORT_MII;
>> +        cmd->base.port = phydev->port;
>>      cmd->base.transceiver = phy_is_internal(phydev) ?
>>                  XCVR_INTERNAL : XCVR_EXTERNAL;
>>      cmd->base.phy_address = phydev->mdio.addr;
> 
> Russell, the phylink has a similiar place where PORT_MII is set. I don't
> know
> if we'd have to change that, too.
> 
> Also, I wanted to look into the PHY_INTERFACE_MODE_MOCA thing and if we can
> get rid of the special case here and just set phydev->port to PORT_BNC
> in the
> driver. Florian, maybe you have a comment on this?

For GENET, it's simple because we can do this:

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index fcca023f22e5..34cbd008a3af 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -777,6 +777,8 @@ static int bcmgenet_get_link_ksettings(struct
net_device *dev,
                return -ENODEV;

        phy_ethtool_ksettings_get(dev->phydev, cmd);
+       if (dev->phydev->interface == PHY_INTERFACE_MODE_MOCA)
+               cmd->base.port = PORT_BNC;

        return 0;
 }

but for bcm_sf2.c, we would need to add plumbing between the DSA core
and the DSA driver in order to override the cmd structure with the
desired port and that would be most likely the only driver needing that,
should we really bother? There is also potentially a 3rd driver coming
down the road (bgmac) which would need to report MoCA/BNC.

I don't see this scaling very well nor being such a big issue to have
that in the PHYLIB and PHYLINK.
-- 
Florian

      parent reply	other threads:[~2021-02-10 18:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 16:38 [PATCH net-next] net: phy: introduce phydev->port Michael Walle
2021-02-09 23:01 ` Florian Fainelli
2021-02-10  1:51 ` Andrew Lunn
2021-02-10 11:01   ` Russell King - ARM Linux admin
2021-02-10  1:53 ` Andrew Lunn
2021-02-10 11:20 ` Michael Walle
2021-02-10 11:54   ` Russell King - ARM Linux admin
2021-02-10 12:10     ` Michael Walle
2021-02-10 18:34   ` Florian Fainelli [this message]

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=558e057f-69a4-cb16-ef0f-9e3d005060ea@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=michael@walle.cc \
    --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 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.