From patchwork Wed Feb 19 01:54:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kever Yang X-Patchwork-Id: 1240468 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=UwvPrCCc; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48MgmJ0Vwcz9sRl for ; Wed, 19 Feb 2020 12:55:44 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B6F5B81584; Wed, 19 Feb 2020 02:55:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UwvPrCCc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 85E9A81685; Wed, 19 Feb 2020 02:55:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id ABB40813C3 for ; Wed, 19 Feb 2020 02:55:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kever.yang@gmail.com Received: by mail-pf1-x443.google.com with SMTP id 185so11662076pfv.3 for ; Tue, 18 Feb 2020 17:55:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ukutx/4Dq2X9Mp6eVVWjqwnG5z/4iBO7KjQO6rtxAaY=; b=UwvPrCCc4p42VnogDvOvIG5q7JxQ+dJ6it/rYxLg7UuKraRZAWSBof+gr4C+o6Xejg DGSOSHE8u/1av5NJALh7ftTDIt5YjcpwYdaExZJWD1QrGeh5CJ7fXGM832ImxIdyu6/p SsippSHeLeb3+Xbi22v/YpACtAkOvqUpcp2vGSgCBM7uInQYEyJBod7GElrh872jgaHr yP6dH6vjiWgQP7sJYCm4fOiN6s5wSOlUwJ2oalQNaywZ1lyvLISYCHGBuRE9Ov0JCBaO H8xjoGeLCvx3gUe4mnfV2vxMilXEU2++rtydaBtYwcqdLasFJM8/iERDeqmRC5AxdE86 lvxw== 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=ukutx/4Dq2X9Mp6eVVWjqwnG5z/4iBO7KjQO6rtxAaY=; b=IBxfKI1HNmrS6BRtTAv3uDQN7Ho+g0Y6r8NlJI4i4DjXgKlc6nCrcG+179GEoAJaaA r15zgFHAGbMrFhvDUMDygWcvPMAeYrw4a9bTvpgCg8r9EpNrhW5oLi360qiOg9Hyyhdx 8EZSFrLOH/mIDbdnBbBbKuToOxjsiOhIDRCNkEUmpwGFkSXI5W/kBIfwNkG/3o7OVEvk oPa25BH03fCjCEQ4oE7O219p+BUxkexSf8BxU7uq9QgbQqNyiPrjhJzhNRMzLEUlaSWr icxmhPd8vhfxehqzrTXXiN6xZAmYXh94l6dHKxpgt1NhCEm2YDCLNIbGRUy0ESQVpelp ddwQ== X-Gm-Message-State: APjAAAW1Ug+7sOSkuIiWYh9olFt+dmf0XOukGI9YnqPiAiEz2vlRhZ0K PNeJ2A8VUz76x3VxJCoB33N+ozN/ X-Google-Smtp-Source: APXvYqwbrvAgFV/MqwBCq4fBS0CdS2DCLt6HkQoPuEX3dw1C5TWCCO5A45Um/v5g1UYt2cyRKoEU0Q== X-Received: by 2002:a63:e257:: with SMTP id y23mr25918476pgj.104.1582077305111; Tue, 18 Feb 2020 17:55:05 -0800 (PST) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id 7sm298686pfc.21.2020.02.18.17.55.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2020 17:55:04 -0800 (PST) From: Kever Yang To: u-boot@lists.denx.de Cc: frank.wang@rock-chips.com, Kever Yang , Jean-Jacques Hiblot , Marek Vasut , Vignesh Raghavendra Subject: [PATCH 03/10] usb: cdns3: Migrate to use ofnode API for bind function Date: Wed, 19 Feb 2020 09:54:40 +0800 Message-Id: <20200219015447.19392-4-kever.yang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200219015447.19392-1-kever.yang@rock-chips.com> References: <20200219015447.19392-1-kever.yang@rock-chips.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.1 at phobos.denx.de X-Virus-Status: Clean Use ofnode_ instead of fdt_ APIs so that the driver can support live DT. Signed-off-by: Kever Yang --- drivers/usb/cdns3/core.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c index 8c8e02169e..d6ccd3e73c 100644 --- a/drivers/usb/cdns3/core.c +++ b/drivers/usb/cdns3/core.c @@ -382,23 +382,21 @@ static const struct udevice_id cdns3_ids[] = { int cdns3_bind(struct udevice *parent) { - int from = dev_of_offset(parent); - const void *fdt = gd->fdt_blob; enum usb_dr_mode dr_mode; struct udevice *dev; const char *driver; const char *name; - int node; + ofnode node; int ret; - node = fdt_node_offset_by_compatible(fdt, from, "cdns,usb3"); - if (node < 0) { + node = ofnode_by_compatible(parent->node, "cdns,usb3"); + if (!ofnode_valid(node)) { ret = -ENODEV; goto fail; } - name = fdt_get_name(fdt, node, NULL); - dr_mode = usb_get_dr_mode(node); + name = ofnode_get_name(node); + dr_mode = usb_get_dr_mode(ofnode_to_offset(node)); switch (dr_mode) { #if defined(CONFIG_SPL_USB_HOST_SUPPORT) || \ @@ -420,8 +418,7 @@ int cdns3_bind(struct udevice *parent) goto fail; }; - ret = device_bind_driver_to_node(parent, driver, name, - offset_to_ofnode(node), &dev); + ret = device_bind_driver_to_node(parent, driver, name, node, &dev); if (ret) { printf("%s: not able to bind usb device mode\n", __func__);