From: Felix Brack <fb@ltec.ch>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: nvmem: add driver for Microchip 24AA025E48 I2C eeprom / nodeID chip
Date: Thu, 25 Jan 2018 15:37:31 +0100 [thread overview]
Message-ID: <ffa98f3a-daa3-d2b3-8401-767517db7490@ltec.ch> (raw)
In-Reply-To: <CAMRc=Meer40sHKK5WgKJBQsfB7UhU4jDyahifH9a7SBBGywapw@mail.gmail.com>
On 24.01.2018 17:02, Bartosz Golaszewski wrote:
> 2018-01-24 16:18 GMT+01:00 Felix Brack <fb@ltec.ch>:
>>
>> On 24.01.2018 16:08, Andy Shevchenko wrote:
>>> On Wed, Jan 24, 2018 at 4:23 PM, Felix Brack <fb@ltec.ch> wrote:
>>>> Hello,
>>>>
>>>> About three years ago I wrote a driver for Microchip's 24AA025E48 I2C
>>>> eeprom/nodeID chip. At that time I placed the source files in
>>>> drivers/misc/eeprom. I never posted the code.
>>>> I now plan to rewrite the driver from scratch. Is it correct to place
>>>> the source code in drivers/nvmem and is there a special mailing list to
>>>> which the patch should be posted when ready?
>>>>
>>>> many thanks and kind regards, Felix
>>>
>>> Does the existing driver [1] work for you (if you add ID there)?
>>>
>>> [1]: at24
>>>
>> Yes it does. Actually the driver I wrote 3 years ago is based on the
>> at24 driver. Lot's of code in my driver originates directly from the
>> at24 driver.
>>
>> --
>> regards Felix
>
> Just from looking at the doc - it seems that it's a variant of
> 24mac402. You should be able to access the memory block by
> instantiating an 'atmel,24c02' device. As for the EUI-48 block -
> current at24 driver will not work as the MAC is located at a different
> offset in this chip. We need to figure out a portable way to specify
> the addresses of such special blocks (same with the serial number) in
> the at24 driver.
>
> Anyways - don't write your own driver for that, just make sure at24 works.
>
If no one offends against blowing up this driver by some more code, then
that's fine with me. What about a patch that does the following:
1. Extend the DT bindings by a new optional property block_offset
denoting where to start reading/writing from/to this device.
2. Add a member block_offset to struct at24_platform_data{} to store
the device read/write offset returned from the DT (similar to the
already existing page_size member).
3. Complement at24_get_pdata() to read block_offset from the DT and
store it.
4. Make at24_eeprom_write_i2c() and at24_eeprom_read_serial() (and
eventually more?) respect the block_offset value.
Initializing the new block_offset member of struct at24_platform_data{}
to 0 should leave the code semantically unchanged.
Once this patch is in place I could use the 24mac402 device type with
block_offset set to 0xfa (and read-only set to true) to read the EUI-48
node address from Microchip's 24AA025E48. Probably the later addition of
a device named 24eui48 would also make sense (if not redundant ?).
Any comments are very appreciated, Felix
next prev parent reply other threads:[~2018-01-25 14:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-24 14:23 Felix Brack
2018-01-24 15:08 ` Andy Shevchenko
2018-01-24 15:10 ` Andy Shevchenko
2018-01-24 15:18 ` Felix Brack
2018-01-24 16:02 ` Bartosz Golaszewski
2018-01-25 14:37 ` Felix Brack [this message]
2018-01-25 21:46 ` Bartosz Golaszewski
2018-01-26 16:47 ` Felix Brack
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=ffa98f3a-daa3-d2b3-8401-767517db7490@ltec.ch \
--to=fb@ltec.ch \
--cc=andy.shevchenko@gmail.com \
--cc=brgl@bgdev.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=srinivas.kandagatla@linaro.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
all inboxes | Powered by JetHome®