linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: srinivas.kandagatla@linaro.org (Srinivas Kandagatla)
To: linux-arm-kernel@lists.infradead.org
Subject: a case for a common efuse API?
Date: Wed, 09 Jul 2014 08:50:59 +0100	[thread overview]
Message-ID: <53BCF463.3000604@linaro.org> (raw)
In-Reply-To: <53BC4DD7.20906@codeaurora.org>



On 08/07/14 21:00, Stephen Boyd wrote:
> Hi,
>
> On MSM chips we have some efuses (called qfprom) where we store things
> like calibration data, speed bins, etc. We need to read out data from
> the efuses in various drivers like the cpufreq, thermal, etc. This
> essentially boils down to a bunch of readls on the efuse from a handful
> of different drivers. In devicetree this looks a little odd because
> these drivers end up having an extra reg property (or two) that points
> to a register in the efuse and some length, i.e you see this:
>
> 	thermal-sensor at 34000 {
> 		compatible = "sensor";
> 		reg = <0x34000 0x1000>, <0x10018 0xc>;
> 		reg-names = "sensor", "efuse_calib";
> 	}
>
>
> I imagine in DT we want something more like this:
>
> 	efuse: efuse at 10000 {
> 		compatible = "efuse";
> 		reg = <0x10000 0x1000>;
> 	}
>
> 	thermal-sensor at 34000 {
> 		compatible = "sensor";
> 		reg = <0x34000 0x1000>;
> 		efuse = <&efuse 0x18>;
> 	}
>
>
> Where we can point to the efuse and give an address offset. From code we
> could then call some efuse_read() function to read the sensor's
> calibration data.
>
> It's been suggested that we use syscon for this, but I wonder if that is
> the right thing to do. With a syscon you're usually writing some
> registers that got lumped together with other registers that aren't
> directly related to your driver. It doesn't seem like syscon is made for
> reading fuses or other things like eeproms. Maybe I'm wrong though.
>

I remember there was a similar discussion some time last year about 
this:  https://lkml.org/lkml/2013/7/5/361


> Using syscon would probably work if we could add a way to point to
> offsets within the syscon node (the 0x18 part in the example). In my
> specific use-case the calibration data may have different offsets
> depending on which SoC the hardware is instantiated in so we could also
> make syscon work if the compatible field for the sensor node indicates
> which SoC it is.

Something like this:

	efuse: efuse at 10000 {
  		compatible = "efuse", "syscon";
  		reg = <0x10000 0x1000>;
  	}

  	thermal-sensor at 34000 {
  		compatible = "sensor", "soc-xyz";
  		reg = <0x34000 0x1000>;
		syscon = <&efuse>;
  	}

sensor driver could add of_data for the soc-xyz which would contain soc 
specific efuse offsets.


--srini

>
> I added Tegra folks because I see that on Tegra this hardware is exposed
> via an SoC specific API, tegra_fuse_readl(), and an associated driver in
> drivers/misc/fuse/tegra/. Unfortunately I don't see any users of the API
> outside of the speedo code in the same directory and the sysfs bin
> attribute that may or may not be in use by some userspace code.
>

  parent reply	other threads:[~2014-07-09  7:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08 20:00 a case for a common efuse API? Stephen Boyd
2014-07-08 20:26 ` Olof Johansson
2014-07-08 21:59 ` Bjorn Andersson
2014-07-09  7:24 ` Uwe Kleine-König
2014-07-09  7:50 ` Srinivas Kandagatla [this message]
2014-07-09  8:35 ` Maxime Ripard
2014-07-09 23:32   ` Stephen Boyd
2014-07-10 14:26     ` Maxime Ripard
2014-07-10 15:18       ` Alexandre Belloni
2014-07-10 15:41       ` Grygorii Strashko
2014-07-10 15:09         ` Maxime Ripard
2014-09-11 21:59       ` Stephen Boyd
2014-09-16 10:16         ` Maxime Ripard
2014-07-09 11:49 ` Peter De Schrijver
2014-07-21 15:51   ` Stephen Warren
2014-07-09 20:42 ` Tomasz Figa

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=53BCF463.3000604@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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).