]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/arm/include/asm/imx-common/mxc_i2c.h
socfpga: Move board/socfpga_cyclone5 to board/socfpga
[karo-tx-uboot.git] / arch / arm / include / asm / imx-common / mxc_i2c.h
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
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 #ifndef __ASM_ARCH_MXC_MXC_I2C_H__
19 #define __ASM_ARCH_MXC_MXC_I2C_H__
20 #include <asm/imx-common/iomux-v3.h>
21
22 struct i2c_pin_ctrl {
23         iomux_v3_cfg_t i2c_mode;
24         iomux_v3_cfg_t gpio_mode;
25         unsigned char gp;
26         unsigned char spare;
27 };
28
29 struct i2c_pads_info {
30         struct i2c_pin_ctrl scl;
31         struct i2c_pin_ctrl sda;
32 };
33
34 void setup_i2c(unsigned i2c_index, int speed, int slave_addr,
35                 struct i2c_pads_info *p);
36 void bus_i2c_init(void *base, int speed, int slave_addr,
37                 int (*idle_bus_fn)(void *p), void *p);
38 int bus_i2c_read(void *base, uchar chip, uint addr, int alen, uchar *buf,
39                 int len);
40 int bus_i2c_write(void *base, uchar chip, uint addr, int alen,
41                 const uchar *buf, int len);
42 #endif