From patchwork Mon Feb 4 17:30:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 1036090 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ettus.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ettus-com.20150623.gappssmtp.com header.i=@ettus-com.20150623.gappssmtp.com header.b="ae5GGyXI"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43tZWH3zQZz9sMM for ; Tue, 5 Feb 2019 04:31:23 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728290AbfBDRa6 (ORCPT ); Mon, 4 Feb 2019 12:30:58 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:44809 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727656AbfBDRa4 (ORCPT ); Mon, 4 Feb 2019 12:30:56 -0500 Received: by mail-pl1-f196.google.com with SMTP id p4so221974plq.11 for ; Mon, 04 Feb 2019 09:30:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ettus-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jdnN8oMz57K6JwphabgMQst68MVpMqZb8th3jd5zgk0=; b=ae5GGyXIQcAiz0To0gPgxCoEA5CoyUjQHcHQLnz18JbBAxVnSCm/ewyi31CJ9Xh2Tw JvtnrPiX0kkk8yyCS1DoYqdMHwghzZOc6DNk8auC7AzdCiSghNTehB4jpmxoWiVZIiY0 9k60W63tBUfWwAT880b3iR6Wag/LQubOiMmVAlxetwQt8igmqUfdkYkzf80LFeAJY3YU tk8Gc1mC4jEHcA38KNw622uvK7J3f17HPZVFRcmzX6wcZMJcGUjtoMHrY2PK6BHpoNn8 KTGSjAy7/rZDcq27tsQUhbVCe7FMyBCL8ykdJboOUWFSzgTUxZRxFcNWAefg+eahVr3t eC4w== 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:mime-version:content-transfer-encoding; bh=jdnN8oMz57K6JwphabgMQst68MVpMqZb8th3jd5zgk0=; b=imLZEujO8+B1atTNZJerswRNgiZzQU4ZRUjSPqDgU/2xsku3T0n70S+v5JEfOT0YI9 cpJ6d8fTYgJpCa3mr90hOw+QBi085hfk6vP6Z+5/74JsbOWlbxCEXJ6MLZKf1eWyHke1 y4QCJCZjJ8cX2VbULWxW19NIi04sNd/B6uLBvy2Se0xLXfxPl/eG/loJntCznVCnlfBy ItV4agaU8R+E1WJknaO5Vq2GspjnenhLIQgewZaK5FnGleEgbjnmovXNH12uRMTQ/EOS 1sAhgQLNaR0PrDb+hS4zfGhfr3O9X3eMt5pJMp8oBoZaJ4wFrEopgrqV3KiYyQ5mzKbk y6LQ== X-Gm-Message-State: AHQUAuZl3i5icneAjKaO7mlJ104F1srD79gQQklbfB+pYG8iJVSdBSAb KyYXAY0jRCJXN5KhO+YQ9BvfFg== X-Google-Smtp-Source: AHgI3IYuFSSOIc8vrBYatt9NQ9ULxlrErKbd0AiboQmzEyIPNy9pM2F2rdd1Qkc1T7ClkAopcBR7Sw== X-Received: by 2002:a17:902:850c:: with SMTP id bj12mr528760plb.46.1549301455688; Mon, 04 Feb 2019 09:30:55 -0800 (PST) Received: from localhost ([207.114.172.147]) by smtp.gmail.com with ESMTPSA id k15sm794363pfb.147.2019.02.04.09.30.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Feb 2019 09:30:55 -0800 (PST) From: Moritz Fischer To: netdev@vger.kernel.org Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alex.williams@ni.com, andrew@lunn.ch, robh+dt@kernel.org, davem@davemloft.net, moritz.fischer@ettus.com, Moritz Fischer Subject: [PATCH net-next 1/3] net: nixge: Make mdio child node optional Date: Mon, 4 Feb 2019 09:30:38 -0800 Message-Id: <20190204173040.5538-2-moritz.fischer@ettus.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190204173040.5538-1-moritz.fischer@ettus.com> References: <20190204173040.5538-1-moritz.fischer@ettus.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Moritz Fischer Make MDIO child optional and only instantiate the MDIO bus if the child is actually present. There are currently no (in-tree) users of this binding; all (out-of-tree) users use overlays that get shipped together with the FPGA images that contain the IP. This will significantly increase maintainabilty of future revisions of this IP. Reviewed-by: Andrew Lunn Signed-off-by: Moritz Fischer --- Changes from RFC: - Add Andrew's Reviewed-by tag - Rebased on top of net-next --- .../devicetree/bindings/net/nixge.txt | 27 ++++++++++++++++--- drivers/net/ethernet/ni/nixge.c | 19 ++++++++----- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/net/nixge.txt b/Documentation/devicetree/bindings/net/nixge.txt index 44a7358b4399..bb2929f9c64f 100644 --- a/Documentation/devicetree/bindings/net/nixge.txt +++ b/Documentation/devicetree/bindings/net/nixge.txt @@ -16,6 +16,9 @@ Required properties: - nvmem-cells: Phandle of nvmem cell containing the MAC address - nvmem-cell-names: Should be "address" +Optional properties: +- mdio subnode to indicate presence of MDIO controller + Examples (10G generic PHY): nixge0: ethernet@40000000 { compatible = "ni,xge-enet-3.00"; @@ -33,8 +36,26 @@ Examples (10G generic PHY): phy-mode = "xgmii"; phy-handle = <ðernet_phy1>; - ethernet_phy1: ethernet-phy@4 { - compatible = "ethernet-phy-ieee802.3-c45"; - reg = <4>; + mdio { + ethernet_phy1: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <4>; + }; }; }; + +Examples (10G generic PHY, no MDIO): + nixge0: ethernet@40000000 { + compatible = "ni,xge-enet-2.00"; + reg = <0x40000000 0x6000>; + + nvmem-cells = <ð1_addr>; + nvmem-cell-names = "address"; + + interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>, <0 30 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "rx", "tx"; + interrupt-parent = <&intc>; + + phy-mode = "xgmii"; + phy-handle = <ðernet_phy1>; + }; diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c index 73a98bd2fcd2..c8dd1e4c759d 100644 --- a/drivers/net/ethernet/ni/nixge.c +++ b/drivers/net/ethernet/ni/nixge.c @@ -1284,6 +1284,7 @@ static int nixge_probe(struct platform_device *pdev) { struct nixge_priv *priv; struct net_device *ndev; + struct device_node *mn; const u8 *mac_addr; int err; @@ -1335,10 +1336,14 @@ static int nixge_probe(struct platform_device *pdev) priv->coalesce_count_rx = XAXIDMA_DFT_RX_THRESHOLD; priv->coalesce_count_tx = XAXIDMA_DFT_TX_THRESHOLD; - err = nixge_mdio_setup(priv, pdev->dev.of_node); - if (err) { - netdev_err(ndev, "error registering mdio bus"); - goto free_netdev; + mn = of_get_child_by_name(pdev->dev.of_node, "mdio"); + if (mn) { + err = nixge_mdio_setup(priv, mn); + of_node_put(mn); + if (err) { + netdev_err(ndev, "error registering mdio bus"); + goto free_netdev; + } } priv->phy_mode = of_get_phy_mode(pdev->dev.of_node); @@ -1364,7 +1369,8 @@ static int nixge_probe(struct platform_device *pdev) return 0; unregister_mdio: - mdiobus_unregister(priv->mii_bus); + if (priv->mii_bus) + mdiobus_unregister(priv->mii_bus); free_netdev: free_netdev(ndev); @@ -1379,7 +1385,8 @@ static int nixge_remove(struct platform_device *pdev) unregister_netdev(ndev); - mdiobus_unregister(priv->mii_bus); + if (priv->mii_bus) + mdiobus_unregister(priv->mii_bus); free_netdev(ndev);