diff mbox series

[12/12] net: phy: add default gpio assert/deassert delay

Message ID 20230405-net-next-topic-net-phy-reset-v1-12-7e5329f08002@pengutronix.de (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series Rework PHY reset handling | expand

Checks

Context Check Description
netdev/series_format warning Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 19 this patch: 19
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 19 this patch: 19
netdev/checkpatch warning WARNING: line length of 81 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Marco Felsch April 5, 2023, 9:27 a.m. UTC
There are phy's not mention any assert/deassert delay within their
datasheets but the real world showed that this is not true. They need at
least a few us to be accessible and to readout the register values. So
add a sane default value of 1000us for both assert and deassert to fix
this in a global matter.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 drivers/net/phy/phy_device.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Andrew Lunn April 5, 2023, 12:39 p.m. UTC | #1
On Wed, Apr 05, 2023 at 11:27:03AM +0200, Marco Felsch wrote:
> There are phy's not mention any assert/deassert delay within their
> datasheets but the real world showed that this is not true. They need at
> least a few us to be accessible and to readout the register values. So
> add a sane default value of 1000us for both assert and deassert to fix
> this in a global matter.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
diff mbox series

Patch

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 30b3ac9818b1..08f2657110e0 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -3197,6 +3197,9 @@  fwnode_find_mii_timestamper(struct fwnode_handle *fwnode)
 	return register_mii_timestamper(arg.np, arg.args[0]);
 }
 
+#define DEFAULT_GPIO_RESET_ASSERT_DELAY_US	1000
+#define DEFAULT_GPIO_RESET_DEASSERT_DELAY_US	1000
+
 static int
 phy_device_parse_fwnode(struct phy_device *phydev,
 			struct phy_device_config *config)
@@ -3223,8 +3226,11 @@  phy_device_parse_fwnode(struct phy_device *phydev,
 
 	if (fwnode_property_read_bool(fwnode, "broken-turn-around"))
 		bus->phy_ignore_ta_mask |= 1 << addr;
+
+	phydev->mdio.reset_assert_delay = DEFAULT_GPIO_RESET_ASSERT_DELAY_US;
 	fwnode_property_read_u32(fwnode, "reset-assert-us",
 				 &phydev->mdio.reset_assert_delay);
+	phydev->mdio.reset_deassert_delay = DEFAULT_GPIO_RESET_DEASSERT_DELAY_US;
 	fwnode_property_read_u32(fwnode, "reset-deassert-us",
 				 &phydev->mdio.reset_deassert_delay);