staticinlinevoid octeon_i2c_writeq_flush(u64 val, void __iomem *addr)
{
__raw_writeq(val, addr);
__raw_readq(addr); /* wait for write to land */
}
/** * octeon_i2c_reg_write - write an I2C core register * @i2c: The struct octeon_i2c * @eop_reg: Register selector * @data: Value to be written * * The I2C core registers are accessed indirectly via the OCTEON_REG_SW_TWSI CSR.
*/ staticinlinevoid octeon_i2c_reg_write(struct octeon_i2c *i2c, u64 eop_reg, u8 data)
{ int tries = 1000;
u64 tmp;
__raw_writeq(SW_TWSI_V | eop_reg | data, i2c->twsi_base + OCTEON_REG_SW_TWSI(i2c)); do {
tmp = __raw_readq(i2c->twsi_base + OCTEON_REG_SW_TWSI(i2c)); if (--tries < 0) return;
} while ((tmp & SW_TWSI_V) != 0);
}
/** * octeon_i2c_reg_read - read lower bits of an I2C core register * @i2c: The struct octeon_i2c * @eop_reg: Register selector * * Returns the data. * * The I2C core registers are accessed indirectly via the SW_TWSI CSR.
*/ staticinlineint octeon_i2c_reg_read(struct octeon_i2c *i2c, u64 eop_reg, int *error)
{ int tries = 1000;
u64 tmp;
__raw_writeq(SW_TWSI_V | eop_reg | SW_TWSI_R, i2c->twsi_base + OCTEON_REG_SW_TWSI(i2c)); do {
tmp = __raw_readq(i2c->twsi_base + OCTEON_REG_SW_TWSI(i2c)); if (--tries < 0) { /* signal that the returned data is invalid */ if (error)
*error = -EIO; return0;
}
} while ((tmp & SW_TWSI_V) != 0);
/** * octeon_i2c_read_int - read the OCTEON_REG_TWSI_INT register * @i2c: The struct octeon_i2c * * Returns the value of the register.
*/ staticinline u64 octeon_i2c_read_int(struct octeon_i2c *i2c)
{ return __raw_readq(i2c->twsi_base + OCTEON_REG_TWSI_INT(i2c));
}
/** * octeon_i2c_write_int - write the OCTEON_REG_TWSI_INT register * @i2c: The struct octeon_i2c * @data: Value to be written
*/ staticinlinevoid octeon_i2c_write_int(struct octeon_i2c *i2c, u64 data)
{
octeon_i2c_writeq_flush(data, i2c->twsi_base + OCTEON_REG_TWSI_INT(i2c));
}
#define IS_LS_FREQ(twsi_freq) ((twsi_freq) <= 400000) #define PCI_SUBSYS_DEVID_9XXX 0xB #define PCI_SUBSYS_MASK GENMASK(15, 12) /** * octeon_i2c_is_otx2 - check for chip ID * @pdev: PCI dev structure * * Returns true if the device is an OcteonTX2, false otherwise.
*/ staticinlinebool octeon_i2c_is_otx2(struct pci_dev *pdev)
{
u32 chip_id = FIELD_GET(PCI_SUBSYS_MASK, pdev->subsystem_device);
return (chip_id == PCI_SUBSYS_DEVID_9XXX);
}
/* Prototypes */
irqreturn_t octeon_i2c_isr(int irq, void *dev_id); int octeon_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); int octeon_i2c_init_lowlevel(struct octeon_i2c *i2c); void octeon_i2c_set_clock(struct octeon_i2c *i2c); externstruct i2c_bus_recovery_info octeon_i2c_recovery_info;
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.36Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-06-08)
¤
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.