Partially fix commit r16660
[openwrt.git] / target / linux / orion / patches / 030-mv88e6095_support.patch
1 From: Lennert Buytenhek <buytenh@wantstofly.org>
2 Date: Fri, 20 Mar 2009 09:50:39 +0000 (+0000)
3 Subject: dsa: add support for the Marvell 88E6095/6095F switch chips
4 X-Git-Tag: v2.6.30-rc1~662^2~146
5 X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=076d3e10a54caa2c148de5732c126c7a31381d48
6
7 dsa: add support for the Marvell 88E6095/6095F switch chips
8
9 Add support for the Marvell 88E6095/6095F switch chips. These
10 chips are similar to the 88e6131, so we can add the support to
11 mv88e6131.c easily.
12
13 Thanks to Gary Thomas <gary@mlbassoc.com> and Jesper Dangaard
14 Brouer <hawk@diku.dk> for testing various patches.
15
16 Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
17 Tested-by: Gary Thomas <gary@mlbassoc.com>
18 Signed-off-by: David S. Miller <davem@davemloft.net>
19 ---
20
21 diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
22 index 49211b3..c51b554 100644
23 --- a/net/dsa/Kconfig
24 +++ b/net/dsa/Kconfig
25 @@ -41,13 +41,13 @@ config NET_DSA_MV88E6XXX_NEED_PPU
26 default n
27
28 config NET_DSA_MV88E6131
29 - bool "Marvell 88E6131 ethernet switch chip support"
30 + bool "Marvell 88E6095/6095F/6131 ethernet switch chip support"
31 select NET_DSA_MV88E6XXX
32 select NET_DSA_MV88E6XXX_NEED_PPU
33 select NET_DSA_TAG_DSA
34 ---help---
35 - This enables support for the Marvell 88E6131 ethernet switch
36 - chip.
37 + This enables support for the Marvell 88E6095/6095F/6131
38 + ethernet switch chips.
39
40 config NET_DSA_MV88E6123_61_65
41 bool "Marvell 88E6123/6161/6165 ethernet switch chip support"
42 diff --git a/net/dsa/mv88e6131.c b/net/dsa/mv88e6131.c
43 index 70fae24..0029957 100644
44 --- a/net/dsa/mv88e6131.c
45 +++ b/net/dsa/mv88e6131.c
46 @@ -1,6 +1,6 @@
47 /*
48 - * net/dsa/mv88e6131.c - Marvell 88e6131 switch chip support
49 - * Copyright (c) 2008 Marvell Semiconductor
50 + * net/dsa/mv88e6131.c - Marvell 88e6095/6095f/6131 switch chip support
51 + * Copyright (c) 2008-2009 Marvell Semiconductor
52 *
53 * This program is free software; you can redistribute it and/or modify
54 * it under the terms of the GNU General Public License as published by
55 @@ -21,6 +21,8 @@ static char *mv88e6131_probe(struct mii_bus *bus, int sw_addr)
56 ret = __mv88e6xxx_reg_read(bus, sw_addr, REG_PORT(0), 0x03);
57 if (ret >= 0) {
58 ret &= 0xfff0;
59 + if (ret == 0x0950)
60 + return "Marvell 88E6095/88E6095F";
61 if (ret == 0x1060)
62 return "Marvell 88E6131";
63 }
64 @@ -36,7 +38,7 @@ static int mv88e6131_switch_reset(struct dsa_switch *ds)
65 /*
66 * Set all ports to the disabled state.
67 */
68 - for (i = 0; i < 8; i++) {
69 + for (i = 0; i < 11; i++) {
70 ret = REG_READ(REG_PORT(i), 0x04);
71 REG_WRITE(REG_PORT(i), 0x04, ret & 0xfffc);
72 }
73 @@ -136,7 +138,7 @@ static int mv88e6131_setup_global(struct dsa_switch *ds)
74 * Clear all trunk masks.
75 */
76 for (i = 0; i < 8; i++)
77 - REG_WRITE(REG_GLOBAL2, 0x07, 0x8000 | (i << 12) | 0xff);
78 + REG_WRITE(REG_GLOBAL2, 0x07, 0x8000 | (i << 12) | 0x7ff);
79
80 /*
81 * Clear all trunk mappings.
82 @@ -159,9 +161,13 @@ static int mv88e6131_setup_port(struct dsa_switch *ds, int p)
83
84 /*
85 * MAC Forcing register: don't force link, speed, duplex
86 - * or flow control state to any particular values.
87 + * or flow control state to any particular values on physical
88 + * ports, but force the CPU port to 1000 Mb/s full duplex.
89 */
90 - REG_WRITE(addr, 0x01, 0x0003);
91 + if (p == ds->cpu_port)
92 + REG_WRITE(addr, 0x01, 0x003e);
93 + else
94 + REG_WRITE(addr, 0x01, 0x0003);
95
96 /*
97 * Port Control: disable Core Tag, disable Drop-on-Lock,
98 @@ -268,7 +274,7 @@ static int mv88e6131_setup(struct dsa_switch *ds)
99 if (ret < 0)
100 return ret;
101
102 - for (i = 0; i < 6; i++) {
103 + for (i = 0; i < 11; i++) {
104 ret = mv88e6131_setup_port(ds, i);
105 if (ret < 0)
106 return ret;
107 @@ -279,7 +285,7 @@ static int mv88e6131_setup(struct dsa_switch *ds)
108
109 static int mv88e6131_port_to_phy_addr(int port)
110 {
111 - if (port >= 0 && port != 3 && port <= 7)
112 + if (port >= 0 && port <= 11)
113 return port;
114 return -1;
115 }
This page took 0.045179 seconds and 5 git commands to generate.