diff options
Diffstat (limited to 'drivers/net/dsa/mv88e6352.c')
-rw-r--r-- | drivers/net/dsa/mv88e6352.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/net/dsa/mv88e6352.c b/drivers/net/dsa/mv88e6352.c index 41fe3a6a72d1..040027fcd013 100644 --- a/drivers/net/dsa/mv88e6352.c +++ b/drivers/net/dsa/mv88e6352.c | |||
@@ -47,12 +47,13 @@ static char *mv88e6352_probe(struct device *host_dev, int sw_addr) | |||
47 | 47 | ||
48 | static int mv88e6352_switch_reset(struct dsa_switch *ds) | 48 | static int mv88e6352_switch_reset(struct dsa_switch *ds) |
49 | { | 49 | { |
50 | struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); | ||
50 | unsigned long timeout; | 51 | unsigned long timeout; |
51 | int ret; | 52 | int ret; |
52 | int i; | 53 | int i; |
53 | 54 | ||
54 | /* Set all ports to the disabled state. */ | 55 | /* Set all ports to the disabled state. */ |
55 | for (i = 0; i < 7; i++) { | 56 | for (i = 0; i < ps->num_ports; i++) { |
56 | ret = REG_READ(REG_PORT(i), 0x04); | 57 | ret = REG_READ(REG_PORT(i), 0x04); |
57 | REG_WRITE(REG_PORT(i), 0x04, ret & 0xfffc); | 58 | REG_WRITE(REG_PORT(i), 0x04, ret & 0xfffc); |
58 | } | 59 | } |
@@ -82,6 +83,7 @@ static int mv88e6352_switch_reset(struct dsa_switch *ds) | |||
82 | 83 | ||
83 | static int mv88e6352_setup_global(struct dsa_switch *ds) | 84 | static int mv88e6352_setup_global(struct dsa_switch *ds) |
84 | { | 85 | { |
86 | struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); | ||
85 | int ret; | 87 | int ret; |
86 | int i; | 88 | int i; |
87 | 89 | ||
@@ -152,7 +154,7 @@ static int mv88e6352_setup_global(struct dsa_switch *ds) | |||
152 | /* Disable ingress rate limiting by resetting all ingress | 154 | /* Disable ingress rate limiting by resetting all ingress |
153 | * rate limit registers to their initial state. | 155 | * rate limit registers to their initial state. |
154 | */ | 156 | */ |
155 | for (i = 0; i < 7; i++) | 157 | for (i = 0; i < ps->num_ports; i++) |
156 | REG_WRITE(REG_GLOBAL2, 0x09, 0x9000 | (i << 8)); | 158 | REG_WRITE(REG_GLOBAL2, 0x09, 0x9000 | (i << 8)); |
157 | 159 | ||
158 | /* Initialise cross-chip port VLAN table to reset defaults. */ | 160 | /* Initialise cross-chip port VLAN table to reset defaults. */ |
@@ -367,6 +369,8 @@ static int mv88e6352_setup(struct dsa_switch *ds) | |||
367 | if (ret < 0) | 369 | if (ret < 0) |
368 | return ret; | 370 | return ret; |
369 | 371 | ||
372 | ps->num_ports = 7; | ||
373 | |||
370 | mutex_init(&ps->eeprom_mutex); | 374 | mutex_init(&ps->eeprom_mutex); |
371 | 375 | ||
372 | ret = mv88e6352_switch_reset(ds); | 376 | ret = mv88e6352_switch_reset(ds); |
@@ -379,7 +383,7 @@ static int mv88e6352_setup(struct dsa_switch *ds) | |||
379 | if (ret < 0) | 383 | if (ret < 0) |
380 | return ret; | 384 | return ret; |
381 | 385 | ||
382 | for (i = 0; i < 7; i++) { | 386 | for (i = 0; i < ps->num_ports; i++) { |
383 | ret = mv88e6352_setup_port(ds, i); | 387 | ret = mv88e6352_setup_port(ds, i); |
384 | if (ret < 0) | 388 | if (ret < 0) |
385 | return ret; | 389 | return ret; |