From 94e01900829cbec67987a1b97598cc351033d7fb Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 14 Jun 2024 17:35:10 +0100 Subject: [PATCH] generic: 6.6: update NVMEM-on-MMC series Allow a wider audience to test this pending series. Use about to be submitted v3 which factors out block notification support. Apart from dropping the no longer needed (and problematic) fallback for for the 'partitions' node being present at the device parent there are no intended functional changes. As opening a block device as file is not supported yet in Kernel v6.6, use the previous method as backporting seems a bit too involving. Fixes: #15642 Signed-off-by: Daniel Golle --- target/linux/generic/config-6.6 | 3 +- ...-add-basic-bindings-for-block-devic.patch} | 26 ++-- ...51-block-partitions-populate-fwnode.patch} | 13 +- ...-block-add-support-for-notifications.patch | 145 ++++++++++++++++++ ...k-add-new-genhd-flag-GENHD_FL_NVMEM.patch} | 6 +- ...vmem-implement-block-NVMEM-provider.patch} | 113 ++++++++------ ...mmc-mmc-card-add-block-device-nodes.patch} | 6 +- ...456-mmc-core-set-card-fwnode_handle.patch} | 6 +- ...mc-block-set-fwnode-of-disk-devices.patch} | 18 +-- ...=> 458-mmc-block-set-GENHD_FL_NVMEM.patch} | 8 +- target/linux/mediatek/filogic/config-6.6 | 3 +- .../041-block-fit-partition-parser.patch | 4 +- 12 files changed, 259 insertions(+), 92 deletions(-) rename target/linux/generic/pending-6.6/{450-08-dt-bindings-block-add-basic-bindings-for-block-devic.patch => 450-dt-bindings-block-add-basic-bindings-for-block-devic.patch} (84%) rename target/linux/generic/pending-6.6/{450-09-block-partitions-populate-fwnode.patch => 451-block-partitions-populate-fwnode.patch} (84%) create mode 100644 target/linux/generic/pending-6.6/452-block-add-support-for-notifications.patch rename target/linux/generic/pending-6.6/{450-10-block-add-new-genhd-flag-GENHD_FL_NVMEM.patch => 453-block-add-new-genhd-flag-GENHD_FL_NVMEM.patch} (81%) rename target/linux/generic/pending-6.6/{450-11-block-implement-NVMEM-provider.patch => 454-nvmem-implement-block-NVMEM-provider.patch} (66%) rename target/linux/generic/pending-6.6/{450-12-dt-bindings-mmc-mmc-card-add-block-device-nodes.patch => 455-dt-bindings-mmc-mmc-card-add-block-device-nodes.patch} (92%) rename target/linux/generic/pending-6.6/{450-13-mmc-core-set-card-fwnode_handle.patch => 456-mmc-core-set-card-fwnode_handle.patch} (78%) rename target/linux/generic/pending-6.6/{450-14-mmc-block-set-fwnode-of-disk-devices.patch => 457-mmc-block-set-fwnode-of-disk-devices.patch} (64%) rename target/linux/generic/pending-6.6/{450-15-mmc-block-set-GENHD_FL_NVMEM.patch => 458-mmc-block-set-GENHD_FL_NVMEM.patch} (71%) diff --git a/target/linux/generic/config-6.6 b/target/linux/generic/config-6.6 index 00c7110d58..c51cc3b0ce 100644 --- a/target/linux/generic/config-6.6 +++ b/target/linux/generic/config-6.6 @@ -635,7 +635,7 @@ CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 # CONFIG_BLK_DEV_UBLK is not set # CONFIG_BLK_DEV_ZONED is not set # CONFIG_BLK_INLINE_ENCRYPTION is not set -# CONFIG_BLK_NVMEM is not set +# CONFIG_BLOCK_NOTIFIERS is not set # CONFIG_BLK_SED_OPAL is not set # CONFIG_BLK_WBT is not set CONFIG_BLOCK=y @@ -4323,6 +4323,7 @@ CONFIG_NLS_DEFAULT="iso8859-1" # CONFIG_NVIDIA_CARMEL_CNP_ERRATUM is not set # CONFIG_NVMEM is not set # CONFIG_NVMEM_BCM_OCOTP is not set +# CONFIG_NVMEM_BLOCK is not set # CONFIG_NVMEM_IMX_OCOTP is not set # CONFIG_NVMEM_LAYOUT_ONIE_TLV is not set # CONFIG_NVMEM_LAYOUT_SL28_VPD is not set diff --git a/target/linux/generic/pending-6.6/450-08-dt-bindings-block-add-basic-bindings-for-block-devic.patch b/target/linux/generic/pending-6.6/450-dt-bindings-block-add-basic-bindings-for-block-devic.patch similarity index 84% rename from target/linux/generic/pending-6.6/450-08-dt-bindings-block-add-basic-bindings-for-block-devic.patch rename to target/linux/generic/pending-6.6/450-dt-bindings-block-add-basic-bindings-for-block-devic.patch index d0727faf3d..9089ce6440 100644 --- a/target/linux/generic/pending-6.6/450-08-dt-bindings-block-add-basic-bindings-for-block-devic.patch +++ b/target/linux/generic/pending-6.6/450-dt-bindings-block-add-basic-bindings-for-block-devic.patch @@ -1,8 +1,7 @@ -From 9ffc1d7d73609a89eb264d6066340f8b7b3b0ebe Mon Sep 17 00:00:00 2001 +From 3245921a87154bdfbe7a55d743ea62dd559a8fb0 Mon Sep 17 00:00:00 2001 From: Daniel Golle -Date: Mon, 7 Aug 2023 21:19:45 +0100 -Subject: [PATCH 08/15] dt-bindings: block: add basic bindings for block - devices +Date: Thu, 30 May 2024 03:13:09 +0100 +Subject: [PATCH 1/9] dt-bindings: block: add basic bindings for block devices Add bindings for block devices which are used to allow referencing nvmem bits on them. @@ -10,9 +9,9 @@ nvmem bits on them. Signed-off-by: Daniel Golle --- .../bindings/block/block-device.yaml | 22 ++++++++ - .../devicetree/bindings/block/partition.yaml | 50 +++++++++++++++++++ + .../devicetree/bindings/block/partition.yaml | 51 +++++++++++++++++++ .../devicetree/bindings/block/partitions.yaml | 20 ++++++++ - 3 files changed, 92 insertions(+) + 3 files changed, 93 insertions(+) create mode 100644 Documentation/devicetree/bindings/block/block-device.yaml create mode 100644 Documentation/devicetree/bindings/block/partition.yaml create mode 100644 Documentation/devicetree/bindings/block/partitions.yaml @@ -44,7 +43,7 @@ Signed-off-by: Daniel Golle +unevaluatedProperties: false --- /dev/null +++ b/Documentation/devicetree/bindings/block/partition.yaml -@@ -0,0 +1,50 @@ +@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- @@ -66,16 +65,17 @@ Signed-off-by: Daniel Golle + pattern: '^block-partition-.+$' + + partnum: ++ $ref: /schemas/types.yaml#/definitions/uint32 + description: + Matches partition by number if present. + + partname: -+ "$ref": "/schemas/types.yaml#/definitions/string" ++ $ref: /schemas/types.yaml#/definitions/string + description: + Matches partition by PARTNAME if present. + -+ uuid: -+ "$ref": "/schemas/types.yaml#/definitions/string" ++ partuuid: ++ $ref: /schemas/types.yaml#/definitions/string + description: + Matches partition by PARTUUID if present. + @@ -86,13 +86,13 @@ Signed-off-by: Daniel Golle + +anyOf: + - required: -+ - partnum ++ - partnum + + - required: -+ - partname ++ - partname + + - required: -+ - uuid ++ - partuuid + +unevaluatedProperties: false --- /dev/null diff --git a/target/linux/generic/pending-6.6/450-09-block-partitions-populate-fwnode.patch b/target/linux/generic/pending-6.6/451-block-partitions-populate-fwnode.patch similarity index 84% rename from target/linux/generic/pending-6.6/450-09-block-partitions-populate-fwnode.patch rename to target/linux/generic/pending-6.6/451-block-partitions-populate-fwnode.patch index 2e5bcac653..2aef22879d 100644 --- a/target/linux/generic/pending-6.6/450-09-block-partitions-populate-fwnode.patch +++ b/target/linux/generic/pending-6.6/451-block-partitions-populate-fwnode.patch @@ -1,7 +1,7 @@ -From 614f4f6fdda09e30ecf7ef6c8091579db15018cb Mon Sep 17 00:00:00 2001 +From 7f4c9c534aabe1315669e076d3fe0af0fd374cda Mon Sep 17 00:00:00 2001 From: Daniel Golle -Date: Fri, 21 Jul 2023 17:51:03 +0100 -Subject: [PATCH 09/15] block: partitions: populate fwnode +Date: Thu, 30 May 2024 03:13:19 +0100 +Subject: [PATCH 2/9] block: partitions: populate fwnode Let block partitions to be represented by a firmware node and hence allow them to being referenced e.g. for use with blk-nvmem. @@ -22,7 +22,7 @@ Signed-off-by: Daniel Golle #include "check.h" static int (*const check_part[])(struct parsed_partitions *) = { -@@ -292,6 +294,43 @@ static ssize_t whole_disk_show(struct de +@@ -292,6 +294,40 @@ static ssize_t whole_disk_show(struct de } static const DEVICE_ATTR(whole_disk, 0444, whole_disk_show, NULL); @@ -35,9 +35,6 @@ Signed-off-by: Daniel Golle + + fw_parts = device_get_named_child_node(ddev, "partitions"); + if (!fw_parts) -+ fw_parts = device_get_named_child_node(ddev->parent, "partitions"); -+ -+ if (!fw_parts) + return NULL; + + fwnode_for_each_child_node(fw_parts, fw_part) { @@ -66,7 +63,7 @@ Signed-off-by: Daniel Golle /* * Must be called either with open_mutex held, before a disk can be opened or * after all disk users are gone. -@@ -374,6 +413,8 @@ static struct block_device *add_partitio +@@ -374,6 +410,8 @@ static struct block_device *add_partitio goto out_put; } diff --git a/target/linux/generic/pending-6.6/452-block-add-support-for-notifications.patch b/target/linux/generic/pending-6.6/452-block-add-support-for-notifications.patch new file mode 100644 index 0000000000..c5a3391e45 --- /dev/null +++ b/target/linux/generic/pending-6.6/452-block-add-support-for-notifications.patch @@ -0,0 +1,145 @@ +From e07ace307ce598847074a096f408bec0e3a392ed Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 30 May 2024 03:14:34 +0100 +Subject: [PATCH 3/9] block: add support for notifications + +Add notifier block to notify other subsystems about the addition or +removal of block devices. + +Signed-off-by: Daniel Golle +--- + block/Kconfig | 6 +++ + block/Makefile | 1 + + block/blk-notify.c | 88 ++++++++++++++++++++++++++++++++++++++++++ + include/linux/blkdev.h | 8 ++++ + 4 files changed, 103 insertions(+) + create mode 100644 block/blk-notify.c + +--- a/block/Kconfig ++++ b/block/Kconfig +@@ -208,6 +208,12 @@ config BLK_INLINE_ENCRYPTION_FALLBACK + by falling back to the kernel crypto API when inline + encryption hardware is not present. + ++config BLOCK_NOTIFIERS ++ bool "Enable support for notifications in block layer" ++ help ++ Enable this option to provide notifiers for other subsystems ++ upon addition or removal of block devices. ++ + source "block/partitions/Kconfig" + + config BLK_MQ_PCI +--- a/block/Makefile ++++ b/block/Makefile +@@ -40,3 +40,4 @@ obj-$(CONFIG_BLK_INLINE_ENCRYPTION) += b + blk-crypto-sysfs.o + obj-$(CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK) += blk-crypto-fallback.o + obj-$(CONFIG_BLOCK_HOLDER_DEPRECATED) += holder.o ++obj-$(CONFIG_BLOCK_NOTIFIERS) += blk-notify.o +--- /dev/null ++++ b/block/blk-notify.c +@@ -0,0 +1,88 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++/* ++ * Notifiers for addition and removal of block devices ++ * ++ * Copyright (c) 2024 Daniel Golle ++ */ ++ ++#include ++#include ++#include ++ ++#include "blk.h" ++ ++struct blk_device_list { ++ struct device *dev; ++ struct list_head list; ++}; ++ ++static RAW_NOTIFIER_HEAD(blk_notifier_list); ++static DEFINE_MUTEX(blk_notifier_lock); ++static LIST_HEAD(blk_devices); ++ ++void blk_register_notify(struct notifier_block *nb) ++{ ++ struct blk_device_list *existing_blkdev; ++ ++ mutex_lock(&blk_notifier_lock); ++ raw_notifier_chain_register(&blk_notifier_list, nb); ++ ++ list_for_each_entry(existing_blkdev, &blk_devices, list) ++ nb->notifier_call(nb, BLK_DEVICE_ADD, existing_blkdev->dev); ++ ++ mutex_unlock(&blk_notifier_lock); ++} ++EXPORT_SYMBOL_GPL(blk_register_notify); ++ ++void blk_unregister_notify(struct notifier_block *nb) ++{ ++ mutex_lock(&blk_notifier_lock); ++ raw_notifier_chain_unregister(&blk_notifier_list, nb); ++ mutex_unlock(&blk_notifier_lock); ++} ++EXPORT_SYMBOL_GPL(blk_unregister_notify); ++ ++static int blk_call_notifier_add(struct device *dev) ++{ ++ struct blk_device_list *new_blkdev; ++ ++ new_blkdev = kmalloc(sizeof(*new_blkdev), GFP_KERNEL); ++ if (!new_blkdev) ++ return -ENOMEM; ++ ++ new_blkdev->dev = dev; ++ mutex_lock(&blk_notifier_lock); ++ list_add_tail(&new_blkdev->list, &blk_devices); ++ raw_notifier_call_chain(&blk_notifier_list, BLK_DEVICE_ADD, dev); ++ mutex_unlock(&blk_notifier_lock); ++ ++ return 0; ++} ++ ++static void blk_call_notifier_remove(struct device *dev) ++{ ++ struct blk_device_list *old_blkdev, *tmp; ++ ++ mutex_lock(&blk_notifier_lock); ++ list_for_each_entry_safe(old_blkdev, tmp, &blk_devices, list) { ++ if (old_blkdev->dev != dev) ++ continue; ++ ++ list_del(&old_blkdev->list); ++ kfree(old_blkdev); ++ } ++ raw_notifier_call_chain(&blk_notifier_list, BLK_DEVICE_REMOVE, dev); ++ mutex_unlock(&blk_notifier_lock); ++} ++ ++static struct class_interface blk_notifications_bus_interface __refdata = { ++ .class = &block_class, ++ .add_dev = &blk_call_notifier_add, ++ .remove_dev = &blk_call_notifier_remove, ++}; ++ ++static int __init blk_notifications_init(void) ++{ ++ return class_interface_register(&blk_notifications_bus_interface); ++} ++device_initcall(blk_notifications_init); +--- a/include/linux/blkdev.h ++++ b/include/linux/blkdev.h +@@ -1564,4 +1564,12 @@ struct io_comp_batch { + + #define DEFINE_IO_COMP_BATCH(name) struct io_comp_batch name = { } + ++ ++#ifdef CONFIG_BLOCK_NOTIFIERS ++#define BLK_DEVICE_ADD 1 ++#define BLK_DEVICE_REMOVE 2 ++void blk_register_notify(struct notifier_block *nb); ++void blk_unregister_notify(struct notifier_block *nb); ++#endif ++ + #endif /* _LINUX_BLKDEV_H */ diff --git a/target/linux/generic/pending-6.6/450-10-block-add-new-genhd-flag-GENHD_FL_NVMEM.patch b/target/linux/generic/pending-6.6/453-block-add-new-genhd-flag-GENHD_FL_NVMEM.patch similarity index 81% rename from target/linux/generic/pending-6.6/450-10-block-add-new-genhd-flag-GENHD_FL_NVMEM.patch rename to target/linux/generic/pending-6.6/453-block-add-new-genhd-flag-GENHD_FL_NVMEM.patch index 8fc5cd636c..5997680e47 100644 --- a/target/linux/generic/pending-6.6/450-10-block-add-new-genhd-flag-GENHD_FL_NVMEM.patch +++ b/target/linux/generic/pending-6.6/453-block-add-new-genhd-flag-GENHD_FL_NVMEM.patch @@ -1,7 +1,7 @@ -From 65f3ff9672ccd5ee78937047e7a2fc696eee1c8f Mon Sep 17 00:00:00 2001 +From f4487fa1cb7e55b3c17a33f41b9c9d66f4f853b7 Mon Sep 17 00:00:00 2001 From: Daniel Golle -Date: Thu, 13 Jul 2023 04:07:16 +0100 -Subject: [PATCH 10/15] block: add new genhd flag GENHD_FL_NVMEM +Date: Thu, 30 May 2024 03:14:49 +0100 +Subject: [PATCH 4/9] block: add new genhd flag GENHD_FL_NVMEM Add new flag to destinguish block devices which may act as an NVMEM provider. diff --git a/target/linux/generic/pending-6.6/450-11-block-implement-NVMEM-provider.patch b/target/linux/generic/pending-6.6/454-nvmem-implement-block-NVMEM-provider.patch similarity index 66% rename from target/linux/generic/pending-6.6/450-11-block-implement-NVMEM-provider.patch rename to target/linux/generic/pending-6.6/454-nvmem-implement-block-NVMEM-provider.patch index d96477111c..3c08f6dd84 100644 --- a/target/linux/generic/pending-6.6/450-11-block-implement-NVMEM-provider.patch +++ b/target/linux/generic/pending-6.6/454-nvmem-implement-block-NVMEM-provider.patch @@ -1,63 +1,66 @@ -From b9936aa8a3775c2027f655d91a206d0e6e1c7ec0 Mon Sep 17 00:00:00 2001 +From 9703951cdfe868b130e64d6122420396c2807be8 Mon Sep 17 00:00:00 2001 From: Daniel Golle -Date: Tue, 11 Jul 2023 00:17:31 +0100 -Subject: [PATCH 11/15] block: implement NVMEM provider +Date: Thu, 30 May 2024 03:15:02 +0100 +Subject: [PATCH 5/9] nvmem: implement block NVMEM provider On embedded devices using an eMMC it is common that one or more partitions on the eMMC are used to store MAC addresses and Wi-Fi calibration EEPROM -data. Allow referencing the partition in device tree for the kernel and -Wi-Fi drivers accessing it via the NVMEM layer. +data. Allow referencing any block device or partition in Device Tree to +allow e.g. Ethernet and Wi-Fi drivers accessing them via the NVMEM layer. Signed-off-by: Daniel Golle --- - block/Kconfig | 9 +++ - block/Makefile | 1 + - block/blk-nvmem.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 196 insertions(+) - create mode 100644 block/blk-nvmem.c + drivers/nvmem/Kconfig | 11 +++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/block.c | 197 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 210 insertions(+) + create mode 100644 drivers/nvmem/block.c ---- a/block/Kconfig -+++ b/block/Kconfig -@@ -208,6 +208,15 @@ config BLK_INLINE_ENCRYPTION_FALLBACK - by falling back to the kernel crypto API when inline - encryption hardware is not present. +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -40,6 +40,17 @@ config NVMEM_APPLE_EFUSES + This driver can also be built as a module. If so, the module will + be called nvmem-apple-efuses. -+config BLK_NVMEM -+ bool "Block device NVMEM provider" ++config NVMEM_BLOCK ++ tristate "Block device NVMEM provider" ++ depends on BLOCK + depends on OF + depends on NVMEM ++ select BLOCK_NOTIFIERS + help + Allow block devices (or partitions) to act as NVMEM prodivers, + typically used with eMMC to store MAC addresses or Wi-Fi + calibration data on embedded devices. + - source "block/partitions/Kconfig" - - config BLK_MQ_PCI ---- a/block/Makefile -+++ b/block/Makefile -@@ -34,6 +34,7 @@ obj-$(CONFIG_BLK_DEV_ZONED) += blk-zoned - obj-$(CONFIG_BLK_WBT) += blk-wbt.o - obj-$(CONFIG_BLK_DEBUG_FS) += blk-mq-debugfs.o - obj-$(CONFIG_BLK_DEBUG_FS_ZONED)+= blk-mq-debugfs-zoned.o -+obj-$(CONFIG_BLK_NVMEM) += blk-nvmem.o - obj-$(CONFIG_BLK_SED_OPAL) += sed-opal.o - obj-$(CONFIG_BLK_PM) += blk-pm.o - obj-$(CONFIG_BLK_INLINE_ENCRYPTION) += blk-crypto.o blk-crypto-profile.o \ + config NVMEM_BCM_OCOTP + tristate "Broadcom On-Chip OTP Controller support" + depends on ARCH_BCM_IPROC || COMPILE_TEST +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -14,6 +14,8 @@ obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvme + nvmem-apple-efuses-y := apple-efuses.o + obj-$(CONFIG_NVMEM_BCM_OCOTP) += nvmem-bcm-ocotp.o + nvmem-bcm-ocotp-y := bcm-ocotp.o ++obj-$(CONFIG_NVMEM_BLOCK) += nvmem-block.o ++nvmem-block-y := block.o + obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o + nvmem_brcm_nvram-y := brcm_nvram.o + obj-$(CONFIG_NVMEM_IMX_IIM) += nvmem-imx-iim.o --- /dev/null -+++ b/block/blk-nvmem.c -@@ -0,0 +1,186 @@ ++++ b/drivers/nvmem/block.c +@@ -0,0 +1,208 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * block device NVMEM provider + * -+ * Copyright (c) 2023 Daniel Golle ++ * Copyright (c) 2024 Daniel Golle + * + * Useful on devices using a partition on an eMMC for MAC addresses or + * Wi-Fi calibration EEPROM data. + */ + -+#include "blk.h" ++#include +#include +#include +#include @@ -216,20 +219,42 @@ Signed-off-by: Daniel Golle + kfree(bnv); +} + -+static struct class_interface blk_nvmem_bus_interface __refdata = { -+ .class = &block_class, -+ .add_dev = &blk_nvmem_register, -+ .remove_dev = &blk_nvmem_unregister, ++static int blk_nvmem_handler(struct notifier_block *this, unsigned long code, void *obj) ++{ ++ struct device *dev = (struct device *)obj; ++ ++ switch (code) { ++ case BLK_DEVICE_ADD: ++ return blk_nvmem_register(dev); ++ case BLK_DEVICE_REMOVE: ++ blk_nvmem_unregister(dev); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static struct notifier_block blk_nvmem_notifier = { ++ .notifier_call = blk_nvmem_handler, +}; + +static int __init blk_nvmem_init(void) +{ -+ int ret; -+ -+ ret = class_interface_register(&blk_nvmem_bus_interface); -+ if (ret) -+ return ret; ++ blk_register_notify(&blk_nvmem_notifier); + + return 0; +} -+device_initcall(blk_nvmem_init); ++ ++static void __exit blk_nvmem_exit(void) ++{ ++ blk_unregister_notify(&blk_nvmem_notifier); ++} ++ ++module_init(blk_nvmem_init); ++module_exit(blk_nvmem_exit); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Daniel Golle "); ++MODULE_DESCRIPTION("block device NVMEM provider"); diff --git a/target/linux/generic/pending-6.6/450-12-dt-bindings-mmc-mmc-card-add-block-device-nodes.patch b/target/linux/generic/pending-6.6/455-dt-bindings-mmc-mmc-card-add-block-device-nodes.patch similarity index 92% rename from target/linux/generic/pending-6.6/450-12-dt-bindings-mmc-mmc-card-add-block-device-nodes.patch rename to target/linux/generic/pending-6.6/455-dt-bindings-mmc-mmc-card-add-block-device-nodes.patch index 77c9bf91a5..74e6c821ba 100644 --- a/target/linux/generic/pending-6.6/450-12-dt-bindings-mmc-mmc-card-add-block-device-nodes.patch +++ b/target/linux/generic/pending-6.6/455-dt-bindings-mmc-mmc-card-add-block-device-nodes.patch @@ -1,7 +1,7 @@ -From 86864bf8f40e84dc881c197ef470a88668329dbf Mon Sep 17 00:00:00 2001 +From f7ec19b34d1b7e934a58ceb102369bbd30b2631d Mon Sep 17 00:00:00 2001 From: Daniel Golle -Date: Mon, 7 Aug 2023 21:21:45 +0100 -Subject: [PATCH 12/15] dt-bindings: mmc: mmc-card: add block device nodes +Date: Thu, 30 May 2024 03:15:11 +0100 +Subject: [PATCH 6/9] dt-bindings: mmc: mmc-card: add block device nodes Add nodes representing the block devices exposed by an MMC device including an example involving nvmem-cells. diff --git a/target/linux/generic/pending-6.6/450-13-mmc-core-set-card-fwnode_handle.patch b/target/linux/generic/pending-6.6/456-mmc-core-set-card-fwnode_handle.patch similarity index 78% rename from target/linux/generic/pending-6.6/450-13-mmc-core-set-card-fwnode_handle.patch rename to target/linux/generic/pending-6.6/456-mmc-core-set-card-fwnode_handle.patch index ff0d9c395c..2ee170d47b 100644 --- a/target/linux/generic/pending-6.6/450-13-mmc-core-set-card-fwnode_handle.patch +++ b/target/linux/generic/pending-6.6/456-mmc-core-set-card-fwnode_handle.patch @@ -1,7 +1,7 @@ -From 644942a31719de674e2aa68f83d66bd8ae7e4fb7 Mon Sep 17 00:00:00 2001 +From 043c4f88476cc0f29c9bf82a8a516f58d848e1cd Mon Sep 17 00:00:00 2001 From: Daniel Golle -Date: Thu, 13 Jul 2023 04:12:21 +0100 -Subject: [PATCH 13/15] mmc: core: set card fwnode_handle +Date: Thu, 30 May 2024 03:15:25 +0100 +Subject: [PATCH 7/9] mmc: core: set card fwnode_handle Set fwnode in case it isn't set yet and of_node is present. diff --git a/target/linux/generic/pending-6.6/450-14-mmc-block-set-fwnode-of-disk-devices.patch b/target/linux/generic/pending-6.6/457-mmc-block-set-fwnode-of-disk-devices.patch similarity index 64% rename from target/linux/generic/pending-6.6/450-14-mmc-block-set-fwnode-of-disk-devices.patch rename to target/linux/generic/pending-6.6/457-mmc-block-set-fwnode-of-disk-devices.patch index d6b3df3aa0..b45a0ebb1a 100644 --- a/target/linux/generic/pending-6.6/450-14-mmc-block-set-fwnode-of-disk-devices.patch +++ b/target/linux/generic/pending-6.6/457-mmc-block-set-fwnode-of-disk-devices.patch @@ -1,7 +1,7 @@ -From d9143f86330dd038fc48878558dd287ceee5d3d4 Mon Sep 17 00:00:00 2001 +From ef3e38fec26901b71975d7e810a2df6b8bd54a8e Mon Sep 17 00:00:00 2001 From: Daniel Golle -Date: Thu, 13 Jul 2023 04:13:04 +0100 -Subject: [PATCH 14/15] mmc: block: set fwnode of disk devices +Date: Thu, 30 May 2024 03:15:36 +0100 +Subject: [PATCH 8/9] mmc: block: set fwnode of disk devices Set fwnode of disk devices to 'block', 'boot0' and 'boot1' subnodes of the mmc-card. This is done in preparation for having the eMMC act as @@ -9,30 +9,28 @@ NVMEM provider. Signed-off-by: Daniel Golle --- - drivers/mmc/core/block.c | 8 ++++++++ - 1 file changed, 8 insertions(+) + drivers/mmc/core/block.c | 7 +++++++ + 1 file changed, 7 insertions(+) --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c -@@ -2463,6 +2463,8 @@ static struct mmc_blk_data *mmc_blk_allo +@@ -2463,6 +2463,7 @@ static struct mmc_blk_data *mmc_blk_allo int area_type, unsigned int part_type) { + struct fwnode_handle *fwnode; -+ struct device *ddev; struct mmc_blk_data *md; int devidx, ret; char cap_str[10]; -@@ -2559,6 +2561,13 @@ static struct mmc_blk_data *mmc_blk_allo +@@ -2559,6 +2560,12 @@ static struct mmc_blk_data *mmc_blk_allo blk_queue_write_cache(md->queue.queue, cache_enabled, fua_enabled); -+ ddev = disk_to_dev(md->disk); + fwnode = device_get_named_child_node(subname ? md->parent->parent : + md->parent, + subname ? subname : "block"); + if (fwnode) -+ device_set_node(ddev, fwnode); ++ device_set_node(disk_to_dev(md->disk), fwnode); + string_get_size((u64)size, 512, STRING_UNITS_2, cap_str, sizeof(cap_str)); diff --git a/target/linux/generic/pending-6.6/450-15-mmc-block-set-GENHD_FL_NVMEM.patch b/target/linux/generic/pending-6.6/458-mmc-block-set-GENHD_FL_NVMEM.patch similarity index 71% rename from target/linux/generic/pending-6.6/450-15-mmc-block-set-GENHD_FL_NVMEM.patch rename to target/linux/generic/pending-6.6/458-mmc-block-set-GENHD_FL_NVMEM.patch index d4c3cd8df8..713401f104 100644 --- a/target/linux/generic/pending-6.6/450-15-mmc-block-set-GENHD_FL_NVMEM.patch +++ b/target/linux/generic/pending-6.6/458-mmc-block-set-GENHD_FL_NVMEM.patch @@ -1,7 +1,7 @@ -From 322035ab2b0113d98b6c0ea788d971e0df2952a4 Mon Sep 17 00:00:00 2001 +From 7903b50441000365a6fe5badb39735889f562252 Mon Sep 17 00:00:00 2001 From: Daniel Golle -Date: Thu, 20 Jul 2023 17:36:44 +0100 -Subject: [PATCH 15/15] mmc: block: set GENHD_FL_NVMEM +Date: Thu, 30 May 2024 03:15:46 +0100 +Subject: [PATCH 9/9] mmc: block: set GENHD_FL_NVMEM Set flag to consider MMC block devices as NVMEM providers. @@ -12,7 +12,7 @@ Signed-off-by: Daniel Golle --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c -@@ -2517,6 +2517,7 @@ static struct mmc_blk_data *mmc_blk_allo +@@ -2516,6 +2516,7 @@ static struct mmc_blk_data *mmc_blk_allo md->disk->major = MMC_BLOCK_MAJOR; md->disk->minors = perdev_minors; md->disk->first_minor = devidx * perdev_minors; diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index 5f4e42ac0f..6d9d42853b 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -48,8 +48,8 @@ CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y -CONFIG_BLK_NVMEM=y CONFIG_BLK_PM=y +CONFIG_BLOCK_NOTIFIERS=y CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_BUFFER_HEAD=y @@ -312,6 +312,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=4 CONFIG_NVMEM=y +CONFIG_NVMEM_BLOCK=y CONFIG_NVMEM_LAYOUTS=y CONFIG_NVMEM_MTK_EFUSE=y CONFIG_NVMEM_SYSFS=y diff --git a/target/linux/mediatek/patches-6.6/041-block-fit-partition-parser.patch b/target/linux/mediatek/patches-6.6/041-block-fit-partition-parser.patch index 185ec105d0..49fc7e638c 100644 --- a/target/linux/mediatek/patches-6.6/041-block-fit-partition-parser.patch +++ b/target/linux/mediatek/patches-6.6/041-block-fit-partition-parser.patch @@ -92,7 +92,7 @@ Subject: [PATCH] kernel: add block fit partition parser #ifdef CONFIG_SGI_PARTITION sgi_partition, #endif -@@ -433,6 +439,11 @@ static struct block_device *add_partitio +@@ -430,6 +436,11 @@ static struct block_device *add_partitio goto out_del; } @@ -104,7 +104,7 @@ Subject: [PATCH] kernel: add block fit partition parser /* everything is up and running, commence */ err = xa_insert(&disk->part_tbl, partno, bdev, GFP_KERNEL); if (err) -@@ -625,6 +636,11 @@ static bool blk_add_partition(struct gen +@@ -622,6 +633,11 @@ static bool blk_add_partition(struct gen (state->parts[p].flags & ADDPART_FLAG_RAID)) md_autodetect_dev(part->bd_dev); -- 2.30.2