Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1986701imm; Thu, 9 Aug 2018 05:34:44 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxZJZ1O3hT9lhagn3olbVeNruvmuXCX7EO7B2rdwWL+D2vlV/IWmhfj3qej5tb65x/rgSFC X-Received: by 2002:a17:902:8482:: with SMTP id c2-v6mr1951293plo.45.1533818084357; Thu, 09 Aug 2018 05:34:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533818084; cv=none; d=google.com; s=arc-20160816; b=iwuwCF/gF0IZF8XsmebSiW4Zxeh/emvgN7tqq4IirIE5v9xRw1MsOBxBcidrpSV4dz RfZGUKpMWS42KNlI9V57ildcUWwtJEvwAHEZOnbBrdQgCEy5M9YhCqHyJZla5VFIaU4H w4CGh9vPXWiI2g2VE5REJZX0JD0OY7bh1Qy2z1BXF6R0p+tiHsbzzePdO/+p/VPaWyYV DVUyAJoRk/QWpCfslXtPFksnNqOBZcI9rjtpsnzsUrEQiXWmOGsKWKTVhcBQHzGDHFGQ r3rVdmae/afjBNhp0ap7FoYehHwNbJ+dN07wiC1FNGJMzGyfDecSVWf8nSWshw9h7lI5 zMvw== 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=3ESQmXQZFM8HUugR+y7kuqNvZLR844rwPBdqMRc4GHg=; b=EmBBzHMbgUOo7aBd5cQYan3/xvsbsdwZgVhAOSyx/hbaDalp+Ds3QKXM1QLKSFnsn4 PwFZsGYlMKerRYIupc3WYEeS91YoWUsAwHJc30VPeg2b50nSIcrbXqRwUHZEjse6A1IF gF7moyBZSAaUy4+Ljus5PWy1ZqtYn6GNMD0uhizQ6+2tkXdl0fdOUpc7dtKsOZr8qKxG qRS5fdVWcEMUt8wwwOgPpgOBmJ/jp8bA5dpKhTsiRBv1ot4DX30e+tIPcQ5EVbgnj8mN AD1Nkh5ZX3mbim8bA8+CuVEyR/mYSJPz+14yo0F7KWoFWAGg4uDqEcxvYZuqVImcEMhb S7Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="MD/s985U"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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. [209.132.180.67]) by mx.google.com with ESMTP id z64-v6si7270151pgb.79.2018.08.09.05.34.29; Thu, 09 Aug 2018 05:34:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="MD/s985U"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1732227AbeHIO6A (ORCPT + 99 others); Thu, 9 Aug 2018 10:58:00 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41987 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732170AbeHIO57 (ORCPT ); Thu, 9 Aug 2018 10:57:59 -0400 Received: by mail-pg1-f196.google.com with SMTP id y4-v6so2689075pgp.9 for ; Thu, 09 Aug 2018 05:33:18 -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=Z1DY/SQ2vnLohnrGiBPWZ1+xSOUnM+fuuDPEmpTAsy06tTv27yRq69NLwsx1yX7JsY gm0eyTrnuGUX2RFyf0kAMHaA4VTZTmddQy+Wqe6xmY9WastNkf2Drc97qLriUlznxMOO 5VJEHX4O8nxZD+MaTmNJUBdXbG659v62M5zjeKzKDmjSxbSTdrF0HCrGTUXuxQP75uXV cCeJ4qBoGr/aEhMcWanYJbvJkZQG7cAv5Q5KhjGIt6ZITA24mw09M7iYNrTbi8wh26yn Eok5R2OAJdj697s4zL3ixAiqiP04L98LNDz/0jIAhdmQVbdfmOAN/ufMqDXo5ByCY7hz my5w== X-Gm-Message-State: AOUpUlFgb7BKuY6g508mye72Qyu0yCbHj8iCarUyFXTHI9Ftn0rVwE2O mkgXeqJ9MNLhcXHsmYuK1BQA4c66Msk= 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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