Loading drivers/net/dsa/mv88e6060.c +8 −4 Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ * (at your option) any later version. */ #include <linux/delay.h> #include <linux/jiffies.h> #include <linux/list.h> #include <linux/module.h> #include <linux/netdevice.h> Loading Loading @@ -66,6 +68,7 @@ static int mv88e6060_switch_reset(struct dsa_switch *ds) { int i; int ret; unsigned long timeout; /* Set all ports to the disabled state. */ for (i = 0; i < 6; i++) { Loading @@ -74,20 +77,21 @@ static int mv88e6060_switch_reset(struct dsa_switch *ds) } /* Wait for transmit queues to drain. */ msleep(2); usleep_range(2000, 4000); /* Reset the switch. */ REG_WRITE(REG_GLOBAL, 0x0a, 0xa130); /* Wait up to one second for reset to complete. */ for (i = 0; i < 1000; i++) { timeout = jiffies + 1 * HZ; while (time_before(jiffies, timeout)) { ret = REG_READ(REG_GLOBAL, 0x00); if ((ret & 0x8000) == 0x0000) break; msleep(1); usleep_range(1000, 2000); } if (i == 1000) if (time_after(jiffies, timeout)) return -ETIMEDOUT; return 0; Loading drivers/net/dsa/mv88e6123_61_65.c +8 −4 Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ * (at your option) any later version. */ #include <linux/delay.h> #include <linux/jiffies.h> #include <linux/list.h> #include <linux/module.h> #include <linux/netdevice.h> Loading Loading @@ -50,6 +52,7 @@ static int mv88e6123_61_65_switch_reset(struct dsa_switch *ds) { int i; int ret; unsigned long timeout; /* Set all ports to the disabled state. */ for (i = 0; i < 8; i++) { Loading @@ -58,20 +61,21 @@ static int mv88e6123_61_65_switch_reset(struct dsa_switch *ds) } /* Wait for transmit queues to drain. */ msleep(2); usleep_range(2000, 4000); /* Reset the switch. */ REG_WRITE(REG_GLOBAL, 0x04, 0xc400); /* Wait up to one second for reset to complete. */ for (i = 0; i < 1000; i++) { timeout = jiffies + 1 * HZ; while (time_before(jiffies, timeout)) { ret = REG_READ(REG_GLOBAL, 0x00); if ((ret & 0xc800) == 0xc800) break; msleep(1); usleep_range(1000, 2000); } if (i == 1000) if (time_after(jiffies, timeout)) return -ETIMEDOUT; return 0; Loading drivers/net/dsa/mv88e6131.c +8 −4 Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ * (at your option) any later version. */ #include <linux/delay.h> #include <linux/jiffies.h> #include <linux/list.h> #include <linux/module.h> #include <linux/netdevice.h> Loading Loading @@ -42,6 +44,7 @@ static int mv88e6131_switch_reset(struct dsa_switch *ds) { int i; int ret; unsigned long timeout; /* Set all ports to the disabled state. */ for (i = 0; i < 11; i++) { Loading @@ -50,20 +53,21 @@ static int mv88e6131_switch_reset(struct dsa_switch *ds) } /* Wait for transmit queues to drain. */ msleep(2); usleep_range(2000, 4000); /* Reset the switch. */ REG_WRITE(REG_GLOBAL, 0x04, 0xc400); /* Wait up to one second for reset to complete. */ for (i = 0; i < 1000; i++) { timeout = jiffies + 1 * HZ; while (time_before(jiffies, timeout)) { ret = REG_READ(REG_GLOBAL, 0x00); if ((ret & 0xc800) == 0xc800) break; msleep(1); usleep_range(1000, 2000); } if (i == 1000) if (time_after(jiffies, timeout)) return -ETIMEDOUT; return 0; Loading drivers/net/dsa/mv88e6xxx.c +10 −6 Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ * (at your option) any later version. */ #include <linux/delay.h> #include <linux/jiffies.h> #include <linux/list.h> #include <linux/module.h> #include <linux/netdevice.h> Loading Loading @@ -196,14 +198,15 @@ int mv88e6xxx_phy_write(struct dsa_switch *ds, int addr, int regnum, u16 val) static int mv88e6xxx_ppu_disable(struct dsa_switch *ds) { int ret; int i; unsigned long timeout; ret = REG_READ(REG_GLOBAL, 0x04); REG_WRITE(REG_GLOBAL, 0x04, ret & ~0x4000); for (i = 0; i < 1000; i++) { timeout = jiffies + 1 * HZ; while (time_before(jiffies, timeout)) { ret = REG_READ(REG_GLOBAL, 0x00); msleep(1); usleep_range(1000, 2000); if ((ret & 0xc000) != 0xc000) return 0; } Loading @@ -214,14 +217,15 @@ static int mv88e6xxx_ppu_disable(struct dsa_switch *ds) static int mv88e6xxx_ppu_enable(struct dsa_switch *ds) { int ret; int i; unsigned long timeout; ret = REG_READ(REG_GLOBAL, 0x04); REG_WRITE(REG_GLOBAL, 0x04, ret | 0x4000); for (i = 0; i < 1000; i++) { timeout = jiffies + 1 * HZ; while (time_before(jiffies, timeout)) { ret = REG_READ(REG_GLOBAL, 0x00); msleep(1); usleep_range(1000, 2000); if ((ret & 0xc000) == 0xc000) return 0; } Loading Loading
drivers/net/dsa/mv88e6060.c +8 −4 Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ * (at your option) any later version. */ #include <linux/delay.h> #include <linux/jiffies.h> #include <linux/list.h> #include <linux/module.h> #include <linux/netdevice.h> Loading Loading @@ -66,6 +68,7 @@ static int mv88e6060_switch_reset(struct dsa_switch *ds) { int i; int ret; unsigned long timeout; /* Set all ports to the disabled state. */ for (i = 0; i < 6; i++) { Loading @@ -74,20 +77,21 @@ static int mv88e6060_switch_reset(struct dsa_switch *ds) } /* Wait for transmit queues to drain. */ msleep(2); usleep_range(2000, 4000); /* Reset the switch. */ REG_WRITE(REG_GLOBAL, 0x0a, 0xa130); /* Wait up to one second for reset to complete. */ for (i = 0; i < 1000; i++) { timeout = jiffies + 1 * HZ; while (time_before(jiffies, timeout)) { ret = REG_READ(REG_GLOBAL, 0x00); if ((ret & 0x8000) == 0x0000) break; msleep(1); usleep_range(1000, 2000); } if (i == 1000) if (time_after(jiffies, timeout)) return -ETIMEDOUT; return 0; Loading
drivers/net/dsa/mv88e6123_61_65.c +8 −4 Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ * (at your option) any later version. */ #include <linux/delay.h> #include <linux/jiffies.h> #include <linux/list.h> #include <linux/module.h> #include <linux/netdevice.h> Loading Loading @@ -50,6 +52,7 @@ static int mv88e6123_61_65_switch_reset(struct dsa_switch *ds) { int i; int ret; unsigned long timeout; /* Set all ports to the disabled state. */ for (i = 0; i < 8; i++) { Loading @@ -58,20 +61,21 @@ static int mv88e6123_61_65_switch_reset(struct dsa_switch *ds) } /* Wait for transmit queues to drain. */ msleep(2); usleep_range(2000, 4000); /* Reset the switch. */ REG_WRITE(REG_GLOBAL, 0x04, 0xc400); /* Wait up to one second for reset to complete. */ for (i = 0; i < 1000; i++) { timeout = jiffies + 1 * HZ; while (time_before(jiffies, timeout)) { ret = REG_READ(REG_GLOBAL, 0x00); if ((ret & 0xc800) == 0xc800) break; msleep(1); usleep_range(1000, 2000); } if (i == 1000) if (time_after(jiffies, timeout)) return -ETIMEDOUT; return 0; Loading
drivers/net/dsa/mv88e6131.c +8 −4 Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ * (at your option) any later version. */ #include <linux/delay.h> #include <linux/jiffies.h> #include <linux/list.h> #include <linux/module.h> #include <linux/netdevice.h> Loading Loading @@ -42,6 +44,7 @@ static int mv88e6131_switch_reset(struct dsa_switch *ds) { int i; int ret; unsigned long timeout; /* Set all ports to the disabled state. */ for (i = 0; i < 11; i++) { Loading @@ -50,20 +53,21 @@ static int mv88e6131_switch_reset(struct dsa_switch *ds) } /* Wait for transmit queues to drain. */ msleep(2); usleep_range(2000, 4000); /* Reset the switch. */ REG_WRITE(REG_GLOBAL, 0x04, 0xc400); /* Wait up to one second for reset to complete. */ for (i = 0; i < 1000; i++) { timeout = jiffies + 1 * HZ; while (time_before(jiffies, timeout)) { ret = REG_READ(REG_GLOBAL, 0x00); if ((ret & 0xc800) == 0xc800) break; msleep(1); usleep_range(1000, 2000); } if (i == 1000) if (time_after(jiffies, timeout)) return -ETIMEDOUT; return 0; Loading
drivers/net/dsa/mv88e6xxx.c +10 −6 Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ * (at your option) any later version. */ #include <linux/delay.h> #include <linux/jiffies.h> #include <linux/list.h> #include <linux/module.h> #include <linux/netdevice.h> Loading Loading @@ -196,14 +198,15 @@ int mv88e6xxx_phy_write(struct dsa_switch *ds, int addr, int regnum, u16 val) static int mv88e6xxx_ppu_disable(struct dsa_switch *ds) { int ret; int i; unsigned long timeout; ret = REG_READ(REG_GLOBAL, 0x04); REG_WRITE(REG_GLOBAL, 0x04, ret & ~0x4000); for (i = 0; i < 1000; i++) { timeout = jiffies + 1 * HZ; while (time_before(jiffies, timeout)) { ret = REG_READ(REG_GLOBAL, 0x00); msleep(1); usleep_range(1000, 2000); if ((ret & 0xc000) != 0xc000) return 0; } Loading @@ -214,14 +217,15 @@ static int mv88e6xxx_ppu_disable(struct dsa_switch *ds) static int mv88e6xxx_ppu_enable(struct dsa_switch *ds) { int ret; int i; unsigned long timeout; ret = REG_READ(REG_GLOBAL, 0x04); REG_WRITE(REG_GLOBAL, 0x04, ret | 0x4000); for (i = 0; i < 1000; i++) { timeout = jiffies + 1 * HZ; while (time_before(jiffies, timeout)) { ret = REG_READ(REG_GLOBAL, 0x00); msleep(1); usleep_range(1000, 2000); if ((ret & 0xc000) == 0xc000) return 0; } Loading