u-boot/arch/arm/include/asm/imx-common
Peng Fan e1bed80272 dm: i2c: mxc_i2c: implement i2c_idle_bus
Implement i2c_idle_bus in driver, then setup_i2c can
be dropped for boards which enable DM_I2C/DM_GPIO/PINCTRL.
The i2c_idle_bus force bus idle flow follows setup_i2c in
arch/arm/imx-common/i2c-mxv7.c

This patch is an implementation following linux kernel patch:
"
commit 1c4b6c3bcf30d0804db0d0647d8ebeb862c6f7e5
Author: Gao Pan <b54642@freescale.com>
Date:   Fri Oct 23 20:28:54 2015 +0800

    i2c: imx: implement bus recovery

    Implement bus recovery methods for i2c-imx so we can recover from
    situations where SCL/SDA are stuck low.

    Once i2c bus SCL/SDA are stuck low during transfer, config the i2c
    pinctrl to gpio mode by calling pinctrl sleep set function, and then
    use GPIO to emulate the i2c protocol to send nine dummy clock to recover
    i2c device. After recovery, set i2c pinctrl to default group setting.
"

See Documentation/devicetree/bindings/i2c/i2c-imx.txt for detailed
description.
1. Introuduce scl_gpio/sda_gpio/bus in mxc_i2c_bus.
2. Discard the __weak attribute for i2c_idle_bus and implement it,
   since we have pinctrl driver/driver model gpio driver. We can
   use device tree, but not let board code to do this.
3. gpio state for mxc_i2c is not a must, but it is recommended. If
   there is no gpio state, driver will give tips, but not fail.
4. The i2c controller was first probed, default pinctrl state will
   be used, so when need to use gpio function, need to do
   "pinctrl_select_state(dev, "gpio")" and after force bus idle,
   need to switch back "pinctrl_select_state(dev, "default")".

This is example about how to use the gpio force bus
idle function:
"
 &i2c1 {
 	clock-frequency = <100000>;
	pinctrl-names = "default", "gpio";
 	pinctrl-0 = <&pinctrl_i2c1>;
	pinctrl-1 = <&pinctrl_i2c1_gpio>;
	scl-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
	sda-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>;
	status = "okay";
	[....]
 };

[.....]

	pinctrl_i2c1_gpio: i2c1grp_gpio {
		fsl,pins = <
			MX6UL_PAD_UART4_TX_DATA__GPIO1_IO28 0x1b8b0
			MX6UL_PAD_UART4_RX_DATA__GPIO1_IO29 0x1b8b0
		>;
	};
"

Signed-off-by: Peng Fan <van.freenix@gmail.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: York Sun <york.sun@nxp.com>
2016-03-28 09:22:58 +02:00
..
boot_mode.h imx: imx7d: Add SoC system support 2015-09-13 10:11:53 +02:00
dma.h imx: apbh_dma: Update APBH-DMA for MX7D 2016-01-24 12:09:16 +01:00
gpio.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
hab.h imx: hab: add secure boot fuse details 2015-10-30 15:22:36 +01:00
imximage.cfg Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
iomux-v3.h iomux-v3: Take MX6D in consideration for imx_iomux_v3_setup_pad() 2015-11-25 09:41:29 +01:00
mx5_video.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
mxc_i2c.h dm: i2c: mxc_i2c: implement i2c_idle_bus 2016-03-28 09:22:58 +02:00
rdc-sema.h imx: imx-common: introduce Resource Domain Controller support 2016-02-21 11:46:26 +01:00
regs-apbh.h imx: apbh_dma: Update APBH-DMA for MX7D 2016-01-24 12:09:16 +01:00
regs-bch.h imx: nand: update GPMI NAND driver to support MX7 2016-01-24 12:09:32 +01:00
regs-common.h imx: include linux/types.h for regs-common.h 2015-11-12 17:38:08 +01:00
regs-gpmi.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
regs-lcdif.h imx: lcdif: use one register structure for i.MXes 2015-11-12 17:38:09 +01:00
regs-usbphy.h usb: host: Add ehci-vf USB driver for ARM Vybrid SoC's 2015-04-23 14:56:09 -04:00
sata.h nitrogen6x: Move setup_sata to common part 2013-12-17 18:12:14 +01:00
spi.h ARM: i.MX: provide declaration for board_spi_cs_gpio 2014-10-21 10:47:14 +02:00
sys_proto.h video: mxsfb: introduce lcdif_power_down 2015-11-12 17:40:53 +01:00
syscounter.h imx: system counter driver for imx7d and mx6ul 2015-09-13 10:11:53 +02:00
video.h video, ipu: make ldb clock frequency overwritable through board code 2015-04-20 09:36:59 +02:00