[PATCH 00/17] RFC for additional 'nvmem' plumbing
Andrey Smirnov
andrew.smirnov at gmail.com
Tue Feb 16 20:20:57 PST 2016
On Tue, Feb 16, 2016 at 7:09 PM, Trent Piepho <tpiepho at kymetacorp.com> wrote:
> On Tue, 2016-02-16 at 17:29 -0800, Andrey Smirnov wrote:
>> Hi everyone,
>>
>> The main purpose of this patchset is propose additional Nvmem plubing
>> needed for that subsytem's inclusion in BB and solicit feedback about
>> it (patches ## 15 to 17) . Included in this set are also a number of
>> bugfixes and RFC-for-bugfixes for problems that were discoverd during
>> development of this patch series.
>>
>> Proposed Nvmem additions are two new platform device drivers that
>> implement a nvmem interface on top of data embedded in DT as well as
>> nvmem interface that allows to combine existing nvmem-accesible bytes
>> into continuous blocks.
>>
>> Below is an example of DT code that uses both drivers in order to
>> create a MAC address as a combination of bytes from DT and OCOTP
>> module:
>
> So for a common case Sasha has pointed out, of the MAC in the opposite
> byte order, one would write:
>
> scatter-gather-blob {
> compatible = "barebox,nvmem-sg";
> #address-cells = <1>;
> #size-cells = <1>;
>
> mac_address: combined-bits {
> reg = <0 6>;
> layout = <&fec_mac_address 5 1
> &fec_mac_address 4 1
> &fec_mac_address 3 1
> &fec_mac_address 2 1
> &fec_mac_address 1 1
> &fec_mac_address 0 1>;
> };
> };
>
> &ocotp {
> #address-cells = <1>;
> #size-cells = <1>;
>
> fec_mac_address: mac_address at 88 {
> reg = <0x88 0x8>;
> };
> };
>
> &fec {
> ?mac-address-location?? = <&mac_address>;
> };
>
mac_address is still a nvmem cell, so the DT code for FEC would remain the same:
&fec {
nvmem-cells = <&mac_address>;
nvmem-cell-names = "mac-address";
}
> I suppose that's a very powerful system, but it does seem a bit
> cumbersome.
I agree, those bindings don't really make me glow with pride because
of their elegance, but unfortunately I wasn't able to come up with
anything better that would be as generic and not tied into a
particular use case of MAC address manipulation.
More information about the barebox
mailing list