Port type data is made available by firmware via CGX lmac specific
firmware data. Extract the same.

Signed-off-by: Nithin Dabilpuram <ndabilpu...@marvell.com>
---
 drivers/common/cnxk/hw/nix.h      | 12 ++++++++++++
 drivers/common/cnxk/roc_mbox.h    |  4 ++--
 drivers/common/cnxk/roc_nix.h     |  1 +
 drivers/common/cnxk/roc_nix_mac.c |  1 +
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/common/cnxk/hw/nix.h b/drivers/common/cnxk/hw/nix.h
index de989153ff..2aa23da037 100644
--- a/drivers/common/cnxk/hw/nix.h
+++ b/drivers/common/cnxk/hw/nix.h
@@ -2735,4 +2735,16 @@ enum cgx_mode {
        CGX_MODE_MAX /* = 51 */
 };
 
+/* CGX Port types from kernel */
+enum cgx_port_type {
+       CGX_PORT_TP = 0x0,
+       CGX_PORT_AUI,
+       CGX_PORT_MII,
+       CGX_PORT_FIBRE,
+       CGX_PORT_BNC,
+       CGX_PORT_DA,
+       CGX_PORT_NONE = 0xef,
+       CGX_PORT_OTHER = 0xff,
+};
+
 #endif /* __NIX_HW_H__ */
diff --git a/drivers/common/cnxk/roc_mbox.h b/drivers/common/cnxk/roc_mbox.h
index 9038ca8fcf..1b0bfbc186 100644
--- a/drivers/common/cnxk/roc_mbox.h
+++ b/drivers/common/cnxk/roc_mbox.h
@@ -783,8 +783,8 @@ struct cgx_lmac_fwdata_s {
        uint32_t __io lmac_type;
        uint32_t __io portm_idx;
        uint64_t __io mgmt_port : 1;
-       uint64_t __io advertised_an : 1;
-#define LMAC_FWDATA_RESERVED_MEM 1019
+       uint64_t __io port;
+#define LMAC_FWDATA_RESERVED_MEM 1018
        uint64_t __io reserved[LMAC_FWDATA_RESERVED_MEM];
 };
 
diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h
index c438a4447c..65778933dd 100644
--- a/drivers/common/cnxk/roc_nix.h
+++ b/drivers/common/cnxk/roc_nix.h
@@ -416,6 +416,7 @@ struct roc_nix_link_info {
 struct roc_nix_mac_fwdata {
        uint64_t advertised_link_modes;
        uint64_t supported_link_modes;
+       uint64_t port_type;
 };
 
 /** Maximum name length for extended statistics counters */
diff --git a/drivers/common/cnxk/roc_nix_mac.c 
b/drivers/common/cnxk/roc_nix_mac.c
index b99f93818a..026ff41ef2 100644
--- a/drivers/common/cnxk/roc_nix_mac.c
+++ b/drivers/common/cnxk/roc_nix_mac.c
@@ -436,6 +436,7 @@ roc_nix_mac_fwdata_get(struct roc_nix *roc_nix, struct 
roc_nix_mac_fwdata *data)
        nix->advertised_link_modes = fw_data->fwdata.advertised_link_modes;
        data->supported_link_modes = nix->supported_link_modes;
        data->advertised_link_modes = nix->advertised_link_modes;
+       data->port_type = fw_data->fwdata.port;
 exit:
        mbox_put(mbox);
        return rc;
-- 
2.34.1

Reply via email to