netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Mason <jon.mason-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
To: rafal-g1n6cQUeyibVItvQsEIGlw@public.gmane.org
Cc: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Florian Fainelli
	<f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v5 5/7] net: ethernet: bgmac: device tree phy enablement
Date: Thu, 3 Nov 2016 12:45:41 -0400	[thread overview]
Message-ID: <20161103164540.GA24723@broadcom.com> (raw)
In-Reply-To: <35b16640-8600-8c48-2f04-886dc925229d-g1n6cQUeyibVItvQsEIGlw@public.gmane.org>

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
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-11-03 16:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02 17:08 [PATCH v5 0/7] add NS2 support to bgmac Jon Mason
2016-11-02 17:08 ` [PATCH v5 1/7] net: phy: broadcom: add bcm54xx_auxctl_read Jon Mason
2016-11-02 17:11   ` Florian Fainelli
2016-11-02 17:08 ` [PATCH v5 2/7] Documentation: devicetree: add PHY lane swap binding Jon Mason
2016-11-02 17:11   ` Florian Fainelli
2016-11-02 17:39   ` Andrew Lunn
2016-11-02 17:08 ` [PATCH v5 3/7] net: phy: broadcom: Add BCM54810 PHY entry Jon Mason
2016-11-02 17:12   ` Florian Fainelli
2016-11-02 18:37   ` Andrew Lunn
2016-11-02 17:08 ` [PATCH v5 4/7] Documentation: devicetree: net: add NS2 bindings to amac Jon Mason
2016-11-02 17:13   ` Florian Fainelli
2016-11-02 17:18   ` Sergei Shtylyov
2016-11-02 17:24     ` Jon Mason
2016-11-02 19:52       ` Sergei Shtylyov
2016-11-02 17:08 ` [PATCH v5 5/7] net: ethernet: bgmac: device tree phy enablement Jon Mason
2016-11-02 17:16   ` Florian Fainelli
2016-11-03  8:31   ` Rafal Milecki
     [not found]     ` <35b16640-8600-8c48-2f04-886dc925229d-g1n6cQUeyibVItvQsEIGlw@public.gmane.org>
2016-11-03 16:45       ` Jon Mason [this message]
2016-11-02 17:08 ` [PATCH v5 6/7] net: ethernet: bgmac: add NS2 support Jon Mason
2016-11-02 17:17   ` Florian Fainelli
     [not found] ` <1478106488-11779-1-git-send-email-jon.mason-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2016-11-02 17:08   ` [PATCH v5 7/7] arm64: dts: NS2: add AMAC ethernet support Jon Mason
2016-11-02 17:17     ` Florian Fainelli
2016-11-03 20:02   ` [PATCH v5 0/7] add NS2 support to bgmac David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161103164540.GA24723@broadcom.com \
    --to=jon.mason-dy08kvg/lbpwk0htik3j/w@public.gmane.org \
    --cc=bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rafal-g1n6cQUeyibVItvQsEIGlw@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).