public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Huang Shijie <b32955@freescale.com>
To: Aaron Sierra <asierra@xes-inc.com>
Cc: linux-mtd@lists.infradead.org, Joe Schaack <jschaack@xes-inc.com>,
	Artem Bityutskiy <dedekind1@gmail.com>
Subject: Re: [PATCH] mtd: ofpart: support partitions of 4 GB and larger
Date: Wed, 20 Feb 2013 10:02:02 +0800	[thread overview]
Message-ID: <51242E9A.3080901@freescale.com> (raw)
In-Reply-To: <3a708bb0-af78-4d31-b61f-8cff1612be8d@zimbra>

于 2013年02月20日 06:23, Aaron Sierra 写道:
> Author: Joe Schaack<jschaack@xes-inc.com>
>
> Previously, partitions were limited to less than 4 GB in size because
> the address and size were read as 32-bit values. Add support for 64-bit
> values to support devices of 4 GB and larger.
>
> Signed-off-by: Joe Schaack<jschaack@xes-inc.com>
> Signed-off-by: Nate Case<ncase@xes-inc.com>
> Signed-off-by: Aaron Sierra<asierra@xes-inc.com>
> ---
>   drivers/mtd/ofpart.c |    7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
> index 30bd907..553d6d6 100644
> --- a/drivers/mtd/ofpart.c
> +++ b/drivers/mtd/ofpart.c
> @@ -55,6 +55,7 @@ static int parse_ofpart_partitions(struct mtd_info *master,
>   	while ((pp = of_get_next_child(node, pp))) {
>   		const __be32 *reg;
>   		int len;
> +		int a_cells, s_cells;
>
>   		reg = of_get_property(pp, "reg",&len);
>   		if (!reg) {
> @@ -62,8 +63,10 @@ static int parse_ofpart_partitions(struct mtd_info *master,
>   			continue;
>   		}
>
> -		(*pparts)[i].offset = be32_to_cpu(reg[0]);
> -		(*pparts)[i].size = be32_to_cpu(reg[1]);
> +		a_cells = of_n_addr_cells(pp);
> +		s_cells = of_n_size_cells(pp);
> +		(*pparts)[i].offset = of_read_number(reg, a_cells);
> +		(*pparts)[i].size = of_read_number(reg + a_cells, s_cells);
>
>   		partname = of_get_property(pp, "label",&len);
>   		if (!partname)
I think it's better to update the 
Documentation/devicetree/bindings/mtd/partition.txt too. for example, 
add a example for the
partition larger then 4G.

thanks
Huang Shijie

  reply	other threads:[~2013-02-20  2:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <f0151b07-ba77-472d-8c7d-b35c2113e9a2@zimbra>
2013-02-19 22:23 ` [PATCH] mtd: ofpart: support partitions of 4 GB and larger Aaron Sierra
2013-02-20  2:02   ` Huang Shijie [this message]
2013-02-21 21:43     ` Aaron Sierra

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=51242E9A.3080901@freescale.com \
    --to=b32955@freescale.com \
    --cc=asierra@xes-inc.com \
    --cc=dedekind1@gmail.com \
    --cc=jschaack@xes-inc.com \
    --cc=linux-mtd@lists.infradead.org \
    /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