On Thu 2019-03-14 12:26:38, Rasmus Villemoes wrote: > On 14/03/2019 11.29, Pavel Machek wrote: > > On Wed 2019-03-13 21:26:15, Rasmus Villemoes wrote: > >> It can be quite convenient to initialize a netdev-triggered LED with a > >> device name and setting the rx,tx,link properties from device tree, > >> instead of having to do that in an init script in userspace. > >> > >> + The optional child node netdev can be used to > >> + configure initial values for the link, rx, tx and > >> + device_name properties. For example, setting > >> + linux,default-trigger = "netdev" and adding the child > >> + node > >> + > >> + netdev { > >> + rx; > >> + tx; > >> + link; > >> + device-name = "can0"; > >> + }; > >> + > >> + can be used to replace 'linux,default-trigger = > >> + "can0-rxtx"' that relies on the deprecated > >> + CONFIG_CAN_LEDS. > > > > I'm sorry, but no, not like this. I see it works for you, only having > > single can device, but it would quickly break with two of them and two > > ethernets are rather common. > > > > So this will need to be device = <&phandle_of_ethernet_device> or > > something like that. There may be example with usb port triggers. > > Huh? I have two CAN devices, and there are two LEDs on the front panel > labeled CAN-A and CAN-B; my device tree nodes for that are ... > and this works just fine. The only change from the old DT is the > addition of the netdev nodes and changing linux,default-trigger from > "can0-rxtx", "can1-rxtx" to both "netdev". Yeah and now insert the modules for the can devices in different order... May not happen in your case but will be fairly common for ethernets. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Attachment:
signature.asc
Description: Digital signature