regs-i2c.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * PKUnity Inter-integrated Circuit (I2C) Registers
  4. */
  5. /*
  6. * Control Reg I2C_CON.
  7. */
  8. #define I2C_CON (PKUNITY_I2C_BASE + 0x0000)
  9. /*
  10. * Target Address Reg I2C_TAR.
  11. */
  12. #define I2C_TAR (PKUNITY_I2C_BASE + 0x0004)
  13. /*
  14. * Data buffer and command Reg I2C_DATACMD.
  15. */
  16. #define I2C_DATACMD (PKUNITY_I2C_BASE + 0x0010)
  17. /*
  18. * Enable Reg I2C_ENABLE.
  19. */
  20. #define I2C_ENABLE (PKUNITY_I2C_BASE + 0x006C)
  21. /*
  22. * Status Reg I2C_STATUS.
  23. */
  24. #define I2C_STATUS (PKUNITY_I2C_BASE + 0x0070)
  25. /*
  26. * Tx FIFO Length Reg I2C_TXFLR.
  27. */
  28. #define I2C_TXFLR (PKUNITY_I2C_BASE + 0x0074)
  29. /*
  30. * Rx FIFO Length Reg I2C_RXFLR.
  31. */
  32. #define I2C_RXFLR (PKUNITY_I2C_BASE + 0x0078)
  33. /*
  34. * Enable Status Reg I2C_ENSTATUS.
  35. */
  36. #define I2C_ENSTATUS (PKUNITY_I2C_BASE + 0x009C)
  37. #define I2C_CON_MASTER FIELD(1, 1, 0)
  38. #define I2C_CON_SPEED_STD FIELD(1, 2, 1)
  39. #define I2C_CON_SPEED_FAST FIELD(2, 2, 1)
  40. #define I2C_CON_RESTART FIELD(1, 1, 5)
  41. #define I2C_CON_SLAVEDISABLE FIELD(1, 1, 6)
  42. #define I2C_DATACMD_READ FIELD(1, 1, 8)
  43. #define I2C_DATACMD_WRITE FIELD(0, 1, 8)
  44. #define I2C_DATACMD_DAT_MASK FMASK(8, 0)
  45. #define I2C_DATACMD_DAT(v) FIELD((v), 8, 0)
  46. #define I2C_ENABLE_ENABLE FIELD(1, 1, 0)
  47. #define I2C_ENABLE_DISABLE FIELD(0, 1, 0)
  48. #define I2C_STATUS_RFF FIELD(1, 1, 4)
  49. #define I2C_STATUS_RFNE FIELD(1, 1, 3)
  50. #define I2C_STATUS_TFE FIELD(1, 1, 2)
  51. #define I2C_STATUS_TFNF FIELD(1, 1, 1)
  52. #define I2C_STATUS_ACTIVITY FIELD(1, 1, 0)
  53. #define I2C_ENSTATUS_ENABLE FIELD(1, 1, 0)
  54. #define I2C_TAR_THERMAL 0x4f
  55. #define I2C_TAR_SPD 0x50
  56. #define I2C_TAR_PWIC 0x55
  57. #define I2C_TAR_EEPROM 0x57