From patchwork Wed Jul 17 15:10:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Marginean X-Patchwork-Id: 1133356 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=nxp.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45pgj46flCz9sLt for ; Thu, 18 Jul 2019 01:11:52 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 837BBC21DF9; Wed, 17 Jul 2019 15:11:03 +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=none 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 731B6C21DDC; Wed, 17 Jul 2019 15:10:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3EFE6C21C3F; Wed, 17 Jul 2019 15:10:32 +0000 (UTC) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by lists.denx.de (Postfix) with ESMTPS id EDD5BC21C29 for ; Wed, 17 Jul 2019 15:10:31 +0000 (UTC) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 7A0AD1A01EC; Wed, 17 Jul 2019 17:10:31 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 6E3261A0088; Wed, 17 Jul 2019 17:10:31 +0200 (CEST) Received: from fsr-ub1864-115.ea.freescale.net (fsr-ub1864-115.ea.freescale.net [10.171.82.26]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 2DCE4205C5; Wed, 17 Jul 2019 17:10:31 +0200 (CEST) From: Alex Marginean To: u-boot@lists.denx.de Date: Wed, 17 Jul 2019 18:10:23 +0300 Message-Id: <20190717151026.27994-2-alexandru.marginean@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190717151026.27994-1-alexandru.marginean@nxp.com> References: <20190717151026.27994-1-alexandru.marginean@nxp.com> MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP Cc: Ken Ma , Joe Hershberger Subject: [U-Boot] [PATCH 1/4] net: mdio-uclass: name MDIO according to device-name property if preset 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Use the optional property device-name to name the MDIO bus. This works around limitations with using the DT node name on devices such as Armada-8040, which integrates two cp100 cores, both featuring MDIOs at the same relative offsets and with the same DT node names. The concept was originally proposed by Marvell as a custom property called mdio-name specific to Marvell driver. This patch uses the more generic property device-name and moves this into MDIO class code so other can use it as well. Signed-off-by: Alex Marginean Acked-by: Joe Hershberger Reviewed-by: Bin Meng --- net/mdio-uclass.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c index 36a404ff44..428f3a994f 100644 --- a/net/mdio-uclass.c +++ b/net/mdio-uclass.c @@ -23,6 +23,17 @@ void dm_mdio_probe_devices(void) static int dm_mdio_post_bind(struct udevice *dev) { + const char *dt_name; + + /* set a custom name for the MDIO device, if present in DT */ + if (ofnode_valid(dev->node)) { + dt_name = ofnode_read_string(dev->node, "device-name"); + if (dt_name) { + debug("renaming dev %s to %s\n", dev->name, dt_name); + device_set_name(dev, dt_name); + } + } + /* * MDIO command doesn't like spaces in names, don't allow them to keep * it happy