From: Simon Glass Date: Tue, 25 Jul 2017 08:30:03 -0600 Subject: [U-Boot] [PATCH v5 09/20] dm: tegra: gpio: Convert to support livetree In-Reply-To: <20170725143015.93811-1-sjg@chromium.org> References: <20170725143015.93811-1-sjg@chromium.org> Message-ID: <20170725143015.93811-10-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Update the GPIO driver to support a live device tree. Signed-off-by: Simon Glass Tested-by: Marcel Ziswiler Tested-on: Beaver, Jetson-TK1 --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/gpio/tegra_gpio.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c index 687cd74fee..4965583158 100644 --- a/drivers/gpio/tegra_gpio.c +++ b/drivers/gpio/tegra_gpio.c @@ -337,11 +337,13 @@ static int gpio_tegra_bind(struct udevice *parent) * This driver does not make use of interrupts, other than to figure * out the number of GPIO banks */ - if (!fdt_getprop(gd->fdt_blob, dev_of_offset(parent), "interrupts", - &len)) - return -EINVAL; + len = dev_read_size(parent, "interrupts"); + if (len < 0) + return len; bank_count = len / 3 / sizeof(u32); - ctlr = (struct gpio_ctlr *)devfdt_get_addr(parent); + ctlr = (struct gpio_ctlr *)dev_read_addr(parent); + if ((ulong)ctlr == FDT_ADDR_T_NONE) + return -EINVAL; } #endif for (bank = 0; bank < bank_count; bank++) { -- 2.14.0.rc0.284.gd933b75aa4-goog