From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Rengarajan.S@microchip.com
Cc: andrew+netdev@lunn.ch, rmk+kernel@armlinux.org.uk,
davem@davemloft.net, Woojung.Huh@microchip.com,
pabeni@redhat.com, edumazet@google.com, kuba@kernel.org,
phil@raspberrypi.org, kernel@pengutronix.de,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
UNGLinuxDriver@microchip.com
Subject: Re: [PATCH net-next v1 1/7] net: usb: lan78xx: Convert to PHYlink for improved PHY and MAC management
Date: Wed, 22 Jan 2025 09:16:29 +0100 [thread overview]
Message-ID: <Z5CpXXNQrtmxuxaF@pengutronix.de> (raw)
In-Reply-To: <0328797731d5ec0af580cf2f4f7e000212befa69.camel@microchip.com>
Hi Rengarajan,
On Fri, Jan 17, 2025 at 10:50:48AM +0000, Rengarajan.S@microchip.com wrote:
> Hi Oleksji,
>
> On Wed, 2025-01-08 at 13:13 +0100, Oleksij Rempel wrote:
> > +static int lan78xx_configure_usb(struct lan78xx_net *dev, int speed)
> > +{
> > + int ret;
> > +
> > + if (dev->udev->speed != USB_SPEED_SUPER)
> > + return 0;
> > +
> > + if (speed != SPEED_1000)
> > + return lan78xx_update_reg(dev, USB_CFG1,
> > + USB_CFG1_DEV_U2_INIT_EN_ |
> > + USB_CFG1_DEV_U1_INIT_EN_,
> > + USB_CFG1_DEV_U2_INIT_EN_ |
> > + USB_CFG1_DEV_U1_INIT_EN_);
> > +
> > + /* disable U2 */
> > + ret = lan78xx_update_reg(dev, USB_CFG1,
> > + USB_CFG1_DEV_U2_INIT_EN_, 0);
> > + if (ret < 0)
> > + return ret;
> > + /* enable U1 */
> > + return lan78xx_update_reg(dev, USB_CFG1,
> > + USB_CFG1_DEV_U1_INIT_EN_,
> > + USB_CFG1_DEV_U1_INIT_EN_);
>
> Since, in the all the above cases we update the USB_CFG1 based on the
> mask and value depending on various speeds, have a variable for mask
> and value and use them to represent enabled flags instead of passing
> the flags directly for better readability.
>
> For Eg: have mask = USB_CFG1_DEV_U2_INIT_EN_ and val = 0 and pass them
> as arguments.
ok.
> +
> > + if (duplex == DUPLEX_FULL)
> > + mac_cr |= MAC_CR_FULL_DUPLEX_;
> > +
> > + /* make sure TXEN and RXEN are disabled before reconfiguring
> > MAC */
> > + ret = lan78xx_update_reg(dev, MAC_CR, MAC_CR_SPEED_MASK_ |
> > + MAC_CR_FULL_DUPLEX_ |
> > MAC_CR_EEE_EN_, mac_cr);
>
> The auto-speed and duplex are disabled in lan78xx_mac_config is it
> necessary to disable this again here. You can disable it once to
> avoid redundancy.
ok.
> > +static const struct phylink_mac_ops lan78xx_phylink_mac_ops = {
> > + .mac_config = lan78xx_mac_config,
> > + .mac_link_down = lan78xx_mac_link_down,
> > + .mac_link_up = lan78xx_mac_link_up,
> > +};
>
> If possible, have MAC and phy related APIs in seperate patch.
I'll think about it, but I ques it will be not so good.
> > @@ -2609,18 +2701,7 @@ static int lan78xx_phy_init(struct lan78xx_net
> > *dev)
> > return -EIO;
> > }
> >
> > - /* MAC doesn't support 1000T Half */
> > - phy_remove_link_mode(phydev,
> > ETHTOOL_LINK_MODE_1000baseT_Half_BIT);
>
> Since MAC doesn't support 1000Base-T half-duplex does phylink handle
> its removal from the advertised link modes. Previously, it was done
> using phy_remove_link_mode. If not, ensure that the phy doesn't end
> up advertising an unsupported mode.
Yes, it is done by following line:
dev->phylink_config.mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE |
MAC_10 | MAC_100 | MAC_1000FD;
Thank you,
Best regards,
Oleksij
--
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 |
next prev parent reply other threads:[~2025-01-22 8:16 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-08 12:13 [PATCH net-next v1 0/7] Convert LAN78xx to PHYLINK Oleksij Rempel
2025-01-08 12:13 ` [PATCH net-next v1 1/7] net: usb: lan78xx: Convert to PHYlink for improved PHY and MAC management Oleksij Rempel
2025-01-08 12:43 ` Russell King (Oracle)
2025-01-17 10:50 ` Rengarajan.S
2025-01-22 8:16 ` Oleksij Rempel [this message]
2025-01-22 4:02 ` Thangaraj.S
2025-01-22 6:06 ` Oleksij Rempel
2025-01-08 12:13 ` [PATCH net-next v1 2/7] net: usb: lan78xx: Move fixed PHY cleanup to lan78xx_unbind() Oleksij Rempel
2025-01-08 12:13 ` [PATCH net-next v1 3/7] net: usb: lan78xx: Improve error handling for PHY init path Oleksij Rempel
2025-01-08 12:52 ` Russell King (Oracle)
2025-01-08 12:13 ` [PATCH net-next v1 4/7] net: usb: lan78xx: Use ethtool_op_get_link to reflect current link status Oleksij Rempel
2025-01-08 12:13 ` [PATCH net-next v1 5/7] net: usb: lan78xx: port link settings to phylink API Oleksij Rempel
2025-01-08 12:13 ` [PATCH net-next v1 6/7] net: usb: lan78xx: Transition get/set_pause to phylink Oleksij Rempel
2025-01-08 12:13 ` [PATCH net-next v1 7/7] net: usb: lan78xx: Enable EEE support with phylink integration Oleksij Rempel
2025-01-08 12:47 ` Russell King (Oracle)
2025-01-08 14:23 ` Oleksij Rempel
2025-01-08 15:15 ` Russell King (Oracle)
2025-01-09 17:13 ` Oleksij Rempel
2025-01-09 17:27 ` Russell King (Oracle)
2025-01-09 17:39 ` Oleksij Rempel
2025-01-09 18:10 ` Russell King (Oracle)
2025-01-09 19:33 ` Andrew Lunn
2025-01-13 12:42 ` Oleksij Rempel
2025-01-13 13:29 ` Russell King (Oracle)
2025-01-13 13:45 ` Andrew Lunn
2025-01-17 16:23 ` Russell King (Oracle)
2025-01-18 7:22 ` Oleksij Rempel
2025-01-18 9:04 ` Russell King (Oracle)
2025-01-18 10:01 ` Oleksij Rempel
2025-01-18 10:40 ` Russell King (Oracle)
2025-01-18 11:23 ` Oleksij Rempel
2025-01-18 10:03 ` Oleksij Rempel
2025-01-09 19:36 ` Oleksij Rempel
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=Z5CpXXNQrtmxuxaF@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=Rengarajan.S@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=Woojung.Huh@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=phil@raspberrypi.org \
--cc=rmk+kernel@armlinux.org.uk \
/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.