Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1943486imm; Mon, 3 Sep 2018 13:46:22 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYEVI2a7j/i7vxlP7hFNY39qmZjIOGNYd+XFx6s98HgrFPOsuYocF4HZRYLBqix9m4ITzpl X-Received: by 2002:a63:6604:: with SMTP id a4-v6mr27756165pgc.404.1536007582854; Mon, 03 Sep 2018 13:46:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536007582; cv=none; d=google.com; s=arc-20160816; b=b4JhhKlTVNg3OgWC+abmlAPxBybrBGiIxjnTUGZnvMzVdY6cMn5gLeU/bf2BH4ut2z cS/NaI3jM1sMkpyv//tTBBxaMYOW6MxbK90da2ZFTP1qjyhN72bQZ2azzBH3FHTp2flY E+mRLcnfFGxOApfSUPdTekkj7K4nw5h/2swMOijKSRqM2aOajOHJzZLUOtkhQwOv1K1/ O+R85jIY4gVvMkwJpUQoYj3Us0C3jwS6ag7C4Nqrx4Ia+XbA1ay/E2kkCZvasVXAfz6j qFZIP7xaVXKvvzfeBDlYA4qbRmNr69fgtg/oJVenplJvWoEXk56KMejbB5ddAc5wFfp9 fjjg== 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=Ve5R3th1vu+5LlT7qqH11xMqXyfo++mt/ogphfUxGJU=; b=Y+VHzv/fqkLWWOuvm0CsCBgc8n8Hq5QPSoDYdkxL/iyR7AVjFm9jNqEnuhDcpEljPH daoDDLWc2bTG1zCbhkhAMK6wI/+of8qWYc+dilFD0ffTLgyNscBi9EuWVRDSsRrwkimg PsVH5LAiqpNZTDt4a/gXPNsfQ+rVm7KAXhiH8gfHRqWbo5iwiBNwU5An0G7flyq/yZ7u yt7etAPRepLMaHbuFfRF2F/qVe+bmWm/SlU6TSnfbcjJ0I/khPYM71o2q6YM7mPCz3An HfW12qBHGupot8XhnlgZ9FpULwTPmfenkfDC0hE2bodNzxcUeVG1COriJNQDNul0das3 SLMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MedzwDFD; 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 y185-v6si18032866pgb.219.2018.09.03.13.46.07; Mon, 03 Sep 2018 13:46:22 -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=MedzwDFD; 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 S1728713AbeIDBGz (ORCPT + 99 others); Mon, 3 Sep 2018 21:06:55 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:39021 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728386AbeIDBGz (ORCPT ); Mon, 3 Sep 2018 21:06:55 -0400 Received: by mail-pg1-f194.google.com with SMTP id i190-v6so588886pgc.6 for ; Mon, 03 Sep 2018 13:45:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Ve5R3th1vu+5LlT7qqH11xMqXyfo++mt/ogphfUxGJU=; b=MedzwDFDGZ7n8gzpqxVX3aYK1QE+XmhR/PHTVkFiERCTi7aEkDiHCOR9Kbhv2EX4iD DVVI3uQqQUgTZmz7nEKIdimORfVXkoIosfX0zQHggAoRWBiEIs8kk6oYHacshyEjBvtt jBEDvwd9D/zS1WAK1n7+GiWpt1vnkPjPhG/XI= 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=Ve5R3th1vu+5LlT7qqH11xMqXyfo++mt/ogphfUxGJU=; b=Lll1B/X7MRXFZ6XVyHdgO3bde+n7LwEi8xUEJ3FioG4/tZ5FFn+Tyi4T0c46ED0OHe 5CUDJ10CroMTSDThHw/DDy0T+fOJDn1UNKHxqhQ5JUmVeet7yWOOnqbYned2EOT9LbfJ Hu0Y2174aYMu5XUMpPS7gVq3rQ9F/q8AWrtdDInqFdL/pzYLH1d5iET3Y33ZjNpNV7J5 TuifMwNvD6aFG0QSFqfUVx1FE9ywHSLJgGv0tmBDlZEIlBsv6v22dJfUauwUI1v8+iuF HZdqZabsNxbQxCU1wueCR+uRY99uCIqEnMOaZIXz+cyKB03bb4HoMnThBoi8Fce+4qO0 PMYw== X-Gm-Message-State: APzg51DB63xuAPwgxdEIy628R994b3Ttw54hxhCyuGN8JNNhm5CBxHUH vooxVLbxxPJMCrR+1+pkAizn34y21o0= X-Received: by 2002:a62:4898:: with SMTP id q24-v6mr31717402pfi.22.1536007500772; Mon, 03 Sep 2018 13:45:00 -0700 (PDT) Received: from tuxbook-pro (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id y85-v6sm29793501pfa.170.2018.09.03.13.44.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Sep 2018 13:45:00 -0700 (PDT) Date: Mon, 3 Sep 2018 13:48:55 -0700 From: Bjorn Andersson To: Amit Kucheria Cc: LKML , Rajendra Nayak , linux-arm-msm , Eduardo Valentin , smohanad@codeaurora.org, Andy Gross , Douglas Anderson , Matthias Kaehlcke , Zhang Rui , Daniel Lezcano , Linux PM list Subject: Re: [PATCH v2 08/11] thermal: tsens: Check if the IP is correctly enabled by firmware Message-ID: <20180903204855.GB1437@tuxbook-pro> References: <35c332750fe1eddfa2eb53750b810256310866bd.1535462942.git.amit.kucheria@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 30 Aug 12:23 PDT 2018, Amit Kucheria wrote: > On Tue, Aug 28, 2018 at 7:08 PM, 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. > > > > Signed-off-by: Amit Kucheria > > Reviewed-by: Matthias Kaehlcke > > --- > > 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 > > This OFFSET is not constant across the TSENS family and breaks atleast > one platform in the test below. I have a patch to fix this for all > platforms, will post it after a bit more testing. > Afaict the other 10 patches can be merged independently of this patch. So please make the minor updates and resend them as a separate series, with the acks/reviews, to make it easier for Eduardo to just pick them. Regards, Bjorn > > > +#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 > >