Tool/software: Linux
In Linux, what is the correct way of linking an indicator LED to activity on a given mmc interface? Naively I would assume you just setup the device tree to use triggers with the gpio-led driver. Something like the following:
mmc1-led { pinctrl-names = "default"; pinctrl-0 = <&mmc1_led_pins>; compatible = "gpio-leds"; mmc1-led@0 { label = "mmc1:activity"; gpios = <&gpioX YY GPIO_ACTIVE_LOW>; linux,default-trigger = "mmc1"; default-state = "off"; }; };
However the device names given by the kernel don't always line up with the physical interface. Obviously this is annoying as the triggers driving the indicator lights are now displaying the wrong information. Just as an example I have the following mmc devices:
sd card on mmc0 is named mmc1
emmc on mmc1 is named mmc2
wifi on mmc2 is named mmc0
However on a board variant without wifi the device names match the correct bus.
sd card on mmc0 is named mmc0
emmc on mmc1 is named mmc1
From what I have read the kernel dynamically assigns the mmc device names based on the order they are discovered. So the scenario where the device names match the physical interface may just be luck. Is there a way to force the device name to match the physical bus a device is attached to? Is the discovery order based on something predictable I can work with like ascending addresses within the memory map? Or is the answer a workaround like an init script to figure out what the devices were named to set the appropriate LED triggers? Any pointers on how to solve this would be appreciated.