linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amit Kucheria <amit.kucheria@linaro.org>
To: Eduardo Valentin <edubezval@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Rajendra Nayak <rnayak@codeaurora.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	smohanad@codeaurora.org, Andy Gross <andy.gross@linaro.org>,
	Doug Anderson <dianders@chromium.org>,
	mka@chromium.org, Zhang Rui <rui.zhang@intel.com>,
	Linux PM list <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v1 07/10] thermal: tsens: Check if the IP is correctly enabled by firmware
Date: Mon, 27 Aug 2018 18:34:40 +0530	[thread overview]
Message-ID: <CAP245DV282a-WW6KfaZM8JuSUgWTJtUQJOULXHviR4_cKTen8A@mail.gmail.com> (raw)
In-Reply-To: <20180824233039.GF25163@localhost.localdomain>

On Sat, Aug 25, 2018 at 5:00 AM Eduardo Valentin <edubezval@gmail.com> 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 <amit.kucheria@linaro.org>
> > ---
> >  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 <linux/regmap.h>
> >  #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
> >

  reply	other threads:[~2018-08-27 13:04 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09 12:32 [PATCH v1 00/10] Another round of tsens cleanups Amit Kucheria
2018-08-09 12:32 ` [PATCH v1 01/10] arm/arm64: dts: msm8974/msm8916: thermal: Split address space into two Amit Kucheria
2018-08-09 19:10   ` Matthias Kaehlcke
2018-08-10  4:50     ` Amit Kucheria
2018-08-24 23:21   ` Eduardo Valentin
2018-08-24 23:27   ` Eduardo Valentin
2018-08-27 12:54     ` Amit Kucheria
2018-08-09 12:32 ` [PATCH v1 02/10] dt-bindings: thermal: Fix a typo in documentation Amit Kucheria
2018-08-09 19:16   ` Matthias Kaehlcke
2018-08-13 21:49   ` Rob Herring
2018-08-24 23:24   ` Eduardo Valentin
2018-08-31  8:14     ` Daniel Lezcano
2018-08-09 12:32 ` [PATCH v1 03/10] thermal: tsens: Add SPDX license identifiers Amit Kucheria
2018-08-09 19:19   ` Matthias Kaehlcke
2018-08-09 12:32 ` [PATCH v1 04/10] thermal: tsens: Get rid of dead code Amit Kucheria
2018-08-09 19:23   ` Matthias Kaehlcke
2018-08-09 12:32 ` [PATCH v1 05/10] thermal: tsens: Rename map field in order to add a second address map Amit Kucheria
2018-08-09 19:32   ` Matthias Kaehlcke
2018-08-09 12:32 ` [PATCH v1 06/10] thermal: tsens: Add the SROT " Amit Kucheria
2018-08-09 19:46   ` Matthias Kaehlcke
2018-08-09 12:32 ` [PATCH v1 07/10] thermal: tsens: Check if the IP is correctly enabled by firmware Amit Kucheria
2018-08-09 20:37   ` Matthias Kaehlcke
2018-08-24 23:30   ` Eduardo Valentin
2018-08-27 13:04     ` Amit Kucheria [this message]
2018-08-09 12:32 ` [PATCH v1 08/10] thermal: tsens: Get rid of 'id' field Amit Kucheria
2018-08-09 20:55   ` Matthias Kaehlcke
2018-08-09 12:32 ` [PATCH v1 09/10] arm64: dts: qcom: Add reg-names for all tsens nodes Amit Kucheria
2018-08-09 21:05   ` Matthias Kaehlcke
2018-08-09 12:32 ` [PATCH v1 10/10] MAINTAINERS: Add entry for Qualcomm TSENS thermal drivers Amit Kucheria
2018-08-09 21:08   ` Matthias Kaehlcke
2018-08-14  5:11   ` Rajendra Nayak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP245DV282a-WW6KfaZM8JuSUgWTJtUQJOULXHviR4_cKTen8A@mail.gmail.com \
    --to=amit.kucheria@linaro.org \
    --cc=andy.gross@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=dianders@chromium.org \
    --cc=edubezval@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=rnayak@codeaurora.org \
    --cc=rui.zhang@intel.com \
    --cc=smohanad@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).