Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1373716

Re: [PATCH V3] net: emac: emac gigabit ethernet controller driver

From Andrew Lunn <andrew@lunn.ch>
Newsgroups linux.kernel
Subject Re: [PATCH V3] net: emac: emac gigabit ethernet controller driver
Date 2016-04-07 22:20 +0200
Message-ID <rlozf-Pg-1@gated-at.bofh.it> (permalink)
References <qLe3M-8ln-11@gated-at.bofh.it> <qLUFH-2le-5@gated-at.bofh.it> <qWlY0-79P-69@gated-at.bofh.it> <qWnGq-8t5-11@gated-at.bofh.it> <rlnMT-h0-43@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> 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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH V3] net: emac: emac gigabit ethernet controller driver Timur Tabi <timur@codeaurora.org> - 2016-04-07 21:30 +0200
  Re: [PATCH V3] net: emac: emac gigabit ethernet controller driver Andrew Lunn <andrew@lunn.ch> - 2016-04-07 22:20 +0200
    Re: [PATCH V3] net: emac: emac gigabit ethernet controller driver Timur Tabi <timur@codeaurora.org> - 2016-04-07 23:50 +0200
      Re: [PATCH V3] net: emac: emac gigabit ethernet controller driver Andrew Lunn <andrew@lunn.ch> - 2016-04-08 03:00 +0200
        Re: [PATCH V3] net: emac: emac gigabit ethernet controller driver Timur Tabi <timur@codeaurora.org> - 2016-04-08 21:10 +0200
          Re: [PATCH V3] net: emac: emac gigabit ethernet controller driver Vikram Sethi <vikrams@codeaurora.org> - 2016-04-08 23:20 +0200
            Re: [PATCH V3] net: emac: emac gigabit ethernet controller driver Timur Tabi <timur@codeaurora.org> - 2016-04-08 23:50 +0200
          Re: [PATCH V3] net: emac: emac gigabit ethernet controller driver Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-09 00:50 +0200
            Re: [PATCH V3] net: emac: emac gigabit ethernet controller driver Timur Tabi <timur@codeaurora.org> - 2016-04-09 01:10 +0200
              Re: [PATCH V3] net: emac: emac gigabit ethernet controller driver Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-09 01:30 +0200

csiph-web