kernel: nvmem: correctly assign fwnode to MMC block device
authorDaniel Golle <daniel@makrotopia.org>
Sun, 18 Feb 2024 01:02:46 +0000 (01:02 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Sun, 18 Feb 2024 03:25:39 +0000 (03:25 +0000)
Use device_set_node to make sure OF node gets assigned on block
devices to be used as NVMEM providers. While block partitions were
already working fine as NVMEM providers, bare block devices such as
mmcblk0boot1 will not work without this change.

Fixes: fc153aa8d9 ("kernel: import pending patches adding support for NVMEM on UBI and MMC")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
target/linux/bcm27xx/patches-6.1/950-0111-MMC-added-alternative-MMC-driver.patch
target/linux/generic/pending-6.1/450-14-mmc-block-set-fwnode-of-disk-devices.patch

index 693ed2b6d1e30c9ab603b71eb2fec8a9490f7061..a89940dacb6f770fc5beac58928473b9f6b271c0 100644 (file)
@@ -266,7 +266,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
  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,
-@@ -3049,6 +3056,8 @@ static int mmc_blk_probe(struct mmc_card
+@@ -3050,6 +3057,8 @@ static int mmc_blk_probe(struct mmc_card
  {
        struct mmc_blk_data *md;
        int ret = 0;
@@ -275,7 +275,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
  
        /*
         * Check that the card supports the command class(es) we need.
-@@ -3056,7 +3065,16 @@ static int mmc_blk_probe(struct mmc_card
+@@ -3057,7 +3066,16 @@ static int mmc_blk_probe(struct mmc_card
        if (!(card->csd.cmdclass & CCC_BLOCK_READ))
                return -ENODEV;
  
@@ -293,7 +293,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
  
        card->complete_wq = alloc_workqueue("mmc_complete",
                                        WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
-@@ -3071,6 +3089,17 @@ static int mmc_blk_probe(struct mmc_card
+@@ -3072,6 +3090,17 @@ static int mmc_blk_probe(struct mmc_card
                goto out_free;
        }
  
index d033abb70de4345fc5063b41a978f53e8d2e6ddc..a9e53f115530e5e19a609318d1b6da278e00edf5 100644 (file)
@@ -23,7 +23,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
        struct mmc_blk_data *md;
        int devidx, ret;
        char cap_str[10];
-@@ -2580,6 +2582,12 @@ static struct mmc_blk_data *mmc_blk_allo
+@@ -2580,6 +2582,13 @@ static struct mmc_blk_data *mmc_blk_allo
  
        blk_queue_write_cache(md->queue.queue, cache_enabled, fua_enabled);
  
@@ -31,7 +31,8 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
 +      fwnode = device_get_named_child_node(subname ? md->parent->parent :
 +                                                     md->parent,
 +                                           subname ? subname : "block");
-+      ddev->fwnode = fwnode;
++      if (fwnode)
++              device_set_node(ddev, fwnode);
 +
        string_get_size((u64)size, 512, STRING_UNITS_2,
                        cap_str, sizeof(cap_str));