mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00

* kernel: crypto: add atmel i2c hw accelerator support Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org> * kernel: add led act/polarity select for rtl8221 phy Signed-off-by: Tianling Shen <cnsztl@gmail.com> * mediatek: add support for OpenEmbed SOM7981 Hardware specification: SoC: MediaTek MT7981B 2x A53 Flash: 256 MiB SPI-NAND RAM: 0.5/1 GB DDR4 Ethernet: 1x 1GbE, 1x 2.5GbE (RTL8221B) WiFi: MediaTek MT7976C USB: 1x M.2 B-Key GPIO: 26-Pin header UART: 6 GND, 8 TX, 10 RX (in Pin header) Button: Reset Installation: The board comes with a third-party custom OpenWrt image, you can upload sysupgrade image via LuCI directly WITHOUT keeping configurations. Or power on the board with pressing reset button for 5 second, then visit http://192.168.1.1 and upload -factory.bin firmware. Signed-off-by: Tianling Shen <cnsztl@gmail.com> --------- Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org> Signed-off-by: Tianling Shen <cnsztl@gmail.com>
89 lines
2.7 KiB
Diff
89 lines
2.7 KiB
Diff
From f9e17c264d316611c26b98ad1a3ca01c289c67b4 Mon Sep 17 00:00:00 2001
|
|
From: Yangyu Chen <cyy@cyyself.name>
|
|
Date: Sun, 23 Apr 2023 20:06:41 +0800
|
|
Subject: [PATCH] net: phy: realtek: add led-link-select for RTL8221
|
|
|
|
RTL8221B PHYs will select the different speeds for 3 LEDs to 10M/100M/1G
|
|
respectively by default. Some devices like TP-Link TL-XDR6088/TL-XDR6086
|
|
have only one LED connects to the PHY chip LED0. If we didn't change the
|
|
default settings, the LED will only blink at 10M speed.
|
|
|
|
This patch allows configuring LED link select bitmask from DT. And it
|
|
has been tested with TP-Link XDR6088 with different DT configurations.
|
|
|
|
Signed-off-by: Yangyu Chen <cyy@cyyself.name>
|
|
---
|
|
drivers/net/phy/realtek.c | 28 +++++++++++++++++++++++++++-
|
|
1 file changed, 27 insertions(+), 1 deletion(-)
|
|
|
|
--- a/drivers/net/phy/realtek.c
|
|
+++ b/drivers/net/phy/realtek.c
|
|
@@ -66,6 +66,12 @@
|
|
#define RTL8221B_PHYCR1_ALDPS_EN BIT(2)
|
|
#define RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN BIT(12)
|
|
|
|
+#define RTL8221B_NR_LEDS 3
|
|
+#define RTL8221B_LED_LINK_SELECT 0xd032
|
|
+#define RTL8221B_LED_LINK_SELECT_OFFSET 0x2
|
|
+#define RTL8221B_LED_ACT_SELECT 0xd040
|
|
+#define RTL8221B_LED_POLARITY_SELECT 0xd044
|
|
+
|
|
#define RTL8366RB_POWER_SAVE 0x15
|
|
#define RTL8366RB_POWER_SAVE_ON BIT(12)
|
|
|
|
@@ -932,6 +938,45 @@ static irqreturn_t rtl9000a_handle_inter
|
|
return IRQ_HANDLED;
|
|
}
|
|
|
|
+static int rtl8221b_config_led(struct phy_device *phydev) {
|
|
+ struct device_node *node = phydev->mdio.dev.of_node;
|
|
+ u32 link_select[RTL8221B_NR_LEDS];
|
|
+ u32 act_select, polarity_select;
|
|
+ int i, val;
|
|
+
|
|
+ val = of_property_read_u32_array(node, "realtek,led-link-select",
|
|
+ link_select, RTL8221B_NR_LEDS);
|
|
+ if (!val) {
|
|
+ for (i = 0; i < RTL8221B_NR_LEDS; i++) {
|
|
+ val = phy_write_mmd(phydev, RTL8221B_MMD_PHY_CTRL,
|
|
+ RTL8221B_LED_LINK_SELECT + i * RTL8221B_LED_LINK_SELECT_OFFSET,
|
|
+ link_select[i]);
|
|
+ if (val < 0)
|
|
+ return val;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ val = of_property_read_u32(node, "realtek,led-act-select",
|
|
+ &act_select);
|
|
+ if (!val) {
|
|
+ val = phy_write_mmd(phydev, RTL8221B_MMD_PHY_CTRL,
|
|
+ RTL8221B_LED_ACT_SELECT, act_select);
|
|
+ if (val < 0)
|
|
+ return val;
|
|
+ }
|
|
+
|
|
+ val = of_property_read_u32(node, "realtek,led-polarity-select",
|
|
+ &polarity_select);
|
|
+ if (!val) {
|
|
+ val = phy_write_mmd(phydev, RTL8221B_MMD_PHY_CTRL,
|
|
+ RTL8221B_LED_POLARITY_SELECT, polarity_select);
|
|
+ if (val < 0)
|
|
+ return val;
|
|
+ }
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static int rtl8221b_config_init(struct phy_device *phydev)
|
|
{
|
|
u16 option_mode;
|
|
@@ -979,7 +1024,7 @@ static int rtl8221b_config_init(struct p
|
|
phy_read_mmd_poll_timeout(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7587,
|
|
val, !(val & BIT(0)), 500, 100000, false);
|
|
|
|
- return 0;
|
|
+ return rtl8221b_config_led(phydev);
|
|
}
|
|
|
|
static int rtl8221b_ack_interrupt(struct phy_device *phydev)
|