Commit 82466921 authored by Vivien Didelot's avatar Vivien Didelot Committed by David S. Miller

net: dsa: mv88e6xxx: prefix Global Status macros

Prefix and document the Global Status Register macros and give clear
16-bit register representation.
Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 83ad357d
...@@ -261,7 +261,7 @@ static irqreturn_t mv88e6xxx_g1_irq_thread_fn(int irq, void *dev_id) ...@@ -261,7 +261,7 @@ static irqreturn_t mv88e6xxx_g1_irq_thread_fn(int irq, void *dev_id)
int err; int err;
mutex_lock(&chip->reg_lock); mutex_lock(&chip->reg_lock);
err = mv88e6xxx_g1_read(chip, GLOBAL_STATUS, &reg); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &reg);
mutex_unlock(&chip->reg_lock); mutex_unlock(&chip->reg_lock);
if (err) if (err)
...@@ -381,7 +381,7 @@ static int mv88e6xxx_g1_irq_setup(struct mv88e6xxx_chip *chip) ...@@ -381,7 +381,7 @@ static int mv88e6xxx_g1_irq_setup(struct mv88e6xxx_chip *chip)
goto out_disable; goto out_disable;
/* Reading the interrupt status clears (most of) them */ /* Reading the interrupt status clears (most of) them */
err = mv88e6xxx_g1_read(chip, GLOBAL_STATUS, &reg); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &reg);
if (err) if (err)
goto out_disable; goto out_disable;
......
...@@ -42,13 +42,13 @@ static int mv88e6185_g1_wait_ppu_disabled(struct mv88e6xxx_chip *chip) ...@@ -42,13 +42,13 @@ static int mv88e6185_g1_wait_ppu_disabled(struct mv88e6xxx_chip *chip)
int i, err; int i, err;
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
err = mv88e6xxx_g1_read(chip, GLOBAL_STATUS, &state); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &state);
if (err) if (err)
return err; return err;
/* Check the value of the PPUState bits 15:14 */ /* Check the value of the PPUState bits 15:14 */
state &= GLOBAL_STATUS_PPU_STATE_MASK; state &= MV88E6185_G1_STS_PPU_STATE_MASK;
if (state != GLOBAL_STATUS_PPU_STATE_POLLING) if (state != MV88E6185_G1_STS_PPU_STATE_POLLING)
return 0; return 0;
usleep_range(1000, 2000); usleep_range(1000, 2000);
...@@ -63,13 +63,13 @@ static int mv88e6185_g1_wait_ppu_polling(struct mv88e6xxx_chip *chip) ...@@ -63,13 +63,13 @@ static int mv88e6185_g1_wait_ppu_polling(struct mv88e6xxx_chip *chip)
int i, err; int i, err;
for (i = 0; i < 16; ++i) { for (i = 0; i < 16; ++i) {
err = mv88e6xxx_g1_read(chip, GLOBAL_STATUS, &state); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &state);
if (err) if (err)
return err; return err;
/* Check the value of the PPUState bits 15:14 */ /* Check the value of the PPUState bits 15:14 */
state &= GLOBAL_STATUS_PPU_STATE_MASK; state &= MV88E6185_G1_STS_PPU_STATE_MASK;
if (state == GLOBAL_STATUS_PPU_STATE_POLLING) if (state == MV88E6185_G1_STS_PPU_STATE_POLLING)
return 0; return 0;
usleep_range(1000, 2000); usleep_range(1000, 2000);
...@@ -84,12 +84,12 @@ static int mv88e6352_g1_wait_ppu_polling(struct mv88e6xxx_chip *chip) ...@@ -84,12 +84,12 @@ static int mv88e6352_g1_wait_ppu_polling(struct mv88e6xxx_chip *chip)
int i, err; int i, err;
for (i = 0; i < 16; ++i) { for (i = 0; i < 16; ++i) {
err = mv88e6xxx_g1_read(chip, GLOBAL_STATUS, &state); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &state);
if (err) if (err)
return err; return err;
/* Check the value of the PPUState (or InitState) bit 15 */ /* Check the value of the PPUState (or InitState) bit 15 */
if (state & GLOBAL_STATUS_PPU_STATE) if (state & MV88E6352_G1_STS_PPU_STATE)
return 0; return 0;
usleep_range(1000, 2000); usleep_range(1000, 2000);
...@@ -109,11 +109,11 @@ static int mv88e6xxx_g1_wait_init_ready(struct mv88e6xxx_chip *chip) ...@@ -109,11 +109,11 @@ static int mv88e6xxx_g1_wait_init_ready(struct mv88e6xxx_chip *chip)
* have finished their initialization and are ready to accept frames. * have finished their initialization and are ready to accept frames.
*/ */
while (time_before(jiffies, timeout)) { while (time_before(jiffies, timeout)) {
err = mv88e6xxx_g1_read(chip, GLOBAL_STATUS, &val); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &val);
if (err) if (err)
return err; return err;
if (val & GLOBAL_STATUS_INIT_READY) if (val & MV88E6XXX_G1_STS_INIT_READY)
break; break;
usleep_range(1000, 2000); usleep_range(1000, 2000);
......
...@@ -17,23 +17,25 @@ ...@@ -17,23 +17,25 @@
#include "chip.h" #include "chip.h"
#define GLOBAL_STATUS 0x00 /* Offset 0x00: Switch Global Status Register */
#define GLOBAL_STATUS_PPU_STATE BIT(15) /* 6351 and 6171 */ #define MV88E6XXX_G1_STS 0x00
#define GLOBAL_STATUS_PPU_STATE_MASK (0x3 << 14) /* 6165 6185 */ #define MV88E6352_G1_STS_PPU_STATE 0x8000
#define GLOBAL_STATUS_PPU_STATE_DISABLED_RST (0x0 << 14) #define MV88E6185_G1_STS_PPU_STATE_MASK 0xc000
#define GLOBAL_STATUS_PPU_STATE_INITIALIZING (0x1 << 14) #define MV88E6185_G1_STS_PPU_STATE_DISABLED_RST 0x0000
#define GLOBAL_STATUS_PPU_STATE_DISABLED (0x2 << 14) #define MV88E6185_G1_STS_PPU_STATE_INITIALIZING 0x4000
#define GLOBAL_STATUS_PPU_STATE_POLLING (0x3 << 14) #define MV88E6185_G1_STS_PPU_STATE_DISABLED 0x8000
#define GLOBAL_STATUS_INIT_READY BIT(11) #define MV88E6185_G1_STS_PPU_STATE_POLLING 0xc000
#define GLOBAL_STATUS_IRQ_AVB 8 #define MV88E6XXX_G1_STS_INIT_READY 0x0800
#define GLOBAL_STATUS_IRQ_DEVICE 7 #define MV88E6XXX_G1_STS_IRQ_AVB 8
#define GLOBAL_STATUS_IRQ_STATS 6 #define MV88E6XXX_G1_STS_IRQ_DEVICE 7
#define GLOBAL_STATUS_IRQ_VTU_PROBLEM 5 #define MV88E6XXX_G1_STS_IRQ_STATS 6
#define GLOBAL_STATUS_IRQ_VTU_DONE 4 #define MV88E6XXX_G1_STS_IRQ_VTU_PROBLEM 5
#define GLOBAL_STATUS_IRQ_ATU_PROBLEM 3 #define MV88E6XXX_G1_STS_IRQ_VTU_DONE 4
#define GLOBAL_STATUS_IRQ_ATU_DONE 2 #define MV88E6XXX_G1_STS_IRQ_ATU_PROBLEM 3
#define GLOBAL_STATUS_IRQ_TCAM_DONE 1 #define MV88E6XXX_G1_STS_IRQ_ATU_DONE 2
#define GLOBAL_STATUS_IRQ_EEPROM_DONE 0 #define MV88E6XXX_G1_STS_IRQ_TCAM_DONE 1
#define MV88E6XXX_G1_STS_IRQ_EEPROM_DONE 0
#define GLOBAL_MAC_01 0x01 #define GLOBAL_MAC_01 0x01
#define GLOBAL_MAC_23 0x02 #define GLOBAL_MAC_23 0x02
#define GLOBAL_MAC_45 0x03 #define GLOBAL_MAC_45 0x03
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <linux/irqdomain.h> #include <linux/irqdomain.h>
#include "chip.h" #include "chip.h"
#include "global1.h" /* for GLOBAL_STATUS_IRQ_DEVICE */ #include "global1.h" /* for MV88E6XXX_G1_STS_IRQ_DEVICE */
#include "global2.h" #include "global2.h"
static int mv88e6xxx_g2_read(struct mv88e6xxx_chip *chip, int reg, u16 *val) static int mv88e6xxx_g2_read(struct mv88e6xxx_chip *chip, int reg, u16 *val)
...@@ -977,7 +977,7 @@ int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip) ...@@ -977,7 +977,7 @@ int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip)
chip->g2_irq.masked = ~0; chip->g2_irq.masked = ~0;
chip->device_irq = irq_find_mapping(chip->g1_irq.domain, chip->device_irq = irq_find_mapping(chip->g1_irq.domain,
GLOBAL_STATUS_IRQ_DEVICE); MV88E6XXX_G1_STS_IRQ_DEVICE);
if (chip->device_irq < 0) { if (chip->device_irq < 0) {
err = chip->device_irq; err = chip->device_irq;
goto out; goto out;
......
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