| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
|
| 3 |
#ifndef OPEN_ALLIANCE_HELPERS_H |
| 4 |
#define OPEN_ALLIANCE_HELPERS_H |
| 5 |
|
| 6 |
/* |
| 7 |
* These defines reflect the TDR (Time Delay Reflection) diagnostic feature |
| 8 |
* for 1000BASE-T1 automotive Ethernet PHYs as specified by the OPEN Alliance. |
| 9 |
* |
| 10 |
* The register values are part of the HDD.TDR register, which provides |
| 11 |
* information about the cable status and faults. The exact register offset |
| 12 |
* is device-specific and should be provided by the driver. |
| 13 |
*/ |
| 14 |
#define OA_1000BT1_HDD_TDR_ACTIVATION_MASK GENMASK(1, 0) |
| 15 |
#define OA_1000BT1_HDD_TDR_ACTIVATION_OFF 1 |
| 16 |
#define OA_1000BT1_HDD_TDR_ACTIVATION_ON 2 |
| 17 |
|
| 18 |
#define OA_1000BT1_HDD_TDR_STATUS_MASK GENMASK(7, 4) |
| 19 |
#define OA_1000BT1_HDD_TDR_STATUS_SHORT 3 |
| 20 |
#define OA_1000BT1_HDD_TDR_STATUS_OPEN 6 |
| 21 |
#define OA_1000BT1_HDD_TDR_STATUS_NOISE 5 |
| 22 |
#define OA_1000BT1_HDD_TDR_STATUS_CABLE_OK 7 |
| 23 |
#define OA_1000BT1_HDD_TDR_STATUS_TEST_IN_PROGRESS 8 |
| 24 |
#define OA_1000BT1_HDD_TDR_STATUS_TEST_NOT_POSSIBLE 13 |
| 25 |
|
| 26 |
/* |
| 27 |
* OA_1000BT1_HDD_TDR_DISTANCE_MASK: |
| 28 |
* This mask is used to extract the distance to the first/main fault |
| 29 |
* detected by the TDR feature. Each bit represents an approximate distance |
| 30 |
* of 1 meter, ranging from 0 to 31 meters. The exact interpretation of the |
| 31 |
* bits may vary, but generally: |
| 32 |
* 000000 = no error |
| 33 |
* 000001 = error about 0-1m away |
| 34 |
* 000010 = error between 1-2m away |
| 35 |
* ... |
| 36 |
* 011111 = error about 30-31m away |
| 37 |
* 111111 = resolution not possible / out of distance |
| 38 |
*/ |
| 39 |
#define OA_1000BT1_HDD_TDR_DISTANCE_MASK GENMASK(13, 8) |
| 40 |
#define OA_1000BT1_HDD_TDR_DISTANCE_NO_ERROR 0 |
| 41 |
#define OA_1000BT1_HDD_TDR_DISTANCE_RESOLUTION_NOT_POSSIBLE 0x3f |
| 42 |
|
| 43 |
int oa_1000bt1_get_ethtool_cable_result_code(u16 reg_value); |
| 44 |
int oa_1000bt1_get_tdr_distance(u16 reg_value); |
| 45 |
|
| 46 |
#endif /* OPEN_ALLIANCE_HELPERS_H */ |
| 47 |
|