From patchwork Sat Jun 3 03:04:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 770710 X-Patchwork-Delegate: twarren@nvidia.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3wfmZd4C1Vz9ryv for ; Sat, 3 Jun 2017 13:21:29 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="RoRUpfmb"; dkim-atps=neutral Received: by lists.denx.de (Postfix, from userid 105) id 62756C21C38; Sat, 3 Jun 2017 03:12:35 +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 E7A86C21C3C; Sat, 3 Jun 2017 03:07:08 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 49B50C21C85; Sat, 3 Jun 2017 03:05:25 +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 D8597C21C80 for ; Sat, 3 Jun 2017 03:05:21 +0000 (UTC) Received: by mail-oi0-f43.google.com with SMTP id s3so21304158oia.0 for ; Fri, 02 Jun 2017 20:05:21 -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=YuJkOOVmvLI+Gw3uieSyJu/PZsnZ3BU83TDuSFOSJf0=; b=RoRUpfmbxl+A5U56uJP9revvr+2OctMitwkdNsOdhqxh70FpiKuLlt+BWcjvy/85Ms BcHg7+oaCWm2PFGy29Iq/Fk+Ea+eyzAqcxwwf5N+fD1huL6Aei+TGjgq5XV3ejgRmWT9 gw8II+CfWhpVf1djv8Q4ZW5+UAE2BgK4PP9CUZW+wgvHkNQOWNGPymIJnL7ToLqQ4PZi zVDq6h3930sIUbkQB3VuKd4ELmwWC2JHRc/6bpHiI+oe7k+Be+dG4yPIQ8UEqa9T9Kou iuZLk+VgszUMEbqNI/Abq2NNFEy2vIP7gmUp8fEz4Ohjv/INc2oiPRknvc+hM+Gt0jiJ FHHg== 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=YuJkOOVmvLI+Gw3uieSyJu/PZsnZ3BU83TDuSFOSJf0=; b=PV/pffY/yJqvWDjuULDxwjA60jySfSS4IJPh/eYv+i0LB2MTql2K+mIxIvdN7urZ6W HwpHCaHfBpM0eXOrucmBMeyQBLO2CRxH+LXhylNdwpjXXvjH25OksROgVdz9LF02XqrB G9UD/ghXriO51P3c/GmUkxXvdDE7EwWFaNTfrXCyd4ku1TppMHOSOuuTUMc5S5RxEVWV d1RXxCMOd1k28DrvvbZ0t8fLIMNYc3URj43wLGC0N2VCwHMD/hyhaFUGoQXMzdM3LgmW vmemWu6ULWmUqzaTkPxIpkj0aZuY6F5sNHoPX049mKVOu9TPZFiV1cf4TKrYx/01mPre D6Ww== X-Gm-Message-State: AODbwcAg5oLqjb6Ep8vwAKVf/5aRcTBCYG/3s4bKwhDavHzRDfgXN80D kTUnmSXYwiPTI+cG X-Received: by 10.202.241.136 with SMTP id p130mr6674163oih.106.1496459120625; Fri, 02 Jun 2017 20:05:20 -0700 (PDT) Received: from kaki.bld.corp.google.com ([2620:0:10f2:12:35ab:5c4c:1c78:ccbc]) by smtp.gmail.com with ESMTPSA id n187sm1939368oia.33.2017.06.02.20.05.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jun 2017 20:05:20 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 80C444013F; Fri, 2 Jun 2017 21:05:19 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 2 Jun 2017 21:04:12 -0600 Message-Id: <20170603030426.16107-18-sjg@chromium.org> X-Mailer: git-send-email 2.13.0.506.g27d5fe0cd-goog In-Reply-To: <20170603030426.16107-1-sjg@chromium.org> References: <20170603030426.16107-1-sjg@chromium.org> Cc: Marek Vasut , Tom Rini , Stephen Warren , Marcel Ziswiler , Tom Warren Subject: [U-Boot] [PATCH v2 17/31] dm: tegra: usb: Convert to 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 Tegra EHCI driver to support a live device tree. Signed-off-by: Simon Glass --- Changes in v2: None drivers/usb/host/ehci-tegra.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 873bf8ecfd..1c72330b0c 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -17,7 +17,6 @@ #include #include #include -#include #include "ehci.h" @@ -695,12 +694,11 @@ static void config_clock(const u32 timing[]) static int fdt_decode_usb(struct udevice *dev, struct fdt_usb *config) { - const void *blob = gd->fdt_blob; - int node = dev_of_offset(dev); const char *phy, *mode; - config->reg = (struct usb_ctlr *)devfdt_get_addr(dev); - mode = fdt_getprop(blob, node, "dr_mode", NULL); + config->reg = (struct usb_ctlr *)dev_read_addr(dev); + debug("reg=%p\n", config->reg); + mode = dev_read_string(dev, "dr_mode"); if (mode) { if (0 == strcmp(mode, "host")) config->dr_mode = DR_MODE_HOST; @@ -717,28 +715,24 @@ static int fdt_decode_usb(struct udevice *dev, struct fdt_usb *config) config->dr_mode = DR_MODE_HOST; } - phy = fdt_getprop(blob, node, "phy_type", NULL); + phy = dev_read_string(dev, "phy_type"); config->utmi = phy && 0 == strcmp("utmi", phy); config->ulpi = phy && 0 == strcmp("ulpi", phy); - config->enabled = fdtdec_get_is_enabled(blob, node); - config->has_legacy_mode = fdtdec_get_bool(blob, node, - "nvidia,has-legacy-mode"); + config->has_legacy_mode = dev_read_bool(dev, "nvidia,has-legacy-mode"); config->periph_id = clock_decode_periph_id(dev); if (config->periph_id == PERIPH_ID_NONE) { debug("%s: Missing/invalid peripheral ID\n", __func__); return -EINVAL; } - gpio_request_by_name_nodev(offset_to_ofnode(node), "nvidia,vbus-gpio", - 0, &config->vbus_gpio, GPIOD_IS_OUT); - gpio_request_by_name_nodev(offset_to_ofnode(node), - "nvidia,phy-reset-gpio", 0, - &config->phy_reset_gpio, GPIOD_IS_OUT); - debug("enabled=%d, legacy_mode=%d, utmi=%d, ulpi=%d, periph_id=%d, " - "vbus=%d, phy_reset=%d, dr_mode=%d\n", - config->enabled, config->has_legacy_mode, config->utmi, - config->ulpi, config->periph_id, - gpio_get_number(&config->vbus_gpio), - gpio_get_number(&config->phy_reset_gpio), config->dr_mode); + gpio_request_by_name(dev, "nvidia,vbus-gpio", 0, &config->vbus_gpio, + GPIOD_IS_OUT); + gpio_request_by_name(dev, "nvidia,phy-reset-gpio", 0, + &config->phy_reset_gpio, GPIOD_IS_OUT); + debug("legacy_mode=%d, utmi=%d, ulpi=%d, periph_id=%d, vbus=%d, phy_reset=%d, dr_mode=%d, reg=%p\n", + config->has_legacy_mode, config->utmi, config->ulpi, + config->periph_id, gpio_get_number(&config->vbus_gpio), + gpio_get_number(&config->phy_reset_gpio), config->dr_mode, + config->reg); return 0; }