Commit ec80bfcb68a0c46443991991d459a0cde773cdea
Committed by
David S. Miller
1 parent
47482f132a
Exists in
master
and in
4 other branches
dsa/mv88e6131: add support for mv88e6085 switch
The mv88e6085 is identical to the mv88e6095, except that all ports are 10/100 Mb/s, so use the existing setup code except for the cpu/dsa speed selection in _setup_port(). Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Acked-by: Lennert Buytenhek <buytenh@wantstofly.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 2 changed files with 21 additions and 4 deletions Side-by-side Diff
net/dsa/mv88e6131.c
... | ... | @@ -14,6 +14,13 @@ |
14 | 14 | #include "dsa_priv.h" |
15 | 15 | #include "mv88e6xxx.h" |
16 | 16 | |
17 | +/* | |
18 | + * Switch product IDs | |
19 | + */ | |
20 | +#define ID_6085 0x04a0 | |
21 | +#define ID_6095 0x0950 | |
22 | +#define ID_6131 0x1060 | |
23 | + | |
17 | 24 | static char *mv88e6131_probe(struct mii_bus *bus, int sw_addr) |
18 | 25 | { |
19 | 26 | int ret; |
20 | 27 | |
... | ... | @@ -21,9 +28,11 @@ |
21 | 28 | ret = __mv88e6xxx_reg_read(bus, sw_addr, REG_PORT(0), 0x03); |
22 | 29 | if (ret >= 0) { |
23 | 30 | ret &= 0xfff0; |
24 | - if (ret == 0x0950) | |
31 | + if (ret == ID_6085) | |
32 | + return "Marvell 88E6085"; | |
33 | + if (ret == ID_6095) | |
25 | 34 | return "Marvell 88E6095/88E6095F"; |
26 | - if (ret == 0x1060) | |
35 | + if (ret == ID_6131) | |
27 | 36 | return "Marvell 88E6131"; |
28 | 37 | } |
29 | 38 | |
... | ... | @@ -164,6 +173,7 @@ |
164 | 173 | |
165 | 174 | static int mv88e6131_setup_port(struct dsa_switch *ds, int p) |
166 | 175 | { |
176 | + struct mv88e6xxx_priv_state *ps = (void *)(ds + 1); | |
167 | 177 | int addr = REG_PORT(p); |
168 | 178 | u16 val; |
169 | 179 | |
170 | 180 | |
... | ... | @@ -171,10 +181,13 @@ |
171 | 181 | * MAC Forcing register: don't force link, speed, duplex |
172 | 182 | * or flow control state to any particular values on physical |
173 | 183 | * ports, but force the CPU port and all DSA ports to 1000 Mb/s |
174 | - * full duplex. | |
184 | + * (100 Mb/s on 6085) full duplex. | |
175 | 185 | */ |
176 | 186 | if (dsa_is_cpu_port(ds, p) || ds->dsa_port_mask & (1 << p)) |
177 | - REG_WRITE(addr, 0x01, 0x003e); | |
187 | + if (ps->id == ID_6085) | |
188 | + REG_WRITE(addr, 0x01, 0x003d); /* 100 Mb/s */ | |
189 | + else | |
190 | + REG_WRITE(addr, 0x01, 0x003e); /* 1000 Mb/s */ | |
178 | 191 | else |
179 | 192 | REG_WRITE(addr, 0x01, 0x0003); |
180 | 193 | |
... | ... | @@ -285,6 +298,8 @@ |
285 | 298 | mutex_init(&ps->smi_mutex); |
286 | 299 | mv88e6xxx_ppu_state_init(ds); |
287 | 300 | mutex_init(&ps->stats_mutex); |
301 | + | |
302 | + ps->id = REG_READ(REG_PORT(0), 0x03) & 0xfff0; | |
288 | 303 | |
289 | 304 | ret = mv88e6131_switch_reset(ds); |
290 | 305 | if (ret < 0) |