Message ID | 8f94c394faf5665ae693f41832f2446dfc7c989e.1487539319.git.chunkeey@googlemail.com |
---|---|
State | Not Applicable, archived |
Headers | show |
On 02/19/2017 01:22 PM, Christian Lamparter wrote: > This patch adds glue-code that allows the EMAC driver to interface > with the existing dt-supported PHYs in drivers/net/phy. > > Because currently, the emac driver maintains a small library of > supported phys for in a private phy.c file located in the drivers > directory. > > The support is limited to mostly single ethernet transceiver like the: > CIS8201, BCM5248, ET1011C, Marvell 88E1111 and 88E1112, AR8035. > > However, routers like the Netgear WNDR4700 and Cisco Meraki MX60(W) > have a 5-port switch (AR8327N) attached to the EMAC. The switch chip > is supported by the qca8k mdio driver, which uses the generic phy > library. Another reason is that PHYLIB also supports the BCM54610, > which was used for the Western Digital My Book Live. > > This will now also make EMAC select PHYLIB. This looks mostly good, except one thing below: > > Signed-off-by: Christian Lamparter <chunkeey@googlemail.com> > --- > +static int emac_dt_phy_connect(struct emac_instance *dev, > + struct device_node *phy_handle) > +{ > + u32 phy_flags = 0; > + int res; > + > + res = of_property_read_u32(phy_handle, "phy-flags", &phy_flags); > + if (res < 0 && res != -EINVAL) > + return res; phy-flags is not documented in the binding document, but looking at how you pass it down, I don't think you should do this. > + > + dev->phy.def = devm_kzalloc(&dev->ofdev->dev, sizeof(*dev->phy.def), > + GFP_KERNEL); > + if (!dev->phy.def) > + return -ENOMEM; > + > + dev->phy_dev = of_phy_connect(dev->ndev, phy_handle, > + &emac_adjust_link, phy_flags, > + dev->phy_mode); phy_flags is meant to allow the MAC driver to pass information down to the PHY driver, e.g: lane swap needed, a revision that could not be read by the PHY itself, board-level workarounds etc. > + if (!dev->phy_dev) { > + dev_err(&dev->ofdev->dev, "failed to connect to PHY.\n"); > + return -ENODEV; > + }
From: Christian Lamparter <chunkeey@googlemail.com> Date: Mon, 20 Feb 2017 20:10:58 +0100 > This patch adds glue-code that allows the EMAC driver to interface > with the existing dt-supported PHYs in drivers/net/phy. > > Because currently, the emac driver maintains a small library of > supported phys for in a private phy.c file located in the drivers > directory. > > The support is limited to mostly single ethernet transceiver like the: > CIS8201, BCM5248, ET1011C, Marvell 88E1111 and 88E1112, AR8035. > > However, routers like the Netgear WNDR4700 and Cisco Meraki MX60(W) > have a 5-port switch (AR8327N) attached to the EMAC. The switch chip > is supported by the qca8k mdio driver, which uses the generic phy > library. Another reason is that PHYLIB also supports the BCM54610, > which was used for the Western Digital My Book Live. > > This will now also make EMAC select PHYLIB. > > Signed-off-by: Christian Lamparter <chunkeey@googlemail.com> Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wednesday, February 22, 2017 3:37:35 PM CET David Miller wrote: > From: Christian Lamparter <chunkeey@googlemail.com> > Date: Mon, 20 Feb 2017 20:10:58 +0100 > > > This patch adds glue-code that allows the EMAC driver to interface > > with the existing dt-supported PHYs in drivers/net/phy. > > > > Because currently, the emac driver maintains a small library of > > supported phys for in a private phy.c file located in the drivers > > directory. > > > > The support is limited to mostly single ethernet transceiver like the: > > CIS8201, BCM5248, ET1011C, Marvell 88E1111 and 88E1112, AR8035. > > > > However, routers like the Netgear WNDR4700 and Cisco Meraki MX60(W) > > have a 5-port switch (AR8327N) attached to the EMAC. The switch chip > > is supported by the qca8k mdio driver, which uses the generic phy > > library. Another reason is that PHYLIB also supports the BCM54610, > > which was used for the Western Digital My Book Live. > > > > This will now also make EMAC select PHYLIB. > > > > Signed-off-by: Christian Lamparter <chunkeey@googlemail.com> > > Applied, thanks. > Thanks David. I noticed that the DT Documentation patch: "[v1,1/2] dt: emac: document device-tree based phy discovery and setup" is still pending with "Changes Requested": <https://patchwork.ozlabs.org/patch/729658/> I think this is because of Florian's comment on patch: "[v1,2/2] net: emac: add support for device-tree based PHY discovery and setup" If so, can you please queue this documentation update patch for -next? (I haven't received any comments or complains. If necessary, I can also resent it.) Thanks, Christian -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Christian Lamparter <chunkeey@googlemail.com> Date: Mon, 27 Feb 2017 20:42:15 +0100 > On Wednesday, February 22, 2017 3:37:35 PM CET David Miller wrote: >> From: Christian Lamparter <chunkeey@googlemail.com> >> Date: Mon, 20 Feb 2017 20:10:58 +0100 >> >> > This patch adds glue-code that allows the EMAC driver to interface >> > with the existing dt-supported PHYs in drivers/net/phy. >> > >> > Because currently, the emac driver maintains a small library of >> > supported phys for in a private phy.c file located in the drivers >> > directory. >> > >> > The support is limited to mostly single ethernet transceiver like the: >> > CIS8201, BCM5248, ET1011C, Marvell 88E1111 and 88E1112, AR8035. >> > >> > However, routers like the Netgear WNDR4700 and Cisco Meraki MX60(W) >> > have a 5-port switch (AR8327N) attached to the EMAC. The switch chip >> > is supported by the qca8k mdio driver, which uses the generic phy >> > library. Another reason is that PHYLIB also supports the BCM54610, >> > which was used for the Western Digital My Book Live. >> > >> > This will now also make EMAC select PHYLIB. >> > >> > Signed-off-by: Christian Lamparter <chunkeey@googlemail.com> >> >> Applied, thanks. >> > Thanks David. > > I noticed that the DT Documentation patch: > "[v1,1/2] dt: emac: document device-tree based phy discovery and setup" > is still pending with "Changes Requested": > <https://patchwork.ozlabs.org/patch/729658/> > > I think this is because of Florian's comment on patch: > "[v1,2/2] net: emac: add support for device-tree based PHY discovery and setup" > If so, can you please queue this documentation update patch for -next? > (I haven't received any comments or complains. If necessary, I can also > resent it.) Please resend. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/Documentation/devicetree/bindings/powerpc/4xx/emac.txt b/Documentation/devicetree/bindings/powerpc/4xx/emac.txt index 712baf6c3e24..1893b4c4d93b 100644 --- a/Documentation/devicetree/bindings/powerpc/4xx/emac.txt +++ b/Documentation/devicetree/bindings/powerpc/4xx/emac.txt @@ -71,6 +71,9 @@ For Axon it can be absent, though my current driver doesn't handle phy-address yet so for now, keep 0x00ffffff in it. + - phy-handle : Used to describe configurations where a external PHY + is used. Please refer to: + Documentation/devicetree/bindings/net/ethernet.txt - rx-fifo-size-gige : 1 cell, Rx fifo size in bytes for 1000 Mb/sec operations (if absent the value is the same as rx-fifo-size). For Axon, either absent or 2048. @@ -81,8 +84,22 @@ offload, phandle of the TAH device node. - tah-channel : 1 cell, optional. If appropriate, channel used on the TAH engine. + - fixed-link : Fixed-link subnode describing a link to a non-MDIO + managed entity. See + Documentation/devicetree/bindings/net/fixed-link.txt + for details. + - mdio subnode : When the EMAC has a phy connected to its local + mdio, which us supported by the kernel's network + PHY library in drivers/net/phy, there must be device + tree subnode with the following required properties: + - #address-cells: Must be <1>. + - #size-cells: Must be <0>. - Example: + For PHY definitions: Please refer to + Documentation/devicetree/bindings/net/phy.txt and + Documentation/devicetree/bindings/net/ethernet.txt + + Examples: EMAC0: ethernet@40000800 { device_type = "network"; @@ -104,6 +121,50 @@ zmii-channel = <0>; }; + EMAC1: ethernet@ef600c00 { + device_type = "network"; + compatible = "ibm,emac-apm821xx", "ibm,emac4sync"; + interrupt-parent = <&EMAC1>; + interrupts = <0 1>; + #interrupt-cells = <1>; + #address-cells = <0>; + #size-cells = <0>; + interrupt-map = <0 &UIC2 0x10 IRQ_TYPE_LEVEL_HIGH /* Status */ + 1 &UIC2 0x14 IRQ_TYPE_LEVEL_HIGH /* Wake */>; + reg = <0xef600c00 0x000000c4>; + local-mac-address = [000000000000]; /* Filled in by U-Boot */ + mal-device = <&MAL0>; + mal-tx-channel = <0>; + mal-rx-channel = <0>; + cell-index = <0>; + max-frame-size = <9000>; + rx-fifo-size = <16384>; + tx-fifo-size = <2048>; + fifo-entry-size = <10>; + phy-mode = "rgmii"; + phy-handle = <&phy0>; + phy-map = <0x00000000>; + rgmii-device = <&RGMII0>; + rgmii-channel = <0>; + tah-device = <&TAH0>; + tah-channel = <0>; + has-inverted-stacr-oc; + has-new-stacr-staopc; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + phy0: ethernet-phy@0 { + device_type = "ethernet-phy"; + reg = <0>; + + qca,ar8327-initvals = < + 0x0010 0x40000000>; + }; + }; + + ii) McMAL node Required properties: @@ -145,4 +206,3 @@ - revision : as provided by the RGMII new version register if available. For Axon: 0x0000012a -