s3c24x0_i2c.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright (C) 2012 Samsung Electronics
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #ifndef _S3C24X0_I2C_H
  7. #define _S3C24X0_I2C_H
  8. struct s3c24x0_i2c {
  9. u32 iiccon;
  10. u32 iicstat;
  11. u32 iicadd;
  12. u32 iicds;
  13. u32 iiclc;
  14. };
  15. struct exynos5_hsi2c {
  16. u32 usi_ctl;
  17. u32 usi_fifo_ctl;
  18. u32 usi_trailing_ctl;
  19. u32 usi_clk_ctl;
  20. u32 usi_clk_slot;
  21. u32 spi_ctl;
  22. u32 uart_ctl;
  23. u32 res1;
  24. u32 usi_int_en;
  25. u32 usi_int_stat;
  26. u32 usi_modem_stat;
  27. u32 usi_error_stat;
  28. u32 usi_fifo_stat;
  29. u32 usi_txdata;
  30. u32 usi_rxdata;
  31. u32 res2;
  32. u32 usi_conf;
  33. u32 usi_auto_conf;
  34. u32 usi_timeout;
  35. u32 usi_manual_cmd;
  36. u32 usi_trans_status;
  37. u32 usi_timing_hs1;
  38. u32 usi_timing_hs2;
  39. u32 usi_timing_hs3;
  40. u32 usi_timing_fs1;
  41. u32 usi_timing_fs2;
  42. u32 usi_timing_fs3;
  43. u32 usi_timing_sla;
  44. u32 i2c_addr;
  45. };
  46. struct s3c24x0_i2c_bus {
  47. bool active; /* port is active and available */
  48. int node; /* device tree node */
  49. int bus_num; /* i2c bus number */
  50. struct s3c24x0_i2c *regs;
  51. struct exynos5_hsi2c *hsregs;
  52. int is_highspeed; /* High speed type, rather than I2C */
  53. unsigned clock_frequency;
  54. int id;
  55. unsigned clk_cycle;
  56. unsigned clk_div;
  57. };
  58. #define I2C_WRITE 0
  59. #define I2C_READ 1
  60. #define I2C_OK 0
  61. #define I2C_NOK 1
  62. #define I2C_NACK 2
  63. #define I2C_NOK_LA 3 /* Lost arbitration */
  64. #define I2C_NOK_TOUT 4 /* time out */
  65. /* S3C I2C Controller bits */
  66. #define I2CSTAT_BSY 0x20 /* Busy bit */
  67. #define I2CSTAT_NACK 0x01 /* Nack bit */
  68. #define I2CCON_ACKGEN 0x80 /* Acknowledge generation */
  69. #define I2CCON_IRPND 0x10 /* Interrupt pending bit */
  70. #define I2C_MODE_MT 0xC0 /* Master Transmit Mode */
  71. #define I2C_MODE_MR 0x80 /* Master Receive Mode */
  72. #define I2C_START_STOP 0x20 /* START / STOP */
  73. #define I2C_TXRX_ENA 0x10 /* I2C Tx/Rx enable */
  74. #define I2C_TIMEOUT_MS 10 /* 10 ms */
  75. #endif /* _S3C24X0_I2C_H */