Commit 5d1359ed authored by Dirk van der Merwe's avatar Dirk van der Merwe Committed by Jakub Kicinski

nfp: use PluDevice register for model for non-NFP6000 chips

The model number for NFP3800 and newer devices can be completely
derived from PluDevice register without subtracting 0x10.
Signed-off-by: default avatarDirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: default avatarFei Qin <fei.qin@corigine.com>
Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 113e9624
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "nfp6000/nfp_xpb.h" #include "nfp6000/nfp_xpb.h"
/* NFP6000 PL */ /* NFP6000 PL */
#define NFP_PL_DEVICE_PART_NFP6000 0x6200
#define NFP_PL_DEVICE_ID 0x00000004 #define NFP_PL_DEVICE_ID 0x00000004
#define NFP_PL_DEVICE_ID_MASK GENMASK(7, 0) #define NFP_PL_DEVICE_ID_MASK GENMASK(7, 0)
#define NFP_PL_DEVICE_PART_MASK GENMASK(31, 16) #define NFP_PL_DEVICE_PART_MASK GENMASK(31, 16)
...@@ -130,8 +131,12 @@ int nfp_cpp_model_autodetect(struct nfp_cpp *cpp, u32 *model) ...@@ -130,8 +131,12 @@ int nfp_cpp_model_autodetect(struct nfp_cpp *cpp, u32 *model)
return err; return err;
*model = reg & NFP_PL_DEVICE_MODEL_MASK; *model = reg & NFP_PL_DEVICE_MODEL_MASK;
/* Disambiguate the NFP4000/NFP5000/NFP6000 chips */
if (FIELD_GET(NFP_PL_DEVICE_PART_MASK, reg) ==
NFP_PL_DEVICE_PART_NFP6000) {
if (*model & NFP_PL_DEVICE_ID_MASK) if (*model & NFP_PL_DEVICE_ID_MASK)
*model -= 0x10; *model -= 0x10;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment