public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] fix: s5p_gpio: call: dev_get_addr() instead of fdtdec_get_addr()
Date: Thu, 24 Sep 2015 11:29:43 -0600	[thread overview]
Message-ID: <56043307.9070606@wwwdotorg.org> (raw)
In-Reply-To: <1443108590-16871-3-git-send-email-p.marczak@samsung.com>

On 09/24/2015 09:29 AM, Przemyslaw Marczak wrote:
> After rework in lib/fdtdec.c, the function fdtdec_get_addr()
> doesn't work for nodes with #size-cells property, set to 0.
>
> To get GPIO's 'reg' property, the code should use one of:
> fdtdec_get_addr_size_auto_no/parent() function.
>
> Fortunately dm core provides a function to get the property.
>
> This commit reworks function gpio_exynos_bind(), to properly
> use dev_get_addr() for GPIO device.
>
> This prevents setting a wrong base register for Exynos GPIOs.

Migrating everything to dev_get_addr() is the correct long-term fix, so 
this patch,

Acked-by: Stephen Warren <swarren@nvidia.com>

... although I'd have liked to see a smaller diff that didn't both 
re-order all the code /and/ call a different function, but I suppose 
that's not possible given the need to pass the device object to 
dev_get_addr(). You could have used fdtdec_get_addr_size_auto_parent() 
directly.


I think it'd be good to fix fdtdec_get_addr_size() to have the same 
semantics that it previously did. There might be other code in U-Boot 
that's affected by the same issue, and fixing fdtdec_get_addr_size() 
would make sure that all got fixed too. Are you willing to send that 
patch too?

Essentially, fdtdec_get_addr_size() used to assume:

#address-cells == sizeof(fdt_addr_t)
if sizep == NULL:
     #size-cells == 0
else:
     #size-cells == sizeof(fdt_addr_t)

However, it now assumes:

#address-cells == sizeof(fdt_addr_t)
#size-cells == sizeof(fdt_addr_t)

Let's just add that condition back by doing something like the following 
in fdtdec_get_addr_size():

u32 ns;

if (sizep)
     ns = sizeof(fdt_size_t) / sizeof(fdt32_t);
else
     ns = 0;

... and replacing the ns parameter that's passed to 
fdtdec_get_addr_size_fixed() with that variable, rather than hard-coding it.

  reply	other threads:[~2015-09-24 17:29 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-24 15:29 [U-Boot] [PATCH 0/3] Fix fdt 'reg' parsing and unbreak Odroid U3 Przemyslaw Marczak
2015-09-24 15:29 ` [U-Boot] [PATCH 1/3] fix: fdtdec: allow parse 'reg' property with zero value in '#size-cells' Przemyslaw Marczak
2015-09-24 17:14   ` Stephen Warren
2015-09-25  8:35     ` Przemyslaw Marczak
2015-09-25 15:41       ` Stephen Warren
2015-09-24 15:29 ` [U-Boot] [PATCH 2/3] fix: s5p_gpio: call: dev_get_addr() instead of fdtdec_get_addr() Przemyslaw Marczak
2015-09-24 17:29   ` Stephen Warren [this message]
2015-09-25  8:36     ` Przemyslaw Marczak
2015-09-25 15:48       ` Stephen Warren
2015-09-29  4:47         ` Simon Glass
2015-09-24 15:29 ` [U-Boot] [PATCH 3/3] fix: mach-exynos: clock: restore calling dead exynos4_get_mmc_clk() Przemyslaw Marczak
2015-09-25  2:40 ` [U-Boot] [PATCH 0/3] Fix fdt 'reg' parsing and unbreak Odroid U3 Jaehoon Chung
2015-09-25  8:59   ` Przemyslaw Marczak
2015-09-25  8:56 ` Przemyslaw Marczak
2015-09-25 10:15   ` Przemyslaw Marczak
2015-09-28 12:17 ` [U-Boot] [PATCH V2 0/3] Fix fdt 'reg' parsing and unbreak few Exynos4 boards Przemyslaw Marczak
2015-09-28 12:17   ` [U-Boot] [PATCH V2 1/3] fdtdec: fix parsing 'reg' property with zero value in '#size-cells' Przemyslaw Marczak
2015-09-29  4:47     ` Simon Glass
2015-09-30  1:27       ` Minkyu Kang
2015-09-28 12:17   ` [U-Boot] [PATCH V2 2/3] gpio: s5p: call: dev_get_addr() instead of fdtdec_get_addr() Przemyslaw Marczak
2015-09-28 12:17   ` [U-Boot] [PATCH V2 3/3] mach-exynos: clock: restore calling dead exynos4_get_mmc_clk() Przemyslaw Marczak
2015-09-29  4:47     ` Simon Glass
2015-09-30  7:26       ` Przemyslaw Marczak
2015-09-30  8:35         ` Jaehoon Chung
2015-09-30  9:20         ` Przemyslaw Marczak
2015-09-30 11:14   ` [U-Boot] [PATCH V3 0/4] Fix fdt 'reg' parsing and unbreak few Exynos4 boards Przemyslaw Marczak
2015-09-30 11:14     ` [U-Boot] [PATCH V3 1/4] fdtdec: fix parsing 'reg' property with zero value in '#size-cells' Przemyslaw Marczak
2015-10-03 14:28       ` Simon Glass
2015-09-30 11:14     ` [U-Boot] [PATCH V3 2/4] gpio: s5p: call: dev_get_addr() instead of fdtdec_get_addr() Przemyslaw Marczak
2015-10-03 14:44       ` Simon Glass
2015-09-30 11:14     ` [U-Boot] [PATCH V3 3/4] mach-exynos: clock: restore calling dead exynos4_get_mmc_clk() Przemyslaw Marczak
2015-10-03 14:44       ` Simon Glass
2015-09-30 11:14     ` [U-Boot] [PATCH V3 4/4] trats: fdt: disable unused DW MMC Przemyslaw Marczak
2015-10-01  3:37       ` Jaehoon Chung
2015-10-01  7:11         ` Przemyslaw Marczak
2015-10-01  7:22           ` Jaehoon Chung
2015-10-03 14:44             ` Simon Glass
2015-09-30 13:13     ` [U-Boot] [PATCH V3 0/4] Fix fdt 'reg' parsing and unbreak few Exynos4 boards Tom Rini
2015-09-30 13:25       ` Przemyslaw Marczak
2015-09-30 18:30         ` Simon Glass
2015-10-03 13:36           ` Simon Glass
2015-10-05  7:46             ` Przemyslaw Marczak

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=56043307.9070606@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=u-boot@lists.denx.de \
    /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