diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2012-06-19 10:44:16 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2012-06-19 10:44:16 +0000 |
commit | b934fa2f160d6c652b5597e686ae31507031ffa9 (patch) | |
tree | f8632923f4b9c6c5d36280c4772c51971f4a5714 /target/linux/generic/files/drivers/net/phy/ar8216.c | |
parent | f509a87f2dfd6524792ace9725b0fb25521a0510 (diff) | |
download | mtk-20170518-b934fa2f160d6c652b5597e686ae31507031ffa9.zip mtk-20170518-b934fa2f160d6c652b5597e686ae31507031ffa9.tar.gz mtk-20170518-b934fa2f160d6c652b5597e686ae31507031ffa9.tar.bz2 |
generic: ar8216: allow to configure AR8327 LEDs via platform data
SVN-Revision: 32456
Diffstat (limited to 'target/linux/generic/files/drivers/net/phy/ar8216.c')
-rw-r--r-- | target/linux/generic/files/drivers/net/phy/ar8216.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 97ce047..698d92d 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -733,6 +733,8 @@ static int ar8327_hw_init(struct ar8216_priv *priv) { struct ar8327_platform_data *pdata; + struct ar8327_led_cfg *led_cfg; + u32 pos, new_pos; u32 t; int i; @@ -747,7 +749,26 @@ ar8327_hw_init(struct ar8216_priv *priv) t = ar8327_get_pad_cfg(pdata->pad6_cfg); priv->write(priv, AR8327_REG_PAD6_MODE, t); - priv->write(priv, AR8327_REG_POWER_ON_STRIP, 0x40000000); + pos = priv->read(priv, AR8327_REG_POWER_ON_STRIP); + new_pos = pos; + + led_cfg = pdata->led_cfg; + if (led_cfg) { + if (led_cfg->open_drain) + new_pos |= AR8327_POWER_ON_STRIP_LED_OPEN_EN; + else + new_pos &= ~AR8327_POWER_ON_STRIP_LED_OPEN_EN; + + priv->write(priv, AR8327_REG_LED_CTRL0, led_cfg->led_ctrl0); + priv->write(priv, AR8327_REG_LED_CTRL1, led_cfg->led_ctrl1); + priv->write(priv, AR8327_REG_LED_CTRL2, led_cfg->led_ctrl2); + priv->write(priv, AR8327_REG_LED_CTRL3, led_cfg->led_ctrl3); + } + + if (new_pos != pos) { + new_pos |= AR8327_POWER_ON_STRIP_POWER_ON_SEL; + priv->write(priv, AR8327_REG_POWER_ON_STRIP, new_pos); + } for (i = 0; i < AR8327_NUM_PHYS; i++) ar8327_phy_fixup(priv, i); |