From: Andrew Lunn <andrew@lunn.ch>
To: Pankaj Bansal <pankaj.bansal@nxp.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH 1/1] netdev/phy: add MDIO bus multiplexer driven by a regmap
Date: Wed, 30 Jan 2019 16:33:35 +0100 [thread overview]
Message-ID: <20190130153335.GD23766@lunn.ch> (raw)
In-Reply-To: <20190130164644.3948-2-pankaj.bansal@nxp.com>
On Wed, Jan 30, 2019 at 11:22:00AM +0000, Pankaj Bansal wrote:
> Add support for an MDIO bus multiplexer controlled by a regmap
> device, like an FPGA.
>
> Tested on a NXP LX2160AQDS board which uses the "QIXIS" FPGA
> attached to the i2c bus.
>
> Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
> ---
> drivers/net/phy/Makefile | 2 +-
> drivers/net/phy/mdio-mux-regmap.c | 170 ++++++++++++++++++++++++++++
> include/linux/mdio-mux.h | 20 ++++
> 3 files changed, 191 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
> index f41b14115fde..16145973a42f 100644
> --- a/drivers/net/phy/Makefile
> +++ b/drivers/net/phy/Makefile
> @@ -25,7 +25,7 @@ obj-$(CONFIG_PHYLIB) += libphy.o
> obj-$(CONFIG_MDIO_BCM_IPROC) += mdio-bcm-iproc.o
> obj-$(CONFIG_MDIO_BCM_UNIMAC) += mdio-bcm-unimac.o
> obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o
> -obj-$(CONFIG_MDIO_BUS_MUX) += mdio-mux.o
> +obj-$(CONFIG_MDIO_BUS_MUX) += mdio-mux.o mdio-mux-regmap.o
Please add a new KCONFIG symbol for it. And think about the
depend/select statement, since you need regmap.
> +/* MDIO multiplexing switch function
> + *
> + * This function is called by the mdio-mux layer when it thinks the mdio bus
> + * multiplexer needs to switch.
> + *
> + * 'current_child' is the current value of the mux register (masked via
> + * s->mask).
> + *
> + * 'desired_child' is the value of the 'reg' property of the target child MDIO
> + * node.
> + *
> + * The first time this function is called, current_child == -1.
> + *
> + * If current_child == desired_child, then the mux is already set to the
> + * correct bus.
> + */
Please use kerneldoc formatting for this function documentation.
> +int mdio_mux_regmap_init(struct device *dev,
> + struct device_node *mux_node,
> + void **data)
> +{
> + /* Verify that the 'reg' property of each child MDIO bus does not
> + * set any bits outside of the 'mask'.
> + */
> + for_each_available_child_of_node(mux_node, child) {
> + ret = of_property_read_u32(child, "reg", &val);
> + if (ret) {
> + dev_err(dev, "mdio-mux child node %pOF is missing a 'reg' property\n", child);
You can probably remove "mdio-mux child node " making the line < 80,
but still retain the meaning. The child node name should be sufficient
to identify it.
> + of_node_put(child);
> + return -ENODEV;
> + }
> + if (val & ~s->mask) {
> + dev_err(dev, "mdio-mux child node %pOF has a 'reg' value with unmasked bits\n", child);
Same here.
Andrew
next prev parent reply other threads:[~2019-01-30 15:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-30 11:21 [PATCH 0/1] add MDIO bus multiplexer driven by a regmap device Pankaj Bansal
2019-01-30 11:22 ` [PATCH 1/1] netdev/phy: add MDIO bus multiplexer driven by a regmap Pankaj Bansal
2019-01-30 15:23 ` Andrew Lunn
2019-01-30 15:33 ` Andrew Lunn [this message]
2019-01-30 15:22 ` [PATCH 0/1] add MDIO bus multiplexer driven by a regmap device Andrew Lunn
2019-02-01 9:24 ` Pankaj Bansal
2019-02-01 13:48 ` Andrew Lunn
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=20190130153335.GD23766@lunn.ch \
--to=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pankaj.bansal@nxp.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).