summaryrefslogtreecommitdiff
path: root/include/linux/phy.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2020-05-27 09:22:28 +0300
committerDavid S. Miller <davem@davemloft.net>2020-05-27 09:22:28 +0300
commit943bbe1de5fcdec06765de182f30b1b2d05f9c43 (patch)
treee4625ef1517d3706e3cec3e7f12f5aad32c258ca /include/linux/phy.h
parent53c0ec4f4db19d430570bbbfc80ce899419d29f4 (diff)
parentdb8668a1951954156c039b9f8fe2881d428a522c (diff)
downloadlinux-943bbe1de5fcdec06765de182f30b1b2d05f9c43.tar.xz
Merge branch 'Raw-PHY-TDR-data'
Andrew Lunn says: ==================== Raw PHY TDR data Some ethernet PHYs allow access to raw TDR data in addition to summary diagnostics information. Add support for retrieving this data via netlink ethtool. The basic structure in the core is the same as for normal phy diagnostics, the PHY driver simply uses different helpers to fill the netlink message with different data. There is a graphical tool under development, as well a ethtool(1) which can dump the data as text and JSON. A patched ethtool(1) can be found in https://github.com/lunn/ethtool.git feature/cable-test-v5 Thanks for Chris Healy for lots of testing. v2: See the individual patches but: Pass distances in centimeters, not meters Allow the PHY to round distances to what it supports and report what it actually used along with the results. Make the Marvell PHY use steps a multiple of 0.805 meters, its native step size. v3: Move the TDR configuration into a structure Add a range check on step Use NL_SET_ERR_MSG_ATTR() when appropriate Move TDR configuration into a nest Document attributes in the request Unsquash the last two patches ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/phy.h')
-rw-r--r--include/linux/phy.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 6d256e720a66..8c05d0fb5c00 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -548,6 +548,18 @@ struct phy_device {
#define to_phy_device(d) container_of(to_mdio_device(d), \
struct phy_device, mdio)
+/* A structure containing possible configuration parameters
+ * for a TDR cable test. The driver does not need to implement
+ * all the parameters, but should report what is actually used.
+ */
+struct phy_tdr_config {
+ u32 first;
+ u32 last;
+ u32 step;
+ s8 pair;
+};
+#define PHY_PAIR_ALL -1
+
/* struct phy_driver: Driver structure for a particular PHY type
*
* driver_data: static driver data
@@ -699,6 +711,11 @@ struct phy_driver {
/* Start a cable test */
int (*cable_test_start)(struct phy_device *dev);
+
+ /* Start a raw TDR cable test */
+ int (*cable_test_tdr_start)(struct phy_device *dev,
+ const struct phy_tdr_config *config);
+
/* Once per second, or on interrupt, request the status of the
* test.
*/
@@ -1251,6 +1268,9 @@ int phy_reset_after_clk_enable(struct phy_device *phydev);
#if IS_ENABLED(CONFIG_PHYLIB)
int phy_start_cable_test(struct phy_device *phydev,
struct netlink_ext_ack *extack);
+int phy_start_cable_test_tdr(struct phy_device *phydev,
+ struct netlink_ext_ack *extack,
+ const struct phy_tdr_config *config);
#else
static inline
int phy_start_cable_test(struct phy_device *phydev,
@@ -1259,6 +1279,14 @@ int phy_start_cable_test(struct phy_device *phydev,
NL_SET_ERR_MSG(extack, "Kernel not compiled with PHYLIB support");
return -EOPNOTSUPP;
}
+static inline
+int phy_start_cable_test_tdr(struct phy_device *phydev,
+ struct netlink_ext_ack *extack,
+ const struct phy_tdr_config *config)
+{
+ NL_SET_ERR_MSG(extack, "Kernel not compiled with PHYLIB support");
+ return -EOPNOTSUPP;
+}
#endif
int phy_cable_test_result(struct phy_device *phydev, u8 pair, u16 result);