Skip to content

Commit

Permalink
soc: qcom: ocmem: Add OCMEM hardware version print
Browse files Browse the repository at this point in the history
[ Upstream commit e81a16e ]

It might be useful to know what hardware version of the OCMEM block the
SoC contains. Add a debug print for that.

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230509-ocmem-hwver-v3-1-e51f3488e0f4@z3ntu.xyz
Stable-dep-of: a7b484b ("soc: qcom: ocmem: Fix NUM_PORTS & NUM_MACROS macros")
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
z3ntu authored and gregkh committed Sep 13, 2023
1 parent 7bdeb76 commit fb4a774
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/soc/qcom/ocmem.c
Expand Up @@ -76,6 +76,10 @@ struct ocmem {
#define OCMEM_REG_GFX_MPU_START 0x00001004
#define OCMEM_REG_GFX_MPU_END 0x00001008

#define OCMEM_HW_VERSION_MAJOR(val) FIELD_GET(GENMASK(31, 28), val)
#define OCMEM_HW_VERSION_MINOR(val) FIELD_GET(GENMASK(27, 16), val)
#define OCMEM_HW_VERSION_STEP(val) FIELD_GET(GENMASK(15, 0), val)

#define OCMEM_HW_PROFILE_NUM_PORTS(val) FIELD_PREP(0x0000000f, (val))
#define OCMEM_HW_PROFILE_NUM_MACROS(val) FIELD_PREP(0x00003f00, (val))

Expand Down Expand Up @@ -355,6 +359,12 @@ static int ocmem_dev_probe(struct platform_device *pdev)
}
}

reg = ocmem_read(ocmem, OCMEM_REG_HW_VERSION);
dev_dbg(dev, "OCMEM hardware version: %lu.%lu.%lu\n",
OCMEM_HW_VERSION_MAJOR(reg),
OCMEM_HW_VERSION_MINOR(reg),
OCMEM_HW_VERSION_STEP(reg));

reg = ocmem_read(ocmem, OCMEM_REG_HW_PROFILE);
ocmem->num_ports = OCMEM_HW_PROFILE_NUM_PORTS(reg);
ocmem->num_macros = OCMEM_HW_PROFILE_NUM_MACROS(reg);
Expand Down

0 comments on commit fb4a774

Please sign in to comment.