kernel: hack: support inverted LEDs on MaxLinear GPY211 PHY
Add downstream DT property to setup the PHY LEDs of the MaxLinear
GPY211 PHY in such way that the VDD of the LED is driven by the SoC
pin rather than the GND (which is the default).
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
(cherry picked from commit 90fbec89be)
[removed patches for kernel 6.1]
Signed-off-by: Tom Herbers <mail@tomherbers.de>
This commit is contained in:
committed by
Hauke Mehrtens
parent
b3ad42e1e3
commit
5c786dcb2b
@@ -55,7 +55,7 @@ Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||
/* SGMII */
|
||||
#define VSPEC1_SGMII_CTRL 0x08
|
||||
#define VSPEC1_SGMII_CTRL_ANEN BIT(12) /* Aneg enable */
|
||||
@@ -80,6 +87,31 @@ static const struct {
|
||||
@@ -80,6 +87,35 @@ static const struct {
|
||||
{9, 0x73},
|
||||
};
|
||||
|
||||
@@ -64,6 +64,7 @@ Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||
+ struct device_node *node = phydev->mdio.dev.of_node;
|
||||
+ u32 led_regs[PHY_LED_NUM_LEDS];
|
||||
+ int i, ret;
|
||||
+ u16 val = 0xff00;
|
||||
+
|
||||
+ if (!IS_ENABLED(CONFIG_OF_MDIO))
|
||||
+ return 0;
|
||||
@@ -71,8 +72,11 @@ Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||
+ if (of_property_read_u32_array(node, "mxl,led-config", led_regs, PHY_LED_NUM_LEDS))
|
||||
+ return 0;
|
||||
+
|
||||
+ if (of_property_read_bool(node, "mxl,led-drive-vdd"))
|
||||
+ val &= 0x0fff;
|
||||
+
|
||||
+ /* Enable LED function handling on all ports*/
|
||||
+ phy_write(phydev, PHY_LED, 0xFF00);
|
||||
+ phy_write(phydev, PHY_LED, val);
|
||||
+
|
||||
+ /* Write LED register values */
|
||||
+ for (i = 0; i < PHY_LED_NUM_LEDS; i++) {
|
||||
@@ -87,7 +91,7 @@ Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||
static int gpy_config_init(struct phy_device *phydev)
|
||||
{
|
||||
int ret;
|
||||
@@ -91,7 +123,10 @@ static int gpy_config_init(struct phy_de
|
||||
@@ -91,7 +127,10 @@ static int gpy_config_init(struct phy_de
|
||||
|
||||
/* Clear all pending interrupts */
|
||||
ret = phy_read(phydev, PHY_ISTAT);
|
||||
|
||||
Reference in New Issue
Block a user