From: Andrew Lunn <andrew@lunn.ch>
To: Quentin Schulz <quentin.schulz@bootlin.com>
Cc: alexandre.belloni@bootlin.com, ralf@linux-mips.org,
paul.burton@mips.com, jhogan@kernel.org, robh+dt@kernel.org,
mark.rutland@arm.com, davem@davemloft.net, f.fainelli@gmail.com,
allan.nielsen@microchip.com, linux-mips@linux-mips.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, thomas.petazzoni@bootlin.com,
antoine.tenart@bootlin.com
Subject: Re: [PATCH net-next 2/7] net: phy: mscc: add support for VSC8584 PHY
Date: Fri, 14 Sep 2018 19:27:54 +0200 [thread overview]
Message-ID: <20180914172754.GC3811@lunn.ch> (raw)
In-Reply-To: <a61d9affd3f1ec9deb60c882cce1daf37fbe2427.1536916714.git-series.quentin.schulz@bootlin.com>
> struct vsc8531_private {
> int rate_magic;
> u16 supp_led_modes;
> @@ -181,6 +354,7 @@ struct vsc8531_private {
> struct vsc85xx_hw_stat *hw_stats;
> u64 *stats;
> int nstats;
> + bool pkg_init;
> +/* bus->mdio_lock should be locked when using this function */
> +static int vsc8584_cmd(struct mii_bus *bus, int phy, u16 val)
> +{
> + unsigned long deadline;
> + u16 reg_val;
> +
> + __mdiobus_write(bus, phy, MSCC_EXT_PAGE_ACCESS,
> + MSCC_PHY_PAGE_EXTENDED_GPIO);
> +
> + __mdiobus_write(bus, phy, MSCC_PHY_PROC_CMD, PROC_CMD_NCOMPLETED | val);
Hi Quentin
All the __mdiobus_write() look a bit ugly. Maybe add bus and base_addr
to the vsc8531_private structure. Then add helpers
phy_write_base_phy(priv, reg, val) and phy_read_base_phy(priv, reg).
You could also add in:
if (unlikely(!mutex_is_locked(&priv->bus->mdio_lock))) {
dev_err(bus->dev, "MDIO bus lock not held!\n");
dump_stack();
}
Having such code in the mv88e6xxx driver has found a few bugs for me.
Andrew
next prev parent reply other threads:[~2018-09-14 17:27 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-14 9:44 [PATCH net-next 0/7] add support for VSC8584 and VSC8574 Microsemi quad-port PHYs Quentin Schulz
2018-09-14 9:44 ` [PATCH net-next 1/7] dt-bindings: net: vsc8531: add two additional LED modes for VSC8584 Quentin Schulz
2018-09-14 13:11 ` Andrew Lunn
2018-09-15 21:34 ` Florian Fainelli
2018-09-14 9:44 ` [PATCH net-next 2/7] net: phy: mscc: add support for VSC8584 PHY Quentin Schulz
2018-09-14 13:18 ` Andrew Lunn
2018-09-14 13:29 ` Quentin Schulz
2018-09-14 16:28 ` Quentin Schulz
2018-09-14 16:58 ` Andrew Lunn
2018-10-01 9:16 ` Quentin Schulz
2018-09-14 17:27 ` Andrew Lunn [this message]
2018-10-01 9:15 ` Quentin Schulz
2018-09-14 9:44 ` [PATCH net-next 3/7] net: phy: mscc: split config_init in two functions for VSC8584 Quentin Schulz
2018-09-14 17:57 ` Florian Fainelli
2018-10-01 9:07 ` Quentin Schulz
2018-09-14 9:44 ` [PATCH net-next 4/7] net: phy: mscc: add support for VSC8574 PHY Quentin Schulz
2018-09-14 20:26 ` Florian Fainelli
2018-10-04 9:45 ` Quentin Schulz
2018-10-04 12:53 ` Quentin Schulz
2018-09-14 9:44 ` [PATCH 5/7] MIPS: mscc: ocelot: add GPIO4 pinmuxing DT node Quentin Schulz
2018-09-14 14:54 ` Alexandre Belloni
2018-09-14 16:26 ` Quentin Schulz
2018-09-14 17:02 ` Andrew Lunn
2018-10-01 9:01 ` Quentin Schulz
2018-09-14 18:02 ` Alexandre Belloni
2018-10-01 9:02 ` Quentin Schulz
2018-09-14 9:44 ` [PATCH 6/7] MIPS: mscc: add DT for Ocelot PCB120 Quentin Schulz
2018-09-14 14:58 ` Alexandre Belloni
2018-09-14 9:44 ` [PATCH 7/7] MIPS: mscc: add PCB120 to the ocelot fitImage Quentin Schulz
2018-09-14 15:00 ` Alexandre Belloni
2018-09-20 21:38 ` [PATCH net-next 0/7] add support for VSC8584 and VSC8574 Microsemi quad-port PHYs Linus Walleij
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=20180914172754.GC3811@lunn.ch \
--to=andrew@lunn.ch \
--cc=alexandre.belloni@bootlin.com \
--cc=allan.nielsen@microchip.com \
--cc=antoine.tenart@bootlin.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=jhogan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=paul.burton@mips.com \
--cc=quentin.schulz@bootlin.com \
--cc=ralf@linux-mips.org \
--cc=robh+dt@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
/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).