Skip to content
Snippets Groups Projects
Commit 8e2cb2a4 authored by Gianfranco Mariotti's avatar Gianfranco Mariotti
Browse files

[DRIVER] dp83867: add LED configuration set-up support

parent 3c4e90a9
No related branches found
No related tags found
1 merge request!237[i.MX8MP][D18] add support for D18 SMARC
......@@ -53,6 +53,7 @@
#define DP83867_RXFSOP2 0x013A
#define DP83867_RXFSOP3 0x013B
#define DP83867_IO_MUX_CFG 0x0170
#define DP83867_GPIO_MUX_CTRL 0x0172
#define DP83867_SGMIICTL 0x00D3
#define DP83867_10M_SGMII_CFG 0x016F
#define DP83867_10M_SGMII_RATE_ADAPT_MASK BIT(7)
......@@ -176,6 +177,9 @@ struct dp83867_private {
bool set_clk_output;
u32 clk_output_sel;
bool sgmii_ref_clk_en;
u32 leds_conf;
u32 leds_polarity;
u32 gpio0_conf;
};
static int dp83867_ack_interrupt(struct phy_device *phydev)
......@@ -666,6 +670,15 @@ static int dp83867_of_init(struct phy_device *phydev)
return -EINVAL;
}
if(of_property_read_u32(of_node, "ti,gpio0-conf", &dp83867->gpio0_conf))
dp83867->gpio0_conf = -1;
if(of_property_read_u32(of_node, "ti,leds-conf", &dp83867->leds_conf))
dp83867->leds_conf = -1;
if(of_property_read_u32(of_node, "ti,leds-polarity", &dp83867->leds_polarity))
dp83867->leds_polarity = -1;
return 0;
}
#else
......@@ -697,6 +710,10 @@ static int dp83867_of_init(struct phy_device *phydev)
dp83867->tx_fifo_depth = DP83867_PHYCR_FIFO_DEPTH_4_B_NIB;
dp83867->rx_fifo_depth = DP83867_PHYCR_FIFO_DEPTH_4_B_NIB;
dp83867->gpio0_conf = -1;
dp83867->leds_conf = -1;
dp83867->leds_polarity = -1;
return 0;
}
#endif /* CONFIG_OF_MDIO */
......@@ -929,6 +946,26 @@ static int dp83867_config_init(struct phy_device *phydev)
mask, val);
}
/* GPIOs */
if(dp83867->gpio0_conf != -1) {
ret = phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_GPIO_MUX_CTRL, dp83867->gpio0_conf);
if (ret)
return ret;
}
/* LEDs */
if(dp83867->leds_conf != -1) {
ret = phy_write(phydev, DP83867_LEDCR1, dp83867->leds_conf);
if (ret)
return ret;
}
if(dp83867->leds_polarity != -1) {
ret = phy_write(phydev, DP83867_LEDCR2, dp83867->leds_polarity);
if (ret)
return ret;
}
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment