Skip to content

Commit

Permalink
kernel: import pending patches adding support for NVMEM on UBI and MMC
Browse files Browse the repository at this point in the history
Similar to supporting nvmem-layouts on MTD devices, also allow referencing
UBI and MMC devices in DT.

Signed-off-by: Daniel Golle <[email protected]>
  • Loading branch information
dangowrt committed Feb 15, 2024
1 parent cff4335 commit fc153aa
Show file tree
Hide file tree
Showing 22 changed files with 1,876 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ Signed-off-by: Phil Elwell <[email protected]>
static inline int mmc_blk_part_switch(struct mmc_card *card,
unsigned int part_type);
static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
@@ -3040,6 +3047,8 @@ static int mmc_blk_probe(struct mmc_card
@@ -3049,6 +3056,8 @@ static int mmc_blk_probe(struct mmc_card
{
struct mmc_blk_data *md;
int ret = 0;
Expand All @@ -275,7 +275,7 @@ Signed-off-by: Phil Elwell <[email protected]>

/*
* Check that the card supports the command class(es) we need.
@@ -3047,7 +3056,16 @@ static int mmc_blk_probe(struct mmc_card
@@ -3056,7 +3065,16 @@ static int mmc_blk_probe(struct mmc_card
if (!(card->csd.cmdclass & CCC_BLOCK_READ))
return -ENODEV;

Expand All @@ -293,7 +293,7 @@ Signed-off-by: Phil Elwell <[email protected]>

card->complete_wq = alloc_workqueue("mmc_complete",
WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
@@ -3062,6 +3080,17 @@ static int mmc_blk_probe(struct mmc_card
@@ -3071,6 +3089,17 @@ static int mmc_blk_probe(struct mmc_card
goto out_free;
}

Expand Down
2 changes: 2 additions & 0 deletions target/linux/generic/config-6.1
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_BLK_DEV_ZONED is not set
# CONFIG_BLK_INLINE_ENCRYPTION is not set
# CONFIG_BLK_NVMEM is not set
# CONFIG_BLK_SED_OPAL is not set
# CONFIG_BLK_WBT is not set
CONFIG_BLOCK=y
Expand Down Expand Up @@ -4037,6 +4038,7 @@ CONFIG_MTD_SPLIT_SUPPORT=y
# CONFIG_MTD_UBI is not set
# CONFIG_MTD_UBI_FASTMAP is not set
# CONFIG_MTD_UBI_GLUEBI is not set
# CONFIG_MTD_UBI_NVMEM is not set
# CONFIG_MTD_UIMAGE_SPLIT is not set
# CONFIG_MTD_VIRT_CONCAT is not set
# CONFIG_MTK_DEVAPC is not set
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
From ffbbe7d66872ff8957dad2136133e28a1fd5d437 Mon Sep 17 00:00:00 2001
From: Daniel Golle <[email protected]>
Date: Mon, 7 Aug 2023 22:51:05 +0100
Subject: [PATCH 01/15] dt-bindings: mtd: add basic bindings for UBI

Add basic bindings for UBI devices and volumes.

Signed-off-by: Daniel Golle <[email protected]>
---
.../bindings/mtd/partitions/linux,ubi.yaml | 65 +++++++++++++++++++
.../bindings/mtd/partitions/ubi-volume.yaml | 35 ++++++++++
2 files changed, 100 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mtd/partitions/linux,ubi.yaml
create mode 100644 Documentation/devicetree/bindings/mtd/partitions/ubi-volume.yaml

--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/partitions/linux,ubi.yaml
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mtd/partitions/linux,ubi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Unsorted Block Images
+
+description: |
+ UBI ("Unsorted Block Images") is a volume management system for raw
+ flash devices which manages multiple logical volumes on a single
+ physical flash device and spreads the I/O load (i.e wear-leveling)
+ across the whole flash chip.
+
+maintainers:
+ - Daniel Golle <[email protected]>
+
+allOf:
+ - $ref: partition.yaml#
+
+properties:
+ compatible:
+ const: linux,ubi
+
+ volumes:
+ type: object
+ description: UBI Volumes
+
+ patternProperties:
+ "^ubi-volume-.*$":
+ $ref: /schemas/mtd/partitions/ubi-volume.yaml#
+
+ unevaluatedProperties: false
+
+required:
+ - compatible
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ reg = <0x0 0x100000>;
+ label = "bootloader";
+ read-only;
+ };
+
+ partition@100000 {
+ reg = <0x100000 0x1ff00000>;
+ label = "ubi";
+ compatible = "linux,ubi";
+
+ volumes {
+ ubi-volume-caldata {
+ volid = <2>;
+ volname = "rf";
+ };
+ };
+ };
+ };
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/partitions/ubi-volume.yaml
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mtd/partitions/ubi-volume.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: UBI volume
+
+description: |
+ This binding describes a single UBI volume. Volumes can be matches either
+ by their ID or their name, or both.
+
+maintainers:
+ - Daniel Golle <[email protected]>
+
+properties:
+ volid:
+ $ref: "/schemas/types.yaml#/definitions/uint32"
+ description:
+ Match UBI volume ID
+
+ volname:
+ $ref: "/schemas/types.yaml#/definitions/string"
+ description:
+ Match UBI volume ID
+
+anyOf:
+ - required:
+ - volid
+
+ - required:
+ - volname
+
+# This is a generic file other binding inherit from and extend
+additionalProperties: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From e4dad3aa5c3ab9c553555dd23c0b85f725f2eb51 Mon Sep 17 00:00:00 2001
From: Daniel Golle <[email protected]>
Date: Mon, 7 Aug 2023 22:53:01 +0100
Subject: [PATCH 02/15] dt-bindings: mtd: ubi-volume: allow UBI volumes to
provide NVMEM

UBI volumes may be used to contain NVMEM bits, typically device MAC
addresses or wireless radio calibration data.

Signed-off-by: Daniel Golle <[email protected]>
---
.../devicetree/bindings/mtd/partitions/linux,ubi.yaml | 10 ++++++++++
.../devicetree/bindings/mtd/partitions/ubi-volume.yaml | 5 +++++
2 files changed, 15 insertions(+)

--- a/Documentation/devicetree/bindings/mtd/partitions/linux,ubi.yaml
+++ b/Documentation/devicetree/bindings/mtd/partitions/linux,ubi.yaml
@@ -59,6 +59,16 @@ examples:
ubi-volume-caldata {
volid = <2>;
volname = "rf";
+
+ nvmem-layout {
+ compatible = "fixed-layout";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ eeprom@0 {
+ reg = <0x0 0x1000>;
+ };
+ };
};
};
};
--- a/Documentation/devicetree/bindings/mtd/partitions/ubi-volume.yaml
+++ b/Documentation/devicetree/bindings/mtd/partitions/ubi-volume.yaml
@@ -24,6 +24,11 @@ properties:
description:
Match UBI volume ID

+ nvmem-layout:
+ $ref: /schemas/nvmem/layouts/nvmem-layout.yaml#
+ description:
+ This container may reference an NVMEM layout parser.
+
anyOf:
- required:
- volid
Loading

0 comments on commit fc153aa

Please sign in to comment.