* [PATCH] mtdpart: Support MTDPART_SIZ_FULL in fixed-partitions
[not found] <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.afd73f79-c1a2-48a0-ba01-91ddb6fb997d@emailsignatures365.codetwo.com>
@ 2025-03-25 15:52 ` Mike Looijmans
2025-04-07 13:42 ` Mike Looijmans
0 siblings, 1 reply; 4+ messages in thread
From: Mike Looijmans @ 2025-03-25 15:52 UTC (permalink / raw)
To: u-boot
Cc: Mike Looijmans, Alexey Romanov, Michael Trimarchi, Tom Rini,
William Zhang
Flash partitions may specify MTDPART_SIZ_FULL (=0) as the size of the
partition to indicate "the remainder of the flash". Make this work with
device-tree "fixed-partitions" as well.
Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
---
drivers/mtd/mtdpart.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 88094b81e7a..5284890bd88 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -910,11 +910,13 @@ int add_mtd_partitions_of(struct mtd_info *master)
continue;
offset = ofnode_get_addr_size_index_notrans(child, 0, &size);
- if (offset == FDT_ADDR_T_NONE || !size) {
- debug("Missing partition offset/size on \"%s\" partition\n",
+ if (offset == FDT_ADDR_T_NONE) {
+ debug("Missing partition offset on \"%s\" partition\n",
master->name);
continue;
}
+ if (size == MTDPART_SIZ_FULL)
+ size = master->size - offset;
part.name = ofnode_read_string(child, "label");
if (!part.name)
--
2.43.0
Met vriendelijke groet / kind regards,
Mike Looijmans
System Expert
TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands
T: +31 (0) 499 33 69 69
E: mike.looijmans@topic.nl
W: www.topic.nl
Please consider the environment before printing this e-mail
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mtdpart: Support MTDPART_SIZ_FULL in fixed-partitions
2025-03-25 15:52 ` [PATCH] mtdpart: Support MTDPART_SIZ_FULL in fixed-partitions Mike Looijmans
@ 2025-04-07 13:42 ` Mike Looijmans
2025-04-07 19:47 ` Michael Nazzareno Trimarchi
0 siblings, 1 reply; 4+ messages in thread
From: Mike Looijmans @ 2025-04-07 13:42 UTC (permalink / raw)
To: u-boot; +Cc: Alexey Romanov, Michael Trimarchi, Tom Rini, William Zhang
ping?
Maybe I should have added to the description that the Linux kernel
allows MTD partitions to specify a size "0" in the device-tree to mean
"the remainder". This patch makes u-boot compatible with the kernel's
MTD partitions. U-boot MTDPARTS also supported this, but it's missing in
the device-tree parser.
M.
On 25-03-2025 16:52, Mike Looijmans wrote:
> Flash partitions may specify MTDPART_SIZ_FULL (=0) as the size of the
> partition to indicate "the remainder of the flash". Make this work with
> device-tree "fixed-partitions" as well.
>
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
> ---
>
> drivers/mtd/mtdpart.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index 88094b81e7a..5284890bd88 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -910,11 +910,13 @@ int add_mtd_partitions_of(struct mtd_info *master)
> continue;
>
> offset = ofnode_get_addr_size_index_notrans(child, 0, &size);
> - if (offset == FDT_ADDR_T_NONE || !size) {
> - debug("Missing partition offset/size on \"%s\" partition\n",
> + if (offset == FDT_ADDR_T_NONE) {
> + debug("Missing partition offset on \"%s\" partition\n",
> master->name);
> continue;
> }
> + if (size == MTDPART_SIZ_FULL)
> + size = master->size - offset;
>
> part.name = ofnode_read_string(child, "label");
> if (!part.name)
--
Mike Looijmans
System Expert
TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands
T: +31 (0) 499 33 69 69
E: mike.looijmans@topic.nl
W: www.topic.nl
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mtdpart: Support MTDPART_SIZ_FULL in fixed-partitions
2025-04-07 13:42 ` Mike Looijmans
@ 2025-04-07 19:47 ` Michael Nazzareno Trimarchi
2025-04-08 5:41 ` Mike Looijmans
0 siblings, 1 reply; 4+ messages in thread
From: Michael Nazzareno Trimarchi @ 2025-04-07 19:47 UTC (permalink / raw)
To: Mike Looijmans; +Cc: u-boot, Alexey Romanov, Tom Rini, William Zhang
Hi MIke
On Mon, Apr 7, 2025 at 3:42 PM Mike Looijmans <mike.looijmans@topic.nl>
wrote:
> ping?
>
> Maybe I should have added to the description that the Linux kernel
> allows MTD partitions to specify a size "0" in the device-tree to mean
> "the remainder". This patch makes u-boot compatible with the kernel's
> MTD partitions. U-boot MTDPARTS also supported this, but it's missing in
> the device-tree parser.
>
>
Please expand your commit message . Add an example where is defined this
way in linux kernel and add your example. I found out that is used a lot in
omap3 platform
but please point me to some recent board if you know
Michael
M.
>
> On 25-03-2025 16:52, Mike Looijmans wrote:
> > Flash partitions may specify MTDPART_SIZ_FULL (=0) as the size of the
> > partition to indicate "the remainder of the flash". Make this work with
> > device-tree "fixed-partitions" as well.
> >
> > Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
> > ---
> >
> > drivers/mtd/mtdpart.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> > index 88094b81e7a..5284890bd88 100644
> > --- a/drivers/mtd/mtdpart.c
> > +++ b/drivers/mtd/mtdpart.c
> > @@ -910,11 +910,13 @@ int add_mtd_partitions_of(struct mtd_info *master)
> > continue;
> >
> > offset = ofnode_get_addr_size_index_notrans(child, 0,
> &size);
> > - if (offset == FDT_ADDR_T_NONE || !size) {
> > - debug("Missing partition offset/size on \"%s\"
> partition\n",
> > + if (offset == FDT_ADDR_T_NONE) {
> > + debug("Missing partition offset on \"%s\"
> partition\n",
> > master->name);
> > continue;
> > }
> > + if (size == MTDPART_SIZ_FULL)
> > + size = master->size - offset;
> >
> > part.name = ofnode_read_string(child, "label");
> > if (!part.name)
>
>
> --
> Mike Looijmans
> System Expert
>
> TOPIC Embedded Products B.V.
> Materiaalweg 4, 5681 RJ Best
> The Netherlands
>
> T: +31 (0) 499 33 69 69
> E: mike.looijmans@topic.nl
> W: www.topic.nl
>
>
>
>
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
michael@amarulasolutions.com
__________________________________
Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
info@amarulasolutions.com
www.amarulasolutions.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mtdpart: Support MTDPART_SIZ_FULL in fixed-partitions
2025-04-07 19:47 ` Michael Nazzareno Trimarchi
@ 2025-04-08 5:41 ` Mike Looijmans
0 siblings, 0 replies; 4+ messages in thread
From: Mike Looijmans @ 2025-04-08 5:41 UTC (permalink / raw)
To: Michael Nazzareno Trimarchi
Cc: u-boot, Alexey Romanov, Tom Rini, William Zhang
On 07-04-2025 21:47, Michael Nazzareno Trimarchi wrote:
Hi MIke
On Mon, Apr 7, 2025 at 3:42 PM Mike Looijmans <mike.looijmans@topic.nl<mailto:mike.looijmans@topic.nl>> wrote:
ping?
Maybe I should have added to the description that the Linux kernel
allows MTD partitions to specify a size "0" in the device-tree to mean
"the remainder". This patch makes u-boot compatible with the kernel's
MTD partitions. U-boot MTDPARTS also supported this, but it's missing in
the device-tree parser.
Please expand your commit message . Add an example where is defined this
way in linux kernel and add your example. I found out that is used a lot in omap3 platform
but please point me to some recent board if you know
I'll send a v2. Indeed the OMAP3 boards are the quickest to find examples.
Obviously, you shouldn't find any example in the u-boot tree because it didn't work...
I came across this because I wanted to migrate the topic_miami boards away from MTDPARTS but the "fixed-partitions" did not work as expected when using the same devicetree for kernel and u-boot. Otherwise topic-miami would have been the example you asked for...
Michael
M.
On 25-03-2025 16:52, Mike Looijmans wrote:
> Flash partitions may specify MTDPART_SIZ_FULL (=0) as the size of the
> partition to indicate "the remainder of the flash". Make this work with
> device-tree "fixed-partitions" as well.
>
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl<mailto:mike.looijmans@topic.nl>>
> ---
>
> drivers/mtd/mtdpart.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index 88094b81e7a..5284890bd88 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -910,11 +910,13 @@ int add_mtd_partitions_of(struct mtd_info *master)
> continue;
>
> offset = ofnode_get_addr_size_index_notrans(child, 0, &size);
> - if (offset == FDT_ADDR_T_NONE || !size) {
> - debug("Missing partition offset/size on \"%s\" partition\n",
> + if (offset == FDT_ADDR_T_NONE) {
> + debug("Missing partition offset on \"%s\" partition\n",
> master->name);
> continue;
> }
> + if (size == MTDPART_SIZ_FULL)
> + size = master->size - offset;
>
> part.name<http://part.name> = ofnode_read_string(child, "label");
> if (!part.name<http://part.name>)
--
Mike Looijmans
System Expert
TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands
T: +31 (0) 499 33 69 69
E: mike.looijmans@topic.nl<mailto:mike.looijmans@topic.nl>
W: www.topic.nl<http://www.topic.nl>
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
michael@amarulasolutions.com<mailto:michael@amarulasolutions.com>
__________________________________
Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
info@amarulasolutions.com<mailto:info@amarulasolutions.com>
www.amarulasolutions.com<http://www.amarulasolutions.com>
--
Mike Looijmans
System Expert
TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands
T: +31 (0) 499 33 69 69
E: mike.looijmans@topic.nl<mailto:mike.looijmans@topic.nl>
W: www.topic.nl<http://www.topic.nl>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-08 5:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.afd73f79-c1a2-48a0-ba01-91ddb6fb997d@emailsignatures365.codetwo.com>
2025-03-25 15:52 ` [PATCH] mtdpart: Support MTDPART_SIZ_FULL in fixed-partitions Mike Looijmans
2025-04-07 13:42 ` Mike Looijmans
2025-04-07 19:47 ` Michael Nazzareno Trimarchi
2025-04-08 5:41 ` Mike Looijmans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox