[RFC PATCH net-next 3/8] mlxsw: reg: Add fields to PMAOS register
From: Ido Schimmel <hidden>
Date: 2021-08-09 10:22:28
Subsystem:
mellanox ethernet switch drivers, networking drivers, the rest · Maintainers:
Ido Schimmel, Petr Machata, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
From: Ido Schimmel <idosch@nvidia.com> The Ports Module Administrative and Operational Status (PMAOS) register configures and retrieves the per-module status. Extend it with fields required to support various module settings such as reset and low power mode. Signed-off-by: Ido Schimmel <idosch@nvidia.com> --- drivers/net/ethernet/mellanox/mlxsw/reg.h | 58 +++++++++++++++++++++++ 1 file changed, 58 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h
index 6fbda6ebd590..b2c55259f333 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/reg.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h@@ -5681,6 +5681,14 @@ static inline void mlxsw_reg_pspa_pack(char *payload, u8 swid, u8 local_port) MLXSW_REG_DEFINE(pmaos, MLXSW_REG_PMAOS_ID, MLXSW_REG_PMAOS_LEN); +/* reg_pmaos_rst + * Module reset toggle. + * Note: Setting reset while module is plugged-in will result in transition to + * "initializing" operational state. + * Access: OP + */ +MLXSW_ITEM32(reg, pmaos, rst, 0x00, 31, 1); + /* reg_pmaos_slot_index * Slot index. * Access: Index
@@ -5693,6 +5701,38 @@ MLXSW_ITEM32(reg, pmaos, slot_index, 0x00, 24, 4); */ MLXSW_ITEM32(reg, pmaos, module, 0x00, 16, 8); +enum mlxsw_reg_pmaos_admin_status { + MLXSW_REG_PMAOS_ADMIN_STATUS_ENABLED = 1, + MLXSW_REG_PMAOS_ADMIN_STATUS_DISABLED = 2, + /* If the module is active and then unplugged, or experienced an error + * event, the operational status should go to "disabled" and can only + * be enabled upon explicit enable command. + */ + MLXSW_REG_PMAOS_ADMIN_STATUS_ENABLED_ONCE = 3, +}; + +/* reg_pmaos_admin_status + * Module administrative state (the desired state of the module). + * Note: To disable a module, all ports associated with the port must be + * administatively down first. + * Access: RW + */ +MLXSW_ITEM32(reg, pmaos, admin_status, 0x00, 8, 4); + +enum mlxsw_reg_pmaos_oper_status { + MLXSW_REG_PMAOS_OPER_STATUS_INITIALIZING, + MLXSW_REG_PMAOS_OPER_STATUS_PLUGGED_ENABLED, + MLXSW_REG_PMAOS_OPER_STATUS_UNPLUGGED, + /* Error code can be read from PMAOS.error_type */ + MLXSW_REG_PMAOS_OPER_STATUS_PLUGGED_ERROR, +}; + +/* reg_pmaos_oper_status + * Module state. Reserved while administrative state is disabled. + * Access: RO + */ +MLXSW_ITEM32(reg, pmaos, oper_status, 0x00, 0, 4); + /* reg_pmaos_ase * Admin state update enable. * If this bit is set, admin state will be updated based on admin_state field.
@@ -5709,6 +5749,24 @@ MLXSW_ITEM32(reg, pmaos, ase, 0x04, 31, 1); */ MLXSW_ITEM32(reg, pmaos, ee, 0x04, 30, 1); +enum mlxsw_reg_pmaos_error_type { + MLXSW_REG_PMAOS_ERROR_TYPE_POWER_BUDGET_EXCEEDED = 0, + /* I2C data or clock shorted */ + MLXSW_REG_PMAOS_ERROR_TYPE_BUS_STUCK = 2, + MLXSW_REG_PMAOS_ERROR_TYPE_BAD_UNSUPPORTED_EEPROM = 3, + MLXSW_REG_PMAOS_ERROR_TYPE_UNSUPPORTED_CABLE = 5, + MLXSW_REG_PMAOS_ERROR_TYPE_HIGH_TEMP = 6, + /* Module / cable is shorted */ + MLXSW_REG_PMAOS_ERROR_TYPE_BAD_CABLE = 7, +}; + +/* reg_pmaos_error_type + * Module error details. Only valid when operational status is "plugged with + * error". + * Access: RO + */ +MLXSW_ITEM32(reg, pmaos, error_type, 0x04, 8, 4); + enum mlxsw_reg_pmaos_e { MLXSW_REG_PMAOS_E_DO_NOT_GENERATE_EVENT, MLXSW_REG_PMAOS_E_GENERATE_EVENT,
--
2.31.1