From: Timur Tabi <timur@freescale.com>
To: David Daney <ddaney.cavm@gmail.com>
Cc: "devicetree-discuss@lists.ozlabs.org"
<devicetree-discuss@lists.ozlabs.org>,
Andy Fleming <afleming@freescale.com>,
David Miller <davem@davemloft.net>,
netdev@vger.kernel.org, david.daney@cavium.com
Subject: Re: [PATCH] netdev/phy: add MDIO bus multiplexer driven by a memory-mapped FPGA
Date: Wed, 22 Aug 2012 17:38:37 -0500 [thread overview]
Message-ID: <50355F6D.4070002@freescale.com> (raw)
In-Reply-To: <50355C05.6000407@gmail.com>
David Daney wrote:
> I wonder if *fpga is really a good name for this. It is a general
> purpose multiplexer with a memory mapped control register. I would call
> it something like mdio-mux-mmioreg.
At one point, I thought of using mdio-mux-bitbang, but -mmioreg is better.
Thanks.
>> +- mdio-mux-device : phandle, points to the FPGA (or similar) node. This
>> + must be a memory-mapped device with 8-bit registers.
>
> You shouldn't need this. Just make the multiplexer a child of FPGA node
> to indicate where it lives.
The problem is that we don't normally consider the FPGA node to be a bus,
so its child nodes won't get probed. That's why I have this:
compatible = "mdio-mux-fpga", "mdio-mux";
^^^^^^^^
This allows me to have multiple mdio-mux parent nodes (which I do, since I
have multiple mdio bus muxes), and they all get registered and probed
properly because I also do this:
static const struct of_device_id of_device_ids[] __devinitconst = {
{
.compatible = "simple-bus"
},
{
.compatible = "fsl,srio",
},
...
{
.compatible = "mdio-mux",
},
{}
};
The .compatible = "mdio-mux" is what causes all of the mdio-mux nodes to
be registered. Therefore, it's simpler if all the mdio-mux nodes are root
nodes.
>> +
>> +- mdio-mux-register : integer, contains the offset of the register that
>> + controls the bus multiplexer.
>
> This should just be the normal "reg" properly
Ok.
>> +- mdio-mux-mask : integer, contains an 8-bit mask that specifies which
>> + bits in the register control the actual bus multiplexer. The
>> + 'reg' property of each child mdio-mux node must be constrained by
>> + this mask.
>> +
>
> "reg-mask" ??
Ok.
>
> Do you need a shift too?
The 'reg' property of the mdio bus child nodes should take the shift into
account. That's why, in the example, I have mask=0x6 and reg=0 or reg=2.
There's even code in the driver to make sure that the 'reg' values are
constrained to the mask.
--
Timur Tabi
Linux kernel developer at Freescale
WARNING: multiple messages have this Message-ID (diff)
From: Timur Tabi <timur@freescale.com>
To: David Daney <ddaney.cavm@gmail.com>
Cc: "devicetree-discuss@lists.ozlabs.org"
<devicetree-discuss@lists.ozlabs.org>,
Andy Fleming <afleming@freescale.com>,
David Miller <davem@davemloft.net>, <netdev@vger.kernel.org>,
<david.daney@cavium.com>
Subject: Re: [PATCH] netdev/phy: add MDIO bus multiplexer driven by a memory-mapped FPGA
Date: Wed, 22 Aug 2012 17:38:37 -0500 [thread overview]
Message-ID: <50355F6D.4070002@freescale.com> (raw)
In-Reply-To: <50355C05.6000407@gmail.com>
David Daney wrote:
> I wonder if *fpga is really a good name for this. It is a general
> purpose multiplexer with a memory mapped control register. I would call
> it something like mdio-mux-mmioreg.
At one point, I thought of using mdio-mux-bitbang, but -mmioreg is better.
Thanks.
>> +- mdio-mux-device : phandle, points to the FPGA (or similar) node. This
>> + must be a memory-mapped device with 8-bit registers.
>
> You shouldn't need this. Just make the multiplexer a child of FPGA node
> to indicate where it lives.
The problem is that we don't normally consider the FPGA node to be a bus,
so its child nodes won't get probed. That's why I have this:
compatible = "mdio-mux-fpga", "mdio-mux";
^^^^^^^^
This allows me to have multiple mdio-mux parent nodes (which I do, since I
have multiple mdio bus muxes), and they all get registered and probed
properly because I also do this:
static const struct of_device_id of_device_ids[] __devinitconst = {
{
.compatible = "simple-bus"
},
{
.compatible = "fsl,srio",
},
...
{
.compatible = "mdio-mux",
},
{}
};
The .compatible = "mdio-mux" is what causes all of the mdio-mux nodes to
be registered. Therefore, it's simpler if all the mdio-mux nodes are root
nodes.
>> +
>> +- mdio-mux-register : integer, contains the offset of the register that
>> + controls the bus multiplexer.
>
> This should just be the normal "reg" properly
Ok.
>> +- mdio-mux-mask : integer, contains an 8-bit mask that specifies which
>> + bits in the register control the actual bus multiplexer. The
>> + 'reg' property of each child mdio-mux node must be constrained by
>> + this mask.
>> +
>
> "reg-mask" ??
Ok.
>
> Do you need a shift too?
The 'reg' property of the mdio bus child nodes should take the shift into
account. That's why, in the example, I have mask=0x6 and reg=0 or reg=2.
There's even code in the driver to make sure that the 'reg' values are
constrained to the mask.
--
Timur Tabi
Linux kernel developer at Freescale
next prev parent reply other threads:[~2012-08-22 22:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-22 21:45 [PATCH] netdev/phy: add MDIO bus multiplexer driven by a memory-mapped FPGA Timur Tabi
2012-08-22 22:24 ` David Daney
2012-08-22 22:38 ` Timur Tabi [this message]
2012-08-22 22:38 ` Timur Tabi
2012-08-22 22:52 ` David Daney
2012-08-22 22:52 ` David Daney
2012-08-23 0:06 ` Tabi Timur-B04825
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=50355F6D.4070002@freescale.com \
--to=timur@freescale.com \
--cc=afleming@freescale.com \
--cc=davem@davemloft.net \
--cc=david.daney@cavium.com \
--cc=ddaney.cavm@gmail.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--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 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.