generic: backport BLOCK OF support patch

Backport BLOCK OF support patch merged upstream and refresh pending
BLOCK patches.

This is a new way to declare partition table for BLOCK device (eMMC
currently supported) with the use of DTS.

Current pending patch are adapted to not cause regression with current
downstream implementation of a similar functionality.

Also enable the new OF_PARTITION config by default.

Link: https://github.com/openwrt/openwrt/pull/16663
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
Christian Marangi
2024-10-11 14:05:40 +02:00
parent 48b8c602d0
commit f9a70a20c5
10 changed files with 470 additions and 28 deletions

View File

@@ -14,24 +14,14 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -2463,6 +2463,7 @@ static struct mmc_blk_data *mmc_blk_allo
int area_type,
unsigned int part_type)
{
+ struct fwnode_handle *fwnode;
struct mmc_blk_data *md;
int devidx, ret;
char cap_str[10];
@@ -2559,6 +2560,12 @@ static struct mmc_blk_data *mmc_blk_allo
blk_queue_write_cache(md->queue.queue, cache_enabled, fua_enabled);
+ fwnode = device_get_named_child_node(subname ? md->parent->parent :
+ md->parent,
+ subname ? subname : "block");
+ if (fwnode)
+ device_set_node(disk_to_dev(md->disk), fwnode);
+
string_get_size((u64)size, 512, STRING_UNITS_2,
cap_str, sizeof(cap_str));
pr_info("%s: %s %s %s%s\n",
@@ -2620,6 +2620,10 @@ static struct mmc_blk_data *mmc_blk_allo
if (area_type == MMC_BLK_DATA_AREA_MAIN)
dev_set_drvdata(&card->dev, md);
disk_fwnode = mmc_blk_get_partitions_node(parent, subname);
+ if (!disk_fwnode)
+ disk_fwnode = device_get_named_child_node(subname ? md->parent->parent :
+ md->parent,
+ subname ? subname : "block");
ret = add_disk_fwnode(md->parent, md->disk, mmc_disk_attr_groups,
disk_fwnode);
if (ret)