-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
include/drivers/flash: document on the unrestricted alignment of reads #23628
include/drivers/flash: document on the unrestricted alignment of reads #23628
Conversation
include/drivers/flash.h
Outdated
* Most of flash drivers support unaligned flash access, but some have | ||
* restrictions on the read offset or/and the read size. Please refer to | ||
* the driver implementation to get details on the read alignment requirement. | ||
* Each of flash drivers support unaligned flash access, without any |
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.
s/Each of/ All
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.
fixed
6ee8bf3
to
90fafe7
Compare
Blocked by #25292 |
API Meeting:
cc @pabigot @sglass68 |
I don't think that PR blocks this change, but it highlights that QSPI needs work before the new requirement can be confirmed. That is a minimal change for a very specific function to support using an external flash to store the alternative image for mcuboot (fixing #25289). Also we should extend the AU promise to not only alignment but memory region: i.e. that it is permitted to writes of data that is located in flash, rather than RAM, which impacts any implementation (like QSPI) that uses DMA that only works on RAM addresses. |
Adds the functionality of doing one byte write to QSPI nor driver. This is achived through the use of stack in the function calls. Can be removed when requirements in zephyrproject-rtos/zephyr#23628 are fulfilled in the QSPI NOR driver. NCSDK-4628 Signed-off-by: Sigvart Hovland <sigvart.m@gmail.com>
Adds the functionality of doing one byte write to QSPI nor driver. This is achived through the use of stack in the function calls. Can be removed when requirements in zephyrproject-rtos/zephyr#23628 are fulfilled in the QSPI NOR driver. NCSDK-4628 Signed-off-by: Sigvart Hovland <sigvart.m@gmail.com>
Adds the functionality of doing one byte write to QSPI nor driver. This is achived through the use of stack in the function calls. Can be removed when requirements in zephyrproject-rtos/zephyr#23628 are fulfilled in the QSPI NOR driver. NCSDK-4628 Signed-off-by: Sigvart Hovland <sigvart.m@gmail.com> (cherry picked from commit 9d4faff)
Adds the functionality of doing one byte write to QSPI nor driver. This is achived through the use of stack in the function calls. Can be removed when requirements in zephyrproject-rtos/zephyr#23628 are fulfilled in the QSPI NOR driver. NCSDK-4628 Signed-off-by: Sigvart Hovland <sigvart.m@gmail.com> (cherry picked from commit 9d4faff)
#26772 going to add unrestricted alignment of reads for nordic qspi flash driver. |
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 believe the exception for QSPI has been addressed, so this can be updated and merged after other issues addressed.
We should also document the expectations regarding memory region for material written to the device. In particular that even if a device only supports DMA, and DMA requires the source buffer be in RAM, that it must still be permitted to write material where the source buffer is in flash. Or, if that is not required, document that on some devices such writes may fail and will return a particular error code.
For being consistent I prefer to force all to support source buffer anywhere. |
90fafe7
to
1523997
Compare
@pabigot Added note on write source buffer location. |
Thanks @nvlsianpu. @pabigot please take another look. |
include/drivers/flash.h
Outdated
@@ -121,6 +120,8 @@ static inline int z_impl_flash_read(struct device *dev, off_t offset, void *data | |||
/** | |||
* @brief Write buffer into flash memory. | |||
* | |||
* All flash drivers support source buffer located either in RAM or SoC flash. |
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.
For complete clarity this should include the same text on alignment and sizes that was added for read.
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.
check once more, propose redaction as I'm not english native
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.
How about for read:
All flash drivers support reads without alignment restrictions on the read offset, the read size, or the destination address.
and for write:
All flash drivers support a source buffer located either in RAM or SoC flash, without alignment restrictions on the source address, or write size or offset.
?
1523997
to
84535a4
Compare
Unaligned read-out capability become fact among all drivers. Let's cut this in stone as API requirement. fixes zephyrproject-rtos#16439 Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Document unrestricted source buffer location while writing to the flash. Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
84535a4
to
4b099e6
Compare
…ites Telling that all the driver supports unaligned writes was and is not true. Drivers only have to support any source buffer. This fix message introduced by zephyrproject-rtos#23628 Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
…ites Telling that all the driver supports unaligned writes was and is not true. Drivers only have to support any source buffer. This fix message introduced by #23628 Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Unaligned read-out capability become fact among all drivers.
Let's cut this in stone as API requirement.
fixes #16439
Signed-off-by: Andrzej Puzdrowski andrzej.puzdrowski@nordicsemi.no