openwrt/target/linux/bcm27xx/patches-5.4/950-0343-net-phy-2711-Allow-ethernet-LED-mode-to-be-set-via-d.patch
Álvaro Fernández Rojas 77e97abf12 bcm27xx: update to latest patches from RPi foundation
Also removes random module and switches to new bcm2711 thermal driver.
Boot tested on RPi 4B v1.1 4G.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2020-05-28 19:12:43 +02:00

120 lines
4.9 KiB
Diff

From eef2d9aeb08a227d0a9c5734214425a3b9693f50 Mon Sep 17 00:00:00 2001
From: James Hughes <james.hughes@raspberrypi.org>
Date: Thu, 31 Oct 2019 14:39:44 +0000
Subject: [PATCH] net:phy:2711 Allow ethernet LED mode to be set via
device tree
Add device tree entries and code to allow the specification of
the lighting modes for the LED's on the ethernet connector.
Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
---
arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 3 +++
arch/arm/boot/dts/bcm2838.dtsi | 1 +
arch/arm/boot/dts/overlays/README | 28 +++++++++++++++++++--------
drivers/net/phy/broadcom.c | 9 +++++++--
4 files changed, 31 insertions(+), 10 deletions(-)
--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
@@ -334,5 +334,8 @@
pwr_led_gpio = <&pwr_led>,"gpios:4";
pwr_led_activelow = <&pwr_led>,"gpios:8";
pwr_led_trigger = <&pwr_led>,"linux,default-trigger";
+
+ eth_led0 = <&phy1>,"led-modes:0";
+ eth_led1 = <&phy1>,"led-modes:4";
};
};
--- a/arch/arm/boot/dts/bcm2838.dtsi
+++ b/arch/arm/boot/dts/bcm2838.dtsi
@@ -380,6 +380,7 @@
/* No interrupts - use PHY_POLL */
max-speed = <1000>;
reg = <0x1>;
+ led-modes = <0x02 0x02>;
};
};
};
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -102,26 +102,38 @@ Params:
eee Enable Energy Efficient Ethernet support for
compatible devices (default "on"). See also
- "tx_lpi_timer".
+ "tx_lpi_timer". Pi3B+ only.
eth_downshift_after Set the number of auto-negotiation failures
after which the 1000Mbps modes are disabled.
Legal values are 2, 3, 4, 5 and 0, where
- 0 means never downshift (default 2).
+ 0 means never downshift (default 2). Pi3B+ only.
- eth_led0 Set mode of LED0 (usually orange) (default
- "1"). The legal values are:
- 0=link/activity 1=link1000/activity
+ eth_led0 Set mode of LED0 (usually orange). The legal
+ values are:
+
+ Pi3B+
+
+ 0=link/activity 1=link1000/activity (default)
2=link100/activity 3=link10/activity
4=link100/1000/activity 5=link10/1000/activity
6=link10/100/activity 14=off 15=on
- eth_led1 Set mode of LED1 (usually green) (default
- "6"). See eth_led0 for legal values.
+ Pi4
+
+ 0=Speed/Activity (default) 1=Speed
+ 2=Speed/Flash activity 3=FDX
+ 4=Off 5=On
+ 6=Alt 7=Speed/Flash
+ 8=Link 9=Activity
+
+ eth_led1 Set mode of LED1 (usually green) (Pi3B+ default
+ "6", Pi4 default "0"). See eth_led0 for legal
+ values.
eth_max_speed Set the maximum speed a link is allowed
to negotiate. Legal values are 10, 100 and
- 1000 (default 1000).
+ 1000 (default 1000). Pi3B+ only.
i2c_arm Set to "on" to enable the ARM's i2c interface
(default "off")
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -267,6 +267,9 @@ static void bcm54xx_adjust_rxrefclk(stru
static int bcm54xx_config_init(struct phy_device *phydev)
{
int reg, err, val;
+ u32 led_modes[] = {BCM_LED_MULTICOLOR_LINK_ACT,
+ BCM_LED_MULTICOLOR_LINK_ACT};
+ struct device_node *np = phydev->mdio.dev.of_node;
reg = phy_read(phydev, MII_BCM54XX_ECR);
if (reg < 0)
@@ -318,6 +321,8 @@ static int bcm54xx_config_init(struct ph
bcm54xx_phydsp_config(phydev);
+ of_property_read_u32_array(np, "led-modes", led_modes, 2);
+
/* Encode link speed into LED1 and LED3 pair (green/amber).
* Also flash these two LEDs on activity. This means configuring
* them for MULTICOLOR and encoding link/activity into them.
@@ -327,8 +332,8 @@ static int bcm54xx_config_init(struct ph
bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1, val);
val = BCM_LED_MULTICOLOR_IN_PHASE |
- BCM5482_SHD_LEDS1_LED1(BCM_LED_MULTICOLOR_LINK_ACT) |
- BCM5482_SHD_LEDS1_LED3(BCM_LED_MULTICOLOR_LINK_ACT);
+ BCM5482_SHD_LEDS1_LED1(led_modes[0]) |
+ BCM5482_SHD_LEDS1_LED3(led_modes[1]);
bcm_phy_write_exp(phydev, BCM_EXP_MULTICOLOR, val);
return 0;