From patchwork Mon Mar 12 17:10:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brad Mouring X-Patchwork-Id: 884608 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@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=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ni.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 400PdV2YCVz9sR9 for ; Tue, 13 Mar 2018 04:10:54 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932532AbeCLRKl (ORCPT ); Mon, 12 Mar 2018 13:10:41 -0400 Received: from mx0a-00010702.pphosted.com ([148.163.156.75]:59232 "EHLO mx0b-00010702.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932326AbeCLRKh (ORCPT ); Mon, 12 Mar 2018 13:10:37 -0400 Received: from pps.filterd (m0098780.ppops.net [127.0.0.1]) by mx0a-00010702.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2CH7sQa031452; Mon, 12 Mar 2018 12:10:26 -0500 Received: from ni.com (skprod3.natinst.com [130.164.80.24]) by mx0a-00010702.pphosted.com with ESMTP id 2gmdrwcx2v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Mar 2018 12:10:26 -0500 Received: from us-aus-exhub2.ni.corp.natinst.com (us-aus-exhub2.ni.corp.natinst.com [130.164.68.32]) by us-aus-skprod3.natinst.com (8.16.0.22/8.16.0.22) with ESMTPS id w2CHAPP7003058 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 12 Mar 2018 12:10:25 -0500 Received: from us-aus-exhub1.ni.corp.natinst.com (130.164.68.41) by us-aus-exhub2.ni.corp.natinst.com (130.164.68.32) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Mon, 12 Mar 2018 12:10:24 -0500 Received: from ni.com (130.164.49.7) by us-aus-exhub1.ni.corp.natinst.com (130.164.68.41) with Microsoft SMTP Server id 15.0.1156.6 via Frontend Transport; Mon, 12 Mar 2018 12:10:23 -0500 Received: by ni.com (sSMTP sendmail emulation); Mon, 12 Mar 2018 12:10:24 -0500 From: Brad Mouring To: Nicolas Ferre , Rob Herring , "David S . Miller" , Michael Grzeschik , Andrew Lunn CC: Mark Rutland , , Julia Cartwright , , Brad Mouring Subject: [PATCH v3 net-next 3/4] net: macb: Add phy-handle DT support Date: Mon, 12 Mar 2018 12:10:00 -0500 Message-ID: <20180312171001.129209-4-brad.mouring@ni.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180312171001.129209-1-brad.mouring@ni.com> References: <20180310161718.GC29174@lunn.ch> <20180312171001.129209-1-brad.mouring@ni.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-12_09:, , signatures=0 X-Proofpoint-Spam-Reason: safe Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This optional binding (as described in the ethernet DT bindings doc) directs the netdev to the phydev to use. This is useful for a phy chip that has >1 phy in it, and two netdevs are using the same phy chip (i.e. the second mac's phy lives on the first mac's MDIO bus) The devicetree snippet would look something like this: ethernet@feedf00d { ... phy-handle = <&phy0> // the first netdev is physically wired to phy0 ... phy0: phy@0 { ... reg = <0x0> // MDIO address 0 ... } phy1: phy@1 { ... reg = <0x1> // MDIO address 1 ... } ... } ethernet@deadbeef { ... phy-handle = <&phy1> // tells the driver to use phy1 on the // first mac's mdio bus (it's wired thusly) ... } The work done to add the phy_node in the first place (dacdbb4dfc1a1: "net: macb: add fixed-link node support") will consume the device_node (if found). Signed-off-by: Brad Mouring --- drivers/net/ethernet/cadence/macb_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index db1dc301bed3..b0700a531f3e 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -488,6 +488,9 @@ static int macb_mii_probe(struct net_device *dev) } bp->phy_node = of_node_get(np); } else { + /* attempt to find a phy-handle */ + bp->phy_node = of_parse_phandle(np, "phy-handle", 0); + /* fallback to standard phy registration if no phy were * found during dt phy registration */