* [PATCH net-next] net: phy: microchip_t1: add lan87xx_config_rgmii_delay for lan87xx phy
@ 2021-11-01 16:56 Yuiko Oshino
2021-11-02 17:07 ` Andrew Lunn
0 siblings, 1 reply; 3+ messages in thread
From: Yuiko Oshino @ 2021-11-01 16:56 UTC (permalink / raw)
To: davem, netdev; +Cc: nisar.sayed, UNGLinuxDriver, Yuiko Oshino
Add a function to initialize phy rgmii delay according to phydev->interface.
Signed-off-by: Yuiko Oshino <yuiko.oshino@microchip.com>
---
drivers/net/phy/microchip_t1.c | 44 +++++++++++++++++++++++++++++++++-
1 file changed, 43 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c
index a4de3d2081c5..bc50224d43dd 100644
--- a/drivers/net/phy/microchip_t1.c
+++ b/drivers/net/phy/microchip_t1.c
@@ -28,6 +28,11 @@
#define LAN87XX_MASK_LINK_UP (0x0004)
#define LAN87XX_MASK_LINK_DOWN (0x0002)
+/* MISC Control 1 Register */
+#define LAN87XX_CTRL_1 (0x11)
+#define LAN87XX_MASK_RGMII_TXC_DLY_EN (0x4000)
+#define LAN87XX_MASK_RGMII_RXC_DLY_EN (0x2000)
+
/* phyaccess nested types */
#define PHYACC_ATTR_MODE_READ 0
#define PHYACC_ATTR_MODE_WRITE 1
@@ -112,6 +117,43 @@ static int access_ereg_modify_changed(struct phy_device *phydev,
return rc;
}
+static int lan87xx_config_rgmii_delay(struct phy_device *phydev)
+{
+ int rc;
+
+ if (!phy_interface_is_rgmii(phydev))
+ return 0;
+
+ rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ,
+ PHYACC_ATTR_BANK_MISC, LAN87XX_CTRL_1, 0);
+ if (rc < 0)
+ return rc;
+
+ switch (phydev->interface) {
+ case PHY_INTERFACE_MODE_RGMII:
+ rc &= ~LAN87XX_MASK_RGMII_TXC_DLY_EN;
+ rc &= ~LAN87XX_MASK_RGMII_RXC_DLY_EN;
+ break;
+ case PHY_INTERFACE_MODE_RGMII_ID:
+ rc |= LAN87XX_MASK_RGMII_TXC_DLY_EN;
+ rc |= LAN87XX_MASK_RGMII_RXC_DLY_EN;
+ break;
+ case PHY_INTERFACE_MODE_RGMII_RXID:
+ rc &= ~LAN87XX_MASK_RGMII_TXC_DLY_EN;
+ rc |= LAN87XX_MASK_RGMII_RXC_DLY_EN;
+ break;
+ case PHY_INTERFACE_MODE_RGMII_TXID:
+ rc |= LAN87XX_MASK_RGMII_TXC_DLY_EN;
+ rc &= ~LAN87XX_MASK_RGMII_RXC_DLY_EN;
+ break;
+ default:
+ return 0;
+ }
+
+ return access_ereg(phydev, PHYACC_ATTR_MODE_WRITE,
+ PHYACC_ATTR_BANK_MISC, LAN87XX_CTRL_1, rc);
+}
+
static int lan87xx_phy_init(struct phy_device *phydev)
{
static const struct access_ereg_val init[] = {
@@ -185,7 +227,7 @@ static int lan87xx_phy_init(struct phy_device *phydev)
return rc;
}
- return 0;
+ return lan87xx_config_rgmii_delay(phydev);
}
static int lan87xx_phy_config_intr(struct phy_device *phydev)
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: phy: microchip_t1: add lan87xx_config_rgmii_delay for lan87xx phy
2021-11-01 16:56 [PATCH net-next] net: phy: microchip_t1: add lan87xx_config_rgmii_delay for lan87xx phy Yuiko Oshino
@ 2021-11-02 17:07 ` Andrew Lunn
2021-11-02 18:30 ` Yuiko.Oshino
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2021-11-02 17:07 UTC (permalink / raw)
To: Yuiko Oshino; +Cc: davem, netdev, nisar.sayed, UNGLinuxDriver
On Mon, Nov 01, 2021 at 12:56:10PM -0400, Yuiko Oshino wrote:
> Add a function to initialize phy rgmii delay according to phydev->interface.
How does this differ to the first version you posted?
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH net-next] net: phy: microchip_t1: add lan87xx_config_rgmii_delay for lan87xx phy
2021-11-02 17:07 ` Andrew Lunn
@ 2021-11-02 18:30 ` Yuiko.Oshino
0 siblings, 0 replies; 3+ messages in thread
From: Yuiko.Oshino @ 2021-11-02 18:30 UTC (permalink / raw)
To: andrew; +Cc: davem, netdev, Nisar.Sayed, UNGLinuxDriver
Hi Andrew,
I forgot to add "PATCH" in the first version of the subject.
Sorry to confuse you. I was not sure where I should mention that I forgot it.
Thank you for your review.
Best regards,
Yuiko
>-----Original Message-----
>From: Andrew Lunn <andrew@lunn.ch>
>Sent: Tuesday, November 2, 2021 1:07 PM
>To: Yuiko Oshino - C18177 <Yuiko.Oshino@microchip.com>
>Cc: davem@davemloft.net; netdev@vger.kernel.org; Nisar Sayed - I17970
><Nisar.Sayed@microchip.com>; UNGLinuxDriver
><UNGLinuxDriver@microchip.com>
>Subject: Re: [PATCH net-next] net: phy: microchip_t1: add
>lan87xx_config_rgmii_delay for lan87xx phy
>
>EXTERNAL EMAIL: Do not click links or open attachments unless you know the
>content is safe
>
>On Mon, Nov 01, 2021 at 12:56:10PM -0400, Yuiko Oshino wrote:
>> Add a function to initialize phy rgmii delay according to phydev->interface.
>
>How does this differ to the first version you posted?
>
> Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-02 18:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-01 16:56 [PATCH net-next] net: phy: microchip_t1: add lan87xx_config_rgmii_delay for lan87xx phy Yuiko Oshino
2021-11-02 17:07 ` Andrew Lunn
2021-11-02 18:30 ` Yuiko.Oshino
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.