From patchwork Tue Jul 25 14:30:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 793446 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="j6/ypJi2"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xH1C21KnCz9s7h for ; Wed, 26 Jul 2017 00:41:18 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E962FC21E88; Tue, 25 Jul 2017 14:35:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 11390C21F24; Tue, 25 Jul 2017 14:31:51 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9EBA1C21DAA; Tue, 25 Jul 2017 14:30:44 +0000 (UTC) Received: from mail-oi0-f43.google.com (mail-oi0-f43.google.com [209.85.218.43]) by lists.denx.de (Postfix) with ESMTPS id BBD32C21E59 for ; Tue, 25 Jul 2017 14:30:39 +0000 (UTC) Received: by mail-oi0-f43.google.com with SMTP id a9so53529187oih.0 for ; Tue, 25 Jul 2017 07:30:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=dC8HEthqgtzVm7lQ4YonN8f4n3DlDnOE0YEK7sGCLms=; b=j6/ypJi24M6ipWnbL1tAMDc+iWjtU9IbM4tinSyDVhMW7pVeVSA+HdOrSc2SEvFuIV Xq9zRDeZJuWiEt+LXxOnaFGIeIo2rWyCFuy10SMd5FOPUyopZXTeGrrBIobhTnSjC4FG CR1RL0mNu4kOR0OYd8zFa3fViFGgzeeVdSdJD6WpA+7ml1pIWcjv+k6Y9o8U0MCqZjrG zp7ibHn8Axjv+gBspoOsYq1DtcMrJoDPndmXiJC/hbrblswWSJxmwr92kxYMyorLHU/N F6vZIPABVu0PmZcKQf6xUrQBtP2rQW4xIQvNFDJ6qCi9pE+g1t/V5MVVxrneI/9J3yYF M7zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=dC8HEthqgtzVm7lQ4YonN8f4n3DlDnOE0YEK7sGCLms=; b=A6GTjPe/cD9EoHI+vw9OI/UsZ42JXzqvrtIegSy9g197wISltyJvrV/DQK85ccZtJU xseATYIujyd1cj37fR1Hahb0R5UQlJunLRiqGJgz+gDOYccGsgfWibXpId/SGEUVk/oT ln+o0g1pnsxNoLmtYAPeiTCN2bgRFWGh00pnfkn7hOY4US1Ra/J4Ohsx4R4xErmNpTbY CBQkr1ejc41A1H+AsLF2UgQW3y3ZOu8RlLp49/hfEz0WNHj9FXT1XUHCyXJgaiJptWB9 aUzIf1ppE6B2mBJkzfmX4Xfvz7Zshr1JDtcffUlg+3LvItfV7/KHrm7jVoN7j8pvdWSC aZvQ== X-Gm-Message-State: AIVw112aZ58+eCznA012Hvo8SXd9dRQPxvJWnXEA39a7DT7acpgnxadu dKgdUpfn3zT0cKnDdRjBO5mquveyGXPQmrtPz+dpaFwW5ZyFA+ROJCOv1FdvsQS7XbbawvI= X-Received: by 10.202.82.201 with SMTP id g192mr10873721oib.252.1500993038236; Tue, 25 Jul 2017 07:30:38 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:0:10f2:0:d1c9:1f60:b519:d62c]) by smtp.gmail.com with ESMTPSA id f64sm11600785oia.28.2017.07.25.07.30.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jul 2017 07:30:37 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id DD2A913FAF1; Tue, 25 Jul 2017 08:30:36 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 25 Jul 2017 08:30:03 -0600 Message-Id: <20170725143015.93811-10-sjg@chromium.org> X-Mailer: git-send-email 2.14.0.rc0.284.gd933b75aa4-goog In-Reply-To: <20170725143015.93811-1-sjg@chromium.org> References: <20170725143015.93811-1-sjg@chromium.org> X-ccpol: medium Cc: Tom Rini , Stephen Warren , Marcel Ziswiler , Tom Warren Subject: [U-Boot] [PATCH v5 09/20] dm: tegra: gpio: Convert to support livetree X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Update the GPIO driver to support a live device tree. Signed-off-by: Simon Glass Tested-by: Marcel Ziswiler Tested-on: Beaver, Jetson-TK1 Signed-off-by: Simon Glass Tested-by: Marcel Ziswiler --- 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++) {