fsl_i2c.h 1.3 KB

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