Message ID | 20190717151026.27994-2-alexandru.marginean@nxp.com |
---|---|
State | Superseded |
Delegated to: | Joe Hershberger |
Headers | show |
Series | Marvell MDIO driver and new MDIO name property | expand |
On Wed, Jul 17, 2019 at 10:11 AM Alex Marginean <alexandru.marginean@nxp.com> wrote: > > Use the optional property device-name to name the MDIO bus. This works > around limitations with using the DT node name on devices such as > Armada-8040, which integrates two cp100 cores, both featuring MDIOs at the > same relative offsets and with the same DT node names. > The concept was originally proposed by Marvell as a custom property called > mdio-name specific to Marvell driver. This patch uses the more generic > property device-name and moves this into MDIO class code so other can use > it as well. > > Signed-off-by: Alex Marginean <alexm.osslist@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
On Wed, Jul 17, 2019 at 11:11 PM Alex Marginean <alexandru.marginean@nxp.com> wrote: > > Use the optional property device-name to name the MDIO bus. This works > around limitations with using the DT node name on devices such as > Armada-8040, which integrates two cp100 cores, both featuring MDIOs at the > same relative offsets and with the same DT node names. > The concept was originally proposed by Marvell as a custom property called > mdio-name specific to Marvell driver. This patch uses the more generic I was wondering whether such optional custom property name is accepted by the Linux devicetree committee or yet? The general goal is to use exact the same DT as kernel uses, at least for ARM, and that is what I learned from this ML. > property device-name and moves this into MDIO class code so other can use > it as well. > > Signed-off-by: Alex Marginean <alexm.osslist@gmail.com> > --- > net/mdio-uclass.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > Anyway, the codes LGTM. So Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Regards, Bin
On 7/23/2019 9:38 AM, Bin Meng wrote: > On Wed, Jul 17, 2019 at 11:11 PM Alex Marginean > <alexandru.marginean@nxp.com> wrote: >> >> Use the optional property device-name to name the MDIO bus. This works >> around limitations with using the DT node name on devices such as >> Armada-8040, which integrates two cp100 cores, both featuring MDIOs at the >> same relative offsets and with the same DT node names. >> The concept was originally proposed by Marvell as a custom property called >> mdio-name specific to Marvell driver. This patch uses the more generic > > I was wondering whether such optional custom property name is accepted > by the Linux devicetree committee or yet? The general goal is to use > exact the same DT as kernel uses, at least for ARM, and that is what I > learned from this ML. I didn't ask, my guess is they would not. The property is not actually describing HW, plus Linux wouldn't need this name anyway. As far as I know MDIOs in Linux are not addressable directly using user-space tools and for the purpose of probing devices and matching ethernet/PHY/MDIO this property is not useful. U-Boot on the other hand has the mdio cmd which requires unique names and also benefits from friendly names for MDIO buses. There are other potential solutions for the unique name problem, like creating something out of the full DT path of the device, or resolve absolute base address and use that. These aren't as easy to use though. Alex > >> property device-name and moves this into MDIO class code so other can use >> it as well. >> >> Signed-off-by: Alex Marginean <alexm.osslist@gmail.com> >> --- >> net/mdio-uclass.c | 11 +++++++++++ >> 1 file changed, 11 insertions(+) >> > > Anyway, the codes LGTM. So > > Reviewed-by: Bin Meng <bmeng.cn@gmail.com> > > Regards, > Bin > _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot >
Hi Alex, On Tue, Jul 23, 2019 at 2:51 PM Alex Marginean <alexm.osslist@gmail.com> wrote: > > On 7/23/2019 9:38 AM, Bin Meng wrote: > > On Wed, Jul 17, 2019 at 11:11 PM Alex Marginean > > <alexandru.marginean@nxp.com> wrote: > >> > >> Use the optional property device-name to name the MDIO bus. This works > >> around limitations with using the DT node name on devices such as > >> Armada-8040, which integrates two cp100 cores, both featuring MDIOs at the > >> same relative offsets and with the same DT node names. > >> The concept was originally proposed by Marvell as a custom property called > >> mdio-name specific to Marvell driver. This patch uses the more generic > > > > I was wondering whether such optional custom property name is accepted > > by the Linux devicetree committee or yet? The general goal is to use > > exact the same DT as kernel uses, at least for ARM, and that is what I > > learned from this ML. > > I didn't ask, my guess is they would not. The property is not actually > describing HW, plus Linux wouldn't need this name anyway. As far as I > know MDIOs in Linux are not addressable directly using user-space tools > and for the purpose of probing devices and matching ethernet/PHY/MDIO > this property is not useful. U-Boot on the other hand has the mdio cmd > which requires unique names and also benefits from friendly names for > MDIO buses. > There are other potential solutions for the unique name problem, like > creating something out of the full DT path of the device, or resolve > absolute base address and use that. These aren't as easy to use though. Thanks for the clarification. Good enough for now :) Regards, Bin
diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c index 36a404ff44..428f3a994f 100644 --- a/net/mdio-uclass.c +++ b/net/mdio-uclass.c @@ -23,6 +23,17 @@ void dm_mdio_probe_devices(void) static int dm_mdio_post_bind(struct udevice *dev) { + const char *dt_name; + + /* set a custom name for the MDIO device, if present in DT */ + if (ofnode_valid(dev->node)) { + dt_name = ofnode_read_string(dev->node, "device-name"); + if (dt_name) { + debug("renaming dev %s to %s\n", dev->name, dt_name); + device_set_name(dev, dt_name); + } + } + /* * MDIO command doesn't like spaces in names, don't allow them to keep * it happy
Use the optional property device-name to name the MDIO bus. This works around limitations with using the DT node name on devices such as Armada-8040, which integrates two cp100 cores, both featuring MDIOs at the same relative offsets and with the same DT node names. The concept was originally proposed by Marvell as a custom property called mdio-name specific to Marvell driver. This patch uses the more generic property device-name and moves this into MDIO class code so other can use it as well. Signed-off-by: Alex Marginean <alexm.osslist@gmail.com> --- net/mdio-uclass.c | 11 +++++++++++ 1 file changed, 11 insertions(+)