From patchwork Sun Jul 14 00:16:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1131667 X-Patchwork-Delegate: joe.hershberger@gmail.com 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; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="sWStBwvT"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45mS471TBwz9sDQ for ; Sun, 14 Jul 2019 10:20:39 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CA03BC21DF9; Sun, 14 Jul 2019 00:20:08 +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=FREEMAIL_FROM, 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 B3460C21E0B; Sun, 14 Jul 2019 00:19:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2F992C21BE5; Sun, 14 Jul 2019 00:19:52 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by lists.denx.de (Postfix) with ESMTPS id CE9A2C21BE5 for ; Sun, 14 Jul 2019 00:19:51 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id f17so11877326wme.2 for ; Sat, 13 Jul 2019 17:19:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=INY52VARqoDjtLDVWY0cQuU7b4jQA8JxlQwdLEZ+cUE=; b=sWStBwvT52I7SKycMEk2CWMvzG8bb2KHNrqaLGiRt8g5HCWDQVhaFl97FQ4kJ094i8 oHcLqIlNNxCsu7IZfoJkSz50xogysrk6y6IKrUBZHlo/DFN6nWN5UWmwskcMD5aiyXGU 1MlKAsF2ZZTu1AJwAAkp1/TTOfK3MauUMus5tPZdCy+J3z1hfqyd72+b4rThRJ8AOOIX /RGXHUTekgVSDaQKPxmi7GqDdJ/Y1eMod4vnQJmQpgyvyNO+wDSZJaXKNrbi02fMg7Ms m7rIDhKKEP9iqss+20MUZYMewC+SbBhBtoBpMGgFvEKmWJE2EOLnFUMXvvEklbyvGw8b B5YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=INY52VARqoDjtLDVWY0cQuU7b4jQA8JxlQwdLEZ+cUE=; b=QNv3IxnU+G012Ad5r5hwjDqpKoGn6NEHA3CUJplj8u4fbFAtky4mzWSbHrf8/MUZcE ExYsHTh4YVahRbIiLCMoz1v5iwnqPD0mDuEP+0u8UMseh7Vu0t7AwKQL6aY+ggWIYaNC 8DiWuweM+V66ofHNTKGoM8u+9yVQBXW/0woI9W0nyNdwQHMnsxJB1QgvXci0umKOJYSS ImVH4bf1HqwGaT8D4gxQgMs3fG8M6LvMPLJI8gZr2KC5forj4LCTSBLPYLAvcUA/QP3H fypjRMmCivWNKrnikPyO15WHjnCZPlrqm7S4QgyTbutKPps9alYBu1L1NNziIYLpGrRw 6U+w== X-Gm-Message-State: APjAAAUm0G2fApQ6U1Okp9MJN/ITXbezh3lg8l2d7M13EvYu6vh8Qpys QL8K02/44wzP/b4AnaBCLPk= X-Google-Smtp-Source: APXvYqxzZ5hn1mgOQGusw8lcgXQvTtF5MMup2QRHiDa2JsPuT42jW0prH+kaJEl98tzpdz79TK34pQ== X-Received: by 2002:a1c:e409:: with SMTP id b9mr15310448wmh.110.1563063591427; Sat, 13 Jul 2019 17:19:51 -0700 (PDT) Received: from localhost.localdomain ([188.26.252.192]) by smtp.gmail.com with ESMTPSA id m24sm7801973wmi.39.2019.07.13.17.19.50 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 13 Jul 2019 17:19:51 -0700 (PDT) From: Vladimir Oltean To: joe.hershberger@ni.com, prabhakar.kushwaha@nxp.com, bmeng.cn@gmail.com, u-boot@lists.denx.de Date: Sun, 14 Jul 2019 03:16:53 +0300 Message-Id: <20190714001701.2781-2-olteanv@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190714001701.2781-1-olteanv@gmail.com> References: <20190714001701.2781-1-olteanv@gmail.com> Subject: [U-Boot] [PATCH v2 1/9] net: tsec: Refactor the readout of the tbi-handle property 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" The point of this patch is to eliminate the use of the locally-defined "reg" variable (which interferes with next patch) and simplify the fallback to the default CONFIG_SYS_TBIPA_VALUE in case "tbi-handle" is missing. Signed-off-by: Vladimir Oltean Acked-by: Joe Hershberger Reviewed-by: Bin Meng --- Changes from v1: None. drivers/net/tsec.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 06a9b4fb03ce..53eb5470f4c8 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -798,6 +798,7 @@ int tsec_probe(struct udevice *dev) struct eth_pdata *pdata = dev_get_platdata(dev); struct fsl_pq_mdio_info mdio_info; struct ofnode_phandle_args phandle_args; + u32 tbiaddr = CONFIG_SYS_TBIPA_VALUE; ofnode parent; const char *phy_mode; int ret; @@ -825,14 +826,12 @@ int tsec_probe(struct udevice *dev) return -ENOENT; } - if (dev_read_phandle_with_args(dev, "tbi-handle", NULL, 0, 0, - &phandle_args)) { - priv->tbiaddr = CONFIG_SYS_TBIPA_VALUE; - } else { - int reg = ofnode_read_u32_default(phandle_args.node, "reg", - CONFIG_SYS_TBIPA_VALUE); - priv->tbiaddr = reg; - } + ret = dev_read_phandle_with_args(dev, "tbi-handle", NULL, 0, 0, + &phandle_args); + if (ret == 0) + ofnode_read_u32(phandle_args.node, "reg", &tbiaddr); + + priv->tbiaddr = tbiaddr; phy_mode = dev_read_prop(dev, "phy-connection-type", NULL); if (phy_mode)