-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
DTS: flash alignment description #860
DTS: flash alignment description #860
Conversation
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.
Are we specifying alignment or the write/erase block size? Not sure what the compatible of 'arm' or 'intel' is getting you (and it seems wrong as the compatible should probably be to the flash type on the SoC).
@galak Is https://github.com/zephyrproject-rtos/zephyr/blob/master/dts/arm/atmel/sam4s.dtsi#L27 looks suitable for you? |
As far as the compatible goes, that's probably should be removed. It should really be something like compatible = "atmel,sam-soc-flash". |
Then in *.yaml is expected to have such a compatible property:
Em I right? |
The compatible value in the yaml may need to be answered by Andy, but it definitely shouldn't be "arm" or "intel". Generally, the flash device hasn't had a compatible value, but lives as a child of the flash controller, and contains a reg field to describe the mapping of the actual flash device. Other devices just have it at the top level, and I guess it is found by name. I think Andy added a way to find nodes by where they are in the tree, but I don't remember how that happens. The description should probably be changed to all match write-block-size. At least to me, the block size would include the alignment that the writes need to happen, but also captures that it is the minimum size that the writes must be done at. I think "alignment" was a poor name choice by the mynewt/mcuboot code. |
As David said, we probably should move flash nodes under a flash controller. The NXP dts I think already do this. Wonder if 'erase-size' as spec in the linux kernel Documentation/devicetree/bindings/mtd/mtd-physmap.txt makes sense for the property name. |
Usually write size (1B-8B) << erase size (sector size), no? The meaning of "alignment" in this context is "write size". |
Should we have both write-size & erase-size as part of the flash node? |
Erase-size is sector size. Not all flash parts have uniform sector sizes. This is being addressed in a separate PR, #816 Edit: the reason for doing it as in 816 is that, if done by hand as nodes, then you'd end up with .dtsi files with hundreds of identical 4K sectors on some parts, which seems unnecessary and doesn't really help with what the user will likely want, which is to query sector information around a given flash offset |
So what's the plan here, are we going to update this or is it needed anymore? |
This is still needed (I was on holiday). @galak wrote:
Following nxp description I propose similar for nordic:
@d3zd3z, @galak Do you expect to have such description in nrf52840.dtsi file? |
Adding @agross-linaro here |
@galak, I think @nvlsianpu's latest proposal based on the NXP looks reasonable? |
I am ok with it being inside or outside the flash controller. I don't think we should absolutely mandate it be inside. The main thing is that there is a label that can be used to point to the flash node or partition. |
placing the flash node inside the controller has issues with addressing. Since the flash controller addresses would be for the MMIO register space to program/adjust the controller and the flash itself is at a different location. So its best to have some link instead. |
@galak Is this comply with what you suggested? |
@nvlsianpu looking at this some more and feeling like we should just support ranges properly and place the flash node under the controller. |
e6f560e
to
03f2f23
Compare
@galak I've updated the patch. I used |
@agross-linaro mind taking a look at the updated patch? Thanks! |
dts/arm/nordic/nrf52840.dtsi
Outdated
@@ -13,8 +13,18 @@ | |||
}; | |||
}; | |||
|
|||
flash0: flash@0 { | |||
reg = <0x00000000 DT_FLASH_SIZE>; | |||
flash-controller@0x4001E000 { |
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.
nit, remove the 0x in the node name. Should be: flash-controller@4001E000
dts/arm/nordic/nrf52840.dtsi
Outdated
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
flash0: 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.
flash0: flash@0 {
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.
Some minor nits on the dts changes. We need more description on what 'write-block-size' means.
dts/common/yaml/flash.yaml
Outdated
|
||
- write-block-size: | ||
type: int | ||
description: flash write alignment |
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.
Can you be more descriptive here.
dts/arm/nordic/nrf52840.dtsi
Outdated
flash0: flash { | ||
compatible = "flash"; | ||
reg = <0x00000000 DT_FLASH_SIZE>; | ||
write-block-size = <4>; |
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.
Curious where you expect to end up using write-block-size in actual code. I wonder if such properties belong up with the flash-controller node instead.
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.
e.g. mcuboot, and mcuboot interface (#747) needs to know this value. For me It doesn't mater whether this is flash-controller's property value or flash memory's property (anyway these entities always existing together). But in my opinion flash
is right node for this property.
dts/arm/nordic/nrf52840.dtsi
Outdated
#size-cells = <1>; | ||
|
||
flash0: flash { | ||
compatible = "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.
I think we need a better compatible to describe this class of flash device.
03f2f23
to
bcf9058
Compare
dts/common/yaml/flash.yaml
Outdated
@@ -0,0 +1,26 @@ | |||
--- | |||
title: Flash base node description | |||
id: soc-nv-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.
rename the file from flash.yaml to 'soc-nv-flash.yaml'
Added flash-controller description and moved flash description to it (for coherence). Added property for description of the flash alignment required by write operations. Thanks to that l-value FLASH_WRITE_BLOCK_SIZE macro will be generated. It is useful for any component uses the flash. Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
bcf9058
to
ba26ccf
Compare
@galak this has been in review for a while, can you take a look? |
The `--rimage-tool=...` parameter was added in March 2022 by the very first map.yml commit (rebased f6d6f1e15022) But `west sign` has been invoked by `west build` (through CMake) since commit fad2da3, almost one year ago. At the time, the ability to sign from west flash was preserved for backwards compatibility. Today, `west flash` does not invoke `west sign` any more which means this `--rimage-tool=...` parameter is now ignored. The CI for more recent, ACE platforms (MTL, LNL, etc.) does not pass any `--rimage-tool=...` at all, see evidence in CI runs of zephyrproject-rtos#860 Removing `--rimage-tool=...` from `.github/data/map.yml` will allow blocking that option in `west flash` (zephyrproject-rtos#860) Now that Zephyr 3.5 has been released, we need to reduce the number of rimage use cases and the corresponding validation complexity and maintenance workload to simplify and accelerate new features like splitting rimage configuration files (zephyrproject-rtos#65411) Signed-off-by: Marc Herbert <marc.herbert@intel.com>
The `--rimage-tool=...` parameter was added in March 2022 by the very first map.yml commit (rebased f6d6f1e15022) But `west sign` has been invoked by `west build` (through CMake) since commit fad2da3, almost one year ago. At the time, the ability to sign from west flash was preserved for backwards compatibility. Today, `west flash` does not invoke `west sign` any more which means this `--rimage-tool=...` parameter is now ignored. The CI for more recent, ACE platforms (MTL, LNL, etc.) does not pass any `--rimage-tool=...` at all, see evidence in CI runs of zephyrproject-rtos#860 Removing `--rimage-tool=...` from `.github/data/map.yml` will allow blocking that option in `west flash` (zephyrproject-rtos#860) Now that Zephyr 3.5 has been released, we need to reduce the number of rimage use cases and the corresponding validation complexity and maintenance workload to simplify and accelerate new features like splitting rimage configuration files (zephyrproject-rtos#65411) Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Added property for description of
the flash alignment required by write operations.
Thanks to that l-value FLASH_WRITE_BLOCK_SIZE macro
will be generated. It is useful for any component uses
the flash.
Added such a description for nrf52840 SoC.
Signed-off-by: Andrzej Puzdrowski andrzej.puzdrowski@nordicsemi.no