PetaLinux EthernetポートのLED

PetaLinux 2020.2, PicoZed, Marvell, LED

Reference : Datasheet of 881512 in https://jp.marvell.com/products/transceivers/alaska-gbe.html 

Abstract : When I changed from PetaLinux 2018.3 to 2020.2, the device driver was also updated, and the value of the Ethernet LED control in marvell.c seems to have been replaced.
I'm using PicoZed, and one of the two LEDs on the RJ45 port now shows the link, and the other is always off. Problem is in components/yocto/workspace/sources/linux-xlnx/drivers/net/phy/marvell.c, we can modify the LED control by MII_88E1510_PHY_LED_DEF . After rebuilding the image, hardware power cycle might be needed.

PetaLinux 2018.3から2020.2に変更すると、デバイスドライバもアップデートされ、marvell.cでのEthernet LEDのコントロールの値が代わったようだ。
PicoZedを使っているが、RJ45ポートの2つのLEDのうち、片方がリンクを表示し、もう片方が常時消灯になってしまった。

問題はプロジェクト内に展開される、components/yocto/workspace/sources/linux-xlnx/drivers/net/phy/marvell.c

#define MII_PHY_LED_CTRL 16
#define MII_88E1121_PHY_LED_DEF 0x0030
// #define MII_88E1510_PHY_LED_DEF 0x1177
#define MII_88E1510_PHY_LED_DEF 0x0030

MII_88E1510_PHY_LED_DEFでLEDのコントロールの値を変えている。値は、4bitづつ下のビットからLED[0], LED[1], LED[2]の設定になっている。2020.2のmarvell.cだと、

LED[0] = 7 : 1000Mbps Link
LED[1] = 7 : 100Mbps Link
LED[2] = 1 : On - Link, Blink - Activity

になっている。0x0030に変えてあげると、

LED[0] = 0 : On - Link (any speed)
LED[1] = 3 : On - Activity
LED[2] = 0 : On - Link

になる。ちなみにLED[1]=4ならBlink - Activity。点滅が早い方が好みの場合は4にすると良い。

kernelをビルドしなおしてイメージを更新すれば良い。ただし、Linuxをリブートだけではダメで、電源を入れなおさないとうまく行かないようだ。