Thread (12 messages) 12 messages, 4 authors, 2021-05-19

Re: [PATCH] net: phy: add driver for Motorcomm yt8511 phy

flat view

From: Peter Geis <hidden>
Date: 2021-05-11 22:56:46
Also in: linux-rockchip, lkml

On Tue, May 11, 2021 at 5:56 PM Russell King - ARM Linux admin
[off-list ref] wrote:
Hi,

On Tue, May 11, 2021 at 05:46:06PM -0400, Peter Geis wrote:
quoted
+static int yt8511_config_init(struct phy_device *phydev)
+{
+     int ret, val, oldpage;
+
+     /* set clock mode to 125mhz */
+     oldpage = phy_select_page(phydev, YT8511_EXT_CLK_GATE);
+     if (oldpage < 0)
+             goto err_restore_page;
+
+     val = __phy_read(phydev, YT8511_PAGE);
+     val |= (YT8511_CLK_125M);
+     ret = __phy_write(phydev, YT8511_PAGE, val);
Please consider __phy_modify(), and handle any error it returns.
Hey that's really neat, thanks!
quoted
+
+     /* disable auto sleep */
+     ret = __phy_write(phydev, YT8511_PAGE_SELECT, YT8511_EXT_SLEEP_CTRL);
Please consider handling a failure to write here.
Will do.
quoted
+     val = __phy_read(phydev, YT8511_PAGE);
+     val &= (~BIT(15));
+     ret = __phy_write(phydev, YT8511_PAGE, val);
Also a use for __phy_modify().
quoted
+
+err_restore_page:
+     return phy_restore_page(phydev, oldpage, ret);
+}
+
+static struct phy_driver motorcomm_phy_drvs[] = {
+     {
+             PHY_ID_MATCH_EXACT(PHY_ID_YT8511),
+             .name           = "YT8511 Gigabit Ethernet",
+             .config_init    = &yt8511_config_init,
Please drop the '&' here, it's unnecessary.
Will do, thank you.
Thanks.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help