mxc_i2c.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. * You should have received a copy of the GNU General Public License along
  13. * with this program; if not, write to the Free Software Foundation, Inc.,
  14. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. */
  16. #ifndef __ASM_ARCH_MXC_MXC_I2C_H__
  17. #define __ASM_ARCH_MXC_MXC_I2C_H__
  18. #include <asm/imx-common/iomux-v3.h>
  19. struct i2c_pin_ctrl {
  20. iomux_v3_cfg_t i2c_mode;
  21. iomux_v3_cfg_t gpio_mode;
  22. unsigned char gp;
  23. unsigned char spare;
  24. };
  25. struct i2c_pads_info {
  26. struct i2c_pin_ctrl scl;
  27. struct i2c_pin_ctrl sda;
  28. };
  29. void setup_i2c(unsigned i2c_index, int speed, int slave_addr,
  30. struct i2c_pads_info *p);
  31. void bus_i2c_init(void *base, int speed, int slave_addr,
  32. int (*idle_bus_fn)(void *p), void *p);
  33. int bus_i2c_read(void *base, uchar chip, uint addr, int alen, uchar *buf,
  34. int len);
  35. int bus_i2c_write(void *base, uchar chip, uint addr, int alen,
  36. const uchar *buf, int len);
  37. #endif