From patchwork Thu Aug 9 12:32:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 143834 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2038633ljj; Thu, 9 Aug 2018 05:33:20 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwtU6GoDQ8XzCtOTermLj83yPufcROil0JO7TeZcYHxiYne2PuDaeV9SDJd3Y/3ceRX4VxK X-Received: by 2002:a63:6c05:: with SMTP id h5-v6mr2006358pgc.367.1533818000310; Thu, 09 Aug 2018 05:33:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533818000; cv=none; d=google.com; s=arc-20160816; b=Yr84O3KEEKtc1v9Nlq6hs3fUxrX+KzpNUq2O7k6cx+aqaQCbaJGmHUxVpJ616fO9wS HUmfqK35j2/XSQXhVhneZhl5KqvynFVA73OYcJmQMPLkHej4ygfAxVNO9s6akExCM2RR PD1lHuP/UywF0Z5FDEVStyDobGBUgmdel9lhJ1y92oAAh5BG00k1reEkOahEPOOKl55e 7rZbJnBXzOXkJtUcuaoI9boOOa1hC9WJcs45wpadzfSmXADSa6wryKjpkZ55/iRUuOZF umJCxEvKK4YY8cetvo3m1k6QyunSdnn7URwWs9qgByGezPiFSyeLduMpbxRUQNXyGZ68 d8gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=HMjVhcucgOcB72eRMe/rfkfW/TdGfEUaMxkOlFZis1U=; b=d6tcQIwELNg5Grp3YnllNTbILRIdRZrcmTgre1q5YqLOlVN+8/FlSBFsYZkgJTMXEz f109TPNoP6RH7CYEOWdGAlDgbrQqjgXHay+02olcOvIALT3di9UgYG99WE2hSOoAHNFI Cmsi0tH6qXEQYKpl47gv7+r4QpxKMdjJHIhCJMEz7DySL9d7OBxh1DLph0EXyon2R4Pn wXlIFpA+eCMCWnF1ZEEZ+Pvwjq1N3c2j+Hi35Bd7Zy9kg7nFH7lKZWI+oo4/gsX9Iu6n zfcfpcNKcoaqv6qvBtRjeLIcfRRjniBz/HdDBPSI8vm1nG30P0aHp0LpG2jrbdhSbiq2 r/qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="MD/s985U"; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e185-v6si6967383pgc.318.2018.08.09.05.33.20; Thu, 09 Aug 2018 05:33:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="MD/s985U"; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732203AbeHIO6A (ORCPT + 13 others); Thu, 9 Aug 2018 10:58:00 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33727 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732100AbeHIO57 (ORCPT ); Thu, 9 Aug 2018 10:57:59 -0400 Received: by mail-pg1-f196.google.com with SMTP id r5-v6so2705235pgv.0 for ; Thu, 09 Aug 2018 05:33:17 -0700 (PDT) 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 :in-reply-to:references; bh=3ESQmXQZFM8HUugR+y7kuqNvZLR844rwPBdqMRc4GHg=; b=MD/s985U67JRAGE4XjUMo1kDCnx44R//xo5N7NcCMsgalYxjuwZx3InYj6GRi/CFis 1z1NHcjctzAHYiAIv6kdEJDF88CMMY6d418C84OdhzX8NPFDCaHXeCb2L6xIB1U7NuS5 +abUaD5hUkHc1v7+jf42YNWLW7XfhPrvAaWyU= 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:in-reply-to:references; bh=3ESQmXQZFM8HUugR+y7kuqNvZLR844rwPBdqMRc4GHg=; b=Bc3az5DlOHp46k8clmhNv8hb9XHydtgYDJ6HAU2TDKdH8ItUWP1nkQEILj86BZkTY3 L3bEUQ73J9b3eWKecmKyC/fmvx1qgCb1I0xlx9O8ebwS7qGqz+FMcUt6ioMxbNJqh38t 91w1fKmXm42A0X/bGglVOhAiH3Vuusod5wZY4ZRUQxmQ8kVIpRttuMxZukdEMGb+DwSd G9B0hJiNDt3zx7ofR0y0hlP0zJoXqyIU/Fx6XDkz0ordnoUWc+JE0cSRJicI9Hn3si9d 0Qcxt/0Hs2xYvWrlbVO3f6gf6voCenKFnasCu6qZhgIeuOVJP2Qnk+o/s3HnM9o4poUc j3Pw== X-Gm-Message-State: AOUpUlFP6AN+dLT9B68C16mi3yoDvOtxO0JDDqjYR1snfNGGM5U/3r9g nhmiphUbhIreP1u+tw6l2u3Hkw== X-Received: by 2002:a62:2ac8:: with SMTP id q191-v6mr2203566pfq.139.1533817997513; Thu, 09 Aug 2018 05:33:17 -0700 (PDT) Received: from localhost ([45.113.251.134]) by smtp.gmail.com with ESMTPSA id v7-v6sm21878001pgh.57.2018.08.09.05.33.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 05:33:16 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: rnayak@codeaurora.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, smohanad@codeaurora.org, andy.gross@linaro.org, dianders@chromium.org, mka@chromium.org, Zhang Rui , linux-pm@vger.kernel.org Subject: [PATCH v1 06/10] thermal: tsens: Add the SROT address map Date: Thu, 9 Aug 2018 18:02:38 +0530 Message-Id: <3759de54da8dac772f43c098fcec322de179c1a4.1533815718.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On platforms whose device trees specify two address spaces for TSENS, the second one points to the SROT registers. Initialise the SROT map on those platforms. Signed-off-by: Amit Kucheria --- drivers/thermal/qcom/tsens-common.c | 14 ++++++++++++-- drivers/thermal/qcom/tsens.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 0585084630b3..0b8a793f15f4 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -117,16 +117,26 @@ static const struct regmap_config tsens_config = { int __init init_common(struct tsens_device *tmdev) { - void __iomem *tm_base; + void __iomem *tm_base, *srot_base; struct resource *res; struct platform_device *op = of_find_device_by_node(tmdev->dev->of_node); if (!op) return -EINVAL; - /* The driver only uses the TM register address space for now */ if (op->num_resources > 1) { + /* DT with separate SROT and TM address space */ tmdev->tm_offset = 0; + res = platform_get_resource(op, IORESOURCE_MEM, 1); + srot_base = devm_ioremap_resource(&op->dev, res); + if (IS_ERR(srot_base)) + return PTR_ERR(srot_base); + + tmdev->srot_map = devm_regmap_init_mmio(tmdev->dev, + srot_base, &tsens_config); + if (IS_ERR(tmdev->srot_map)) + return PTR_ERR(tmdev->srot_map); + } else { /* old DTs where SROT and TM were in a contiguous 2K block */ tmdev->tm_offset = 0x1000; diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index 58e98c4d3a8b..b9c4bcf255fa 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -70,6 +70,7 @@ struct tsens_device { struct device *dev; u32 num_sensors; struct regmap *tm_map; + struct regmap *srot_map; u32 tm_offset; struct tsens_context ctx; const struct tsens_ops *ops;