diff options
author | Guenter Roeck <linux@roeck-us.net> | 2015-04-01 22:06:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-04-01 22:55:40 -0400 |
commit | 0d65da4a238d3e9fc358b8e1540a193d63f92e20 (patch) | |
tree | 4557ed159e752f5e07f789892c88c396b0259b37 /drivers/net/dsa/mv88e6131.c | |
parent | 05e8bb860b55acc2646b59cd5746c6b4189fa29e (diff) |
net: dsa: mv88e6131: Use common initialization functions
Common initialization functions will be needed to enable
HW bridging support.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mv88e6131.c')
-rw-r--r-- | drivers/net/dsa/mv88e6131.c | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/drivers/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c index 2540ef0142af..0252d51c0a74 100644 --- a/drivers/net/dsa/mv88e6131.c +++ b/drivers/net/dsa/mv88e6131.c | |||
@@ -208,28 +208,6 @@ static int mv88e6131_setup_port(struct dsa_switch *ds, int p) | |||
208 | val |= 0x0100; | 208 | val |= 0x0100; |
209 | REG_WRITE(addr, 0x04, val); | 209 | REG_WRITE(addr, 0x04, val); |
210 | 210 | ||
211 | /* Port Control 1: disable trunking. Also, if this is the | ||
212 | * CPU port, enable learn messages to be sent to this port. | ||
213 | */ | ||
214 | REG_WRITE(addr, 0x05, dsa_is_cpu_port(ds, p) ? 0x8000 : 0x0000); | ||
215 | |||
216 | /* Port based VLAN map: give each port its own address | ||
217 | * database, allow the CPU port to talk to each of the 'real' | ||
218 | * ports, and allow each of the 'real' ports to only talk to | ||
219 | * the upstream port. | ||
220 | */ | ||
221 | val = (p & 0xf) << 12; | ||
222 | if (dsa_is_cpu_port(ds, p)) | ||
223 | val |= ds->phys_port_mask; | ||
224 | else | ||
225 | val |= 1 << dsa_upstream_port(ds); | ||
226 | REG_WRITE(addr, 0x06, val); | ||
227 | |||
228 | /* Default VLAN ID and priority: don't set a default VLAN | ||
229 | * ID, and set the default packet priority to zero. | ||
230 | */ | ||
231 | REG_WRITE(addr, 0x07, 0x0000); | ||
232 | |||
233 | /* Port Control 2: don't force a good FCS, don't use | 211 | /* Port Control 2: don't force a good FCS, don't use |
234 | * VLAN-based, source address-based or destination | 212 | * VLAN-based, source address-based or destination |
235 | * address-based priority overrides, don't let the switch | 213 | * address-based priority overrides, don't let the switch |
@@ -278,20 +256,19 @@ static int mv88e6131_setup_port(struct dsa_switch *ds, int p) | |||
278 | */ | 256 | */ |
279 | REG_WRITE(addr, 0x19, 0x7654); | 257 | REG_WRITE(addr, 0x19, 0x7654); |
280 | 258 | ||
281 | return 0; | 259 | return mv88e6xxx_setup_port_common(ds, p); |
282 | } | 260 | } |
283 | 261 | ||
284 | static int mv88e6131_setup(struct dsa_switch *ds) | 262 | static int mv88e6131_setup(struct dsa_switch *ds) |
285 | { | 263 | { |
286 | struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); | ||
287 | int i; | 264 | int i; |
288 | int ret; | 265 | int ret; |
289 | 266 | ||
290 | mutex_init(&ps->smi_mutex); | 267 | ret = mv88e6xxx_setup_common(ds); |
291 | mv88e6xxx_ppu_state_init(ds); | 268 | if (ret < 0) |
292 | mutex_init(&ps->stats_mutex); | 269 | return ret; |
293 | 270 | ||
294 | ps->id = REG_READ(REG_PORT(0), 0x03) & 0xfff0; | 271 | mv88e6xxx_ppu_state_init(ds); |
295 | 272 | ||
296 | ret = mv88e6131_switch_reset(ds); | 273 | ret = mv88e6131_switch_reset(ds); |
297 | if (ret < 0) | 274 | if (ret < 0) |