All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amit Kucheria <amit.kucheria@linaro.org>
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 <rui.zhang@intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	linux-pm@vger.kernel.org
Subject: [PATCH v3 05/16] thermal: tsens: Add the SROT address map
Date: Wed, 12 Sep 2018 15:22:50 +0530	[thread overview]
Message-ID: <2900c1006e7e978403b1b95448f9c959c7ae486a.1536744310.git.amit.kucheria@linaro.org> (raw)
In-Reply-To: <cover.1536744310.git.amit.kucheria@linaro.org>
In-Reply-To: <cover.1536744310.git.amit.kucheria@linaro.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 <amit.kucheria@linaro.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 drivers/thermal/qcom/tsens-common.c | 14 ++++++++++++--
 drivers/thermal/qcom/tsens.h        |  1 +
 2 files changed, 13 insertions(+), 2 deletions(-)

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;
-- 
2.17.1

  parent reply	other threads:[~2018-09-12  9:52 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-12  9:52 [PATCH v3 00/16] Another round of tsens cleanups Amit Kucheria
2018-09-12  9:52 ` [PATCH v3 01/16] thermal: tsens: Prepare 8916 and 8974 tsens to use SROT and TM address space Amit Kucheria
2018-09-12  9:52 ` [PATCH v3 02/16] thermal: tsens: Add SPDX license identifiers Amit Kucheria
2018-09-12  9:52 ` [PATCH v3 03/16] thermal: tsens: Get rid of dead code Amit Kucheria
2018-09-12  9:52 ` [PATCH v3 04/16] thermal: tsens: Rename map field in order to add a second address map Amit Kucheria
2018-09-12  9:52 ` Amit Kucheria [this message]
2018-09-12  9:52 ` [PATCH v3 06/16] MAINTAINERS: Add entry for Qualcomm TSENS thermal drivers Amit Kucheria
2018-09-12  9:52 ` [PATCH v3 07/16] thermal: tsens: Pass register offsets as private data Amit Kucheria
2018-09-18 19:34   ` Bjorn Andersson
     [not found]     ` <cover.1537547011.git.amit.kucheria@linaro.org>
2018-09-21 17:25       ` [PATCH v4 " Amit Kucheria
2018-09-21 17:25         ` Amit Kucheria
2018-09-21 17:46           ` Amit Kucheria
2018-09-12  9:52 ` [PATCH v3 08/16] thermal: tsens: Check if the IP is correctly enabled by firmware Amit Kucheria
2018-09-12  9:52 ` [PATCH v3 09/16] arm: dts: msm8974: thermal: split address space into two Amit Kucheria
2018-09-20 18:57   ` Andy Gross
2018-09-12  9:52 ` [PATCH v3 10/16] arm64: dts: msm8916: " Amit Kucheria
2018-09-20 18:57   ` Andy Gross
2018-09-12  9:52 ` [PATCH v3 11/16] arm: dts: msm8974: thermal: Add "qcom,sensors" property Amit Kucheria
2018-09-20 18:58   ` Andy Gross
2018-09-12  9:52 ` [PATCH v3 12/16] arm64: dts: msm8916: " Amit Kucheria
2018-09-20 18:58   ` Andy Gross
2018-09-12  9:52 ` [PATCH v3 13/16] dt-bindings: thermal: Fix a typo in documentation Amit Kucheria
2018-09-12  9:52 ` [PATCH v3 14/16] arm64: dts: msm8916: Add gpu thermal zone Amit Kucheria
2018-09-20 18:59   ` Andy Gross
2018-09-12  9:53 ` [PATCH v3 15/16] arm64: dts: msm8916: Add camera " Amit Kucheria
2018-09-20 19:00   ` Andy Gross
2018-09-12  9:53 ` [PATCH v3 16/16] arm64: dts: sdm845: enable tsens thermal zones Amit Kucheria
2018-09-20 19:01   ` Andy Gross
2018-10-25 19:25   ` Matthias Kaehlcke
2018-10-25 20:03     ` Amit Kucheria
2018-10-25 20:37       ` Matthias Kaehlcke
2018-09-18 15:01 ` [PATCH v3 00/16] Another round of tsens cleanups Amit Kucheria
2018-09-18 15:01   ` Amit Kucheria
2018-09-20 19:02 ` Andy Gross
2018-09-21 17:48   ` Amit Kucheria
2018-09-21 17:48     ` Amit Kucheria

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2900c1006e7e978403b1b95448f9c959c7ae486a.1536744310.git.amit.kucheria@linaro.org \
    --to=amit.kucheria@linaro.org \
    --cc=andy.gross@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=dianders@chromium.org \
    --cc=edubezval@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=rnayak@codeaurora.org \
    --cc=rui.zhang@intel.com \
    --cc=smohanad@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.