-
Notifications
You must be signed in to change notification settings - Fork 8.3k
drivers: Add zephyr,flash-disk compatible binding #50856
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
mbolivar-nordic
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.
Second patch is the wrong approach. Kconfig option should be removed entirely and DEVICE_DT_GET used instead. See devicetree release notes for v3.2 for extended discussion
No, that is not the intention of this patch. See also changes in |
I can achieve this by modifying zephyr/drivers/disk/flashdisk.c Line 59 in 11e3344
but doing so doesn't really seem right. @mbolivar-nordic Is above what you want? How to handle the device selection, is the ifdef chain appropriate? |
Is there an option to use chosen This would allow code like this This is flexible and easily allows to set default value in DTS or board overlay, while at the same time easily allowing to replace it in app overlay by doing There is also an option, less nice and flexible, to use specific label, for example and in code: In both cases Kconfigs are no longer there and there is no need for IMHO using Kconfig to select flash disk is not best approach, because the Kconfig will require updates every time when new flash devices or boards with such devices are added; when the DTS is designated for selecting flash disk, and you add new board with new flash, all you have to do is to point to it with chosen or label, and you do not have to touch Kconfig, or the flash disk driver code. |
This seems better than the Another option instead of overlays would be putting it by default in board dts, but it raises an issue what to do with targets that actually use the |
Every sample and test, either generic or board specific, that uses mass storage needs to have overlay which elects the flash disk; the same way it does this with Kconfig now, just the place will be different.
Not really fan of this, but it wouldn't break anything unless you enable all subsystems that use that specific flash at the same time. |
|
I agree with the approach of |
f8b5663 to
6cb9716
Compare
a532dfc
Add bindings to describe a block storage device based on flash map partition. Co-authored-by: Johann Fischer <johann.fischer@nordicsemi.no> Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Add flash disk description to overlays. Specify custom flashdisk partition for fat fs api test to match the Kconfig values, because native posix storage partition is too small for FatFS filesystem. Co-authored-by: Johann Fischer <johann.fischer@nordicsemi.no> Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Use devicetree to obtain information for all zephyr flash disks. Co-authored-by: Johann Fischer <johann.fischer@nordicsemi.no> Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Allocate cache buffer for every flashdisk instance instead of using one globally shared buffer. Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Remove all obsolete DISK_FLASH* Kconfig options. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no> Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Include zephyr,flash-disk devicetree sample in disk documentation. Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Mention removal of flashdisk Kconfig options in favor of new zephyr,flash-disk devicetree binding. Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
a532dfc to
65618e0
Compare
drivers/disk/flashdisk.c
Outdated
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.
This breaks ability to have RO FAT FS on non page uniform devices.
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'll just remove the constraints check commit then. The write on non-uniform partitions never worked before and this PR won't change it, but removing the constraint check will make the RO continue to work.
65618e0 to
1def895
Compare
de-nordic
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.
Looks OK. Thanks for commits and your patience.
|
@desowin, Thank you for the excellent work and the perseverance. |
USB mass storage sample, when configured to use flash-based disk do not work in Zephyr 3.2 release due to removed label property. The naive fix is to change the "MX25R64" to "mx25r6435f@0" and "GD25Q16" to "gd25q16@0" in
samples/subsys/usb/mass/Kconfig. During the review, the naive fix was deemed inappropriate.The PR addresses the issue by introducing "zephyr,flash-disk" compatible property. That way, any number of flashdisks can be specified in devicetree. While this fixes the USB Mass Storage sample, the actual Mass Storage class support for multiple LUNs is out of scope of this PR.