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: 10561363 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA3CD1390 for ; Thu, 9 Aug 2018 12:33:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 989B72624C for ; Thu, 9 Aug 2018 12:33:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D24E2787C; Thu, 9 Aug 2018 12:33:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37D102624C for ; Thu, 9 Aug 2018 12:33:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732203AbeHIO6A (ORCPT ); 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-Google-Smtp-Source: AA+uWPxzAUwNYf+Vegu8iqqg36S0km4gd5a756a+BMMyMjFirZUBseXWHyhnU9hBErAHnkfBaXmw9A== 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 X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Matthias Kaehlcke --- 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;