Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757423AbcDGUKQ (ORCPT ); Thu, 7 Apr 2016 16:10:16 -0400 Received: from vps0.lunn.ch ([178.209.37.122]:50682 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755458AbcDGUKO (ORCPT ); Thu, 7 Apr 2016 16:10:14 -0400 Date: Thu, 7 Apr 2016 22:10:09 +0200 From: Andrew Lunn To: Timur Tabi Cc: Rob Herring , Gilad Avidov , netdev , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" , linux-arm-msm , Sagar Dharia , shankerd@codeaurora.org, Greg Kroah-Hartman , vikrams@codeaurora.org, Christopher Covington Subject: Re: [PATCH V3] net: emac: emac gigabit ethernet controller driver Message-ID: <20160407201009.GA16136@lunn.ch> References: <1451440135-25771-1-git-send-email-gavidov@codeaurora.org> <20151231231039.GA8886@rob-hp-laptop> <56ABADEA.40801@codeaurora.org> <5706B4EF.2050600@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5706B4EF.2050600@codeaurora.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2102 Lines: 70 > I'm back to working on this driver, and I need some more help with > how to handle the phy. mdio-gpio.txt doesn't really tell me much. > I'm actually working on an ACPI system and not DT. I can help you with DT, but not ACPI. The MDIO bus can be a separate Linux device. Since you have GPIO lines for the MDIO bus, it makes sense for this to be a mdio-gpio device. So in DT, you would have: mdio0: mdio { compatible = "virtual,mdio-gpio"; #address-cells = <1>; #size-cells = <0>; gpios = <&qcomgpio 123 0 &qcomgpio 124 0>; phy0: ethernet-phy@8 { reg = <9>; }; }; Here i've assumed the PHY is using address 8 on the bus. Change as needed. In your MAC DT node, you then have phy-handle pointing to this phy: emac0: qcom,emac@feb20000 { cell-index = <0>; compatible = "qcom,emac"; reg-names = "base", "csr", "ptp", "sgmii"; reg = <0xfeb20000 0x10000>, <0xfeb36000 0x1000>, <0xfeb3c000 0x4000>, <0xfeb38000 0x400>; #address-cells = <0>; interrupt-parent = <&emac0>; #interrupt-cells = <1>; interrupts = <0 1>; interrupt-map-mask = <0xffffffff>; interrupt-map = <0 &intc 0 76 0 1 &intc 0 80 0>; interrupt-names = "emac_core0", "sgmii_irq"; qcom,emac-tstamp-en; qcom,emac-ptp-frac-ns-adj = <125000000 1>; phy-handle = <&phy0> } In the driver, you need to connect the PHY to the MAC. You do this using something like: if (dev->of_node) { phy_np = of_parse_phandle(dev->of_node, "phy-handle", 0); if (!phy_np) { netdev_dbg(ndev, "No phy-handle found in DT\n"); return -ENODEV; } phy_dev = of_phy_connect(ndev, phy_np, &xxxx_enet_adjust_link, 0, pdata->phy_mode); if (!phy_dev) { netdev_err(ndev, "Could not connect to PHY\n"); return -ENODEV; } Do you have an ACPI table describing this hardware? What does it look like? Andrew