All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] fdt: Fix regression in fdt_pack_reg()
@ 2014-11-28 13:23 Hans de Goede
  2014-11-28 16:46 ` Masahiro YAMADA
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Hans de Goede @ 2014-11-28 13:23 UTC (permalink / raw)
  To: u-boot

After commit 933cdbb479: "fdt: Try to use fdt_address_cells()/fdt_size_cells()"
I noticed that allwinner boards would no longer boot.

Switching to fdt_address_cells / fdt_size_cells changes the result from
bytes to 32 bit words, so when we increment pointers into the blob, we must
do so by 32 bit words now.

This commit makes allwinner boards boot again.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Improved patch subject
-s/_len/_cells/ to indicated that adress_cells and size_cells are in cells now
---
 common/fdt_support.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index ea42c63..6254e34 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -370,22 +370,22 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size,
 			int n)
 {
 	int i;
-	int address_len = fdt_address_cells(fdt, 0);
-	int size_len = fdt_size_cells(fdt, 0);
+	int address_cells = fdt_address_cells(fdt, 0);
+	int size_cells = fdt_size_cells(fdt, 0);
 	char *p = buf;
 
 	for (i = 0; i < n; i++) {
-		if (address_len == 2)
+		if (address_cells == 2)
 			*(fdt64_t *)p = cpu_to_fdt64(address[i]);
 		else
 			*(fdt32_t *)p = cpu_to_fdt32(address[i]);
-		p += address_len;
+		p += 4 * address_cells;
 
-		if (size_len == 2)
+		if (size_cells == 2)
 			*(fdt64_t *)p = cpu_to_fdt64(size[i]);
 		else
 			*(fdt32_t *)p = cpu_to_fdt32(size[i]);
-		p += size_len;
+		p += 4 * size_cells;
 	}
 
 	return p - (char *)buf;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v2] fdt: Fix regression in fdt_pack_reg()
  2014-11-28 13:23 [U-Boot] [PATCH v2] fdt: Fix regression in fdt_pack_reg() Hans de Goede
@ 2014-11-28 16:46 ` Masahiro YAMADA
  2014-11-30  3:05 ` Simon Glass
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Masahiro YAMADA @ 2014-11-28 16:46 UTC (permalink / raw)
  To: u-boot

2014-11-28 22:23 GMT+09:00 Hans de Goede <hdegoede@redhat.com>:
> After commit 933cdbb479: "fdt: Try to use fdt_address_cells()/fdt_size_cells()"
> I noticed that allwinner boards would no longer boot.
>
> Switching to fdt_address_cells / fdt_size_cells changes the result from
> bytes to 32 bit words, so when we increment pointers into the blob, we must
> do so by 32 bit words now.
>
> This commit makes allwinner boards boot again.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>


Tested-by: Masahiro Yamada <yamada.m@jp.panasonic.com>




-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v2] fdt: Fix regression in fdt_pack_reg()
  2014-11-28 13:23 [U-Boot] [PATCH v2] fdt: Fix regression in fdt_pack_reg() Hans de Goede
  2014-11-28 16:46 ` Masahiro YAMADA
@ 2014-11-30  3:05 ` Simon Glass
  2014-12-01 12:31 ` Stefan Roese
  2014-12-01 13:21 ` Vince Hsu
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2014-11-30  3:05 UTC (permalink / raw)
  To: u-boot

On 28 November 2014 at 06:23, Hans de Goede <hdegoede@redhat.com> wrote:
> After commit 933cdbb479: "fdt: Try to use fdt_address_cells()/fdt_size_cells()"
> I noticed that allwinner boards would no longer boot.
>
> Switching to fdt_address_cells / fdt_size_cells changes the result from
> bytes to 32 bit words, so when we increment pointers into the blob, we must
> do so by 32 bit words now.
>
> This commit makes allwinner boards boot again.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Improved patch subject
> -s/_len/_cells/ to indicated that adress_cells and size_cells are in cells now
> ---

Thanks for fixing this.

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v2] fdt: Fix regression in fdt_pack_reg()
  2014-11-28 13:23 [U-Boot] [PATCH v2] fdt: Fix regression in fdt_pack_reg() Hans de Goede
  2014-11-28 16:46 ` Masahiro YAMADA
  2014-11-30  3:05 ` Simon Glass
@ 2014-12-01 12:31 ` Stefan Roese
  2014-12-01 13:21 ` Vince Hsu
  3 siblings, 0 replies; 5+ messages in thread
From: Stefan Roese @ 2014-12-01 12:31 UTC (permalink / raw)
  To: u-boot

On 28.11.2014 14:23, Hans de Goede wrote:
> After commit 933cdbb479: "fdt: Try to use fdt_address_cells()/fdt_size_cells()"
> I noticed that allwinner boards would no longer boot.
>
> Switching to fdt_address_cells / fdt_size_cells changes the result from
> bytes to 32 bit words, so when we increment pointers into the blob, we must
> do so by 32 bit words now.
>
> This commit makes allwinner boards boot again.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Even if I'm a bit late with this answer, this fixes a regression on 
Linux booting on one of my mx6 boards. So:

Tested-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v2] fdt: Fix regression in fdt_pack_reg()
  2014-11-28 13:23 [U-Boot] [PATCH v2] fdt: Fix regression in fdt_pack_reg() Hans de Goede
                   ` (2 preceding siblings ...)
  2014-12-01 12:31 ` Stefan Roese
@ 2014-12-01 13:21 ` Vince Hsu
  3 siblings, 0 replies; 5+ messages in thread
From: Vince Hsu @ 2014-12-01 13:21 UTC (permalink / raw)
  To: u-boot

Hi,

On 11/28/2014 09:23 PM, Hans de Goede wrote:
> After commit 933cdbb479: "fdt: Try to use fdt_address_cells()/fdt_size_cells()"
> I noticed that allwinner boards would no longer boot.
>
> Switching to fdt_address_cells / fdt_size_cells changes the result from
> bytes to 32 bit words, so when we increment pointers into the blob, we must
> do so by 32 bit words now.
>
> This commit makes allwinner boards boot again.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Improved patch subject
> -s/_len/_cells/ to indicated that adress_cells and size_cells are in cells now
> ---

I just hit this problem on jetson tk1 and tried the same fix. So

Tested-by: Vince Hsu <vinceh@nvidia.com>

Thanks,
Vince

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-12-01 13:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-28 13:23 [U-Boot] [PATCH v2] fdt: Fix regression in fdt_pack_reg() Hans de Goede
2014-11-28 16:46 ` Masahiro YAMADA
2014-11-30  3:05 ` Simon Glass
2014-12-01 12:31 ` Stefan Roese
2014-12-01 13:21 ` Vince Hsu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.