On Tue, 28 Jul 2020 18:28:16 +0200 Andrew Lunn <andrew@xxxxxxx> wrote: > > > @@ -736,6 +777,16 @@ struct phy_driver { > > > int (*set_loopback)(struct phy_device *dev, bool enable); > > > int (*get_sqi)(struct phy_device *dev); > > > int (*get_sqi_max)(struct phy_device *dev); > > > + > > > + /* PHY LED support */ > > > + int (*led_init)(struct phy_device *dev, struct > > > phy_device_led *led); > > > + int (*led_brightness_set)(struct phy_device *dev, struct > > > phy_device_led *led, > > > + enum led_brightness brightness); > > > + const char *(*led_iter_hw_mode)(struct phy_device *dev, > > > struct phy_device_led *led, > > > + void ** iter); > > > + int (*led_set_hw_mode)(struct phy_device *dev, struct > > > phy_device_led *led, > > > + const char *mode); > > > + const char *(*led_get_hw_mode)(struct phy_device *dev, > > > struct phy_device_led *led); }; > > > #define to_phy_driver(d) > > > container_of(to_mdio_common_driver(d), \ struct > > > phy_driver, mdiodrv) > > > > The problem here is that the same code will have to be added to DSA > > switch ops structure, which is not OK. > > Not necessarily. DSA drivers do have access to the phydev structure. > > I think putting these members into a structure is a good idea. That > structure can be part of phy_driver and initialised just like other > members. But on probing the phy, it can be copied over to the > phy_device structure. And we can provide an API which DSA drivers can > use to register there own structure of ops to be placed into > phy_device, which would call into the DSA driver. > > Andrew On Marvell switches there are LEDs that do not necesarrily blink on events on a specific port, but instead on the whole switch. Ie a LED can be put into a mode "act on any port". Vendors may create devices with this as intender mode for a LED, and such a LED may be on the other side of the device from where the ports are, or something. Such a LED should be described in the device tree not as a child of any PHY or port, but instead as a child of the switch itself. And since all the LEDs on Marvell switches are technically controlled by the switch, not it's internal PHYs, I think all of them should be children of the switch node (or a "leds" node which is a child of the switch node), instead of being descended from the internal PHYs. Marek