From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: "linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Bjorn Andersson <bjorn.andersson@sonymobile.com>,
Stephen Warren <swarren@nvidia.com>,
Peter De Schrijver <pdeschrijver@nvidia.com>,
Arnd Bergmann <arnd@arndb.de>,
"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: a case for a common efuse API?
Date: Thu, 10 Jul 2014 16:26:16 +0200 [thread overview]
Message-ID: <20140710142616.GD27469@lukather> (raw)
In-Reply-To: <53BDD0F3.7040906@codeaurora.org>
[-- Attachment #1: Type: text/plain, Size: 3212 bytes --]
On Wed, Jul 09, 2014 at 04:32:03PM -0700, Stephen Boyd wrote:
> On 07/09/14 01:35, Maxime Ripard wrote:
> > Hi Stephen,
> >
> > On Tue, Jul 08, 2014 at 01:00:23PM -0700, 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@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@10000 {
> >> compatible = "efuse";
> >> reg = <0x10000 0x1000>;
> >> }
> >>
> >> thermal-sensor@34000 {
> >> compatible = "sensor";
> >> reg = <0x34000 0x1000>;
> >> efuse = <&efuse 0x18>;
> >> }
> > We have pretty much the same things in the Allwinner SoCs. We have an
> > efuse directly mapped into memory, with a few informations like a MAC
> > address, the SoC ID, the serial number, some RSA keys for the device,
> > etc.
> >
> > The thing is, some boards expose these informations in an external
> > EEPROM as well.
> >
> > I started working and went quite far to create an "eeprom" framework
> > to handle these cases, with a dt representation similar to what you
> > were exposing.
> >
> > https://github.com/mripard/linux/tree/eeprom-framework-at24
> >
> > It was working quite well, I was about to send it, but was told that I
> > should all be moved to MTD, and given up on it.
>
> Did anything ever get merged? Or the whole thing was dropped?
Nope, I just never posted it. I could send it as an RFC though, and
see what are the feedbacks.
> That branch looks like what I want, assuming we could get an agreement
> on the binding. It looks like pretty much every SoC has this, and there
> isn't any API or binding for it that I've seen. The only thing I see is
> Documentation/devicetree/bindings/eeprom.txt and that doesn't cover the
> client aspect at all.
>
> Taking a quick peek at the code, it might be better to change the read
> API to take a buffer and length, so that the caller doesn't need to free
> the data allocated by the eeprom layer. It also makes it symmetrical
> with the write API. We'd probably also need to make it work really early
> for SoC's like Tegra where we want to read the SoC revision early. So
> probably split off the device registration part to a later time to allow
> register() to be called early.
I guess that the kind of things we could discuss after posting these
patches, but yep, it looks reasonnable.
I'll try to get things a bit cleaner, and post them in the next days.
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: maxime.ripard@free-electrons.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: a case for a common efuse API?
Date: Thu, 10 Jul 2014 16:26:16 +0200 [thread overview]
Message-ID: <20140710142616.GD27469@lukather> (raw)
In-Reply-To: <53BDD0F3.7040906@codeaurora.org>
On Wed, Jul 09, 2014 at 04:32:03PM -0700, Stephen Boyd wrote:
> On 07/09/14 01:35, Maxime Ripard wrote:
> > Hi Stephen,
> >
> > On Tue, Jul 08, 2014 at 01:00:23PM -0700, 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>;
> >> }
> > We have pretty much the same things in the Allwinner SoCs. We have an
> > efuse directly mapped into memory, with a few informations like a MAC
> > address, the SoC ID, the serial number, some RSA keys for the device,
> > etc.
> >
> > The thing is, some boards expose these informations in an external
> > EEPROM as well.
> >
> > I started working and went quite far to create an "eeprom" framework
> > to handle these cases, with a dt representation similar to what you
> > were exposing.
> >
> > https://github.com/mripard/linux/tree/eeprom-framework-at24
> >
> > It was working quite well, I was about to send it, but was told that I
> > should all be moved to MTD, and given up on it.
>
> Did anything ever get merged? Or the whole thing was dropped?
Nope, I just never posted it. I could send it as an RFC though, and
see what are the feedbacks.
> That branch looks like what I want, assuming we could get an agreement
> on the binding. It looks like pretty much every SoC has this, and there
> isn't any API or binding for it that I've seen. The only thing I see is
> Documentation/devicetree/bindings/eeprom.txt and that doesn't cover the
> client aspect at all.
>
> Taking a quick peek at the code, it might be better to change the read
> API to take a buffer and length, so that the caller doesn't need to free
> the data allocated by the eeprom layer. It also makes it symmetrical
> with the write API. We'd probably also need to make it work really early
> for SoC's like Tegra where we want to read the SoC revision early. So
> probably split off the device registration part to a later time to allow
> register() to be called early.
I guess that the kind of things we could discuss after posting these
patches, but yep, it looks reasonnable.
I'll try to get things a bit cleaner, and post them in the next days.
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140710/7e3b54ab/attachment-0001.sig>
next prev parent reply other threads:[~2014-07-10 14:30 UTC|newest]
Thread overview: 35+ 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:00 ` Stephen Boyd
2014-07-08 20:26 ` Olof Johansson
2014-07-08 20:26 ` Olof Johansson
2014-07-08 21:59 ` Bjorn Andersson
2014-07-08 21:59 ` Bjorn Andersson
[not found] ` <53BC4DD7.20906-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2014-07-09 7:24 ` Uwe Kleine-König
2014-07-09 7:24 ` Uwe Kleine-König
2014-07-09 7:24 ` Uwe Kleine-König
2014-07-09 7:50 ` Srinivas Kandagatla
2014-07-09 7:50 ` Srinivas Kandagatla
2014-07-09 8:35 ` Maxime Ripard
2014-07-09 8:35 ` Maxime Ripard
2014-07-09 23:32 ` Stephen Boyd
2014-07-09 23:32 ` Stephen Boyd
2014-07-10 14:26 ` Maxime Ripard [this message]
2014-07-10 14:26 ` Maxime Ripard
2014-07-10 15:18 ` Alexandre Belloni
2014-07-10 15:18 ` Alexandre Belloni
2014-07-10 15:41 ` Grygorii Strashko
2014-07-10 15:41 ` Grygorii Strashko
[not found] ` <53BEB443.9000606-l0cyMroinI0@public.gmane.org>
2014-07-10 15:09 ` Maxime Ripard
2014-07-10 15:09 ` Maxime Ripard
2014-07-10 15:09 ` Maxime Ripard
2014-09-11 21:59 ` Stephen Boyd
2014-09-11 21:59 ` Stephen Boyd
2014-09-16 10:16 ` Maxime Ripard
2014-09-16 10:16 ` Maxime Ripard
2014-07-09 11:49 ` Peter De Schrijver
2014-07-09 11:49 ` Peter De Schrijver
[not found] ` <20140709114907.GI23218-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2014-07-21 15:51 ` Stephen Warren
2014-07-21 15:51 ` Stephen Warren
2014-07-21 15:51 ` Stephen Warren
2014-07-09 20:42 ` Tomasz Figa
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=20140710142616.GD27469@lukather \
--to=maxime.ripard@free-electrons.com \
--cc=arnd@arndb.de \
--cc=bjorn.andersson@sonymobile.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pdeschrijver@nvidia.com \
--cc=sboyd@codeaurora.org \
--cc=swarren@nvidia.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.