i2c.h 1.0 KB

1234567891011121314151617181920212223242526
  1. /* Polled Synopsys DesignWare APB I2C master. Used by the Braswell LPSS
  2. * controllers, in particular the one the HID-over-I2C touchpad sits on. */
  3. #ifndef I2C_H
  4. #define I2C_H
  5. /* Probe and initialize the controller at a physical MMIO base. Returns 0
  6. * when the DesignWare component type matches. */
  7. int i2c_dw_init(unsigned int base);
  8. /* True when the controller at base looks like a DesignWare I2C block. */
  9. int i2c_dw_present(unsigned int base);
  10. /* TX_ABRT_SOURCE of the last failed transfer (0 = timeout, not a NAK). */
  11. extern unsigned int i2c_last_abort;
  12. /* Raw component-type / reset-release access for the LPSS scan. */
  13. unsigned int i2c_dw_comp_type(unsigned int base);
  14. void i2c_dw_reset_release(unsigned int base);
  15. /* Combined write + repeated-start read, the form HID-over-I2C uses for
  16. * register-addressed transfers. Either buffer may be empty. */
  17. int i2c_dw_transfer(unsigned int base, unsigned int addr,
  18. const unsigned char *wr, unsigned int wrlen,
  19. unsigned char *rd, unsigned int rdlen);
  20. #endif