From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5A25C43334 for ; Mon, 3 Sep 2018 20:45:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 779CC20867 for ; Mon, 3 Sep 2018 20:45:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linaro.org header.i=@linaro.org header.b="MedzwDFD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 779CC20867 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728748AbeIDBGz (ORCPT ); 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-Google-Smtp-Source: ANB0VdbtOyt8U+7XLboKU2BLpB5kLelR3uy1QDgzEm3qld49+BqIq5+AIAYQIU0pnCWUulBijzsu3A== 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 > >