diff mbox

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

Message ID 1425983444-18565-4-git-send-email-p.marczak@samsung.com
State Changes Requested
Delegated to: Simon Glass
Headers show

Commit Message

Przemyslaw Marczak March 10, 2015, 10:30 a.m. UTC
Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Heiko Schocher <hs@denx.de>
---
 drivers/i2c/Kconfig | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

Comments

Ɓukasz Majewski March 23, 2015, 8:46 a.m. UTC | #1
Hi Przemyslaw,

> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Cc: Mike Frysinger <vapier@gentoo.org>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Heiko Schocher <hs@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@13500000";
> +	    i2c6 = "/soft-i2c@1";
> +	    [...]
> +	  }
> +
> +	  /* And next define the basic bus attributes */
> +	  soft-i2c@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@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@samsung.com>
Simon Glass March 23, 2015, 11:40 p.m. UTC | #2
On 10 March 2015 at 04:30, Przemyslaw Marczak <p.marczak@samsung.com> wrote:
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Cc: Mike Frysinger <vapier@gentoo.org>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Heiko Schocher <hs@denx.de>
> ---
>  drivers/i2c/Kconfig | 43 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
>

This is very nice.

Acked-by: Simon Glass <sjg@chromium.org>
Masahiro Yamada March 25, 2015, 3:35 a.m. UTC | #3
Hi.



2015-03-10 19:30 GMT+09:00 Przemyslaw Marczak <p.marczak@samsung.com>:
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>

I am no longer working for Panasonic.
The old email address will get unavailable at the end of March.

Going forward, please use my new address, yamada.masahiro@socionext.com



>
> 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.

Very nice!

> +         The bus configuration is given by the device-tree, like below.
> +
> +         /* First, define the alias number to have continuous bus numbering */
> +         aliases {
> +           [...]
> +           i2c5 = "/i2c@13500000";
> +           i2c6 = "/soft-i2c@1";
> +           [...]
> +         }

This description is not specific to this CONFIG option.

The relation between the aliases node and the sequence number
is well-documented in doc/driver-model/README.txt.

Should we repeat it here?


> +         /* And next define the basic bus attributes */
> +         soft-i2c@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@0x44 {
> +               compatible = "somedev";
> +               reg = <0x44>;
> +               [...]
> +           };
> +         }

This is binding information, right?

Stuff like that is usually documented in a separate text file.

In Linux, Documentation/devicetree/bindings/i2c/
In U-boot, doc/device-tree-bindings/i2c/



> +         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!)
> +         ...


This is the usage of "i2c" command.
It is not specific to this option, either.




> +         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
> --
> 1.9.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Przemyslaw Marczak March 26, 2015, 1:17 p.m. UTC | #4
Hello Masahiro,

On 03/25/2015 04:35 AM, Masahiro Yamada wrote:
> Hi.
>
>
>
> 2015-03-10 19:30 GMT+09:00 Przemyslaw Marczak <p.marczak@samsung.com>:
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>> Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
>
> I am no longer working for Panasonic.
> The old email address will get unavailable at the end of March.
>
> Going forward, please use my new address, yamada.masahiro@socionext.com
>
>
>

Ok, will update this.

>>
>> 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.
>
> Very nice!
>
>> +         The bus configuration is given by the device-tree, like below.
>> +
>> +         /* First, define the alias number to have continuous bus numbering */
>> +         aliases {
>> +           [...]
>> +           i2c5 = "/i2c@13500000";
>> +           i2c6 = "/soft-i2c@1";
>> +           [...]
>> +         }
>
> This description is not specific to this CONFIG option.
>
> The relation between the aliases node and the sequence number
> is well-documented in doc/driver-model/README.txt.
>
> Should we repeat it here?
>
>

Yes, you are right. I wanted to put here all informations, required to 
make it working with devices, since I think it could facilitate the 
development for the others.
Will remove this.

>> +         /* And next define the basic bus attributes */
>> +         soft-i2c@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@0x44 {
>> +               compatible = "somedev";
>> +               reg = <0x44>;
>> +               [...]
>> +           };
>> +         }
>
> This is binding information, right?
>
> Stuff like that is usually documented in a separate text file.
>
> In Linux, Documentation/devicetree/bindings/i2c/
> In U-boot, doc/device-tree-bindings/i2c/
>

Right, will move into proper path.

>
>
>> +         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!)
>> +         ...
>
>
> This is the usage of "i2c" command.
> It is not specific to this option, either.
 >

Ok.

>
>
>
>> +         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
>> --
>> 1.9.1
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>
>
>

Thanks for review!

Best regards,
diff mbox

Patch

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@13500000";
+	    i2c6 = "/soft-i2c@1";
+	    [...]
+	  }
+
+	  /* And next define the basic bus attributes */
+	  soft-i2c@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@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