8 #define CROSSOVER_MDI 0
9 #define CROSSOVER_MDIX 1
10 #define CROSSOVER_AUTO 3
12 #define INTR_ENABLE_MASK 0x6CA0
21 (
void) simple_mdio_read(cphy, reg, &val);
22 (
void) simple_mdio_write(cphy, reg, val | bitval);
32 (
void) simple_mdio_read(cphy, reg, &val);
33 (
void) simple_mdio_write(cphy, reg, val & ~bitval);
47 static int mv88e1xxx_reset(
struct cphy *cphy,
int wait)
59 }
while (ctl && --time_out);
64 static int mv88e1xxx_interrupt_enable(
struct cphy *cphy)
71 if (t1_is_asic(cphy->
adapter)) {
83 static int mv88e1xxx_interrupt_disable(
struct cphy *cphy)
89 if (t1_is_asic(cphy->
adapter)) {
101 static int mv88e1xxx_interrupt_clear(
struct cphy *cphy)
106 (
void) simple_mdio_read(cphy,
110 if (t1_is_asic(cphy->
adapter)) {
124 static int mv88e1xxx_set_speed_duplex(
struct cphy *
phy,
int speed,
int duplex)
147 static int mv88e1xxx_crossover_set(
struct cphy *cphy,
int crossover)
151 (
void) simple_mdio_read(cphy,
155 (
void) simple_mdio_write(cphy,
160 static int mv88e1xxx_autoneg_enable(
struct cphy *cphy)
173 static int mv88e1xxx_autoneg_disable(
struct cphy *cphy)
193 static int mv88e1xxx_autoneg_restart(
struct cphy *cphy)
199 static int mv88e1xxx_advertise(
struct cphy *phy,
unsigned int advertise_map)
231 static int mv88e1xxx_set_loopback(
struct cphy *cphy,
int on)
240 static int mv88e1xxx_get_link_status(
struct cphy *cphy,
int *link_ok,
241 int *speed,
int *duplex,
int *
fc)
244 int sp = -1, dplx = -1,
pause = 0;
246 (
void) simple_mdio_read(cphy,
273 static int mv88e1xxx_downshift_set(
struct cphy *cphy,
int downshift_enable)
277 (
void) simple_mdio_read(cphy,
286 if (downshift_enable)
288 (
void) simple_mdio_write(cphy,
293 static int mv88e1xxx_interrupt_handler(
struct cphy *cphy)
304 (
void) simple_mdio_read(cphy,
312 (
void) simple_mdio_read(cphy,
315 if (status & MV88E1XXX_INTR_LINK_CHNG)
335 static void mv88e1xxx_destroy(
struct cphy *cphy)
340 static struct cphy_ops mv88e1xxx_ops = {
341 .destroy = mv88e1xxx_destroy,
342 .reset = mv88e1xxx_reset,
343 .interrupt_enable = mv88e1xxx_interrupt_enable,
344 .interrupt_disable = mv88e1xxx_interrupt_disable,
345 .interrupt_clear = mv88e1xxx_interrupt_clear,
346 .interrupt_handler = mv88e1xxx_interrupt_handler,
347 .autoneg_enable = mv88e1xxx_autoneg_enable,
348 .autoneg_disable = mv88e1xxx_autoneg_disable,
349 .autoneg_restart = mv88e1xxx_autoneg_restart,
350 .advertise = mv88e1xxx_advertise,
351 .set_loopback = mv88e1xxx_set_loopback,
352 .set_speed_duplex = mv88e1xxx_set_speed_duplex,
353 .get_link_status = mv88e1xxx_get_link_status,
356 static struct cphy *mv88e1xxx_phy_create(
struct net_device *
dev,
int phy_addr,
360 struct cphy *cphy = kzalloc(
sizeof(*cphy),
GFP_KERNEL);
365 cphy_init(cphy, dev, phy_addr, &mv88e1xxx_ops, mdio_ops);
373 (
void) simple_mdio_write(cphy,
375 (
void) simple_mdio_write(cphy,
378 (
void) mv88e1xxx_downshift_set(cphy, 1);
381 if (
is_T2(adapter)) {
382 (
void) simple_mdio_write(cphy,
389 static int mv88e1xxx_phy_reset(
adapter_t* adapter)
395 .create = mv88e1xxx_phy_create,
396 .reset = mv88e1xxx_phy_reset