aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/drivers
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-03-15 15:49:57 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-03-15 15:49:57 +0000
commit17d735fc466b1ed9a3ae237da248cdb03ad396d1 (patch)
treeed788cd258d2601eb32d2dc11bbceca539b1fcd7 /target/linux/generic/files/drivers
parent3fee1bddbe8584e6c5663028cec7f81031fb9d2e (diff)
downloadupstream-17d735fc466b1ed9a3ae237da248cdb03ad396d1.tar.gz
upstream-17d735fc466b1ed9a3ae237da248cdb03ad396d1.tar.bz2
upstream-17d735fc466b1ed9a3ae237da248cdb03ad396d1.zip
generic: ar8216: simplify and rename ar8327_config_port
Return with the PORT_STATUS register value instead of writing that directly into the corresponding register. Also rename the function to ar8327_get_port_init_status. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 36043
Diffstat (limited to 'target/linux/generic/files/drivers')
-rw-r--r--target/linux/generic/files/drivers/net/phy/ar8216.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c
index 7cb5186f34..6454b2b217 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c
@@ -1086,17 +1086,13 @@ ar8327_init_globals(struct ar8xxx_priv *priv)
AR8327_MODULE_EN_MIB);
}
-static void
-ar8327_config_port(struct ar8xxx_priv *priv, unsigned int port,
- struct ar8327_port_cfg *cfg)
+static u32
+ar8327_get_port_init_status(struct ar8327_port_cfg *cfg)
{
u32 t;
- if (!cfg || !cfg->force_link) {
- priv->write(priv, AR8327_REG_PORT_STATUS(port),
- AR8216_PORT_STATUS_LINK_AUTO);
- return;
- }
+ if (!cfg->force_link)
+ return AR8216_PORT_STATUS_LINK_AUTO;
t = AR8216_PORT_STATUS_TXMAC | AR8216_PORT_STATUS_RXMAC;
t |= cfg->duplex ? AR8216_PORT_STATUS_DUPLEX : 0;
@@ -1115,27 +1111,25 @@ ar8327_config_port(struct ar8xxx_priv *priv, unsigned int port,
break;
}
- priv->write(priv, AR8327_REG_PORT_STATUS(port), t);
+ return t;
}
static void
ar8327_init_port(struct ar8xxx_priv *priv, int port)
{
struct ar8327_platform_data *pdata;
- struct ar8327_port_cfg *cfg;
u32 t;
pdata = priv->phy->dev.platform_data;
if (port == AR8216_PORT_CPU)
- cfg = &pdata->port0_cfg;
+ t = ar8327_get_port_init_status(&pdata->port0_cfg);
else if (port == 6)
- cfg = &pdata->port6_cfg;
+ t = ar8327_get_port_init_status(&pdata->port6_cfg);
else
- cfg = NULL;
-
- ar8327_config_port(priv, port, cfg);
+ t = AR8216_PORT_STATUS_LINK_AUTO;
+ priv->write(priv, AR8327_REG_PORT_STATUS(port), t);
priv->write(priv, AR8327_REG_PORT_HEADER(port), 0);
t = 1 << AR8327_PORT_VLAN0_DEF_SVID_S;