From: Mark Rutland <mark.rutland@arm.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"davem@davemloft.net" <davem@davemloft.net>,
"cernekee@gmail.com" <cernekee@gmail.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH net-next v2 07/10] net: bcmgenet: add MDIO routines
Date: Thu, 13 Feb 2014 11:50:08 +0000 [thread overview]
Message-ID: <20140213115008.GB5871@e106331-lin.cambridge.arm.com> (raw)
In-Reply-To: <1392269395-23513-8-git-send-email-f.fainelli@gmail.com>
On Thu, Feb 13, 2014 at 05:29:52AM +0000, Florian Fainelli wrote:
> This patch adds support for configuring the port multiplexer hardware
> which resides in front of the GENET Ethernet MAC controller. This allows
> us to support:
>
> - internal PHYs (using drivers/net/phy/bcm7xxx.c)
> - MoCA PHYs which are an entirely separate hardware block not covered
> here
> - external PHYs and switches
>
> Note that MoCA and switches are currently supported using the emulated
> "fixed PHY" driver.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> Changes since v1:
> - fixed MDIO crash/warning when Device Tree probing fails
> - removed the use of priv->phy_type and use priv->phy_interface
> directly
>
> drivers/net/ethernet/broadcom/genet/bcmmii.c | 481 +++++++++++++++++++++++++++
> 1 file changed, 481 insertions(+)
> create mode 100644 drivers/net/ethernet/broadcom/genet/bcmmii.c
[...]
> +static int bcmgenet_mii_of_init(struct bcmgenet_priv *priv)
> +{
> + struct device_node *dn = priv->pdev->dev.of_node;
> + struct device *kdev = &priv->pdev->dev;
> + struct device_node *mdio_dn;
> + const __be32 *fixed_link;
This looks a bit odd. Could we not have a common parser for fixed-link
properties?
> + u32 propval;
> + int ret, sz;
> +
> + mdio_dn = of_get_next_child(dn, NULL);
> + if (!mdio_dn) {
> + dev_err(kdev, "unable to find MDIO bus node\n");
> + return -ENODEV;
> + }
Could you please check that this is the node you expect (by looking at
the compatible string list).
> +
> + ret = of_mdiobus_register(priv->mii_bus, mdio_dn);
> + if (ret) {
> + dev_err(kdev, "failed to register MDIO bus\n");
> + return ret;
> + }
> +
> + /* Check if we have an internal or external PHY */
> + priv->phy_dn = of_parse_phandle(dn, "phy-handle", 0);
> + if (priv->phy_dn) {
> + if (!of_property_read_u32(priv->phy_dn, "max-speed", &propval))
> + priv->phy_speed = propval;
Is there no way to find this out without reading values directly off of
the PHY? It seems like something we should have an abstraction for.
> + } else {
> + /* Read the link speed from the fixed-link property */
> + fixed_link = of_get_property(dn, "fixed-link", &sz);
> + if (!fixed_link || sz < sizeof(*fixed_link)) {
> + ret = -ENODEV;
> + goto out;
> + }
> +
> + priv->phy_speed = be32_to_cpu(fixed_link[2]);
Similarly can we not have a common fixed-link parser? Or abstraction
such that you query the phy regardless of what it is and how its binding
represents this?
Thanks,
Mark.
next prev parent reply other threads:[~2014-02-13 11:50 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-13 5:29 [PATCH net-next v2 00/10] Support for the Broadcom GENET driver Florian Fainelli
2014-02-13 5:29 ` [PATCH net-next v2 02/10] net: phy: add MoCA PHY type Florian Fainelli
2014-02-13 5:29 ` [PATCH net-next v2 03/10] net: phy: update port type for MoCA PHYs Florian Fainelli
[not found] ` <1392269395-23513-1-git-send-email-f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-02-13 5:29 ` [PATCH net-next v2 01/10] net: phy: add "internal" PHY mode Florian Fainelli
2014-02-13 20:34 ` David Miller
2014-02-13 20:41 ` Florian Fainelli
2014-02-13 5:29 ` [PATCH net-next v2 04/10] net: phy: add Broadcom BCM7xxx internal PHY driver Florian Fainelli
2014-02-13 10:34 ` Francois Romieu
2014-02-13 18:41 ` Florian Fainelli
2014-02-13 5:29 ` [PATCH net-next v2 05/10] net: bcmgenet: add driver definitions and private structure Florian Fainelli
2014-02-13 5:29 ` [PATCH net-next v2 06/10] net: bcmgenet: add main driver file Florian Fainelli
2014-02-13 10:35 ` Francois Romieu
2014-02-13 10:58 ` Joe Perches
2014-02-13 11:38 ` Mark Rutland
2014-02-13 5:29 ` [PATCH net-next v2 07/10] net: bcmgenet: add MDIO routines Florian Fainelli
2014-02-13 11:50 ` Mark Rutland [this message]
2014-02-13 17:00 ` Florian Fainelli
2014-02-13 5:29 ` [PATCH net-next v2 08/10] net: bcmgenet: hook into the build system Florian Fainelli
2014-02-13 5:29 ` [PATCH net-next v2 09/10] Documentation: add Device tree bindings for Broadcom GENET Florian Fainelli
[not found] ` <1392269395-23513-10-git-send-email-f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-02-13 11:13 ` Mark Rutland
[not found] ` <20140213111328.GB30705-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2014-02-13 16:57 ` Florian Fainelli
2014-02-13 5:29 ` [PATCH net-next v2 10/10] MAINTAINERS: add entry for the Broadcom GENET driver Florian Fainelli
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=20140213115008.GB5871@e106331-lin.cambridge.arm.com \
--to=mark.rutland@arm.com \
--cc=cernekee@gmail.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.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