From: Alex Marginean Date: Thu, 25 Jul 2019 09:33:17 +0000 (+0300) Subject: net: mdio-uclass: name MDIO according to device-name property if preset X-Git-Tag: v2019.10-rc4~22^2~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6b3abc048228bb4336dd0cc761993353a4efb206;p=platform%2Fkernel%2Fu-boot.git net: mdio-uclass: name MDIO according to device-name property if preset 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 Acked-by: Joe Hershberger Reviewed-by: Bin Meng --- diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c index 1c0d252..6f922e8 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