From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Timur Tabi <timur-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
Andy Fleming <afleming-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Subject: Re: [PATCH] [v2] netdev/phy: add MDIO bus multiplexer driven by a memory-mapped device
Date: Thu, 23 Aug 2012 16:54:53 -0600 [thread overview]
Message-ID: <5036B4BD.70208@wwwdotorg.org> (raw)
In-Reply-To: <1345751071-23128-1-git-send-email-timur-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
On 08/23/2012 01:44 PM, Timur Tabi wrote:
> Add support for an MDIO bus multiplexer controlled by a simple memory-mapped
> device, like an FPGA. The device must be memory-mapped and contain only
> 8-bit registers (which keeps things simple).
> +++ b/Documentation/devicetree/bindings/net/mdio-mux-mmioreg.txt
> + /* The FPGA node */
> + fpga: board-control@3,0 {
> + compatible = "fsl,p5020ds-fpga", "fsl,fpga-ngpixis";
> + reg = <3 0 0x30>;
Why not add the following here:
#address-cells = <1>:
#size-cells = <1>;
ranges = <...>;
> +
> + mdio-mux-emi2 {
> + compatible = "mdio-mux-mmioreg", "mdio-mux";
> + mdio-parent-bus = <&xmdio0>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + reg = <9>; // BRDCFG1
Then, that'd have to be <9 1>;
That way, ...
> diff --git a/drivers/net/phy/mdio-mux-mmioreg.c b/drivers/net/phy/mdio-mux-mmioreg.c
> +static int __devinit mdio_mux_mmioreg_probe(struct platform_device *pdev)
> + /* The MMIO device is the parent of this device */
> + np2 = of_get_parent(np);
> + if (!np2) {
> + dev_err(&pdev->dev, "could not find parent MMIO device\n");
> + return -ENODEV;
> + }
> +
> + ret = of_address_to_resource(np2, 0, &res);
> + if (ret) {
> + dev_err(&pdev->dev, "could not obtain memory map for node %s\n",
> + np2->full_name);
> + return ret;
> + }
> + s->phys = res.start;
You could simplify all that into just "of_iomap(np, 0)", and all the
address translation etc. happens entirely automatically, in the standard
fashion for DT.
The advantage here is that it completely decouples the mdio-mux-mmioreg
driver from any knowledge of its parent; you could just as easily use
this driver/binding as a device directly on some SoC bus, rather than
requiring there to be a parent device above it. After all, the mux
register might be some random standalone on-SoC register (although I
wonder if that case might not be better covered by a mdio-mux-pinctrl
driver instead; I guess it depends on how special-purpose the mux
register is).
next prev parent reply other threads:[~2012-08-23 22:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-23 19:44 [PATCH] [v2] netdev/phy: add MDIO bus multiplexer driven by a memory-mapped device Timur Tabi
2012-08-23 19:44 ` Timur Tabi
[not found] ` <1345751071-23128-1-git-send-email-timur-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2012-08-23 22:54 ` Stephen Warren [this message]
2012-08-24 0:28 ` Tabi Timur-B04825
[not found] ` <6AE080B68D46FC4BA2D2769E68D765B7059D1DC7-RL0Hj/+nBVC81RJBUSuqCa4g8xLGJsHaLnY5E4hWTkheoWH0uzbU5w@public.gmane.org>
2012-08-24 2:46 ` Stephen Warren
2012-08-24 16:27 ` Timur Tabi
2012-08-24 18:29 ` Stephen Warren
2012-08-24 18:36 ` Timur Tabi
2012-08-24 18:43 ` Scott Wood
2012-08-24 18:56 ` Stephen Warren
2012-08-24 19:07 ` David Miller
2012-08-24 19:18 ` Scott Wood
2012-08-24 19:18 ` Scott Wood
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=5036B4BD.70208@wwwdotorg.org \
--to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
--cc=afleming-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=timur-KZfg59tc24xl57MIdRCFDg@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.