Add the generic parts of the code used to trigger a cable test and return raw TDR data. Any PHY driver which support this must implement the new driver op. Signed-off-by: Andrew Lunn <andrew@lunn.ch> v2 Update nxp-tja11xx for API change.
Showing the changes to include/linux (2 of 7 files). Show all
Unified · Split
| @@ -17,13 +17,13 @@ enum ethtool_multicast_groups { · 16 unmodified lines | |||
| 17 | struct phy_device; | 17 | struct phy_device; |
| 18 | 18 | ||
| 19 | #if IS_ENABLED(CONFIG_ETHTOOL_NETLINK) | 19 | #if IS_ENABLED(CONFIG_ETHTOOL_NETLINK) |
| 20 | int ethnl_cable_test_alloc(struct phy_device *phydev); | 20 | int ethnl_cable_test_alloc(struct phy_device *phydev, u8 cmd); |
| 21 | void ethnl_cable_test_free(struct phy_device *phydev); | 21 | void ethnl_cable_test_free(struct phy_device *phydev); |
| 22 | void ethnl_cable_test_finished(struct phy_device *phydev); | 22 | void ethnl_cable_test_finished(struct phy_device *phydev); |
| 23 | int ethnl_cable_test_result(struct phy_device *phydev, u8 pair, u8 result); | 23 | int ethnl_cable_test_result(struct phy_device *phydev, u8 pair, u8 result); |
| 24 | int ethnl_cable_test_fault_length(struct phy_device *phydev, u8 pair, u32 cm); | 24 | int ethnl_cable_test_fault_length(struct phy_device *phydev, u8 pair, u32 cm); |
| 25 | #else | 25 | #else |
| 26 | static inline int ethnl_cable_test_alloc(struct phy_device *phydev) | 26 | static inline int ethnl_cable_test_alloc(struct phy_device *phydev, u8 cmd) |
| 27 | { | 27 | { |
| 28 | return -EOPNOTSUPP; | 28 | return -EOPNOTSUPP; |
| 29 | } | 29 | } |
| @@ -699,6 +699,10 @@ struct phy_driver { · 698 unmodified lines | |||
| 699 | 699 | ||
| 700 | /* Start a cable test */ | 700 | /* Start a cable test */ |
| 701 | int (*cable_test_start)(struct phy_device *dev); | 701 | int (*cable_test_start)(struct phy_device *dev); |
| 702 | |||
| 703 | /* Start a raw TDR cable test */ | ||
| 704 | int (*cable_test_tdr_start)(struct phy_device *dev); | ||
| 705 | |||
| 702 | /* Once per second, or on interrupt, request the status of the | 706 | /* Once per second, or on interrupt, request the status of the |
| 703 | * test. | 707 | * test. |
| 704 | */ | 708 | */ |
| @@ -1251,6 +1255,8 @@ int phy_reset_after_clk_enable(struct phy_device *phydev); · 546 unmodified lines | |||
| 1251 | #if IS_ENABLED(CONFIG_PHYLIB) | 1255 | #if IS_ENABLED(CONFIG_PHYLIB) |
| 1252 | int phy_start_cable_test(struct phy_device *phydev, | 1256 | int phy_start_cable_test(struct phy_device *phydev, |
| 1253 | struct netlink_ext_ack *extack); | 1257 | struct netlink_ext_ack *extack); |
| 1258 | int phy_start_cable_test_tdr(struct phy_device *phydev, | ||
| 1259 | struct netlink_ext_ack *extack); | ||
| 1254 | #else | 1260 | #else |
| 1255 | static inline | 1261 | static inline |
| 1256 | int phy_start_cable_test(struct phy_device *phydev, | 1262 | int phy_start_cable_test(struct phy_device *phydev, |
| @@ -1259,6 +1265,13 @@ int phy_start_cable_test(struct phy_device *phydev, · 2 unmodified lines | |||
| 1259 | NL_SET_ERR_MSG(extack, "Kernel not compiled with PHYLIB support"); | 1265 | NL_SET_ERR_MSG(extack, "Kernel not compiled with PHYLIB support"); |
| 1260 | return -EOPNOTSUPP; | 1266 | return -EOPNOTSUPP; |
| 1261 | } | 1267 | } |
| 1268 | static inline | ||
| 1269 | int phy_start_cable_test_tdr(struct phy_device *phydev, | ||
| 1270 | struct netlink_ext_ack *extack) | ||
| 1271 | { | ||
| 1272 | NL_SET_ERR_MSG(extack, "Kernel not compiled with PHYLIB support"); | ||
| 1273 | return -EOPNOTSUPP; | ||
| 1274 | } | ||
| 1262 | #endif | 1275 | #endif |
| 1263 | 1276 | ||
| 1264 | int phy_cable_test_result(struct phy_device *phydev, u8 pair, u16 result); | 1277 | int phy_cable_test_result(struct phy_device *phydev, u8 pair, u16 result); |