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:
@@ -49,7 +49,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
#include "check.h"
|
||||
|
||||
static int (*const check_part[])(struct parsed_partitions *) = {
|
||||
@@ -292,6 +294,74 @@ static ssize_t whole_disk_show(struct de
|
||||
@@ -295,6 +297,74 @@ static ssize_t whole_disk_show(struct de
|
||||
}
|
||||
static const DEVICE_ATTR(whole_disk, 0444, whole_disk_show, NULL);
|
||||
|
||||
@@ -124,7 +124,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
/*
|
||||
* Must be called either with open_mutex held, before a disk can be opened or
|
||||
* after all disk users are gone.
|
||||
@@ -374,6 +444,8 @@ static struct block_device *add_partitio
|
||||
@@ -377,6 +447,8 @@ static struct block_device *add_partitio
|
||||
goto out_put;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
+device_initcall(blk_notifications_init);
|
||||
--- a/include/linux/blkdev.h
|
||||
+++ b/include/linux/blkdev.h
|
||||
@@ -1564,4 +1564,15 @@ struct io_comp_batch {
|
||||
@@ -1567,4 +1567,15 @@ struct io_comp_batch {
|
||||
|
||||
#define DEFINE_IO_COMP_BATCH(name) struct io_comp_batch name = { }
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -12,7 +12,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
|
||||
--- a/drivers/mmc/core/block.c
|
||||
+++ b/drivers/mmc/core/block.c
|
||||
@@ -2516,6 +2516,7 @@ static struct mmc_blk_data *mmc_blk_allo
|
||||
@@ -2566,6 +2566,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;
|
||||
|
||||
Reference in New Issue
Block a user