Skip to content
Commit 99599b5d authored by Grzegorz Swiderski's avatar Grzegorz Swiderski Committed by Carles Cufí
Browse files

devicetree: Add DT_MEM_FROM_FIXED_PARTITION macro



This is a new fixed-partitions API, which serves as a companion to the
existing `DT_MTD_FROM_FIXED_PARTITION()`. In the following example:

  flash-controller@0 {
          compatible = "flash-controller";
          flash@1000000 {
                  compatible = "soc-nv-flash";
                  partitions {
                          compatible = "fixed-partitions";
                          partition@3a000 {};
                  };
          };
  };

`DT_MTD_FROM_FIXED_PARTITION()` would let us map `partition@3a000` to
`flash-controller@0`. Now, the new `DT_MEM_FROM_FIXED_PARTITION()` can
let us retrieve the memory node (`flash@1000000`) as well, in a manner
consistent with the existing API.

Caution: if a fixed partition is not said to belong to a memory node,
like in this alternative example:

  flash@0 {
          compatible = "spi-nor";
          partitions {
                  compatible = "fixed-partitions";
                  partition@0 {};
          };
  };

then `DT_MEM_FROM_FIXED_PARTITION()` will map `partition@0` to an
invalid node identifier. This partition belongs to `flash@0`, which
could be an MTD on a SPI bus.

For consistency, the existing `DT_MTD_FROM_FIXED_PARTITION()` is now re-
expressed in terms of the new `DT_MEM_FROM_FIXED_PARTITION()`.

Signed-off-by: default avatarGrzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
parent a5895d64
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment