u-boot-brain/drivers
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
..
adc sandbox: add ADC driver 2015-11-02 10:38:00 +09:00
bios_emulator dm: pci: Convert bios_emu to use the driver model PCI API 2016-01-24 12:07:19 +08:00
block Fix spelling of "transferred". 2016-03-22 12:16:16 -04:00
bootcount bootcount: Correct #endif comment to match, other aesthetics 2016-01-08 10:15:43 -05:00
clk clk: uniphier: add Media I/O clock driver for UniPhier SoCs 2016-02-14 16:36:13 +09:00
core syscon: Avoid returning a device on failure 2016-03-17 10:27:24 +08:00
cpu x86: Move MP initialization codes into a common place 2015-07-14 18:03:16 -06:00
crypto drivers/crypto/fsl: define structures for PDB 2016-03-21 12:42:11 -07:00
ddr Fix typo choosen in comments and printf logs 2016-03-27 09:12:23 -04:00
demo drivers: hierarchize drivers Kconfig menu 2015-08-12 20:47:44 -04:00
dfu dm: part: Rename some partition functions 2016-03-14 15:34:50 -06:00
dma drivers: dma: ti-edma3: convert driver to adopt driver model 2016-02-23 16:14:46 +05:30
fpga fpga: altera: Add StratixV support 2016-03-24 09:47:43 +01:00
gpio Merge git://www.denx.de/git/u-boot-marvell 2016-03-25 12:57:18 -04:00
hwmon mailaddr: Update mail address 2016-01-27 15:32:05 +01:00
i2c dm: i2c: mxc_i2c: implement i2c_idle_bus 2016-03-28 09:22:58 +02:00
input input: i8042: Make sure the keyboard is enabled 2016-03-17 10:27:24 +08:00
led dm: led: Tidy up SPL options for the led and led-gpio 2015-09-02 21:28:22 -06:00
memory Various Makefiles: Add SPDX-License-Identifier tags 2015-11-10 09:19:52 -05:00
misc Merge git://git.denx.de/u-boot-dm 2016-03-14 19:21:44 -04:00
mmc mmc: Print send_cmd response only when return value is zero 2016-03-27 09:12:24 -04:00
mtd cfi_flash: return device into read array mode after reading status 2016-03-27 09:13:02 -04:00
net net: rtl8169: Fix build error when DEBUG is on 2016-03-27 09:12:25 -04:00
pch x86: pch9: Implement get_io_base op 2016-02-05 12:47:21 +08:00
pci pci/layerscape: set LUT and msi-map for discovered PCI devices 2016-03-21 12:42:13 -07:00
pcmcia powerpc: mpc824x: remove MPC824X cpu support 2015-01-05 12:08:55 -05:00
pinctrl ARM: uniphier: drop PH1- prefix from CONFIG options and file names 2016-03-24 01:42:13 +09:00
power power: twl6030: Power off support 2016-03-15 15:12:56 -04:00
pwm tegra: video: Move LCD driver to use the DM PWM driver 2016-02-16 09:17:53 -07:00
qe board: ls1043ardb: Add micro QE support for ls1043ardb 2016-02-24 08:51:14 -08:00
ram ram: rename CONFIG_SPL_RAM_SUPPORT to CONFIG_SPL_RAM 2015-08-18 13:46:02 -04:00
remoteproc remoteproc: Add support for TI power processor 2016-03-14 19:18:37 -04:00
rtc rtc: Add MCP79411 support to DS1307 rtc driver 2015-11-04 15:19:12 -08:00
serial serial: add BCM283x mini UART driver 2016-03-27 09:12:52 -04:00
soc Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
sound of: clean up OF_CONTROL ifdef conditionals 2015-08-18 13:46:05 -04:00
spi spi: omap3: Fix multiple definition of 'priv' 2016-03-15 14:50:09 -04:00
thermal imx: mx7: fix the temperature checking for Rev1.1 2016-01-07 17:53:11 +01:00
timer Merge git://git.denx.de/u-boot-dm 2016-03-14 19:21:44 -04:00
tpm tpm: st33zp24: Add tpm st33zp24 spi support 2016-01-28 21:01:22 -07:00
twserial drivers: convert makefiles to Kbuild style 2013-10-31 13:26:01 -04:00
usb usb: gadget: Move CONFIG_USB_GADGET to Kconfig 2016-03-25 15:29:48 -04:00
video Revert "pxa_lcd: make driver cache-aware" 2016-03-27 20:58:08 -04:00
watchdog imx_watchdog: always set minimal timeout in reset_cpu 2016-01-07 17:54:53 +01:00
Kconfig dm: pwm: Add a PWM uclass 2016-01-21 20:42:36 -07:00
Makefile drivers: ddr: Add DDR2 SDRAM controller driver for Microchip PIC32. 2016-02-01 22:14:01 +01:00