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


Groups > linux.kernel > #1514690

Re: [PATCH v5 5/7] net: ethernet: bgmac: device tree phy enablement

From Jon Mason <jon.mason@broadcom.com>
Newsgroups linux.kernel
Subject Re: [PATCH v5 5/7] net: ethernet: bgmac: device tree phy enablement
Date 2016-11-03 17:50 +0100
Message-ID <sztnc-6qT-11@gated-at.bofh.it> (permalink)
References <sz7cZ-FB-27@gated-at.bofh.it> <sz7mH-J6-67@gated-at.bofh.it> <szlSF-1wU-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Nov 03, 2016 at 09:31:21AM +0100, Rafal Milecki wrote:
> On 11/02/2016 06:08 PM, Jon Mason wrote:
> >Change the bgmac driver to allow for phy's defined by the device tree
> 
> This is a late review, I know, sorry... :(
> 
> 
> >+static int bcma_phy_direct_connect(struct bgmac *bgmac)
> >+{
> >+	struct fixed_phy_status fphy_status = {
> >+		.link = 1,
> >+		.speed = SPEED_1000,
> >+		.duplex = DUPLEX_FULL,
> >+	};
> >+	struct phy_device *phy_dev;
> >+	int err;
> >+
> >+	phy_dev = fixed_phy_register(PHY_POLL, &fphy_status, -1, NULL);
> >+	if (!phy_dev || IS_ERR(phy_dev)) {
> >+		dev_err(bgmac->dev, "Failed to register fixed PHY device\n");
> >+		return -ENODEV;
> >+	}
> >+
> >+	err = phy_connect_direct(bgmac->net_dev, phy_dev, bgmac_adjust_link,
> >+				 PHY_INTERFACE_MODE_MII);
> >+	if (err) {
> >+		dev_err(bgmac->dev, "Connecting PHY failed\n");
> >+		return err;
> >+	}
> >+
> >+	return err;
> >+}
> 
> This bcma specific function looks exactly the same as...
> 
> 
> >+static int platform_phy_direct_connect(struct bgmac *bgmac)
> >+{
> >+	struct fixed_phy_status fphy_status = {
> >+		.link = 1,
> >+		.speed = SPEED_1000,
> >+		.duplex = DUPLEX_FULL,
> >+	};
> >+	struct phy_device *phy_dev;
> >+	int err;
> >+
> >+	phy_dev = fixed_phy_register(PHY_POLL, &fphy_status, -1, NULL);
> >+	if (!phy_dev || IS_ERR(phy_dev)) {
> >+		dev_err(bgmac->dev, "Failed to register fixed PHY device\n");
> >+		return -ENODEV;
> >+	}
> >+
> >+	err = phy_connect_direct(bgmac->net_dev, phy_dev, bgmac_adjust_link,
> >+				 PHY_INTERFACE_MODE_MII);
> >+	if (err) {
> >+		dev_err(bgmac->dev, "Connecting PHY failed\n");
> >+		return err;
> >+	}
> >+
> >+	return err;
> >+}
> 
> This one.
> 
> Would that make sense to keep bgmac_phy_connect_direct and just use it in
> bcma/platform code?

Yes, I was having the same internal debate.  I hate the duplication of
code, but I really wanted to keep the PHY logic out of the bgmac.c
file.  Do you think it is acceptable to make this an inline function
in bgmac.h?

Thanks,
Jon

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


Thread

[PATCH v5 0/7] add NS2 support to bgmac Jon Mason <jon.mason@broadcom.com> - 2016-11-02 18:10 +0100
  [PATCH v5 1/7] net: phy: broadcom: add bcm54xx_auxctl_read Jon Mason <jon.mason@broadcom.com> - 2016-11-02 18:10 +0100
    Re: [PATCH v5 1/7] net: phy: broadcom: add bcm54xx_auxctl_read Florian Fainelli <florian.fainelli@broadcom.com> - 2016-11-02 18:20 +0100
  Re: [PATCH v5 3/7] net: phy: broadcom: Add BCM54810 PHY entry Florian Fainelli <florian.fainelli@broadcom.com> - 2016-11-02 18:20 +0100
  [PATCH v5 3/7] net: phy: broadcom: Add BCM54810 PHY entry Jon Mason <jon.mason@broadcom.com> - 2016-11-02 18:20 +0100
    Re: [PATCH v5 3/7] net: phy: broadcom: Add BCM54810 PHY entry Andrew Lunn <andrew@lunn.ch> - 2016-11-02 19:40 +0100
  Re: [PATCH v5 4/7] Documentation: devicetree: net: add NS2 bindings  to amac Florian Fainelli <f.fainelli@gmail.com> - 2016-11-02 18:20 +0100
  [PATCH v5 4/7] Documentation: devicetree: net: add NS2 bindings to amac Jon Mason <jon.mason@broadcom.com> - 2016-11-02 18:20 +0100
    Re: [PATCH v5 4/7] Documentation: devicetree: net: add NS2 bindings  to amac Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-11-02 18:20 +0100
      Re: [PATCH v5 4/7] Documentation: devicetree: net: add NS2 bindings  to amac Jon Mason <jon.mason@broadcom.com> - 2016-11-02 18:30 +0100
        Re: [PATCH v5 4/7] Documentation: devicetree: net: add NS2 bindings  to amac Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-11-02 21:00 +0100
  [PATCH v5 5/7] net: ethernet: bgmac: device tree phy enablement Jon Mason <jon.mason@broadcom.com> - 2016-11-02 18:20 +0100
    Re: [PATCH v5 5/7] net: ethernet: bgmac: device tree phy enablement Rafal Milecki <rafal@milecki.pl> - 2016-11-03 09:50 +0100
      Re: [PATCH v5 5/7] net: ethernet: bgmac: device tree phy enablement Jon Mason <jon.mason@broadcom.com> - 2016-11-03 17:50 +0100
  Re: [PATCH v5 0/7] add NS2 support to bgmac David Miller <davem@davemloft.net> - 2016-11-03 21:10 +0100

csiph-web