11 #include <linux/list.h>
12 #include <linux/module.h>
13 #include <linux/netdevice.h>
17 #define REG_PORT(p) (8 + (p))
18 #define REG_GLOBAL 0x0f
25 #define REG_READ(addr, reg) \
29 __ret = reg_read(ds, addr, reg); \
42 #define REG_WRITE(addr, reg, val) \
46 __ret = reg_write(ds, addr, reg, val); \
51 static char *mv88e6060_probe(
struct mii_bus *
bus,
int sw_addr)
59 return "Marvell 88E6060";
73 for (i = 0; i < 6; i++) {
91 for (i = 0; i < 1000; i++) {
93 if ((ret & 0x8000) == 0x0000)
104 static int mv88e6060_setup_global(
struct dsa_switch *ds)
123 static int mv88e6060_setup_port(
struct dsa_switch *ds,
int p)
133 REG_WRITE(addr, 0x04, dsa_is_cpu_port(ds, p) ? 0x4103 : 0x0003);
143 (dsa_is_cpu_port(ds, p) ?
145 (1 << ds->
dst->cpu_port)));
158 static int mv88e6060_setup(
struct dsa_switch *ds)
163 ret = mv88e6060_switch_reset(ds);
169 ret = mv88e6060_setup_global(ds);
173 for (i = 0; i < 6; i++) {
174 ret = mv88e6060_setup_port(ds, i);
182 static int mv88e6060_set_addr(
struct dsa_switch *ds,
u8 *addr)
191 static int mv88e6060_port_to_phy_addr(
int port)
193 if (port >= 0 && port <= 5)
198 static int mv88e6060_phy_read(
struct dsa_switch *ds,
int port,
int regnum)
202 addr = mv88e6060_port_to_phy_addr(port);
214 addr = mv88e6060_port_to_phy_addr(port);
221 static void mv88e6060_poll_link(
struct dsa_switch *ds)
247 if (netif_carrier_ok(dev)) {
258 if (!netif_carrier_ok(dev)) {
260 "flow control %sabled\n", dev->
name,
261 speed, duplex ?
"full" :
"half",
270 .probe = mv88e6060_probe,
271 .setup = mv88e6060_setup,
272 .set_addr = mv88e6060_set_addr,
273 .phy_read = mv88e6060_phy_read,
274 .phy_write = mv88e6060_phy_write,
275 .poll_link = mv88e6060_poll_link,
278 static int __init mv88e6060_init(
void)
285 static void __exit mv88e6060_cleanup(
void)