Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5882463imm; Mon, 27 Aug 2018 06:06:20 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZim8SIK2DGuQCn70pPDmG7fqnLc1GwceOoaVpPveyV9PV6NNFojpXA9iQIXUnwbESWPDXI X-Received: by 2002:a62:c8d2:: with SMTP id i79-v6mr14240106pfk.35.1535375180124; Mon, 27 Aug 2018 06:06:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535375180; cv=none; d=google.com; s=arc-20160816; b=LbwaogNN4m71H88P5mwKYuXBcD9TxORFkJ3WodZyn6wmnnNnOZTEm1hF7lYZY8Yxnj YtRSCJOfEJQrF5n7dwHjtX8HDOiw/tirHll0igmpIItCr/YUcuq+Fad6B5wOlykUHLp3 s0a00E0DP6IZkX4kVbwATvojJ4+NIs75kimn8rKOd0J4mPGVARWsVBB2vOS1MTYWcDg6 IyC9Tz8+4oUdXKmxThmygXCwbDFFs84R/lSaiAufaAEWH9lzv2hGKxgkHyvURXMG3fcC dk0upJxBRazDnkzY/bp3ih1YbAl8N5Abj7RI1dZH14cNoPSRv9mS+aLdzmgtz3DZmmoC qRLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=3KFh+SNy5OQ9piD2w7/Sn30dnwpxD1czFrXEAImEM2E=; b=dcwhAIbI0I+c2oldP6D6i6jV2Kv1MdLXpNRvIYgypv6fIRvq6VuUOmKHOXNwXqE/kf 4agHGswR/LN4mN3DcO+fqCUOazBqzjFbTicvNM/oYWst26ble6sx1e6KMx2BZqzI0vKK Q7broqA+9Uec06YbjYpezTuRMPeAQeyQUFhpv41z6phh35kQu55DY013P2y6Q1/4040O gwUj++dakW30UO+hw3Qku/24xrwu5kiqJercHcEcT0iM5mJYXEE/8Oc6JDY5Wyiy5wt8 2ytCX9L3/5wbKby0R/5+r9X2ePyltdkvMVhUsAG4/f7DgBYgXnpamN67ziKSBUyj6Ygx 5Ixw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SejB4gwZ; 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 a64-v6si16408085pfb.224.2018.08.27.06.06.04; Mon, 27 Aug 2018 06:06:20 -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=SejB4gwZ; 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 S1726987AbeH0Qv2 (ORCPT + 99 others); Mon, 27 Aug 2018 12:51:28 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:41530 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726883AbeH0Qv2 (ORCPT ); Mon, 27 Aug 2018 12:51:28 -0400 Received: by mail-qk0-f195.google.com with SMTP id h138-v6so10370715qke.8 for ; Mon, 27 Aug 2018 06:04:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3KFh+SNy5OQ9piD2w7/Sn30dnwpxD1czFrXEAImEM2E=; b=SejB4gwZ8BQmJW3AdfaI8xvvdaaNnurNU8TvbgX+ipcXK/AKAqBIIu21v3lA9u/TLY 5TH8MLaP8QSIm/0v6A5eHfTIYi5zcWOUIcWpy+r5P/Xy7zhBSrepiHiiWe5TGPsw8dNZ ZhqW8Yjfu4jJci2MqWqehSVBEIQ04lg/ITiXM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3KFh+SNy5OQ9piD2w7/Sn30dnwpxD1czFrXEAImEM2E=; b=bxI5uaBnJa8cRXHZz+lqTrSzYQOpk+D0N8CK4e9j092oNVZFHPhVr2oqKMWds4iEuF rtFv52GtXcAZ0G7DPV7qyXLHZc8c8za4AYtvGxlyoC3akAk+hOFgdjUmn5iktJPE98Pn PJfoRtg3cpM6q3y3H4Qy57u8j6ZTJobOz+hC1byNE5FPkoLF/d6rDhW4NoNhtFxYBuNw OHK6uxN7zX5P3cY7CFjz7iMHDSsssrDqaHGEzS5seLtFst5iv+xF124ddLcA4LKUwuS7 6Ly1WEgqbJTU4aZ5aP+mHAlwGrch2itd4U2+o3WwqUvCP6norpRBiBoSYgSx9d6F1jjT 5MdA== X-Gm-Message-State: APzg51DFzTYJXcUITaZqWsuPspqlZ1nGE/oJbImfIIy1BnIZ7mo/EFoL K+sa5l+kZLPEcPLta/qrAOtlbnNzdfZ+xVKgflLilw== X-Received: by 2002:a37:d74b:: with SMTP id m72-v6mr13126923qki.296.1535375091952; Mon, 27 Aug 2018 06:04:51 -0700 (PDT) MIME-Version: 1.0 References: <985ed415774fdac9ac21afad4b4b74f30f6c5068.1533815718.git.amit.kucheria@linaro.org> <20180824233039.GF25163@localhost.localdomain> In-Reply-To: <20180824233039.GF25163@localhost.localdomain> From: Amit Kucheria Date: Mon, 27 Aug 2018 18:34:40 +0530 Message-ID: Subject: Re: [PATCH v1 07/10] thermal: tsens: Check if the IP is correctly enabled by firmware To: Eduardo Valentin Cc: Linux Kernel Mailing List , Rajendra Nayak , linux-arm-msm , Bjorn Andersson , smohanad@codeaurora.org, Andy Gross , Doug Anderson , mka@chromium.org, Zhang Rui , Linux PM list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 25, 2018 at 5:00 AM Eduardo Valentin wrote: > > 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? I've kept it separate because this 'enable' check could've been added to the old code as well, without the separate SROT mapping in patch 6. So in my mind, they're two different things: splitting the address map and adding the 'enable' check and I'd prefer to keep it as it is. > > 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 > >