diff options
author | Komal Bajaj <quic_kbajaj@quicinc.com> | 2023-08-30 13:56:52 +0300 |
---|---|---|
committer | Bjorn Andersson <andersson@kernel.org> | 2023-09-20 05:57:53 +0300 |
commit | a78502a4b2201235d93b04ac2902e01e32588bd5 (patch) | |
tree | f46a8dec0bfad2c5684834f30a1ef7108d2aadb1 /drivers/soc/qcom/llcc-qcom.c | |
parent | 54e1f99d91405417b3ddb6050cfba82733c3aa41 (diff) | |
download | linux-a78502a4b2201235d93b04ac2902e01e32588bd5.tar.xz |
soc: qcom: Add LLCC support for multi channel DDR
Add LLCC support for multi channel DDR configuration
based on a feature register.
Signed-off-by: Komal Bajaj <quic_kbajaj@quicinc.com>
Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230830105654.28057-5-quic_kbajaj@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Diffstat (limited to 'drivers/soc/qcom/llcc-qcom.c')
-rw-r--r-- | drivers/soc/qcom/llcc-qcom.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c index cbef8d825361..c31d9e39e864 100644 --- a/drivers/soc/qcom/llcc-qcom.c +++ b/drivers/soc/qcom/llcc-qcom.c @@ -12,6 +12,7 @@ #include <linux/kernel.h> #include <linux/module.h> #include <linux/mutex.h> +#include <linux/nvmem-consumer.h> #include <linux/of.h> #include <linux/regmap.h> #include <linux/sizes.h> @@ -995,6 +996,24 @@ static int qcom_llcc_cfg_program(struct platform_device *pdev, return ret; } +static int qcom_llcc_get_cfg_index(struct platform_device *pdev, u8 *cfg_index, int num_config) +{ + int ret; + + ret = nvmem_cell_read_u8(&pdev->dev, "multi-chan-ddr", cfg_index); + if (ret == -ENOENT || ret == -EOPNOTSUPP) { + if (num_config > 1) + return -EINVAL; + *cfg_index = 0; + return 0; + } + + if (!ret && *cfg_index >= num_config) + ret = -EINVAL; + + return ret; +} + static int qcom_llcc_remove(struct platform_device *pdev) { /* Set the global pointer to a error code to avoid referencing it */ @@ -1031,6 +1050,7 @@ static int qcom_llcc_probe(struct platform_device *pdev) const struct qcom_llcc_config *cfg; const struct llcc_slice_config *llcc_cfg; u32 sz; + u8 cfg_index; u32 version; struct regmap *regmap; @@ -1052,7 +1072,10 @@ static int qcom_llcc_probe(struct platform_device *pdev) ret = -EINVAL; goto err; } - cfg = &cfgs->llcc_config[0]; + ret = qcom_llcc_get_cfg_index(pdev, &cfg_index, cfgs->num_config); + if (ret) + goto err; + cfg = &cfgs->llcc_config[cfg_index]; ret = regmap_read(regmap, cfg->reg_offset[LLCC_COMMON_STATUS0], &num_banks); if (ret) |