From: Kumar Gala <galak-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
To: David Daney <david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
Cc: linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org,
"David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Subject: Re: [PATCH 2/3] netdev/of/phy: Add MDIO bus multiplexer support.
Date: Wed, 14 Sep 2011 15:42:21 -0500 [thread overview]
Message-ID: <678076BE-4CF8-4AC9-BE9B-9AF1A17B7AF8@kernel.crashing.org> (raw)
In-Reply-To: <4E6FE5F9.2060604-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
On Sep 13, 2011, at 6:23 PM, David Daney wrote:
> On 09/13/2011 04:07 PM, Kumar Gala wrote:
>>
>>> diff --git a/Documentation/devicetree/bindings/net/mdio-mux.txt b/Documentation/devicetree/bindings/net/mdio-mux.txt
>>> new file mode 100644
>>> index 0000000..a908312
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/net/mdio-mux.txt
>>> @@ -0,0 +1,132 @@
>>> +Common MDIO bus multiplexer/switch properties.
>>> +
>>> +An MDIO bus multiplexer/switch will have several child busses that are
>>> +numbered uniquely in a device dependent manner. The nodes for an MDIO
>>> +bus multiplexer/switch will have one child node for each child bus.
>>> +
>>> +Required properties:
>>> +- parent-bus : phandle to the parent MDIO bus.
>>
>> Should probably be mdio-parent-bus
>
> Why? We know it is MDIO.
>
> Serial bus multiplexing is not a concept limited to MDIO. We would want to use "parent-bus" for some I2C multiplexers as well.
>From many years of dealing with device trees. We typically don't name things overlay generically unless they will be used over and over again as a common idiom (like reg, interrupt, etc.).
We don't really use 'bus' generically today.
>
>>
>>> +
>>> +Optional properties:
>>> +- Other properties specific to the multiplexer/switch hardware.
>>> +
>>> +Required properties for child nodes:
>>> +- #address-cells =<1>;
>>> +- #size-cells =<0>;
>>> +- cell-index : The sub-bus number.
>>
>> What does sub-bus number mean?
>
> There are N child buses (or sub-buses) coming out of the multiplexer. The cell-index is used as a handle or identifier for each of these.
>
> The concrete example in Patch 3/3 is a multiplexer with four child buses. The happen to have cell-indexes of 0, 1, 2 and 3.
>
> In the GPIO case of patch 3/3, these directly correspond the the state of the two GPIO pins controlling the multiplexer. The driver then uses the cell-index property to determine the state of the GPIO to connect any given child.
>
> It is possible that the documentation part of the patch could be made more clear about this.
>
>>
>>> +
>>> +
>>> +Example :
>>
> [...]
>>> +
>>> +int mdio_mux_probe(struct platform_device *pdev,
>>> + int (*switch_fn)(int cur, int desired, void *data),
>>> + void *data)
>>> +{
>>> + struct device_node *parent_bus_node;
>>> + struct device_node *child_bus_node;
>>> + int r, n, ret_val;
>>> + struct mii_bus *parent_bus;
>>> + struct mdio_mux_parent_bus *pb;
>>> + struct mdio_mux_child_bus *cb;
>>> +
>>> + if (!pdev->dev.of_node)
>>> + return -ENODEV;
>>> +
>>> + parent_bus_node = of_parse_phandle(pdev->dev.of_node, "parent-bus", 0);
>>> +
>>> + if (!parent_bus_node)
>>> + return -ENODEV;
>>> +
>>> + parent_bus = of_mdio_find_bus(parent_bus_node);
>>
>>
>> So what happens if the parent bus probe happens after the mux probe?
>>
>
> The whole house of cards collapses.
>
> Grant Likely has a patch to deal with this by retrying the probing, but as far as I know, it has not been merged yet.
- k
next prev parent reply other threads:[~2011-09-14 20:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-31 20:01 [PATCH 0/3] netdev/of/phy: MDIO bus multiplexer support David Daney
[not found] ` <1314820906-14004-1-git-send-email-david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2011-08-31 20:01 ` [PATCH 1/3] netdev/of/phy: New function: of_mdio_find_bus() David Daney
2011-08-31 20:01 ` [PATCH 2/3] netdev/of/phy: Add MDIO bus multiplexer support David Daney
2011-09-09 23:22 ` Andy Fleming
[not found] ` <1314820906-14004-3-git-send-email-david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2011-09-13 23:07 ` Kumar Gala
[not found] ` <129FAAB3-C9AD-43F6-A8CB-96548A47C4DC-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2011-09-13 23:23 ` David Daney
[not found] ` <4E6FE5F9.2060604-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2011-09-14 20:42 ` Kumar Gala [this message]
2011-09-14 21:40 ` Device tree property names for MDIO bus multiplexer. Was: " David Daney
[not found] ` <4E711F59.6000801-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2011-09-15 0:41 ` Grant Likely
2011-09-15 0:51 ` Grant Likely
2011-09-15 4:16 ` David Daney
2011-08-31 20:01 ` [PATCH 3/3] netdev/of/phy: Add MDIO bus multiplexer driven by GPIO lines David Daney
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=678076BE-4CF8-4AC9-BE9B-9AF1A17B7AF8@kernel.crashing.org \
--to=galak-xvmvhmargas8u2djnn8i7kb+6bgklq7r@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ralf-6z/3iImG2C8G8FEW9MqTrA@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).