lkml.org 
[lkml]   [2020]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] eeprom: at25: set minimum read/write access stride to 1
Date
On Tuesday, 28 July 2020, 13:20:15 CEST, David Laight wrote:
> From: Christian Eggers
>
> > &spi {
> > ....
> > fram: fram@0 {
> > ...
> > mac_address_fec2: mac-address@126 {
> > reg = <0x126 6>;
> > };
> > ...
> > };
> > };
>
>
> Hmmmm.... the 'stride' only constrains the alignment of 'cells'.
> (ie address ranges from the device tree.)

My mac-address is not aligned to 4 bytes...

> It looks as though you can open the entire NVMEM device and
> then do reads from byte offsets.
> The 'stride' and 'word_size' are then not checked!

When I set back the stride to 4, I get the following errors:
[ 6.998788] 000: nvmem spi0.00: cell mac-address unaligned to nvmem stride 4
[ 6.998902] 000: at25: probe of spi0.0 failed with error -22
...
[ 7.146454] 000: fec 20b4000.ethernet: Invalid MAC address: 00:00:00:00:00:00
[ 7.146480] 000: fec 20b4000.ethernet: Using random MAC address: 6e:9d:37:49:6d:15

> Actually it might be that before 01973a01f9ec3 byte aligned
> 'cells' were allowed.

I use linux-5.4.x (latest), the mentioned patch has been included long time ago.

regards
Christian



\
 
 \ /
  Last update: 2020-07-28 14:14    [W:0.354 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site