summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-07-20 14:39:47 +0000
committerFelix Fietkau <nbd@openwrt.org>2011-07-20 14:39:47 +0000
commitc7173a211d320f5c27d35137c8344a3e9d4c207d (patch)
tree9755a32fc810b7cee6a27171a8ed23466fee56a8
parentca473833c42367e1bd48cb43138b09590b8120a9 (diff)
downloadmtk-20170518-c7173a211d320f5c27d35137c8344a3e9d4c207d.zip
mtk-20170518-c7173a211d320f5c27d35137c8344a3e9d4c207d.tar.gz
mtk-20170518-c7173a211d320f5c27d35137c8344a3e9d4c207d.tar.bz2
ar71xx: reinitialize global switch settings after reset on ar7240
SVN-Revision: 27705
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar7240.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar7240.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar7240.c
index fe3232b..534af4b 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar7240.c
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar7240.c
@@ -418,28 +418,6 @@ static void ar7240sw_disable_port(struct ar7240sw *as, unsigned port)
AR7240_PORT_CTRL_STATE_DISABLED);
}
-static int ar7240sw_reset(struct ar7240sw *as)
-{
- struct mii_bus *mii = as->mii_bus;
- int ret;
- int i;
-
- /* Set all ports to disabled state. */
- for (i = 0; i < AR7240_NUM_PORTS; i++)
- ar7240sw_disable_port(as, i);
-
- /* Wait for transmit queues to drain. */
- msleep(2);
-
- /* Reset the switch. */
- ar7240sw_reg_write(mii, AR7240_REG_MASK_CTRL,
- AR7240_MASK_CTRL_SOFT_RESET);
-
- ret = ar7240sw_reg_wait(mii, AR7240_REG_MASK_CTRL,
- AR7240_MASK_CTRL_SOFT_RESET, 0, 1000);
- return ret;
-}
-
static void ar7240sw_setup(struct ar7240sw *as)
{
struct mii_bus *mii = as->mii_bus;
@@ -471,6 +449,30 @@ static void ar7240sw_setup(struct ar7240sw *as)
ar7240sw_reg_rmw(mii, AR7240_REG_SERVICE_TAG, AR7240_SERVICE_TAG_M, 0);
}
+static int ar7240sw_reset(struct ar7240sw *as)
+{
+ struct mii_bus *mii = as->mii_bus;
+ int ret;
+ int i;
+
+ /* Set all ports to disabled state. */
+ for (i = 0; i < AR7240_NUM_PORTS; i++)
+ ar7240sw_disable_port(as, i);
+
+ /* Wait for transmit queues to drain. */
+ msleep(2);
+
+ /* Reset the switch. */
+ ar7240sw_reg_write(mii, AR7240_REG_MASK_CTRL,
+ AR7240_MASK_CTRL_SOFT_RESET);
+
+ ret = ar7240sw_reg_wait(mii, AR7240_REG_MASK_CTRL,
+ AR7240_MASK_CTRL_SOFT_RESET, 0, 1000);
+
+ ar7240sw_setup(as);
+ return ret;
+}
+
static void ar7240sw_setup_port(struct ar7240sw *as, unsigned port, u8 portmask)
{
struct mii_bus *mii = as->mii_bus;
@@ -867,7 +869,6 @@ void ag71xx_ar7240_start(struct ag71xx *ag)
struct ar7240sw *as = ag->phy_priv;
ar7240sw_reset(as);
- ar7240sw_setup(as);
ag->speed = SPEED_1000;
ag->duplex = 1;