staticint mv88e6xxx_smi_direct_read(struct mv88e6xxx_chip *chip, int dev, int reg, u16 *data)
{ int ret;
ret = mdiobus_read_nested(chip->bus, dev, reg); if (ret < 0) return ret;
*data = ret & 0xffff;
return0;
}
staticint mv88e6xxx_smi_direct_write(struct mv88e6xxx_chip *chip, int dev, int reg, u16 data)
{ int ret;
ret = mdiobus_write_nested(chip->bus, dev, reg, data); if (ret < 0) return ret;
return0;
}
staticint mv88e6xxx_smi_direct_wait(struct mv88e6xxx_chip *chip, int dev, int reg, int bit, int val)
{ constunsignedlong timeout = jiffies + msecs_to_jiffies(50);
u16 data; int err; int i;
/* Even if the initial poll takes longer than 50ms, always do *atleastonemoreattempt.
*/ for (i = 0; time_before(jiffies, timeout) || (i < 2); i++) {
err = mv88e6xxx_smi_direct_read(chip, dev, reg, &data); if (err) return err;
if (!!(data & BIT(bit)) == !!val) return0;
if (i < 2)
cpu_relax(); else
usleep_range(1000, 2000);
}
staticint mv88e6xxx_smi_indirect_init(struct mv88e6xxx_chip *chip)
{ /* Ensure that the chip starts out in the ready state. As both *readsandwritesalwaysensurethisonreturn,theycan *safelydependonthechipnotbeingbusyonentry.
*/ return mv88e6xxx_smi_direct_wait(chip, chip->sw_addr,
MV88E6XXX_SMI_CMD, 15, 0);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.