lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160407201009.GA16136@lunn.ch>
Date:	Thu, 7 Apr 2016 22:10:09 +0200
From:	Andrew Lunn <andrew@...n.ch>
To:	Timur Tabi <timur@...eaurora.org>
Cc:	Rob Herring <robh@...nel.org>,
	Gilad Avidov <gavidov@...eaurora.org>,
	netdev <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	linux-arm-msm <linux-arm-msm@...r.kernel.org>,
	Sagar Dharia <sdharia@...eaurora.org>, shankerd@...eaurora.org,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	vikrams@...eaurora.org, Christopher Covington <cov@...eaurora.org>
Subject: Re: [PATCH V3] net: emac: emac gigabit ethernet controller driver

> 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@...20000 {
  	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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ