From patchwork Wed Sep 12 09:52:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10597275 X-Patchwork-Delegate: eduardo.valentin@ti.com 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 C4046920 for ; Wed, 12 Sep 2018 09:54:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2F1A29832 for ; Wed, 12 Sep 2018 09:54:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A44392982F; Wed, 12 Sep 2018 09:54:00 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 3C9D62982F for ; Wed, 12 Sep 2018 09:54:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727686AbeILO5k (ORCPT ); Wed, 12 Sep 2018 10:57:40 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:34208 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727650AbeILO5j (ORCPT ); Wed, 12 Sep 2018 10:57:39 -0400 Received: by mail-ed1-f67.google.com with SMTP id u1-v6so1276997eds.1 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=DjBFY5fz/neIx87YRogbaVeV0XR3e8uYJgG4IiopcCworWOnbtyEpgVt9QjITqN7EP bNlXooTIdw5NsgAzW1ZeLbFiQVu1/Eg+ESqxnTcXZp9nYkz7hn0f5J6HRX7uAKOIwrBU 1SJsEK15BF0RDTOz1rm6usGFSBQTL0nDKBvZZl2lrVbKB4fKb2QIkApen4L1g4D1b9Ti l6V+ri1sD08RUqxRpasB4mykkrMnwrbfbe6hKutxhmvcrO9wo2AA7zN1aXoMMrivuEAX YiUAcv3L0B3/0aQopgWQpcK/yKsob3rhLFZeHW46LrNGNMitJSiA27fL0k8nTRd1Rnur 15cw== X-Gm-Message-State: APzg51CltF2kEy2gAhix4EPeyb0OliW/6y4p1vwsVxybeZcc0yvQR53o GFirY7zGR8T+Mry9dYZy6fx3EMvtgGc= X-Google-Smtp-Source: ANB0VdYlqb3HRo8aP5ClmwxcBK3IK1VPxxiE7ngroUoagHKqfYqJNBJLtL7vp8BYdd9dEVfZHNLKRA== 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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 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;