Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10203820rwr; Fri, 12 May 2023 05:23:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4if3mQKp7tHDvFylTHcxQ7qIk12nkvcSqlvGGF3UUt+7cwKR/RYip6adqCQ19jpmW39iIa X-Received: by 2002:a17:902:e881:b0:1ac:83d1:9269 with SMTP id w1-20020a170902e88100b001ac83d19269mr21222352plg.16.1683894190212; Fri, 12 May 2023 05:23:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683894190; cv=none; d=google.com; s=arc-20160816; b=Hvt2KUOhsIkP7EJsOoozTCgCL1ZuDIt7WSTfAHBscvCkusCm7XwTbt6y7oSzRtbHW3 Zsc8FR+BTobCHOsjtAtLC6zLdUwW9FBN8+epvpO3qZFYc9SbDGNc96yiI5CVbau8GMjH duaur+kCJVmBM/bXLlpXJ6NPLIQEVbRBe9m9y0pURzt2ghbPv1kV3OJ27vS8nm0zLMPz 7HzQlXtUtXgWjAkJgDwUlan2BS0UIVEQ5mZb++x+QpTbVfcOvwQ01HuE/S08bZF7azdC /UZFKQrGiQ1+IxQ/Dxn3Wko3ST2dHNXf2hWZjLF4KlZjBcBapoQk/HUEU6G/afuoLPwi 2Tww== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q9-20020a170902dac900b001a1b238d1c0si9987068plx.636.2023.05.12.05.22.55; Fri, 12 May 2023 05:23:10 -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 S240930AbjELMWG (ORCPT + 99 others); Fri, 12 May 2023 08:22:06 -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 ); 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 To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Srinivas Kandagatla , Conor Dooley Cc: Komal Bajaj , 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: X-Mailing-List: linux-kernel@vger.kernel.org Add LLCC support for multi channel DDR configuration based on a feature register. Signed-off-by: Komal Bajaj --- 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 #include #include +#include #include #include #include @@ -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) -- 2.17.1