27875b8c2c94beb9f2958374b29e15efdcf636a4
[openwrt/staging/stintel.git] / target / linux / generic / pending-6.6 / 450-14-mmc-block-set-fwnode-of-disk-devices.patch
1 From d9143f86330dd038fc48878558dd287ceee5d3d4 Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Thu, 13 Jul 2023 04:13:04 +0100
4 Subject: [PATCH 14/15] mmc: block: set fwnode of disk devices
5
6 Set fwnode of disk devices to 'block', 'boot0' and 'boot1' subnodes of
7 the mmc-card. This is done in preparation for having the eMMC act as
8 NVMEM provider.
9
10 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
11 ---
12 drivers/mmc/core/block.c | 8 ++++++++
13 1 file changed, 8 insertions(+)
14
15 --- a/drivers/mmc/core/block.c
16 +++ b/drivers/mmc/core/block.c
17 @@ -2461,6 +2461,8 @@ static struct mmc_blk_data *mmc_blk_allo
18 int area_type,
19 unsigned int part_type)
20 {
21 + struct fwnode_handle *fwnode;
22 + struct device *ddev;
23 struct mmc_blk_data *md;
24 int devidx, ret;
25 char cap_str[10];
26 @@ -2557,6 +2559,13 @@ static struct mmc_blk_data *mmc_blk_allo
27
28 blk_queue_write_cache(md->queue.queue, cache_enabled, fua_enabled);
29
30 + ddev = disk_to_dev(md->disk);
31 + fwnode = device_get_named_child_node(subname ? md->parent->parent :
32 + md->parent,
33 + subname ? subname : "block");
34 + if (fwnode)
35 + device_set_node(ddev, fwnode);
36 +
37 string_get_size((u64)size, 512, STRING_UNITS_2,
38 cap_str, sizeof(cap_str));
39 pr_info("%s: %s %s %s%s\n",