* [PATCH v3 0/4] net: phy: dp83867: add some fixes
@ 2019-05-28 10:00 Max Uvarov
2019-05-28 10:00 ` [PATCH v3 1/4] net: phy: dp83867: fix speed 10 in sgmii mode Max Uvarov
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Max Uvarov @ 2019-05-28 10:00 UTC (permalink / raw)
To: netdev; +Cc: andrew, f.fainelli, hkallweit1, davem, Max Uvarov
v3: use phy_modify_mmd()
v2: fix minor comments by Heiner Kallweit and Florian Fainelli
Max Uvarov (4):
net: phy: dp83867: fix speed 10 in sgmii mode
net: phy: dp83867: increase SGMII autoneg timer duration
net: phy: dp83867: do not call config_init twice
net: phy: dp83867: Set up RGMII TX delay
drivers/net/phy/dp83867.c | 41 +++++++++++++++++++++++++++++++++++----
1 file changed, 37 insertions(+), 4 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 1/4] net: phy: dp83867: fix speed 10 in sgmii mode
2019-05-28 10:00 [PATCH v3 0/4] net: phy: dp83867: add some fixes Max Uvarov
@ 2019-05-28 10:00 ` Max Uvarov
2019-05-28 10:00 ` [PATCH v3 2/4] net: phy: dp83867: increase SGMII autoneg timer duration Max Uvarov
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Max Uvarov @ 2019-05-28 10:00 UTC (permalink / raw)
To: netdev; +Cc: andrew, f.fainelli, hkallweit1, davem, Max Uvarov
For supporting 10Mps speed in SGMII mode DP83867_10M_SGMII_RATE_ADAPT bit
of DP83867_10M_SGMII_CFG register has to be cleared by software.
That does not affect speeds 100 and 1000 so can be done on init.
Signed-off-by: Max Uvarov <muvarov@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/phy/dp83867.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index fd35131a0c39..1091a625bf4c 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -30,6 +30,8 @@
#define DP83867_STRAP_STS1 0x006E
#define DP83867_RGMIIDCTL 0x0086
#define DP83867_IO_MUX_CFG 0x0170
+#define DP83867_10M_SGMII_CFG 0x016F
+#define DP83867_10M_SGMII_RATE_ADAPT_MASK BIT(7)
#define DP83867_SW_RESET BIT(15)
#define DP83867_SW_RESTART BIT(14)
@@ -277,6 +279,21 @@ static int dp83867_config_init(struct phy_device *phydev)
DP83867_IO_MUX_CFG_IO_IMPEDANCE_CTRL);
}
+ if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
+ /* For support SPEED_10 in SGMII mode
+ * DP83867_10M_SGMII_RATE_ADAPT bit
+ * has to be cleared by software. That
+ * does not affect SPEED_100 and
+ * SPEED_1000.
+ */
+ ret = phy_modify_mmd(phydev, DP83867_DEVADDR,
+ DP83867_10M_SGMII_CFG,
+ DP83867_10M_SGMII_RATE_ADAPT_MASK,
+ 0);
+ if (ret)
+ return ret;
+ }
+
/* Enable Interrupt output INT_OE in CFG3 register */
if (phy_interrupt_is_valid(phydev)) {
val = phy_read(phydev, DP83867_CFG3);
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 2/4] net: phy: dp83867: increase SGMII autoneg timer duration
2019-05-28 10:00 [PATCH v3 0/4] net: phy: dp83867: add some fixes Max Uvarov
2019-05-28 10:00 ` [PATCH v3 1/4] net: phy: dp83867: fix speed 10 in sgmii mode Max Uvarov
@ 2019-05-28 10:00 ` Max Uvarov
2019-05-28 10:00 ` [PATCH v3 3/4] net: phy: dp83867: do not call config_init twice Max Uvarov
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Max Uvarov @ 2019-05-28 10:00 UTC (permalink / raw)
To: netdev; +Cc: andrew, f.fainelli, hkallweit1, davem, Max Uvarov
After reset SGMII Autoneg timer is set to 2us (bits 6 and 5 are 01).
That is not enough to finalize autonegatiation on some devices.
Increase this timer duration to maximum supported 16ms.
Signed-off-by: Max Uvarov <muvarov@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/phy/dp83867.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index 1091a625bf4c..14e9e8a94639 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -26,6 +26,12 @@
/* Extended Registers */
#define DP83867_CFG4 0x0031
+#define DP83867_CFG4_SGMII_ANEG_MASK (BIT(5) | BIT(6))
+#define DP83867_CFG4_SGMII_ANEG_TIMER_11MS (3 << 5)
+#define DP83867_CFG4_SGMII_ANEG_TIMER_800US (2 << 5)
+#define DP83867_CFG4_SGMII_ANEG_TIMER_2US (1 << 5)
+#define DP83867_CFG4_SGMII_ANEG_TIMER_16MS (0 << 5)
+
#define DP83867_RGMIICTL 0x0032
#define DP83867_STRAP_STS1 0x006E
#define DP83867_RGMIIDCTL 0x0086
@@ -292,6 +298,18 @@ static int dp83867_config_init(struct phy_device *phydev)
0);
if (ret)
return ret;
+
+ /* After reset SGMII Autoneg timer is set to 2us (bits 6 and 5
+ * are 01). That is not enough to finalize autoneg on some
+ * devices. Increase this timer duration to maximum 16ms.
+ */
+ ret = phy_modify_mmd(phydev, DP83867_DEVADDR,
+ DP83867_CFG4,
+ DP83867_CFG4_SGMII_ANEG_MASK,
+ DP83867_CFG4_SGMII_ANEG_TIMER_16MS);
+
+ if (ret)
+ return ret;
}
/* Enable Interrupt output INT_OE in CFG3 register */
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 3/4] net: phy: dp83867: do not call config_init twice
2019-05-28 10:00 [PATCH v3 0/4] net: phy: dp83867: add some fixes Max Uvarov
2019-05-28 10:00 ` [PATCH v3 1/4] net: phy: dp83867: fix speed 10 in sgmii mode Max Uvarov
2019-05-28 10:00 ` [PATCH v3 2/4] net: phy: dp83867: increase SGMII autoneg timer duration Max Uvarov
@ 2019-05-28 10:00 ` Max Uvarov
2019-05-28 17:09 ` Florian Fainelli
2019-05-28 10:00 ` [PATCH v3 4/4] net: phy: dp83867: Set up RGMII TX delay Max Uvarov
2019-05-29 21:29 ` [PATCH v3 0/4] net: phy: dp83867: add some fixes David Miller
4 siblings, 1 reply; 8+ messages in thread
From: Max Uvarov @ 2019-05-28 10:00 UTC (permalink / raw)
To: netdev; +Cc: andrew, f.fainelli, hkallweit1, davem, Max Uvarov
Phy state machine calls _config_init just after
reset.
Signed-off-by: Max Uvarov <muvarov@gmail.com>
---
drivers/net/phy/dp83867.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index 14e9e8a94639..1ec48ecf4133 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -342,7 +342,7 @@ static int dp83867_phy_reset(struct phy_device *phydev)
usleep_range(10, 20);
- return dp83867_config_init(phydev);
+ return 0;
}
static struct phy_driver dp83867_driver[] = {
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 4/4] net: phy: dp83867: Set up RGMII TX delay
2019-05-28 10:00 [PATCH v3 0/4] net: phy: dp83867: add some fixes Max Uvarov
` (2 preceding siblings ...)
2019-05-28 10:00 ` [PATCH v3 3/4] net: phy: dp83867: do not call config_init twice Max Uvarov
@ 2019-05-28 10:00 ` Max Uvarov
2019-05-28 17:09 ` Florian Fainelli
2019-05-29 21:29 ` [PATCH v3 0/4] net: phy: dp83867: add some fixes David Miller
4 siblings, 1 reply; 8+ messages in thread
From: Max Uvarov @ 2019-05-28 10:00 UTC (permalink / raw)
To: netdev; +Cc: andrew, f.fainelli, hkallweit1, davem, Max Uvarov
PHY_INTERFACE_MODE_RGMII_RXID is less then TXID
so code to set tx delay is never called.
Fixes: 2a10154abcb75 ("net: phy: dp83867: Add TI dp83867 phy")
Signed-off-by: Max Uvarov <muvarov@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/phy/dp83867.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index 1ec48ecf4133..c71c7d0f53f0 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -255,10 +255,8 @@ static int dp83867_config_init(struct phy_device *phydev)
ret = phy_write(phydev, MII_DP83867_PHYCTRL, val);
if (ret)
return ret;
- }
- if ((phydev->interface >= PHY_INTERFACE_MODE_RGMII_ID) &&
- (phydev->interface <= PHY_INTERFACE_MODE_RGMII_RXID)) {
+ /* Set up RGMII delays */
val = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_RGMIICTL);
if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v3 3/4] net: phy: dp83867: do not call config_init twice
2019-05-28 10:00 ` [PATCH v3 3/4] net: phy: dp83867: do not call config_init twice Max Uvarov
@ 2019-05-28 17:09 ` Florian Fainelli
0 siblings, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2019-05-28 17:09 UTC (permalink / raw)
To: Max Uvarov, netdev; +Cc: andrew, hkallweit1, davem
On 5/28/19 3:00 AM, Max Uvarov wrote:
> Phy state machine calls _config_init just after
> reset.
>
> Signed-off-by: Max Uvarov <muvarov@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 4/4] net: phy: dp83867: Set up RGMII TX delay
2019-05-28 10:00 ` [PATCH v3 4/4] net: phy: dp83867: Set up RGMII TX delay Max Uvarov
@ 2019-05-28 17:09 ` Florian Fainelli
0 siblings, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2019-05-28 17:09 UTC (permalink / raw)
To: Max Uvarov, netdev; +Cc: andrew, hkallweit1, davem
On 5/28/19 3:00 AM, Max Uvarov wrote:
> PHY_INTERFACE_MODE_RGMII_RXID is less then TXID
> so code to set tx delay is never called.
> Fixes: 2a10154abcb75 ("net: phy: dp83867: Add TI dp83867 phy")
There is no need to put a newline, the Fixes: tag is just like any other
tag.
>
> Signed-off-by: Max Uvarov <muvarov@gmail.com>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/4] net: phy: dp83867: add some fixes
2019-05-28 10:00 [PATCH v3 0/4] net: phy: dp83867: add some fixes Max Uvarov
` (3 preceding siblings ...)
2019-05-28 10:00 ` [PATCH v3 4/4] net: phy: dp83867: Set up RGMII TX delay Max Uvarov
@ 2019-05-29 21:29 ` David Miller
4 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2019-05-29 21:29 UTC (permalink / raw)
To: muvarov; +Cc: netdev, andrew, f.fainelli, hkallweit1
From: Max Uvarov <muvarov@gmail.com>
Date: Tue, 28 May 2019 13:00:48 +0300
> v3: use phy_modify_mmd()
> v2: fix minor comments by Heiner Kallweit and Florian Fainelli
Series applied, thank you.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-05-29 21:29 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-28 10:00 [PATCH v3 0/4] net: phy: dp83867: add some fixes Max Uvarov
2019-05-28 10:00 ` [PATCH v3 1/4] net: phy: dp83867: fix speed 10 in sgmii mode Max Uvarov
2019-05-28 10:00 ` [PATCH v3 2/4] net: phy: dp83867: increase SGMII autoneg timer duration Max Uvarov
2019-05-28 10:00 ` [PATCH v3 3/4] net: phy: dp83867: do not call config_init twice Max Uvarov
2019-05-28 17:09 ` Florian Fainelli
2019-05-28 10:00 ` [PATCH v3 4/4] net: phy: dp83867: Set up RGMII TX delay Max Uvarov
2019-05-28 17:09 ` Florian Fainelli
2019-05-29 21:29 ` [PATCH v3 0/4] net: phy: dp83867: add some fixes David Miller
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.