mlxsw: core: Add a new interface for reading the hardware free running clock
authorShalom Toledo <shalomt@mellanox.com>
Tue, 11 Jun 2019 15:45:05 +0000 (18:45 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 14 Jun 2019 05:34:55 +0000 (22:34 -0700)
Add two new bus operations for reading the hardware free running clock.

Signed-off-by: Shalom Toledo <shalomt@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core.c
drivers/net/ethernet/mellanox/mlxsw/core.h

index 1c4ef8ed17068c473e78b2c30dd354894048d03c..30e0526a9cf6145cf8b26368977591ecb0716c12 100644 (file)
@@ -2026,6 +2026,18 @@ int mlxsw_core_resources_query(struct mlxsw_core *mlxsw_core, char *mbox,
 }
 EXPORT_SYMBOL(mlxsw_core_resources_query);
 
+u32 mlxsw_core_read_frc_h(struct mlxsw_core *mlxsw_core)
+{
+       return mlxsw_core->bus->read_frc_h(mlxsw_core->bus_priv);
+}
+EXPORT_SYMBOL(mlxsw_core_read_frc_h);
+
+u32 mlxsw_core_read_frc_l(struct mlxsw_core *mlxsw_core)
+{
+       return mlxsw_core->bus->read_frc_l(mlxsw_core->bus_priv);
+}
+EXPORT_SYMBOL(mlxsw_core_read_frc_l);
+
 static int __init mlxsw_core_module_init(void)
 {
        int err;
index a44ad0fb9477c88ec15fc74f7e3c54d704ccdec4..6dbb0ede502e80b6034b2d6d2da3de329cc8e55e 100644 (file)
@@ -309,6 +309,9 @@ int mlxsw_core_kvd_sizes_get(struct mlxsw_core *mlxsw_core,
 void mlxsw_core_fw_flash_start(struct mlxsw_core *mlxsw_core);
 void mlxsw_core_fw_flash_end(struct mlxsw_core *mlxsw_core);
 
+u32 mlxsw_core_read_frc_h(struct mlxsw_core *mlxsw_core);
+u32 mlxsw_core_read_frc_l(struct mlxsw_core *mlxsw_core);
+
 bool mlxsw_core_res_valid(struct mlxsw_core *mlxsw_core,
                          enum mlxsw_res_id res_id);
 
@@ -339,6 +342,8 @@ struct mlxsw_bus {
                        char *in_mbox, size_t in_mbox_size,
                        char *out_mbox, size_t out_mbox_size,
                        u8 *p_status);
+       u32 (*read_frc_h)(void *bus_priv);
+       u32 (*read_frc_l)(void *bus_priv);
        u8 features;
 };
 
@@ -356,7 +361,8 @@ struct mlxsw_bus_info {
        struct mlxsw_fw_rev fw_rev;
        u8 vsd[MLXSW_CMD_BOARDINFO_VSD_LEN];
        u8 psid[MLXSW_CMD_BOARDINFO_PSID_LEN];
-       u8 low_frequency;
+       u8 low_frequency:1,
+          read_frc_capable:1;
 };
 
 struct mlxsw_hwmon;