Add official support for the ST M24 I2C EEPROM series#73136
Add official support for the ST M24 I2C EEPROM series#73136benediktibk wants to merge 4 commits intozephyrproject-rtos:mainfrom
Conversation
44ed1b3 to
d711611
Compare
erwango
left a comment
There was a problem hiding this comment.
Thanks for digging into this direction, but adequate use of dts should help getting things more simple.
dts/bindings/mtd/st,m24c04-a125.yaml
Outdated
There was a problem hiding this comment.
Do we actually need to have all these "non-compatible" compatibles using fixed properties?
What about a more generic st,m24xxx compatible ?
Aim it to document that a class of devices is supported and show how to configure it.
There was a problem hiding this comment.
I would rather prefer to be specific, as this has multiple advantages:
- If I only document the proper usage, I still have to add some text which has to be maintained. And usually documentation gets forgotten during updates and changes and it is therefore more likely be incorrect in the future.
- This adds a build time check, which avoids improper use and therefore frustration and bugs in real applications. And as the hardware won't change anymore I think this is worth the effort.
- Having a very generic compatible brought us to the current situation. From my experience it is rather handy on the first sight to add a more generic compatible, but in the end hardware vendors tend to do all kind of weird stuff with their hardware identifiers. There might not be something currently in the range of st,m24xxx which is incompatible with this driver, but I wouldn't bet on this to be true in the future as well.
- It is more clear to a user which compatible should be used for which IC in the hardware design.
d711611 to
c497304
Compare
henrikbrixandersen
left a comment
There was a problem hiding this comment.
NAK. This will become a maintenance nightmare given all the different, compatible EEPROMs out there. I wish you had approached me before embarking on this.
Is the NACK for only the IC specific compatibles, or the complete approach? Because I wouldn't be a big fan of having a more generic st,m24xxx (as explained here #73136 (comment)), but I would consider this still be better than the current status. |
I really do not see an issue with the current compatible and I would not want to add a bunch of vendor-specific aliases for this. As mentioned earlier, I believe this can be solved by improving the documentation on how to configure serial EEPROMs in Zephyr. I plan on starting this work prior to v3.7.0. |
Unfortunately I will have to disagree, because as a user it is rather confusing to use the compatible of A for B. I'm not convinced that documentation will solve this issue. On top of that, having build time checks and therefore a mechanism to fail early avoids a lot of issues in the long run. |
|
I like the comment of @erwango, put a generic compatible at the end if the list? |
c497304 to
17b6ff5
Compare
|
But anyway, @henrikbrixandersen is strongly against this, he prefers to stick to only the historical binding of atmel,at24 as it preceeds the reimplementation by other vendors and wants to avoid the confusion with additional documentation. Please correct me, if I am (unintentionally) citing you incorrectly. |
No, that is correct. |
@henrikbrixandersen I understand your position, but what would you propose to explicit the fact that |
|
I tend to agree, there are ongoing discussions whether to rename |
My plan is to add a documentation page under https://docs.zephyrproject.org/latest/hardware/peripherals/eeprom.html detailing how to look up the various properties of a serial EEPROM in the data sheet with examples of how to represent these in a devicetree node. Furthermore, I plan revisiting all occurrences of We can also extend the help text of the bindings and Kconfig options to list "st,m24xxx" and other families to help people find them. |
I honestly don't believe the two are comparable. Also, as you may recall, it was decided not to rename net_buf for now, but merely move it up to increase visibility. |
Ok, then, that's basically quite aligned with the content of my review (here and here) so I can't agree more. |
17b6ff5 to
d795d84
Compare
|
Lets see if I have understood it correctly. This PR now contains only additional bindings and build_all tests which show how they can be used. This doesn't impact the implementation of the AT24 at all, but states explicitly which devices are supported, with the added benefit of build time failures for improper usage. |
|
The build error seems to be unrelated to these changes: |
Please see #73512 |
157f327 to
85f766e
Compare
|
Rebased onto main to resolve conflicts. |
85f766e to
dbf78a8
Compare
|
Rebased onto main to resolve merge conflicts. |
dbf78a8 to
280f7f7
Compare
pdgendt
left a comment
There was a problem hiding this comment.
I think this makes sense, but needs maintainer (Brix) approval. Should this still be considered for 3.7?
I don't mind when it is getting merged, I just think it should end up in main at some point. Maybe we can convince @henrikbrixandersen with the next PR which tries to implement an AT24 variant ;-). |
As I have told you already, this PR will not be merged upstream. We already have what you call "official support for the ST M24 I2C EEPROM series". The proper solution is to use the devicetree "compatible" string as it is intended, and simply add a "atmel,at24" (as this is the common programming model for this type of device) at the end of the list.. |
|
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
Generalize the AT24/AT25 EEPROM implementation, so that it can be reused for bindings of compatible chips from other vendors. Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
Add a binding for the I2C EEPROM series M24xxx from ST. Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
Use the AT2X driver for the ST M24 I2C EEPROM series. Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
Add an instance of the ST M24 I2C EEPROM to the EEPROM build_all tests. Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
280f7f7 to
6164684
Compare
|
Rebased onto main to resolve merge conflicts. |
It is already with the existing implementation of the AT24 possible to use an EEPROM from the ST M24 series, although it is not very well documented (see #73064 and #69021). To avoid this confusion I have generalized the driver for the AT24 and AT25 so that it can be reused for other compatibles and added specific bindings for the ST M24 I2C automotive series.
With this approach it is rather clear which ICs are supported by which driver, and it can be easily extended for other compatible ICs.