From: Andrew Lunn <andrew@lunn.ch>
To: Andre Edich <andre.edich@microchip.com>
Cc: netdev@vger.kernel.org, UNGLinuxDriver@microchip.com,
steve.glendinning@shawell.net,
Parthiban.Veerasooran@microchip.com
Subject: Re: [PATCH net-next v2 3/6] smsc95xx: add PAL support to use external PHY drivers
Date: Fri, 24 Jul 2020 00:39:56 +0200 [thread overview]
Message-ID: <20200723223956.GL1553578@lunn.ch> (raw)
In-Reply-To: <20200723115507.26194-4-andre.edich@microchip.com>
On Thu, Jul 23, 2020 at 01:55:04PM +0200, Andre Edich wrote:
> Generally, each PHY has their own configuration and it can be done
> through an external PHY driver. The smsc95xx driver uses only the
> hard-coded internal PHY configuration.
>
> This patch adds PAL (PHY Abstraction Layer) support to probe external
> PHY drivers for configuring external PHYs.
Hi Andre
We call it phylib, not PAL.
> static int __must_check smsc95xx_wait_eeprom(struct usbnet *dev)
> {
> unsigned long start_time = jiffies;
> @@ -559,15 +580,20 @@ static int smsc95xx_link_reset(struct usbnet *dev)
> u16 lcladv, rmtadv;
> int ret;
>
> - /* clear interrupt status */
> - ret = smsc95xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC);
> - if (ret < 0)
> - return ret;
> -
> ret = smsc95xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL_);
> if (ret < 0)
> return ret;
>
> + if (pdata->internal_phy) {
> + /* clear interrupt status */
> + ret = smsc95xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC);
> + if (ret < 0)
> + return ret;
> +
> + smsc95xx_mdio_write(dev->net, mii->phy_id, PHY_INT_MASK,
> + PHY_INT_MASK_DEFAULT_);
> + }
The PHY driver should do this, not the MAC driver.
Which PHY driver is used for the internal PHY? In theory, you should
not need to know if it is internal or external, it is just a PHY. That
might mean you need to move some code from this driver into the PHY
driver, if it is currently missing in the PHY driver.
> +
> mii_check_media(mii, 1, 1);
> mii_ethtool_gset(&dev->mii, &ecmd);
> lcladv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_ADVERTISE);
> @@ -851,10 +877,10 @@ static int smsc95xx_get_link_ksettings(struct net_device *net,
> int retval;
>
> retval = usbnet_get_link_ksettings(net, cmd);
> -
> - cmd->base.eth_tp_mdix = pdata->mdix_ctrl;
> - cmd->base.eth_tp_mdix_ctrl = pdata->mdix_ctrl;
> -
> + if (pdata->internal_phy) {
> + cmd->base.eth_tp_mdix = pdata->mdix_ctrl;
> + cmd->base.eth_tp_mdix_ctrl = pdata->mdix_ctrl;
> + }
Again, they PHY driver should take care of this. You need to set
phydev->mdix_ctrl before starting the PHY. The PHY driver should set
phdev->mdix to the current status.
> +static void smsc95xx_handle_link_change(struct net_device *net)
> +{
> + phy_print_status(net->phydev);
So the MAC does not care about the speed? The pause configuration?
Duplex?
Andrew
next prev parent reply other threads:[~2020-07-23 22:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-23 11:55 [PATCH net-next v2 0/6] Add PAL support to smsc95xx Andre Edich
2020-07-23 11:55 ` [PATCH net-next v2 1/6] smsc95xx: remove redundant function arguments Andre Edich
2020-07-23 11:55 ` [PATCH net-next v2 2/6] smsc95xx: use usbnet->driver_priv Andre Edich
2020-07-23 22:42 ` Andrew Lunn
2020-07-23 11:55 ` [PATCH net-next v2 3/6] smsc95xx: add PAL support to use external PHY drivers Andre Edich
2020-07-23 22:39 ` Andrew Lunn [this message]
2020-07-24 15:17 ` Andre.Edich
2020-07-24 15:34 ` Andrew Lunn
2020-07-25 16:33 ` kernel test robot
2020-07-23 11:55 ` [PATCH net-next v2 4/6] smsc95xx: remove redundant link status checking Andre Edich
2020-07-23 22:41 ` Andrew Lunn
2020-07-23 11:55 ` [PATCH net-next v2 5/6] smsc95xx: use PAL framework read/write functions Andre Edich
2020-07-25 19:30 ` kernel test robot
2020-07-23 11:55 ` [PATCH net-next v2 6/6] smsc95xx: use PHY framework instead of MII library Andre Edich
2020-07-25 23:36 ` kernel test robot
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=20200723223956.GL1553578@lunn.ch \
--to=andrew@lunn.ch \
--cc=Parthiban.Veerasooran@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andre.edich@microchip.com \
--cc=netdev@vger.kernel.org \
--cc=steve.glendinning@shawell.net \
/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).