Commit d6aa8e0a authored by David S. Miller's avatar David S. Miller

Merge branch 'qca-phy-led-fixes'

Christian Marangi says:

====================
net: phy: qcom: qca808x: fixup qca808x LED

This is a bit embarassing and totally my fault so sorry for that!

While reworking the patch to phy_modify API, it was done a logic
error and made the brightness_set function broken. It wasn't
notice in last revisions test as the testing method was to verify
if hw control was correctly working.

Noticing this problem also made me notice an additional problem
with the polarity.

The introduced patch made the polarity configurable but I forgot
to add the required code to enable Active High by default.
(the PHY sets active low by default)

This wasn't notice with hw control testing as the LED blink on
traffic and polarity problem are not notice.

It might be worth discussing if needed a change in implementation
where the polarity function is always called but I think it's
better this way where specific PHY apply fixup with the help
of priv struct and on the config_init phase.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 0eb1ec42 f203c8c7
...@@ -290,8 +290,18 @@ static int qca808x_probe(struct phy_device *phydev) ...@@ -290,8 +290,18 @@ static int qca808x_probe(struct phy_device *phydev)
static int qca808x_config_init(struct phy_device *phydev) static int qca808x_config_init(struct phy_device *phydev)
{ {
struct qca808x_priv *priv = phydev->priv;
int ret; int ret;
/* Default to LED Active High if active-low not in DT */
if (priv->led_polarity_mode == -1) {
ret = phy_set_bits_mmd(phydev, MDIO_MMD_AN,
QCA808X_MMD7_LED_POLARITY_CTRL,
QCA808X_LED_ACTIVE_HIGH);
if (ret)
return ret;
}
/* Active adc&vga on 802.3az for the link 1000M and 100M */ /* Active adc&vga on 802.3az for the link 1000M and 100M */
ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, QCA808X_PHY_MMD3_ADDR_CLD_CTRL7, ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, QCA808X_PHY_MMD3_ADDR_CLD_CTRL7,
QCA808X_8023AZ_AFE_CTRL_MASK, QCA808X_8023AZ_AFE_EN); QCA808X_8023AZ_AFE_CTRL_MASK, QCA808X_8023AZ_AFE_EN);
...@@ -820,8 +830,8 @@ static int qca808x_led_brightness_set(struct phy_device *phydev, ...@@ -820,8 +830,8 @@ static int qca808x_led_brightness_set(struct phy_device *phydev,
return phy_modify_mmd(phydev, MDIO_MMD_AN, reg, return phy_modify_mmd(phydev, MDIO_MMD_AN, reg,
QCA808X_LED_FORCE_EN | QCA808X_LED_FORCE_MODE_MASK, QCA808X_LED_FORCE_EN | QCA808X_LED_FORCE_MODE_MASK,
QCA808X_LED_FORCE_EN | value ? QCA808X_LED_FORCE_ON : QCA808X_LED_FORCE_EN | (value ? QCA808X_LED_FORCE_ON :
QCA808X_LED_FORCE_OFF); QCA808X_LED_FORCE_OFF));
} }
static int qca808x_led_blink_set(struct phy_device *phydev, u8 index, static int qca808x_led_blink_set(struct phy_device *phydev, u8 index,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment