-
Notifications
You must be signed in to change notification settings - Fork 8.2k
drivers: syscon: Preparation for NVMEM usage #98140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Documenting return values with doxygen should use the @RetVal tags. Signed-off-by: Pieter De Gendt <[email protected]>
Introduce a function to the syscon API that can be used to get the register width of the device. Signed-off-by: Pieter De Gendt <[email protected]>
62090de to
19270a5
Compare
Implement the get_reg_width API function for the generic syscon driver. Signed-off-by: Pieter De Gendt <[email protected]>
Add shell commands to use the SYSCON driver API with SYSCON devices. Signed-off-by: Pieter De Gendt <[email protected]>
Add OTP support for NXP i.MX OCOTP using the SYSCON API. Signed-off-by: Pieter De Gendt <[email protected]>
Add device tree nodes for the OCOTP controller on i.MX RT10xx platforms. Signed-off-by: Pieter De Gendt <[email protected]>
19270a5 to
7f70bf6
Compare
|
|
Semantically speaking, OCOTP is not suitable for implementation based on the syscon device driver model. What we should introduce is the nvmem device driver model, with EEPROM and FUSE/OCOTP implemented based on this device driver model, just like in Linux. |
@ZhaoxiangJin thanks for your feedback, currently the NVMEM subsystem expects a device driver in the backend, with only EEPROM implemented at the moment. So the FUSE/OCOTP driver is missing, which is compatible with the |
@pdgendt, in Linux, FUSE, OTP, and EEPROM are abstracted into a device driver model called nvmem . In the current Zephyr, EEPROM has its own device driver model @henrikbrixandersen, but FUSE and OTP do not. Some people have implemented FUSE driver based on syscon, but this is a semantically wrong approach (just like using sensor to implement comparator before @bjarki-andreasen). In the long run, we need more than just being able to use it. The current EEPROM device driver moel in Zephyr is suitable for FUSE and OTP (This is why #89108 initially implemented the fuse driver based on eeprom), so we should now convert the current EEPROM device driver model in Zephyr into the NVMEM device driver model, and convert the existing EEPROM driver into the NVMEM driver (In fact, the implementation details may not be much different, just the name has changed). Based on this, let's think about what the nvmem subsys layer can bring us. |
|
@ZhaoxiangJin The NVMEM subsystem has been introduced in #96379 already? Looking at Linux it also uses So NVMEM needs a driver API to call into, and in this case for the OCOTP, I think the |
@pdgendt, yes, I know this subsys was introduced recently, what I want to talk here is that we should abstract the nvmem device driver model for FUSE, OTP, and EEPROM. This design has already been validated in Linux. |
gmarull
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to (ab)use syscon for peripherals that are not system controllers, but have a clear purpose like fuse controllers.



This PR has the necessary bits to make the SYSCON API usable in NVMEM. Some of the parts
syscon_get_reg_widthAPI function to determine how many bytes are readThis work relates to #96598 as the OCOTP SYSCON driver will be used as an NVMEM backend. This allows to rework the following with NVMEM:
zephyr/drivers/ethernet/eth_nxp_enet.c
Lines 646 to 673 in 8aba2e3