On Tue, Jul 14, 2020 at 04:22:12PM +0200, Marek Behún wrote: > This adds config option CONFIG_MDIO_BUS_DEBUGFS which, when enabled, > adds support to communicate with the devices connected to the MDIO > via debugfs. > > For every MDIO bus this creates directory > /sys/kernel/debug/mdio_bus/MDIO_BUS_NAME > with files "addr", "reg" and "val". > User can write device address to the "addr" file and register number to > the "reg" file, and then can read the value of the register from the > "val" file, or can write new value by writing to the "val" file. > > This is useful when debugging various PHYs or switches.
Hi Marek Please work with Tobias Waldekranz <tob...@waldekranz.com>. I'm not particularly keen on allowing write access to such registers, but it seems like there is demand. But we don't want two ways to do this. > static int mdiobus_register_gpiod(struct mdio_device *mdiodev) > { > @@ -576,6 +577,12 @@ int __mdiobus_register(struct mii_bus *bus, struct > module *owner) > } > } > > + err = mdiobus_register_debugfs(bus); > + if (err) { > + dev_err(&bus->dev, "mii_bus %s couldn't create debugfs > entries\n", bus->id); > + goto error; > + } FYI: You should never error out for debugfs. You should not even check the return values from debugfs calls. Andrew