Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5219859imm; Wed, 12 Sep 2018 02:55:53 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYdagD2gcSoSk8YqYEFmrY2kEyKbQs8SI1AEKi/skyIkO/fgovGZOWzT42/CgsdKrCCWiWx X-Received: by 2002:a63:a06:: with SMTP id 6-v6mr1310759pgk.318.1536746153561; Wed, 12 Sep 2018 02:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536746153; cv=none; d=google.com; s=arc-20160816; b=BtPPMvq9gYh7/Q09cAdl1/ifdmEnJ5LdC5A5lTheHVYbEGzmgjS1AtfOiUTz6x3sPV DzhDw1hKKEwBt1YhaeLWzxPAoH3kRzs9I1jburl08SGiqYjbuWCUDfQyrz6ls6k6KLnB U/Hj9CTpZ/lU4sMJhmzq0ovWAv8GMHVI7NpnwEYEePACFoHU2l8WlzB2AAz85xD1l7pl A5aaEN4tdM01KMFS83T7VR9L+zBq0ZQKVxxZWLYIi/z8i9ya4WtM+cDcJNXp2BrF07N1 4roGozIcvG9NSt9FdIMTVK3PSc/7x78Hlw6+nYOoBsMAdXzXC/MZbTXew/899SWSgZE/ Sgdg== 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; bh=FjREbFGVR4U2BlmcUg5I3xLlSlYd4TVVX+ZjdpIMju8=; b=CeKyvQ3gc+sbLsotLtAaBFGMG1/wM7wrcUx2bhQcM4LT6W1g+vE8FQiO5pW6yCtfQ3 24/X6hXoOKNfs2lwboJ0iYLN2y92m7F7NyRN3KWricDLTB6kpbWMNQM/4bi4veweS/5X OSxPoRpwRIK1MffOpq3s1Q3A8v92LUivYaL7MhUaKLN+sOKTgwMM+VAiYVJC6J1vBtlh jXM3t720grj5QssTOUl62ItOjv2jU6gtjPXMe6N1lJW/ZomCpgx9HwhZcKrXaT3dUmDq KScoJWA8AyfT0sH7/uPNwAlP1LQ4N12GarD8BBPsgfQYNMZccfeBzz31civQVFIROfpE d3XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gSDuBvzg; 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 q10-v6si538060pge.674.2018.09.12.02.55.38; Wed, 12 Sep 2018 02:55:53 -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=gSDuBvzg; 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 S1727711AbeILO5k (ORCPT + 99 others); Wed, 12 Sep 2018 10:57:40 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:44719 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727685AbeILO5j (ORCPT ); Wed, 12 Sep 2018 10:57:39 -0400 Received: by mail-ed1-f68.google.com with SMTP id s10-v6so1234588edb.11 for ; Wed, 12 Sep 2018 02:53:52 -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=FjREbFGVR4U2BlmcUg5I3xLlSlYd4TVVX+ZjdpIMju8=; b=gSDuBvzg5L1d1hFDoKnmjQix+KFeP1cO2uVFU56g2/qrZxMTvgh2xfjzWq5lb0E0Tk Wvv+qDIhwcL7lBs/wnayTmppcEG2rfEQkaD8auHl1nwy1UgBRHa9C4uWrT3LQB29XTgS eP+tbT6VRGAjL5x8b42lx36NpdXb7tRSIlNTo= 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=FjREbFGVR4U2BlmcUg5I3xLlSlYd4TVVX+ZjdpIMju8=; b=Zir30yUTw+kTQhi1ao957BbPXh9vATr3CM3/uUb+gUnpO2eG4WOYoYnotMtjs+yJKh ddr36Cm9C6+vzjcpQ4q/PU5jA7WyY/pPte+UKunrfmywnxboj7O/6wRQ9X7ne8zRKpgi +Wwn1rp9L7TL3AbbAULmkUXOwXNGdccF8LhbKCL2xLKHzG6DtFwpHTZXHDxFXMKrXWld /H9UVsAw4IUdpIJWhdT0RVdFMpqFiZevDVzUuvWhfze8eYnYkQI0aExCJvoYEGMxFJn/ aphMUWbRX4eKh4/qwYPiQ4YQybumU/iSS1MqSFUGaI43F/Po0J/fj4JE/EJ7ZLRZnFTo vHnQ== X-Gm-Message-State: APzg51CdcuDiApFhyBJs+9P6OgszVBJ6arDzfQeFiA2lH13LN5y8hobk f5puOxbWQs7uh3wEYuX/yKO4TCZ7MZw= X-Received: by 2002:a50:86b5:: with SMTP id r50-v6mr1736811eda.201.1536746031759; Wed, 12 Sep 2018 02:53:51 -0700 (PDT) Received: from localhost ([49.248.190.214]) by smtp.gmail.com with ESMTPSA id a19-v6sm481328edd.69.2018.09.12.02.53.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Sep 2018 02:53:50 -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 , Daniel Lezcano , 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 Message-Id: <2900c1006e7e978403b1b95448f9c959c7ae486a.1536744310.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 Reviewed-by: Matthias Kaehlcke Reviewed-by: Bjorn Andersson --- 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