forked from Ivasoft/openwrt
kernel: backport mtd implementation for "compatible" in "partitions" subnode
This backports upstream support for "compatible" DT property set for the "partitions" subnode of flash node. It allows specifying how partitions should be created/parsed. Right now only "fixed-partitions" is supported. It should eventually replace our downstream "linux,part-probe" solution. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
This commit is contained in:
@@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/drivers/mtd/mtdpart.c
|
||||
+++ b/drivers/mtd/mtdpart.c
|
||||
@@ -36,6 +36,8 @@
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "mtdcore.h"
|
||||
#include "mtdsplit/mtdsplit.h"
|
||||
|
||||
@@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
/* Our partition linked list */
|
||||
static LIST_HEAD(mtd_partitions);
|
||||
static DEFINE_MUTEX(mtd_partitions_mutex);
|
||||
@@ -241,13 +243,61 @@ static int part_erase(struct mtd_info *m
|
||||
@@ -242,13 +244,61 @@ static int part_erase(struct mtd_info *m
|
||||
struct mtd_part *part = mtd_to_part(mtd);
|
||||
int ret;
|
||||
|
||||
@@ -81,7 +81,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -255,6 +305,25 @@ void mtd_erase_callback(struct erase_inf
|
||||
@@ -256,6 +306,25 @@ void mtd_erase_callback(struct erase_inf
|
||||
{
|
||||
if (instr->mtd->_erase == part_erase) {
|
||||
struct mtd_part *part = mtd_to_part(instr->mtd);
|
||||
@@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
|
||||
instr->fail_addr -= part->offset;
|
||||
@@ -598,19 +667,22 @@ static struct mtd_part *allocate_partiti
|
||||
@@ -599,19 +668,22 @@ static struct mtd_part *allocate_partiti
|
||||
remainder = do_div(tmp, wr_alignment);
|
||||
if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) {
|
||||
/* Doesn't start on a boundary of major erase size */
|
||||
|
||||
Reference in New Issue
Block a user