From patchwork Mon Nov 30 09:39:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 334705 Delivered-To: patch@linaro.org Received: by 2002:a92:5e16:0:0:0:0:0 with SMTP id s22csp4485633ilb; Mon, 30 Nov 2020 01:41:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOVktT72fKSEFo4vVQgkQ2Pr3aGLPtImWx3jtSAEyYmXgXLLl7Dz7kzW4GL+b/bt+VPgVE X-Received: by 2002:a50:e68a:: with SMTP id z10mr20451979edm.28.1606729309282; Mon, 30 Nov 2020 01:41:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606729309; cv=none; d=google.com; s=arc-20160816; b=uuF4Db46v+h1dmTHKvNwx6iumaGoHepNC6nrmoLrb7DMh7yfp3M4qJJ2z5NyB4ks38 0qN4CiL6S/fkazmfn4qav0akpzB/1yWu0cm9xbOO9H0t0l4PYwTwCB1ulvtasa3XQXov pzfWFp1s6c2I7bQHK+9hnCh1dKDNr3WXqwSJDSLoPft5lZImYOnC07jS5rZxNtKOt6MC OK1ypikVeZPlgpkTXSPUYaeUihfPy+6DeHdgx+lOfZLeSntw9Cp92He6dLwX42xMZPx1 tsY/lqy4rWQrVj2hHFpvQDwN+AynQcs4M7rj9xDnLYRfKThDz/QW1lO8h/mvUJAChW/c zCsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wbIAyBk/aKDm2aOVZ9gMdgrzEY6OUn0PU2J1sb9nIlY=; b=p3FcZ4a4gOWijrT/i0Qz2HPpUyD7QpvM5F6N1St+xf7JxvBx6zME1SDjUPWbXHgHWL 5ZqZfPxYO7t8MT01d8wMHAOedneWlIlnGj+ldSvW8Jj5fVWDm5lcaet6Ki8HOhqv/faf MaAFio6fqSuXMRcwdHKRg8LCa3HsmG4tOV+WXYaB2jXG9MgN+J04hxRtSosaOoldA6mR n/XAKjQcbdwo+Zh+4RdM5dzvY4cpiHChOakduyzONuF7yuG3oKCC4REu0MzxMPTWP/p2 6mZpDFvZT/qgizzL/TiYY9j7Eeqk79C0AiwUCrp2USj6xOoyJVXVQP1cEwwae0t6lgHi fAUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ntfd2Qys; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z15si2808130eju.429.2020.11.30.01.41.49; Mon, 30 Nov 2020 01:41:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ntfd2Qys; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728166AbgK3Jk5 (ORCPT + 15 others); Mon, 30 Nov 2020 04:40:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726614AbgK3Jk5 (ORCPT ); Mon, 30 Nov 2020 04:40:57 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F02D2C061A04 for ; Mon, 30 Nov 2020 01:39:52 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id o4so7477623pgj.0 for ; Mon, 30 Nov 2020 01:39:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wbIAyBk/aKDm2aOVZ9gMdgrzEY6OUn0PU2J1sb9nIlY=; b=Ntfd2QysKsNiw7SqrBvTvDdGgzSjVIu7y4FtGSM0OcrDHO9Xcsq0vxOroC80FJtpqU okeSzZ+Hj9N4uzQWiDiI053tXfghJwEWVjbdJLlfV2Uh7GHC6U9Ny0ABL3mhcLfoAvE8 OA7x0v+wLZJRCljpSTLOvQZXgRugpoWvwM/OZLWgrxTMjNK3EfcEJvqN9Ep9YlDVC3f6 7gTDZik5ZlnUSXA8HzHTob5rA0fvmWGibxYVAePJRNUEspHGcheYKukHdsrx26nmmgdk Z8Lp8hPvl73HDv9JXXbyEqPs9ToupQ62ocQ/rjY6Thxckho1ztApBkIDs/atFSh7P7YG 47rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wbIAyBk/aKDm2aOVZ9gMdgrzEY6OUn0PU2J1sb9nIlY=; b=gj7rg+1Ht7FUYcNpyv3FU1LszjzDacIm8Fub8Yl4tcIWQFAPalnkJ0g4qRK1QC0h0G aCgVuuJBYICUnMfAdyK7on0jVv9Yp9MPSBP9Dvdw8+G5bNkUm0j4Kcl7pHFvxMtcW326 u+Xp9Oy+b2VWqcXzTF+TZJe54dx52p75SmHz9tm8xCl00EXvp8iSgYpd9BTcm568zu1t wH7qL9KrnXWBIFFF+tr6NgZBDdt1kKWDKvc6+3Q9+tIGQFg13Pgt/dWFA0zWLGXSzKEc CNLfksYiX8XDp4vBNS7IWgp1IcBtusIga2qreOfGBPhoBueyk5bVZ5lcMUadGt5OG8MK J7gg== X-Gm-Message-State: AOAM531V0XPLS5STzKldm9Reg2+dLto0S7d9F8nefq0ir920U4cF6nRa jU4sd+Q6v607nQyoDGXiJtVK X-Received: by 2002:a63:b511:: with SMTP id y17mr8379504pge.345.1606729192528; Mon, 30 Nov 2020 01:39:52 -0800 (PST) Received: from localhost.localdomain ([2409:4072:6c0d:98b:4016:605b:102d:cbb8]) by smtp.gmail.com with ESMTPSA id u14sm16348429pfc.87.2020.11.30.01.39.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 01:39:51 -0800 (PST) From: Manivannan Sadhasivam To: agross@kernel.org, bjorn.andersson@linaro.org, robh+dt@kernel.org Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dmitry.baryshkov@linaro.org, saiprakash.ranjan@codeaurora.org, Manivannan Sadhasivam Subject: [PATCH v2 3/4] soc: qcom: llcc-qcom: Extract major hardware version Date: Mon, 30 Nov 2020 15:09:23 +0530 Message-Id: <20201130093924.45057-4-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201130093924.45057-1-manivannan.sadhasivam@linaro.org> References: <20201130093924.45057-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Sai Prakash Ranjan The major hardware version of the LLCC IP is encoded in its LLCC_COMMON_HW_INFO register. Extract the version and cache it in the driver data so that it can be used to implement version specific functionality like enabling Write sub cache for given SCID. Signed-off-by: Sai Prakash Ranjan [mani: splitted the version extract as a single patch and few cleanups] Signed-off-by: Manivannan Sadhasivam --- drivers/soc/qcom/llcc-qcom.c | 12 ++++++++++++ include/linux/soc/qcom/llcc-qcom.h | 2 ++ 2 files changed, 14 insertions(+) -- 2.25.1 diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c index 16b421608e9c..a559617ea7c0 100644 --- a/drivers/soc/qcom/llcc-qcom.c +++ b/drivers/soc/qcom/llcc-qcom.c @@ -4,6 +4,7 @@ * */ +#include #include #include #include @@ -35,6 +36,9 @@ #define CACHE_LINE_SIZE_SHIFT 6 +#define LLCC_COMMON_HW_INFO 0x00030000 +#define LLCC_MAJOR_VERSION_MASK GENMASK(31, 24) + #define LLCC_COMMON_STATUS0 0x0003000c #define LLCC_LB_CNT_MASK GENMASK(31, 28) #define LLCC_LB_CNT_SHIFT 28 @@ -476,6 +480,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; + u32 version; drv_data = devm_kzalloc(dev, sizeof(*drv_data), GFP_KERNEL); if (!drv_data) { @@ -496,6 +501,13 @@ static int qcom_llcc_probe(struct platform_device *pdev) goto err; } + /* Extract major version of the IP */ + ret = regmap_read(drv_data->bcast_regmap, LLCC_COMMON_HW_INFO, &version); + if (ret) + goto err; + + drv_data->major_version = FIELD_GET(LLCC_MAJOR_VERSION_MASK, version); + ret = regmap_read(drv_data->regmap, LLCC_COMMON_STATUS0, &num_banks); if (ret) diff --git a/include/linux/soc/qcom/llcc-qcom.h b/include/linux/soc/qcom/llcc-qcom.h index 3db6797ba6ff..d17a3de80510 100644 --- a/include/linux/soc/qcom/llcc-qcom.h +++ b/include/linux/soc/qcom/llcc-qcom.h @@ -79,6 +79,7 @@ struct llcc_edac_reg_data { * @bitmap: Bit map to track the active slice ids * @offsets: Pointer to the bank offsets array * @ecc_irq: interrupt for llcc cache error detection and reporting + * @major_version: Indicates the LLCC major version */ struct llcc_drv_data { struct regmap *regmap; @@ -91,6 +92,7 @@ struct llcc_drv_data { unsigned long *bitmap; u32 *offsets; int ecc_irq; + u32 major_version; }; #if IS_ENABLED(CONFIG_QCOM_LLCC)