fsl_i2c.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Freescale I2C Controller
  3. *
  4. * Copyright 2006 Freescale Semiconductor, Inc.
  5. *
  6. * Based on earlier versions by Gleb Natapov <gnatapov@mrv.com>,
  7. * Xianghua Xiao <x.xiao@motorola.com>, Eran Liberty (liberty@freescale.com),
  8. * and Jeff Brown.
  9. * Some bits are taken from linux driver writen by adrian@humboldt.co.uk.
  10. *
  11. * SPDX-License-Identifier: GPL-2.0
  12. */
  13. #ifndef _ASM_FSL_I2C_H_
  14. #define _ASM_FSL_I2C_H_
  15. #include <asm/types.h>
  16. typedef struct fsl_i2c_base {
  17. u8 adr; /* I2C slave address */
  18. u8 res0[3];
  19. #define I2C_ADR 0xFE
  20. #define I2C_ADR_SHIFT 1
  21. #define I2C_ADR_RES ~(I2C_ADR)
  22. u8 fdr; /* I2C frequency divider register */
  23. u8 res1[3];
  24. #define IC2_FDR 0x3F
  25. #define IC2_FDR_SHIFT 0
  26. #define IC2_FDR_RES ~(IC2_FDR)
  27. u8 cr; /* I2C control redister */
  28. u8 res2[3];
  29. #define I2C_CR_MEN 0x80
  30. #define I2C_CR_MIEN 0x40
  31. #define I2C_CR_MSTA 0x20
  32. #define I2C_CR_MTX 0x10
  33. #define I2C_CR_TXAK 0x08
  34. #define I2C_CR_RSTA 0x04
  35. #define I2C_CR_BCST 0x01
  36. u8 sr; /* I2C status register */
  37. u8 res3[3];
  38. #define I2C_SR_MCF 0x80
  39. #define I2C_SR_MAAS 0x40
  40. #define I2C_SR_MBB 0x20
  41. #define I2C_SR_MAL 0x10
  42. #define I2C_SR_BCSTM 0x08
  43. #define I2C_SR_SRW 0x04
  44. #define I2C_SR_MIF 0x02
  45. #define I2C_SR_RXAK 0x01
  46. u8 dr; /* I2C data register */
  47. u8 res4[3];
  48. #define I2C_DR 0xFF
  49. #define I2C_DR_SHIFT 0
  50. #define I2C_DR_RES ~(I2C_DR)
  51. } fsl_i2c_t;
  52. #endif /* _ASM_I2C_H_ */