U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Looijmans <mike.looijmans@topic.nl>
To: u-boot@lists.denx.de
Cc: Alexey Romanov <avromanov@salutedevices.com>,
	Michael Trimarchi <michael@amarulasolutions.com>,
	Tom Rini <trini@konsulko.com>,
	William Zhang <william.zhang@broadcom.com>
Subject: Re: [PATCH] mtdpart: Support MTDPART_SIZ_FULL in fixed-partitions
Date: Mon, 7 Apr 2025 15:42:13 +0200	[thread overview]
Message-ID: <2b2f97fe-ebeb-43ba-9751-c7b45a88a92f@topic.nl> (raw)
In-Reply-To: <20250325155310.456037-1-mike.looijmans@topic.nl>

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




  reply	other threads:[~2025-04-07 13:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
2025-04-07 19:47     ` Michael Nazzareno Trimarchi
2025-04-08  5:41       ` Mike Looijmans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2b2f97fe-ebeb-43ba-9751-c7b45a88a92f@topic.nl \
    --to=mike.looijmans@topic.nl \
    --cc=avromanov@salutedevices.com \
    --cc=michael@amarulasolutions.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=william.zhang@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox