i2c.h 1.1 KB

12345678910111213141516171819202122232425262728
  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. /* One-line controller register dump for the seriallog. */
  16. void i2c_dw_dump(unsigned int base);
  17. /* Combined write + repeated-start read, the form HID-over-I2C uses for
  18. * register-addressed transfers. Either buffer may be empty. */
  19. int i2c_dw_transfer(unsigned int base, unsigned int addr,
  20. const unsigned char *wr, unsigned int wrlen,
  21. unsigned char *rd, unsigned int rdlen);
  22. #endif