From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Trent Piepho <tpiepho@kymetacorp.com>
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>
Subject: Re: [RESEND RFC 2/3] nvmem: Add 'nvmem-blob' driver
Date: Wed, 9 Mar 2016 11:13:39 +0100 [thread overview]
Message-ID: <20160309101339.GN8418@lukather> (raw)
In-Reply-To: <1457479515.25961.162.camel@rtred1test09.kymeta.local>
[-- Attachment #1: Type: text/plain, Size: 2970 bytes --]
On Tue, Mar 08, 2016 at 11:24:33PM +0000, Trent Piepho wrote:
> On Tue, 2016-03-08 at 14:46 -0800, Andrey Smirnov wrote:
> > >> I don't think I understand what you mean, could you give me an example
> > >> of how I'd use local-mac-address property for that use case? AFAIK,
> > >> local-mac-address is just an array of bytes embedded into device tree,
> > >
> > > Well, yeah, but the nvmem-blob is also just an array of bytes embedded
> > > into the DT, right?
> >
> > One is accessible via "nvmem" API and the other one isn't.
> >
> > >
> > >> how would it get populated with data from OTP memory of SoC?
> > >
> > > In the bootloader, or Linux, read the OTP, patch the DT to add that
> > > node, done.
> >
> > No, it's not really "done", because if you read my previous messages,
> > "read the OTP, patch the DT" is exactly the problem I am trying to
> > solve. The overall goal is to be able to read a certain "nvmem" cell
> > and patch DT with that data as MAC address, however in it's current
> > incarnation "nvmem" doesn't have provisions to make cells that are
> > just combination of other cells (patch #3) and to embed certain data
>
> So I did something that solved this a few years ago for another board
> and embedded the data into the local-mac-address property.
>
> I think maybe the problem isn't here isn't clear. For some boards
> (mxs), only part of a MAC address is stored in nvmem while the rest of
> the address is fixed data. Currently embedded in the kernel source,
> though embedded in the device tree would clearly be better. While
> splitting the MAC into two locations like this is not, at least in my
> opinion, the best design, it's burned into the one time programmable
> memory so there's not much that can be done.
>
> The kernel looks for 'mac-address' and then 'local-mac-address', with
> the former having precedence.
>
> So what I did was embed the fixed portion in 'local-mac-address', have
> the bootloader extract the variable part from nvmem, and then combine
> the two and place it into 'mac-address' for the kernel to use.
I guess another solution would be to deal with that at the driver
level. Read the 3 last bytes from the OTP, add the MAC prefix and give
that to the net framework without looking it up in the DT. The MAC
prefix could even be changed then through a kernel parameter, which is
not possible currently.
> My DT binding that described the placement of data from nvmem into the
> MAC used a permutation list instead of a series of ranges. So a list
> like [0 0 0 1 2 3] could be used to specify the first three bytes of the
> mac address do not come from nvmem. This also allows changing byte
> order concisely. But doesn't scale well to larger regions.
Is your code / binding doc somewhere for reference ?
Thanks,
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 --]
next prev parent reply other threads:[~2016-03-09 10:13 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-01 16:59 [RESEND RFC 0/3] Proposed extensions for NVMEM Andrey Smirnov
2016-03-01 16:59 ` [RESEND RFC 1/3] nvmem: Add 'of_nvmem_cell_from_device_node()' Andrey Smirnov
2016-03-02 13:58 ` Srinivas Kandagatla
2016-03-02 18:11 ` Andrey Smirnov
2016-03-01 16:59 ` [RESEND RFC 2/3] nvmem: Add 'nvmem-blob' driver Andrey Smirnov
2016-03-02 13:58 ` Srinivas Kandagatla
2016-03-02 17:21 ` Andrey Smirnov
2016-03-07 8:18 ` Maxime Ripard
2016-03-08 4:07 ` Andrey Smirnov
2016-03-08 22:28 ` Maxime Ripard
2016-03-08 22:46 ` Andrey Smirnov
2016-03-08 23:24 ` Trent Piepho
2016-03-09 10:13 ` Maxime Ripard [this message]
2016-03-09 19:50 ` Trent Piepho
2016-03-09 9:58 ` Maxime Ripard
2016-03-09 17:04 ` Andrey Smirnov
2016-03-09 7:59 ` Sascha Hauer
2016-03-01 16:59 ` [RESEND RFC 3/3] nvmem: Add 'nvmem-composite' driver Andrey Smirnov
2016-03-02 13:59 ` Srinivas Kandagatla
2016-03-02 18:33 ` Andrey Smirnov
2016-03-17 11:26 ` Srinivas Kandagatla
2016-03-21 16:12 ` Andrey Smirnov
2016-03-21 16:56 ` Srinivas Kandagatla
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=20160309101339.GN8418@lukather \
--to=maxime.ripard@free-electrons.com \
--cc=andrew.smirnov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=srinivas.kandagatla@linaro.org \
--cc=tpiepho@kymetacorp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox