Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3391038imm; Fri, 24 Aug 2018 16:32:09 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZsj37esa8Ih0q2nY41PFYePkq6filMH+NkvzFwDtLiH10/Yzv5YxOX5/IIOztWQRO4dEIF X-Received: by 2002:a62:ba0b:: with SMTP id k11-v6mr3942741pff.171.1535153529844; Fri, 24 Aug 2018 16:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535153529; cv=none; d=google.com; s=arc-20160816; b=GIQaeU+VrWA+IV8KXhE1kgpA1BEBresaUgFvZIxP+cvivC4ztRcPLTP6vL67XhGony 8xAREN4CeZESt7fjv6Of29MyFQFb2tlUg4K9UxJ6vSdSSnr/3cI9QGCzg7LY+BmySwwe 2BXs92Kymy0mzLfj0YAPvvV8p7b32V98IBNKf+R7F5G/+iaqeKB8ZHu/DYbT3EV/lEYS FKR1jYlopeSYThmU78zQPj2p9exUAunwLpfcOK7ehLBIx6zQ51PKZsBNg+Hf+4YTbx5z wRyOC+XnpGG7nQf9lt9xvY6JDn8I+B8cZV696iSPuf9sIPcn5ENZ7ywiOwSkEWhHvsq7 BEsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=xzisnbfc26vkGabzdj2vUCHH8y+m++S7Mn1QAoBjw/4=; b=PAC+EGwAav0OnGZkzrzQ1QTKxSnlMBtMkW3FOrWFPj20EQk/lq24AlmNqEMs/3zO0o bQe8/BzK0jYHbgNxFvExy8cNKNE5YxLhRb7U/T691Os0T/sAVp4Pq4JkLMEzwA8eWSWm +OyzzpY66mOsaen0M1Ek1t5xCQXeqByiHv4U2sEIhR54jfwg08WaAqUyi6Yk23hyMrdR L+pQ10X9YBy+8pmHOd+GCgG5G9GbLwTvrwmhKxcP0+JYdbmCRxF/luxgssl6HXvZmB2i o0OvKcF8F1Q7oTqXay0bHYHfD/kYG3xOoKWS8eupTHtOhFsqnYztlkv4XAN3szHuo1BI 358A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=skD0hSN1; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 15-v6si7738475pld.157.2018.08.24.16.31.53; Fri, 24 Aug 2018 16:32:09 -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=@gmail.com header.s=20161025 header.b=skD0hSN1; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727112AbeHYDHd (ORCPT + 99 others); Fri, 24 Aug 2018 23:07:33 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:43889 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726860AbeHYDHd (ORCPT ); Fri, 24 Aug 2018 23:07:33 -0400 Received: by mail-pf1-f195.google.com with SMTP id j26-v6so5188649pfi.10; Fri, 24 Aug 2018 16:30:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=xzisnbfc26vkGabzdj2vUCHH8y+m++S7Mn1QAoBjw/4=; b=skD0hSN1sBG0vhXC3rnpRD3RFP1VV5s7B3FxvnRZWuo8XPDtOhSds0Jiayrhz0pZKS CNKX7+A8gMICKWaTDdPAZxwLqnu4hyAGX+c5fY+NJ9UOO2gMAl0ZBbBxIrfWkXEJKG2h a57rH+D7vIfwkFiJwHl2qH7GMcguyJfibk9iQxM9gjXZqNcmCWEK2ekzDaI+O+mAswjE dftZ1rYWOGemeREdEq/niySuOYB6x2M492sK6aCrVtz7LIUQBM95R4CG5JG0z5bD1UpZ F93weBS9Miur/Kn/pzGxp8yvbyZ/sGp1hGgl4lRJ/y7gT2b44jzy7LFLPar0kdhseyZu Dh/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=xzisnbfc26vkGabzdj2vUCHH8y+m++S7Mn1QAoBjw/4=; b=tVHXznJI2cDv87NVDqHyGp95U+8qLJsCLVA2oCiVpTgZso4j6hI9NxP2xlDLwZy93h 87PKpwaokPrKJl5TsUxPvc/+631JEo4HFv96ZIQu1hIToGdo04UIPV3J9v6Hh2nPJLBw FC2uJJYWF5Vw3geQjArKpbOhTigZm+OQYoRnw4x6NYT6KR5kjNT9F0rtnAIRkqyAhc7v SJFvdKFhMFNObVQb6bPA7Nfb+lavYiOkWc5ngYnIdNGeCcxtIlj1FWdGI0RpN0XNRse9 EZyrYViYBtcsv6TieUeyRybEbgfkWo8wOEBoy3WaYmodCjAF5pLP0+1OPnRLtfg3teBb 7cEQ== X-Gm-Message-State: APzg51A0ozt4IBuPNBp8xnqczSC7HMOkg7UUrIjy+yp5NdUP6t3nWOkY B3s6ZjSM7KUQphSpx0xDNdo= X-Received: by 2002:a62:d8c7:: with SMTP id e190-v6mr3948351pfg.88.1535153446836; Fri, 24 Aug 2018 16:30:46 -0700 (PDT) Received: from localhost.localdomain ([2601:644:8201:32e0:7256:81ff:febd:926d]) by smtp.gmail.com with ESMTPSA id t17-v6sm16589783pfm.138.2018.08.24.16.30.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Aug 2018 16:30:46 -0700 (PDT) Date: Fri, 24 Aug 2018 16:30:41 -0700 From: Eduardo Valentin To: Amit Kucheria Cc: linux-kernel@vger.kernel.org, rnayak@codeaurora.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, smohanad@codeaurora.org, andy.gross@linaro.org, dianders@chromium.org, mka@chromium.org, Zhang Rui , linux-pm@vger.kernel.org Subject: Re: [PATCH v1 07/10] thermal: tsens: Check if the IP is correctly enabled by firmware Message-ID: <20180824233039.GF25163@localhost.localdomain> References: <985ed415774fdac9ac21afad4b4b74f30f6c5068.1533815718.git.amit.kucheria@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <985ed415774fdac9ac21afad4b4b74f30f6c5068.1533815718.git.amit.kucheria@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 09, 2018 at 06:02:39PM +0530, Amit Kucheria wrote: > The SROT registers are initialised by the secure firmware at boot. We > don't have write access to the registers. Check if the block is enabled > before continuing. > Should this be merged to patch 6? > Signed-off-by: Amit Kucheria > --- > drivers/thermal/qcom/tsens-common.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c > index 0b8a793f15f4..d250b757d1f0 100644 > --- a/drivers/thermal/qcom/tsens-common.c > +++ b/drivers/thermal/qcom/tsens-common.c > @@ -12,6 +12,11 @@ > #include > #include "tsens.h" > > +/* SROT */ > +#define CTRL_OFFSET 0x4 > +#define TSENS_EN BIT(0) > + > +/* TM */ > #define STATUS_OFFSET 0x30 > #define SN_ADDR_OFFSET 0x4 > #define SN_ST_TEMP_MASK 0x3ff > @@ -119,6 +124,8 @@ int __init init_common(struct tsens_device *tmdev) > { > void __iomem *tm_base, *srot_base; > struct resource *res; > + u32 code; > + int ret; > struct platform_device *op = of_find_device_by_node(tmdev->dev->of_node); > > if (!op) > @@ -151,5 +158,15 @@ int __init init_common(struct tsens_device *tmdev) > if (IS_ERR(tmdev->tm_map)) > return PTR_ERR(tmdev->tm_map); > > + if (tmdev->srot_map) { > + ret = regmap_read(tmdev->srot_map, CTRL_OFFSET, &code); > + if (ret) > + return ret; > + if (!(code & TSENS_EN)) { > + dev_err(tmdev->dev, "tsens device is not enabled\n"); > + return -ENODEV; > + } > + } > + > return 0; > } > -- > 2.17.1 >