Message ID | 20230512122134.24339-7-quic_kbajaj@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp5060891vqo; Fri, 12 May 2023 05:25:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4yWF3ELicLGhEl7LCC9xViaoMlJGuSTojD5cMq3JtlGhitrVgYcg/kUZOm+6JI2Av4Mqd7 X-Received: by 2002:a05:6a20:1452:b0:f0:edb:f60b with SMTP id a18-20020a056a20145200b000f00edbf60bmr33046257pzi.20.1683894346483; Fri, 12 May 2023 05:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683894346; cv=none; d=google.com; s=arc-20160816; b=adcbDHbkbo1ZpZ2nkmcTK3N3Eu7TUPCMNyvwttxTwAMkusztHEN+yuqUNH35FFkWcC RZdxX8mBQxaDPQMrNJeajO8cXU9ePZEJ69vqsK2p5EO8Ws323Jyvi84zJCJq10q1FLsF LGu09upb0HsD2aGSGkcVhZ97Ms0a32/j5sMjztFhO/bNqnsgbCiHtTs6hkvNTRRhGjUS N1oghHDNsGApT/4Vfr9t1uOL+Ol4ImLX9VfagU6E3+/f5ig1LCEtCoDAngeDEDR3IicH cRYmz5lJBRFPnf95kW5dIeSFNfi0V2YfKilhm+qJRA9tuI+DOKZxkSqF/ijPR7d+YAkn H/3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=xlNdu9x86CFmg14L3vqKJv3SzJInwe5m0GZNMnkQ5Tw=; b=UVfjePd0eU8+2QL79l9Il2RSrwHFajMAGtkq3KUA8mZ2IfgN1K/XRHBnIq3kT6XDsB flrx5ocdvkqHQCQ9JIRycyBL5WpjHCbZsmo17pYLXIgbe2oyQquM22JLqyDelClFQSQh Z4lU8jdGg+WldtYBhadDVAcmA88LbsM2rAtUwHbJJw+AFLShm8byEbn6wK4yaTL5RZpz 5jhqBxcti2EEN5OS5tvcSZtUPsgW+1G2uv4eGUBKsYSALCk6q1dI7MsedBFvEU9MkRkB 7RGnKYkS115LuhPD3tnz3GCdXAieowJP2JOqT1I2CIQ0vSGcuVJXZc5+8RfGzPZaKnun bxlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mMDQI37o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i186-20020a6387c3000000b0052c87a89084si9106295pge.374.2023.05.12.05.25.31; Fri, 12 May 2023 05:25:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mMDQI37o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240961AbjELMWH (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Fri, 12 May 2023 08:22:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240807AbjELMV7 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 12 May 2023 08:21:59 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A101112095; Fri, 12 May 2023 05:21:57 -0700 (PDT) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34CC0mZS020438; Fri, 12 May 2023 12:21:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=qcppdkim1; bh=xlNdu9x86CFmg14L3vqKJv3SzJInwe5m0GZNMnkQ5Tw=; b=mMDQI37oWYvNQCuaMVatxMOW80xY1AyDjwgn4RrrhEeQ58amuAA876Jz6GBeTt4VhStN DNB3h5QWx3JDpo3refSJL4TDjtzC8DAwCMw+z7/0Aaru27m1By+YdKg1hNGROXC34fKN A2/ITFfUfs+RjC53kNXMS9YPMcAwlbx5DGOkuAw8NKKPulhM5rFS//Fcswfxq2/oPvmy 7iBM1L1OklilbuxRQVOlTkMVoMPCueMthcQ13Uwr23QoIMFQHCQOhMQVIy28/HdDF1/L Z+5NoFwUapWaf34h7+TzOz983Ct/zW79qvUq5yFNFmlOzMu0Fg+ijo82KItUstUse0tQ 6Q== Received: from apblrppmta01.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qhfww0pp2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 May 2023 12:21:54 +0000 Received: from pps.filterd (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 34CCLpHB029068; Fri, 12 May 2023 12:21:51 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTP id 3qdy59u1vg-1; Fri, 12 May 2023 12:21:51 +0000 Received: from APBLRPPMTA01.qualcomm.com (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 34CCLpHx029062; Fri, 12 May 2023 12:21:51 GMT Received: from hu-maiyas-hyd.qualcomm.com (hu-kbajaj-hyd.qualcomm.com [10.147.247.189]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTP id 34CCLobD029061; Fri, 12 May 2023 12:21:51 +0000 Received: by hu-maiyas-hyd.qualcomm.com (Postfix, from userid 2340697) id 4632D52974D; Fri, 12 May 2023 17:51:50 +0530 (+0530) From: Komal Bajaj <quic_kbajaj@quicinc.com> To: Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, Conor Dooley <conor+dt@kernel.org> Cc: Komal Bajaj <quic_kbajaj@quicinc.com>, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v3 06/10] soc: qcom: Add LLCC support for multi channel DDR Date: Fri, 12 May 2023 17:51:30 +0530 Message-Id: <20230512122134.24339-7-quic_kbajaj@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230512122134.24339-1-quic_kbajaj@quicinc.com> References: <20230512122134.24339-1-quic_kbajaj@quicinc.com> X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: ENHVhyvHmZXH_BlUpj2N_v5FDTtYymC_ X-Proofpoint-GUID: ENHVhyvHmZXH_BlUpj2N_v5FDTtYymC_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-12_08,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 clxscore=1015 adultscore=0 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305120103 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765691198397962036?= X-GMAIL-MSGID: =?utf-8?q?1765691198397962036?= |
Series |
soc: qcom: llcc: Add support for QDU1000/QRU1000
|
|
Commit Message
Komal Bajaj
May 12, 2023, 12:21 p.m. UTC
Add LLCC support for multi channel DDR configuration
based on a feature register.
Signed-off-by: Komal Bajaj <quic_kbajaj@quicinc.com>
---
drivers/soc/qcom/llcc-qcom.c | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
--
2.17.1
Comments
Hi Komal, kernel test robot noticed the following build errors: [auto build test ERROR on linus/master] [also build test ERROR on v6.4-rc1 next-20230512] [cannot apply to robh/for-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Komal-Bajaj/nvmem-qfprom-Add-support-for-secure-reading/20230512-202430 base: linus/master patch link: https://lore.kernel.org/r/20230512122134.24339-7-quic_kbajaj%40quicinc.com patch subject: [PATCH v3 06/10] soc: qcom: Add LLCC support for multi channel DDR config: riscv-randconfig-r042-20230509 (https://download.01.org/0day-ci/archive/20230513/202305130303.wwdZb5hy-lkp@intel.com/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project b0fb98227c90adf2536c9ad644a74d5e92961111) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install riscv cross compiling tool for clang build # apt-get install binutils-riscv64-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/52808ee1c4720767ab330b371d356ffbd8fe7235 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Komal-Bajaj/nvmem-qfprom-Add-support-for-secure-reading/20230512-202430 git checkout 52808ee1c4720767ab330b371d356ffbd8fe7235 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/soc/qcom/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202305130303.wwdZb5hy-lkp@intel.com/ All errors (new ones prefixed by >>): >> drivers/soc/qcom/llcc-qcom.c:951:8: error: call to undeclared function 'nvmem_cell_read_u8'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] ret = nvmem_cell_read_u8(&pdev->dev, "multi_chan_ddr", cfg_index); ^ 1 error generated. vim +/nvmem_cell_read_u8 +951 drivers/soc/qcom/llcc-qcom.c 946 947 static int qcom_llcc_get_cfg_index(struct platform_device *pdev, u8 *cfg_index) 948 { 949 int ret = 0; 950 > 951 ret = nvmem_cell_read_u8(&pdev->dev, "multi_chan_ddr", cfg_index); 952 if (ret == -ENOENT) { 953 *cfg_index = 0; 954 return 0; 955 } 956 957 return ret; 958 } 959
Hi Komal, kernel test robot noticed the following build errors: [auto build test ERROR on linus/master] [also build test ERROR on v6.4-rc1 next-20230512] [cannot apply to robh/for-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Komal-Bajaj/nvmem-qfprom-Add-support-for-secure-reading/20230512-202430 base: linus/master patch link: https://lore.kernel.org/r/20230512122134.24339-7-quic_kbajaj%40quicinc.com patch subject: [PATCH v3 06/10] soc: qcom: Add LLCC support for multi channel DDR config: nios2-buildonly-randconfig-r001-20230509 (https://download.01.org/0day-ci/archive/20230513/202305130308.9zOC4OZC-lkp@intel.com/config) compiler: nios2-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/52808ee1c4720767ab330b371d356ffbd8fe7235 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Komal-Bajaj/nvmem-qfprom-Add-support-for-secure-reading/20230512-202430 git checkout 52808ee1c4720767ab330b371d356ffbd8fe7235 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=nios2 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=nios2 SHELL=/bin/bash drivers/soc/qcom/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202305130308.9zOC4OZC-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/soc/qcom/llcc-qcom.c: In function 'qcom_llcc_get_cfg_index': >> drivers/soc/qcom/llcc-qcom.c:951:15: error: implicit declaration of function 'nvmem_cell_read_u8'; did you mean 'nvmem_cell_read_u64'? [-Werror=implicit-function-declaration] 951 | ret = nvmem_cell_read_u8(&pdev->dev, "multi_chan_ddr", cfg_index); | ^~~~~~~~~~~~~~~~~~ | nvmem_cell_read_u64 cc1: some warnings being treated as errors vim +951 drivers/soc/qcom/llcc-qcom.c 946 947 static int qcom_llcc_get_cfg_index(struct platform_device *pdev, u8 *cfg_index) 948 { 949 int ret = 0; 950 > 951 ret = nvmem_cell_read_u8(&pdev->dev, "multi_chan_ddr", cfg_index); 952 if (ret == -ENOENT) { 953 *cfg_index = 0; 954 return 0; 955 } 956 957 return ret; 958 } 959
On Fri, May 12, 2023 at 05:51:30PM +0530, Komal Bajaj wrote: > Add LLCC support for multi channel DDR configuration > based on a feature register. > > Signed-off-by: Komal Bajaj <quic_kbajaj@quicinc.com> > --- > drivers/soc/qcom/llcc-qcom.c | 32 +++++++++++++++++++++++++++++--- > 1 file changed, 29 insertions(+), 3 deletions(-) > > diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c > index 6cf373da5df9..1da337e7a378 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/of_device.h> > #include <linux/regmap.h> > @@ -943,6 +944,19 @@ 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 ret = 0; First use is an assignment, no need to initialize here. > + > + ret = nvmem_cell_read_u8(&pdev->dev, "multi_chan_ddr", cfg_index); > + if (ret == -ENOENT) { > + *cfg_index = 0; Does nvmem_cell_read_u8() cahnge cfg_index when it fails with -ENOENT? > + return 0; > + } > + > + return ret; > +} > + > static int qcom_llcc_remove(struct platform_device *pdev) > { > /* Set the global pointer to a error code to avoid referencing it */ > @@ -975,11 +989,13 @@ static int qcom_llcc_probe(struct platform_device *pdev) > struct device *dev = &pdev->dev; > int ret, i; > struct platform_device *llcc_edac; > - const struct qcom_llcc_config *cfg; > + const struct qcom_llcc_config *cfg, *entry; > const struct llcc_slice_config *llcc_cfg; > u32 sz; > + u8 cfg_index; > u32 version; > struct regmap *regmap; > + u32 num_entries = 0; > > drv_data = devm_kzalloc(dev, sizeof(*drv_data), GFP_KERNEL); > if (!drv_data) { > @@ -1040,8 +1056,18 @@ static int qcom_llcc_probe(struct platform_device *pdev) > > drv_data->version = version; > > - llcc_cfg = cfg[0]->sct_data; > - sz = cfg[0]->size; > + ret = qcom_llcc_get_cfg_index(pdev, &cfg_index); > + if (ret) > + goto err; > + > + for (entry = cfg; entry->sct_data; entry++, num_entries++); This is not readable, move the increment of num_entries out of there. > + if (cfg_index >= num_entries || cfg_index < 0) { How can cfg_index be negative? Regards, Bjorn > + ret = -EINVAL; > + goto err; > + } > + > + llcc_cfg = cfg[cfg_index].sct_data; > + sz = cfg[cfg_index].size; > > for (i = 0; i < sz; i++) > if (llcc_cfg[i].slice_id > drv_data->max_slices) > -- > 2.17.1 >
On 6/13/2023 10:41 PM, Bjorn Andersson wrote: > On Fri, May 12, 2023 at 05:51:30PM +0530, Komal Bajaj wrote: >> Add LLCC support for multi channel DDR configuration >> based on a feature register. >> >> Signed-off-by: Komal Bajaj <quic_kbajaj@quicinc.com> >> --- >> drivers/soc/qcom/llcc-qcom.c | 32 +++++++++++++++++++++++++++++--- >> 1 file changed, 29 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c >> index 6cf373da5df9..1da337e7a378 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/of_device.h> >> #include <linux/regmap.h> >> @@ -943,6 +944,19 @@ 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 ret = 0; > First use is an assignment, no need to initialize here. Noted. > >> + >> + ret = nvmem_cell_read_u8(&pdev->dev, "multi_chan_ddr", cfg_index); >> + if (ret == -ENOENT) { >> + *cfg_index = 0; > Does nvmem_cell_read_u8() cahnge cfg_index when it fails with -ENOENT? No, if nvmem_cell_read_u8() fails with any error, cfg_index will not be changed. Thanks Komal >> + return 0; >> + } >> + >> + return ret; >> +} >> + >> static int qcom_llcc_remove(struct platform_device *pdev) >> { >> /* Set the global pointer to a error code to avoid referencing it */ >> @@ -975,11 +989,13 @@ static int qcom_llcc_probe(struct platform_device *pdev) >> struct device *dev = &pdev->dev; >> int ret, i; >> struct platform_device *llcc_edac; >> - const struct qcom_llcc_config *cfg; >> + const struct qcom_llcc_config *cfg, *entry; >> const struct llcc_slice_config *llcc_cfg; >> u32 sz; >> + u8 cfg_index; >> u32 version; >> struct regmap *regmap; >> + u32 num_entries = 0; >> >> drv_data = devm_kzalloc(dev, sizeof(*drv_data), GFP_KERNEL); >> if (!drv_data) { >> @@ -1040,8 +1056,18 @@ static int qcom_llcc_probe(struct platform_device *pdev) >> >> drv_data->version = version; >> >> - llcc_cfg = cfg[0]->sct_data; >> - sz = cfg[0]->size; >> + ret = qcom_llcc_get_cfg_index(pdev, &cfg_index); >> + if (ret) >> + goto err; >> + >> + for (entry = cfg; entry->sct_data; entry++, num_entries++); > This is not readable, move the increment of num_entries out of there. > >> + if (cfg_index >= num_entries || cfg_index < 0) { > How can cfg_index be negative? > > Regards, > Bjorn > >> + ret = -EINVAL; >> + goto err; >> + } >> + >> + llcc_cfg = cfg[cfg_index].sct_data; >> + sz = cfg[cfg_index].size; >> >> for (i = 0; i < sz; i++) >> if (llcc_cfg[i].slice_id > drv_data->max_slices) >> -- >> 2.17.1 >>
diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c index 6cf373da5df9..1da337e7a378 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/of_device.h> #include <linux/regmap.h> @@ -943,6 +944,19 @@ 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 ret = 0; + + ret = nvmem_cell_read_u8(&pdev->dev, "multi_chan_ddr", cfg_index); + if (ret == -ENOENT) { + *cfg_index = 0; + return 0; + } + + return ret; +} + static int qcom_llcc_remove(struct platform_device *pdev) { /* Set the global pointer to a error code to avoid referencing it */ @@ -975,11 +989,13 @@ static int qcom_llcc_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret, i; struct platform_device *llcc_edac; - const struct qcom_llcc_config *cfg; + const struct qcom_llcc_config *cfg, *entry; const struct llcc_slice_config *llcc_cfg; u32 sz; + u8 cfg_index; u32 version; struct regmap *regmap; + u32 num_entries = 0; drv_data = devm_kzalloc(dev, sizeof(*drv_data), GFP_KERNEL); if (!drv_data) { @@ -1040,8 +1056,18 @@ static int qcom_llcc_probe(struct platform_device *pdev) drv_data->version = version; - llcc_cfg = cfg[0]->sct_data; - sz = cfg[0]->size; + ret = qcom_llcc_get_cfg_index(pdev, &cfg_index); + if (ret) + goto err; + + for (entry = cfg; entry->sct_data; entry++, num_entries++); + if (cfg_index >= num_entries || cfg_index < 0) { + ret = -EINVAL; + goto err; + } + + llcc_cfg = cfg[cfg_index].sct_data; + sz = cfg[cfg_index].size; for (i = 0; i < sz; i++) if (llcc_cfg[i].slice_id > drv_data->max_slices)