-
Notifications
You must be signed in to change notification settings - Fork 8k
drivers: flash_mspi_nor: Assign quirks based on flash DT node property #96701
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
base: main
Are you sure you want to change the base?
Conversation
How it works in spi-nor: https://github.com/zephyrproject-rtos/zephyr/blob/main/dts/bindings/mtd/jedec%2Cspi-nor-common.yaml there are properties for each thing e.g. dpd, 4b addr, mx25r power mode (vendor property) - these can be used differently for many different devices and an out of tree device can also make use of them which has some or all of the properties In this new method, there is just a chip family, this chip family selects all the options, it is possible for an out of tree device to use the exact same properties by using the same chip family but it is not possible to use only some of the properties and not others, or to use properties of 2 chip families combined, plus if the actual chip they are using has a different name completely then would seem to be very messy to have to use a chip family which they clearly are not but to use a specific feature as in above it is possible In my mind, whilst the bottom does work for some cases, I prefer the top method for flexibility, freedom and expandability of downstream users/devices which the bottom method does not support in all cases without forking zephyr and editing it |
The quirks mechanism is not intended to be used for things like DPD or 4-byte addressing. For those, dedicated properties are used, just like in spi-nor. Only vendor specific things should be covered by quirks, like the mentioned mx25r power mode. And I don't think that a separate property for it would be better. This is a thing specific to this chip family, so in my opinion the current approach to handling it is fine. |
1a10ff4
to
5bd1927
Compare
Rebased on #96770. |
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.
USB part looks OK, not sure why it is bundled here.
I just noticed the USB part has been posted separately.
Introduce "chip-family" enum property in the "jedec,mspi-nor" binding as a way of specifying what special routines need to be use for a given flash chip. This has the advantage over an additional compatible string that users can see the possibilities in the binding documentation and do not need to look into the driver code to find out those. Also any typos in the enum value will be caught by the DT compiler, while for the compatible string such typos would cause it to be silently ignored. Signed-off-by: Andrzej Głąbek <[email protected]>
5bd1927
to
eeed45f
Compare
Rebased. |
|
I think we should have definitions of quirks rather than address them by devices, if we take that info directly from DTS anyway. Similar approach has been proposed to PR #69257 (defunct now). This would reduce need to change code when adding chips with the same quirks; I know that this would require careful specification in DTS, for JEDEC compatible, but also should allow to define read-only defaults for compatibles that have the full name of a chip. |
For other device types, actually pretty much all other hardware in the devicetree, a compat means:
is invalid according to the devicetree spec. The hardware model "jedec,mspi-nor" can be made more flexible by adding properties like The solution which best matches in this case would be:
in the devicetree, and the binding
See this example for CAN:
Is there a reason this approach can't be used? |
Initial implementation of quirks was based on USB approach: I agree this might not be up to devicetree spec. |
Introduce "chip-family" enum property in the "jedec,mspi-nor" binding as a way of specifying what special routines need to be use for a given flash chip. This has the advantage over an additional compatible string that users can see the possibilities in the binding documentation and do not need to look into the driver code to find out those. Also any typos in the enum value will be caught by the DT compiler, while for the compatible string such typos would cause it to be silently ignored.
Addresses #93135.