[PATCH v2 2/3] soc: qcom: llcc: Add LLCC configuration for the QCS8300 platform

Jingyi Wang posted 3 patches 1 month, 2 weeks ago
There is a newer version of this series
[PATCH v2 2/3] soc: qcom: llcc: Add LLCC configuration for the QCS8300 platform
Posted by Jingyi Wang 1 month, 2 weeks ago
Add LLCC configuration for the QCS8300 platform. There is an errata on
LB_CNT information on QCS8300 platform, override the value to get the
right number of banks.

Signed-off-by: Jingyi Wang <quic_jingyw@quicinc.com>
---
 drivers/soc/qcom/llcc-qcom.c | 72 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)

diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c
index a470285f54a8..d867b1596725 100644
--- a/drivers/soc/qcom/llcc-qcom.c
+++ b/drivers/soc/qcom/llcc-qcom.c
@@ -2225,6 +2225,56 @@ static const struct llcc_slice_config sm8650_data[] = {
 	},
 };
 
+static const struct llcc_slice_config qcs8300_data[] = {
+	{
+		.usecase_id = LLCC_GPUHTW,
+		.slice_id = 11,
+		.max_cap = 128,
+		.priority = 1,
+		.fixed_size = true,
+		.bonus_ways = 0xf,
+		.cache_mode = 0,
+		.retain_on_pc = true,
+	}, {
+		.usecase_id = LLCC_GPU,
+		.slice_id = 12,
+		.max_cap = 512,
+		.priority = 1,
+		.fixed_size = true,
+		.bonus_ways = 0xf,
+		.cache_mode = 0,
+		.retain_on_pc = true,
+		.write_scid_en = true,
+	}, {
+		.usecase_id = LLCC_MMUHWT,
+		.slice_id = 13,
+		.max_cap = 128,
+		.priority = 1,
+		.fixed_size = true,
+		.bonus_ways = 0xf,
+		.cache_mode = 0,
+		.activate_on_init = true,
+	}, {
+		.usecase_id = LLCC_ECC,
+		.slice_id = 26,
+		.max_cap = 256,
+		.priority = 3,
+		.fixed_size = true,
+		.bonus_ways = 0xf,
+		.cache_mode = 0,
+		.activate_on_init = true,
+	}, {
+		.usecase_id = LLCC_WRCACHE,
+		.slice_id = 31,
+		.max_cap = 128,
+		.priority = 1,
+		.fixed_size = true,
+		.bonus_ways = 0xf,
+		.cache_mode = 0,
+		.activate_on_init = true,
+	},
+};
+
 static const struct llcc_slice_config qdu1000_data_2ch[] = {
 	{
 		.usecase_id = LLCC_MDMHPGRW,
@@ -2646,6 +2696,16 @@ static const u32 llcc_v2_1_reg_offset[] = {
 	[LLCC_COMMON_STATUS0]	= 0x0003400c,
 };
 
+static const struct qcom_llcc_config qcs8300_cfg[] = {
+	{
+		.sct_data	= qcs8300_data,
+		.size		= ARRAY_SIZE(qcs8300_data),
+		.need_llcc_cfg	= true,
+		.reg_offset	= llcc_v2_1_reg_offset,
+		.edac_reg_offset = &llcc_v2_1_edac_reg_offset,
+	},
+};
+
 static const struct qcom_llcc_config qdu1000_cfg[] = {
 	{
 		.sct_data       = qdu1000_data_8ch,
@@ -2829,6 +2889,11 @@ static const struct qcom_llcc_config x1e80100_cfg[] = {
 	},
 };
 
+static const struct qcom_sct_config qcs8300_cfgs = {
+	.llcc_config	= qcs8300_cfg,
+	.num_config	= ARRAY_SIZE(qcs8300_cfg),
+};
+
 static const struct qcom_sct_config qdu1000_cfgs = {
 	.llcc_config	= qdu1000_cfg,
 	.num_config	= ARRAY_SIZE(qdu1000_cfg),
@@ -3391,6 +3456,12 @@ static int qcom_llcc_probe(struct platform_device *pdev)
 	num_banks >>= LLCC_LB_CNT_SHIFT;
 	drv_data->num_banks = num_banks;
 
+	/* LB_CNT information is wrong on QCS8300, override the value */
+	if (of_device_is_compatible(dev->of_node, "qcom,qcs8300-llcc")) {
+		num_banks = 4;
+		drv_data->num_banks = 4;
+	}
+
 	drv_data->regmaps = devm_kcalloc(dev, num_banks, sizeof(*drv_data->regmaps), GFP_KERNEL);
 	if (!drv_data->regmaps) {
 		ret = -ENOMEM;
@@ -3484,6 +3555,7 @@ static int qcom_llcc_probe(struct platform_device *pdev)
 }
 
 static const struct of_device_id qcom_llcc_of_match[] = {
+	{ .compatible = "qcom,qcs8300-llcc", .data = &qcs8300_cfgs},
 	{ .compatible = "qcom,qdu1000-llcc", .data = &qdu1000_cfgs},
 	{ .compatible = "qcom,sa8775p-llcc", .data = &sa8775p_cfgs },
 	{ .compatible = "qcom,sc7180-llcc", .data = &sc7180_cfgs },

-- 
2.25.1
Re: [PATCH v2 2/3] soc: qcom: llcc: Add LLCC configuration for the QCS8300 platform
Posted by Konrad Dybcio 1 month ago
On 10.10.2024 12:08 PM, Jingyi Wang wrote:
> Add LLCC configuration for the QCS8300 platform. There is an errata on
> LB_CNT information on QCS8300 platform, override the value to get the
> right number of banks.
> 
> Signed-off-by: Jingyi Wang <quic_jingyw@quicinc.com>
> ---
>  drivers/soc/qcom/llcc-qcom.c | 72 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 72 insertions(+)
> 
> diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c
> index a470285f54a8..d867b1596725 100644
> --- a/drivers/soc/qcom/llcc-qcom.c
> +++ b/drivers/soc/qcom/llcc-qcom.c
> @@ -2225,6 +2225,56 @@ static const struct llcc_slice_config sm8650_data[] = {
>  	},
>  };
>  
> +static const struct llcc_slice_config qcs8300_data[] = {

This part looks good and in line with the data I have

[...]

>  
> +	/* LB_CNT information is wrong on QCS8300, override the value */
> +	if (of_device_is_compatible(dev->of_node, "qcom,qcs8300-llcc")) {
> +		num_banks = 4;
> +		drv_data->num_banks = 4;
> +	}

This, please rebase on <20241025-sar2130p-llcc-v2-0-7455dc40e952@linaro.org>
and reuse the thing added there

Konrad
Re: [PATCH v2 2/3] soc: qcom: llcc: Add LLCC configuration for the QCS8300 platform
Posted by Jingyi Wang 1 month ago

On 10/26/2024 1:41 AM, Konrad Dybcio wrote:
> On 10.10.2024 12:08 PM, Jingyi Wang wrote:
>> Add LLCC configuration for the QCS8300 platform. There is an errata on
>> LB_CNT information on QCS8300 platform, override the value to get the
>> right number of banks.
>>
>> Signed-off-by: Jingyi Wang <quic_jingyw@quicinc.com>
>> ---
>>  drivers/soc/qcom/llcc-qcom.c | 72 ++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 72 insertions(+)
>>
>> diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c
>> index a470285f54a8..d867b1596725 100644
>> --- a/drivers/soc/qcom/llcc-qcom.c
>> +++ b/drivers/soc/qcom/llcc-qcom.c
>> @@ -2225,6 +2225,56 @@ static const struct llcc_slice_config sm8650_data[] = {
>>  	},
>>  };
>>  
>> +static const struct llcc_slice_config qcs8300_data[] = {
> 
> This part looks good and in line with the data I have
> 
> [...]
> 
>>  
>> +	/* LB_CNT information is wrong on QCS8300, override the value */
>> +	if (of_device_is_compatible(dev->of_node, "qcom,qcs8300-llcc")) {
>> +		num_banks = 4;
>> +		drv_data->num_banks = 4;
>> +	}
> 
> This, please rebase on <20241025-sar2130p-llcc-v2-0-7455dc40e952@linaro.org>
> and reuse the thing added there

Well noted, thanks for review.

> 
> Konrad

Thanks,
Jingyi
Re: [PATCH v2 2/3] soc: qcom: llcc: Add LLCC configuration for the QCS8300 platform
Posted by Dmitry Baryshkov 1 month, 1 week ago
On Thu, Oct 10, 2024 at 06:08:47PM +0800, Jingyi Wang wrote:
> Add LLCC configuration for the QCS8300 platform. There is an errata on
> LB_CNT information on QCS8300 platform, override the value to get the
> right number of banks.
> 
> Signed-off-by: Jingyi Wang <quic_jingyw@quicinc.com>
> ---
>  drivers/soc/qcom/llcc-qcom.c | 72 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 72 insertions(+)
> 
> @@ -3391,6 +3456,12 @@ static int qcom_llcc_probe(struct platform_device *pdev)
>  	num_banks >>= LLCC_LB_CNT_SHIFT;
>  	drv_data->num_banks = num_banks;
>  
> +	/* LB_CNT information is wrong on QCS8300, override the value */
> +	if (of_device_is_compatible(dev->of_node, "qcom,qcs8300-llcc")) {
> +		num_banks = 4;
> +		drv_data->num_banks = 4;
> +	}

Nit: I think it might be better to skip reading LLCC_COMMON_STATUS0
register completely and just set num_banks instead. See [1]

[1] https://lore.kernel.org/linux-arm-msm/20241019-sar2130p-llcc-v1-2-4e09063d04f2@linaro.org/

> +
>  	drv_data->regmaps = devm_kcalloc(dev, num_banks, sizeof(*drv_data->regmaps), GFP_KERNEL);
>  	if (!drv_data->regmaps) {
>  		ret = -ENOMEM;
> @@ -3484,6 +3555,7 @@ static int qcom_llcc_probe(struct platform_device *pdev)
>  }
>  
>  static const struct of_device_id qcom_llcc_of_match[] = {
> +	{ .compatible = "qcom,qcs8300-llcc", .data = &qcs8300_cfgs},
>  	{ .compatible = "qcom,qdu1000-llcc", .data = &qdu1000_cfgs},
>  	{ .compatible = "qcom,sa8775p-llcc", .data = &sa8775p_cfgs },
>  	{ .compatible = "qcom,sc7180-llcc", .data = &sc7180_cfgs },
> 
> -- 
> 2.25.1
> 

-- 
With best wishes
Dmitry
Re: [PATCH v2 2/3] soc: qcom: llcc: Add LLCC configuration for the QCS8300 platform
Posted by Jingyi Wang 1 month ago

On 10/20/2024 12:29 AM, Dmitry Baryshkov wrote:
> On Thu, Oct 10, 2024 at 06:08:47PM +0800, Jingyi Wang wrote:
>> Add LLCC configuration for the QCS8300 platform. There is an errata on
>> LB_CNT information on QCS8300 platform, override the value to get the
>> right number of banks.
>>
>> Signed-off-by: Jingyi Wang <quic_jingyw@quicinc.com>
>> ---
>>  drivers/soc/qcom/llcc-qcom.c | 72 ++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 72 insertions(+)
>>
>> @@ -3391,6 +3456,12 @@ static int qcom_llcc_probe(struct platform_device *pdev)
>>  	num_banks >>= LLCC_LB_CNT_SHIFT;
>>  	drv_data->num_banks = num_banks;
>>  
>> +	/* LB_CNT information is wrong on QCS8300, override the value */
>> +	if (of_device_is_compatible(dev->of_node, "qcom,qcs8300-llcc")) {
>> +		num_banks = 4;
>> +		drv_data->num_banks = 4;
>> +	}
> 
> Nit: I think it might be better to skip reading LLCC_COMMON_STATUS0
> register completely and just set num_banks instead. See [1]
> 
> [1] https://lore.kernel.org/linux-arm-msm/20241019-sar2130p-llcc-v1-2-4e09063d04f2@linaro.org/
> 

Just went through the series and the follow up sereies, I think it is a good idea to
add the property in the config. Thanks!


>> +
>>  	drv_data->regmaps = devm_kcalloc(dev, num_banks, sizeof(*drv_data->regmaps), GFP_KERNEL);
>>  	if (!drv_data->regmaps) {
>>  		ret = -ENOMEM;
>> @@ -3484,6 +3555,7 @@ static int qcom_llcc_probe(struct platform_device *pdev)
>>  }
>>  
>>  static const struct of_device_id qcom_llcc_of_match[] = {
>> +	{ .compatible = "qcom,qcs8300-llcc", .data = &qcs8300_cfgs},
>>  	{ .compatible = "qcom,qdu1000-llcc", .data = &qdu1000_cfgs},
>>  	{ .compatible = "qcom,sa8775p-llcc", .data = &sa8775p_cfgs },
>>  	{ .compatible = "qcom,sc7180-llcc", .data = &sc7180_cfgs },
>>
>> -- 
>> 2.25.1
>>
> 
Thanks,
Jingyi