[U-Boot] [PATCH 3/3] Kconfig: i2c: add entry for driver-model software i2c

Lukasz Majewski l.majewski at samsung.com
Mon Mar 23 09:46:58 CET 2015


Hi Przemyslaw,

> Signed-off-by: Przemyslaw Marczak <p.marczak at samsung.com>
> Cc: Masahiro Yamada <yamada.m at jp.panasonic.com>
> Cc: Mike Frysinger <vapier at gentoo.org>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Heiko Schocher <hs at denx.de>
> ---
>  drivers/i2c/Kconfig | 43 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
> 
> diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
> index 0a52ed9..dd7eb3c 100644
> --- a/drivers/i2c/Kconfig
> +++ b/drivers/i2c/Kconfig
> @@ -13,6 +13,49 @@ config DM_I2C_COMPAT
>  	  to convert all code for a board in a single commit. It
> should not be enabled for any board in an official release.
>  
> +config DM_I2C_SOFT
> +	bool "Enable Driver Model for Software I2C Driver"
> +	depends on DM_I2C
> +	help
> +	  Enable the i2c bus driver emulation by using GPIO.
> +	  The bus configuration is given by the device-tree, like
> below. +
> +	  /* First, define the alias number to have continuous bus
> numbering */
> +	  aliases {
> +	    [...]
> +	    i2c5 = "/i2c at 13500000";
> +	    i2c6 = "/soft-i2c at 1";
> +	    [...]
> +	  }
> +
> +	  /* And next define the basic bus attributes */
> +	  soft-i2c at 1 {
> +	    #address-cells = <1>;
> +	    #size-cells = <0>;
> +	    compatible = "soft-i2c";
> +	    clock-frequency = <50000>;
> +	    /* Define the proper GPIO pins */
> +	    clock-pin = <&gpa0 0 GPIO_ACTIVE_HIGH>;
> +	    data-pin = <&gpa0 1 GPIO_ACTIVE_HIGH>;
> +
> +	    /* Optionally, define some driver node (bus child) */
> +	    somedev at 0x44 {
> +	        compatible = "somedev";
> +	        reg = <0x44>;
> +	        [...]
> +	    };
> +	  }
> +
> +	  The device can be accessed by the i2c command:
> +	  # i2c dev 8                   (bus number set by alias)
> +	  # i2c probe <0x44>            (address is optionally)
> +	  # i2c md 0x44 0x0             (dump dev registers at
> address 0x0)
> +	  # Valid chip addresses: 0x44  (success!)
> +	  ...
> +
> +	  Driving the bus lines is done by dm gpio calls in the
> preprocessor
> +	  macros. Each, can be redefined by the user.
> +
>  config SYS_I2C_UNIPHIER
>  	bool "UniPhier I2C driver"
>  	depends on ARCH_UNIPHIER && DM_I2C

Reviewed-by: Lukasz Majewski <l.majewski at samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group


More information about the U-Boot mailing list