Files
openwrt/target/linux/pistachio/patches-6.12/401-mtd-nor-support-mtd-name-from-device-tree.patch
John Audia 97e9d7038e kernel: bump 6.12 to 6.12.62
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.12.62

Manually rebased:
  bcm27xx/patches-6.12/950-0358-mmc-sdhci-of-dwcmshc-define-sdio-timeout-clocks.patch

Removed upstreamed:
  backport-6.12/830-v6.18-spi-bcm63xx-fix-premature-CS-deassertion-on-RX-only-transactions.patch[1]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.62&id=e31194bf494f6900a5f96f55ed194a00e458f8d1

Build system: x86/64
Build-tested: flogic/glinet_gl-mt6000, ramips/tplink_archer-a6-v3, x86/64-glibc
Run-tested: flogic/glinet_gl-mt6000, ramips/tplink_archer-a6-v3, x86/64-glibc

Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/21126
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-12-17 00:27:21 +01:00

62 lines
1.8 KiB
Diff

From f32bc2aa01edcba2f2ed5db151cf183eac9ef919 Mon Sep 17 00:00:00 2001
From: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
Date: Sat, 25 Feb 2017 16:42:50 +0000
Subject: mtd: nor: support mtd name from device tree
Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
---
drivers/mtd/spi-nor/spi-nor.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -930,7 +930,9 @@ static int spi_mem_probe(struct spi_devi
{
struct spi_mem_driver *memdrv = to_spi_mem_drv(spi->dev.driver);
struct spi_controller *ctlr = spi->controller;
+ const char __maybe_unused *of_mtd_name = NULL;
struct spi_mem *mem;
+ int ret;
mem = devm_kzalloc(&spi->dev, sizeof(*mem), GFP_KERNEL);
if (!mem)
@@ -938,10 +940,15 @@ static int spi_mem_probe(struct spi_devi
mem->spi = spi;
- if (ctlr->mem_ops && ctlr->mem_ops->get_name)
+ if (ctlr->mem_ops && ctlr->mem_ops->get_name) {
mem->name = ctlr->mem_ops->get_name(mem);
- else
- mem->name = dev_name(&spi->dev);
+ } else {
+ ret = device_property_read_string(&spi->dev, "linux,mtd-name", &of_mtd_name);
+ if (!ret)
+ mem->name = of_mtd_name;
+ else
+ mem->name = dev_name(&spi->dev);
+ }
if (IS_ERR_OR_NULL(mem->name))
return PTR_ERR_OR_ZERO(mem->name);
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -849,6 +849,17 @@ out_error:
*/
static void mtd_set_dev_defaults(struct mtd_info *mtd)
{
+#ifdef CONFIG_MTD_OF_PARTS
+ const char __maybe_unused *of_mtd_name = NULL;
+ struct device_node *np;
+
+ np = mtd_get_of_node(mtd);
+ if (np && !mtd->name) {
+ of_property_read_string(np, "linux,mtd-name", &of_mtd_name);
+ if (of_mtd_name)
+ mtd->name = of_mtd_name;
+ } else
+#endif
if (mtd->dev.parent) {
if (!mtd->owner && mtd->dev.parent->driver)
mtd->owner = mtd->dev.parent->driver->owner;