Skip to content

Commit 505f524

Browse files
Jiri Pirkodavem330
authored andcommitted
mlxsw: reg: Add Management DownStream Device Query Register
The MDDQ register allows to query the DownStream device properties. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b0ec003 commit 505f524

File tree

1 file changed

+144
-0
lines changed
  • drivers/net/ethernet/mellanox/mlxsw

1 file changed

+144
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/reg.h

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11492,6 +11492,149 @@ mlxsw_reg_mgpir_unpack(char *payload, u8 *num_of_devices,
1149211492
*num_of_slots = mlxsw_reg_mgpir_num_of_slots_get(payload);
1149311493
}
1149411494

11495+
/* MDDQ - Management DownStream Device Query Register
11496+
* --------------------------------------------------
11497+
* This register allows to query the DownStream device properties. The desired
11498+
* information is chosen upon the query_type field and is delivered by 32B
11499+
* of data blocks.
11500+
*/
11501+
#define MLXSW_REG_MDDQ_ID 0x9161
11502+
#define MLXSW_REG_MDDQ_LEN 0x30
11503+
11504+
MLXSW_REG_DEFINE(mddq, MLXSW_REG_MDDQ_ID, MLXSW_REG_MDDQ_LEN);
11505+
11506+
/* reg_mddq_sie
11507+
* Slot info event enable.
11508+
* When set to '1', each change in the slot_info.provisioned / sr_valid /
11509+
* active / ready will generate a DSDSC event.
11510+
* Access: RW
11511+
*/
11512+
MLXSW_ITEM32(reg, mddq, sie, 0x00, 31, 1);
11513+
11514+
enum mlxsw_reg_mddq_query_type {
11515+
MLXSW_REG_MDDQ_QUERY_TYPE_SLOT_INFO = 1,
11516+
MLXSW_REG_MDDQ_QUERY_TYPE_SLOT_NAME = 3,
11517+
};
11518+
11519+
/* reg_mddq_query_type
11520+
* Access: Index
11521+
*/
11522+
MLXSW_ITEM32(reg, mddq, query_type, 0x00, 16, 8);
11523+
11524+
/* reg_mddq_slot_index
11525+
* Slot index. 0 is reserved.
11526+
* Access: Index
11527+
*/
11528+
MLXSW_ITEM32(reg, mddq, slot_index, 0x00, 0, 4);
11529+
11530+
/* reg_mddq_slot_info_provisioned
11531+
* If set, the INI file is applied and the card is provisioned.
11532+
* Access: RO
11533+
*/
11534+
MLXSW_ITEM32(reg, mddq, slot_info_provisioned, 0x10, 31, 1);
11535+
11536+
/* reg_mddq_slot_info_sr_valid
11537+
* If set, Shift Register is valid (after being provisioned) and data
11538+
* can be sent from the switch ASIC to the line-card CPLD over Shift-Register.
11539+
* Access: RO
11540+
*/
11541+
MLXSW_ITEM32(reg, mddq, slot_info_sr_valid, 0x10, 30, 1);
11542+
11543+
enum mlxsw_reg_mddq_slot_info_ready {
11544+
MLXSW_REG_MDDQ_SLOT_INFO_READY_NOT_READY,
11545+
MLXSW_REG_MDDQ_SLOT_INFO_READY_READY,
11546+
MLXSW_REG_MDDQ_SLOT_INFO_READY_ERROR,
11547+
};
11548+
11549+
/* reg_mddq_slot_info_lc_ready
11550+
* If set, the LC is powered on, matching the INI version and a new FW
11551+
* version can be burnt (if necessary).
11552+
* Access: RO
11553+
*/
11554+
MLXSW_ITEM32(reg, mddq, slot_info_lc_ready, 0x10, 28, 2);
11555+
11556+
/* reg_mddq_slot_info_active
11557+
* If set, the FW has completed the MDDC.device_enable command.
11558+
* Access: RO
11559+
*/
11560+
MLXSW_ITEM32(reg, mddq, slot_info_active, 0x10, 27, 1);
11561+
11562+
/* reg_mddq_slot_info_hw_revision
11563+
* Major user-configured version number of the current INI file.
11564+
* Valid only when active or ready are '1'.
11565+
* Access: RO
11566+
*/
11567+
MLXSW_ITEM32(reg, mddq, slot_info_hw_revision, 0x14, 16, 16);
11568+
11569+
/* reg_mddq_slot_info_ini_file_version
11570+
* User-configured version number of the current INI file.
11571+
* Valid only when active or lc_ready are '1'.
11572+
* Access: RO
11573+
*/
11574+
MLXSW_ITEM32(reg, mddq, slot_info_ini_file_version, 0x14, 0, 16);
11575+
11576+
/* reg_mddq_slot_info_card_type
11577+
* Access: RO
11578+
*/
11579+
MLXSW_ITEM32(reg, mddq, slot_info_card_type, 0x18, 0, 8);
11580+
11581+
static inline void
11582+
__mlxsw_reg_mddq_pack(char *payload, u8 slot_index,
11583+
enum mlxsw_reg_mddq_query_type query_type)
11584+
{
11585+
MLXSW_REG_ZERO(mddq, payload);
11586+
mlxsw_reg_mddq_slot_index_set(payload, slot_index);
11587+
mlxsw_reg_mddq_query_type_set(payload, query_type);
11588+
}
11589+
11590+
static inline void
11591+
mlxsw_reg_mddq_slot_info_pack(char *payload, u8 slot_index, bool sie)
11592+
{
11593+
__mlxsw_reg_mddq_pack(payload, slot_index,
11594+
MLXSW_REG_MDDQ_QUERY_TYPE_SLOT_INFO);
11595+
mlxsw_reg_mddq_sie_set(payload, sie);
11596+
}
11597+
11598+
static inline void
11599+
mlxsw_reg_mddq_slot_info_unpack(const char *payload, u8 *p_slot_index,
11600+
bool *p_provisioned, bool *p_sr_valid,
11601+
enum mlxsw_reg_mddq_slot_info_ready *p_lc_ready,
11602+
bool *p_active, u16 *p_hw_revision,
11603+
u16 *p_ini_file_version,
11604+
u8 *p_card_type)
11605+
{
11606+
*p_slot_index = mlxsw_reg_mddq_slot_index_get(payload);
11607+
*p_provisioned = mlxsw_reg_mddq_slot_info_provisioned_get(payload);
11608+
*p_sr_valid = mlxsw_reg_mddq_slot_info_sr_valid_get(payload);
11609+
*p_lc_ready = mlxsw_reg_mddq_slot_info_lc_ready_get(payload);
11610+
*p_active = mlxsw_reg_mddq_slot_info_active_get(payload);
11611+
*p_hw_revision = mlxsw_reg_mddq_slot_info_hw_revision_get(payload);
11612+
*p_ini_file_version = mlxsw_reg_mddq_slot_info_ini_file_version_get(payload);
11613+
*p_card_type = mlxsw_reg_mddq_slot_info_card_type_get(payload);
11614+
}
11615+
11616+
#define MLXSW_REG_MDDQ_SLOT_ASCII_NAME_LEN 20
11617+
11618+
/* reg_mddq_slot_ascii_name
11619+
* Slot's ASCII name.
11620+
* Access: RO
11621+
*/
11622+
MLXSW_ITEM_BUF(reg, mddq, slot_ascii_name, 0x10,
11623+
MLXSW_REG_MDDQ_SLOT_ASCII_NAME_LEN);
11624+
11625+
static inline void
11626+
mlxsw_reg_mddq_slot_name_pack(char *payload, u8 slot_index)
11627+
{
11628+
__mlxsw_reg_mddq_pack(payload, slot_index,
11629+
MLXSW_REG_MDDQ_QUERY_TYPE_SLOT_NAME);
11630+
}
11631+
11632+
static inline void
11633+
mlxsw_reg_mddq_slot_name_unpack(const char *payload, char *slot_ascii_name)
11634+
{
11635+
mlxsw_reg_mddq_slot_ascii_name_memcpy_from(payload, slot_ascii_name);
11636+
}
11637+
1149511638
/* MFDE - Monitoring FW Debug Register
1149611639
* -----------------------------------
1149711640
*/
@@ -12811,6 +12954,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = {
1281112954
MLXSW_REG(mtptpt),
1281212955
MLXSW_REG(mfgd),
1281312956
MLXSW_REG(mgpir),
12957+
MLXSW_REG(mddq),
1281412958
MLXSW_REG(mfde),
1281512959
MLXSW_REG(tngcr),
1281612960
MLXSW_REG(tnumt),

0 commit comments

Comments
 (0)