u-boot/drivers/i2c
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
..
muxes dm: i2c: Allow muxes to be enabled for SPL separately 2016-01-21 20:42:35 -07:00
adi_i2c.c Move console definitions into a new console.h file 2015-11-19 20:27:50 -07:00
cros_ec_ldo.c cros_ec: Support the LDO access method used by spring 2015-08-05 21:06:11 -06:00
cros_ec_tunnel.c dm: cros_ec: Convert the I2C tunnel code to use driver model 2015-08-05 21:06:11 -06:00
davinci_i2c.c i2c, davinci: convert driver to new mutlibus/mutliadapter framework 2014-04-17 17:24:38 -04:00
davinci_i2c.h i2c, davinci: convert driver to new mutlibus/mutliadapter framework 2014-04-17 17:24:38 -04:00
designware_i2c.c i2c: designware: Convert driver to multibus/multiadapter framework 2014-10-29 08:56:23 +01:00
designware_i2c.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
fsl_i2c.c Add more SPDX-License-Identifier tags 2016-01-19 08:31:21 -05:00
fti2c010.c i2c: fti2c010: fix compiler warning on paddr[] 2014-01-13 08:18:38 +01:00
fti2c010.h drivers/i2c: Update fti2c010.[ch], i2c_core.c to use SPDX identifiers 2013-07-25 08:51:42 -04:00
i2c-emul-uclass.c dm: i2c: Add I2C emulation driver for sandbox 2014-12-11 13:18:42 -07:00
i2c-gpio.c dm: i2c-gpio: Remove redundant dm_gpio_set_value() call 2015-05-05 20:58:41 -06:00
i2c-uclass-compat.c dm: i2c: Add compatibility functions for dm_i2c_reg_read/write() 2015-06-10 19:26:54 -06:00
i2c-uclass.c dm: i2c: Add a function to transfer messages 2015-08-05 20:57:51 -06:00
i2c-uniphier-f.c ARM: UniPhier: replace <asm/io.h> with <linux/io.h> 2015-05-31 02:53:56 +09:00
i2c-uniphier.c ARM: UniPhier: replace <asm/io.h> with <linux/io.h> 2015-05-31 02:53:56 +09:00
i2c_core.c i2c: Correct spelling error 2014-12-08 07:27:22 +01:00
ihs_i2c.c i2c: ihs_i2c: Fix hold_bus control 2015-11-12 15:59:02 -05:00
intel_i2c.c x86: ivybridge: Use the I2C driver to perform SMbus init 2016-01-24 12:09:41 +08:00
Kconfig x86: i2c: Add a stub driver for Intel I2C/SMbus 2016-01-24 12:09:40 +08:00
kona_i2c.c dm: i2c: Make API accessible even without CONFIG_DM 2015-02-12 10:35:33 -07:00
lpc32xx_i2c.c i2c: lpc32xx: correct sanity check for requested bus speed 2015-08-18 13:45:59 -04:00
Makefile x86: i2c: Add a stub driver for Intel I2C/SMbus 2016-01-24 12:09:40 +08:00
mv_i2c.c mv_i2c: fix warnings on 64-bit builds 2015-03-18 09:13:17 +01:00
mv_i2c.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
mvtwsi.c mvtwsi: Fix breakage introduced by "Fix mvtwsi not working on sun6i and newer sunxi SoCs" 2016-01-26 17:58:02 +01:00
mxc_i2c.c dm: i2c: mxc_i2c: implement i2c_idle_bus 2016-03-28 09:22:58 +02:00
mxs_i2c.c i2c: mxs: Add support for I2C 1 on i.MX28 2014-10-29 08:56:07 +01:00
omap24xx_i2c.c cosmetic: change Author/MAINTAINER Name from Petermaier to Schmelzer 2015-05-28 11:17:48 -04:00
omap24xx_i2c.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
pca9564_i2c.c Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
ppc4xx_i2c.c ppc4xx: Handle i2c stuck on combined xfer 2014-11-10 06:44:30 +01:00
rcar_i2c.c i2c: rcar_i2c: Fix order of restart and clear status 2014-11-10 06:47:37 +01:00
rk_i2c.c rockchip: i2c: Update the driver to use the new clock ID 2016-01-21 20:42:34 -07:00
s3c24x0_i2c.c dm: Use dev_get_addr() where possible 2015-08-31 07:57:26 -06:00
s3c24x0_i2c.h i2c: s3c24xx: add hsi2c controller support 2013-10-17 07:20:26 +02:00
sandbox_i2c.c sandbox: i2c: search child emul dev and check its uclass id 2015-05-14 19:58:34 -06:00
sh_i2c.c i2c: sh_i2c: bugfix: i2c probe command does not work 2014-04-14 17:41:48 +09:00
sh_sh7734_i2c.c Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
soft_i2c.c i2c: soft_i2c: Fix bus indizes 2015-11-12 18:04:12 -05:00
tegra_i2c.c dm: Use dev_get_addr() where possible 2015-08-31 07:57:26 -06:00
tsi108_i2c.c Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
zynq_i2c.c i2c: Instantiate I2C controllers when selected 2015-10-28 09:53:49 +01:00