mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 5/7] i2c: i2c_gpio: add devicetree support
Date: Tue, 24 Jun 2014 09:03:56 +0200	[thread overview]
Message-ID: <20140624070356.GB15686@pengutronix.de> (raw)
In-Reply-To: <1403558473-26199-6-git-send-email-antonynpavlov@gmail.com>

On Tue, Jun 24, 2014 at 01:21:11AM +0400, Antony Pavlov wrote:
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> ---
>  .../devicetree/bindings/gpio/gpio_i2c.txt          | 32 +++++++++++++
>  drivers/i2c/busses/i2c-gpio.c                      | 54 +++++++++++++++++++--
>  include/of_gpio.h                                  | 55 ++++++++++++++++++++++
>  3 files changed, 138 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/gpio/gpio_i2c.txt b/Documentation/devicetree/bindings/gpio/gpio_i2c.txt
> new file mode 100644
> index 0000000..4f8ec94
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/gpio_i2c.txt

We already have this binding in dts/Bindings/i2c/i2c-gpio.txt, no need
to duplicate it here. Documentation/devicetree is only for barebox
specific bindings.


> @@ -0,0 +1,32 @@
> +Device-Tree bindings for i2c gpio driver
> +
> +Required properties:
> +	- compatible = "i2c-gpio";
> +	- gpios: sda and scl gpio
> +
> +
> +Optional properties:
> +	- i2c-gpio,sda-open-drain: sda as open drain
> +	- i2c-gpio,scl-open-drain: scl as open drain
> +	- i2c-gpio,scl-output-only: scl as output only
> +	- i2c-gpio,delay-us: delay between GPIO operations (may depend on each platform)
> +	- i2c-gpio,timeout-ms: timeout to get data
> +
> +Example nodes:
> +
> +i2c@0 {
> +	compatible = "i2c-gpio";
> +	gpios = <&pioA 23 0 /* sda */
> +		 &pioA 24 0 /* scl */
> +		>;
> +	i2c-gpio,sda-open-drain;
> +	i2c-gpio,scl-open-drain;
> +	i2c-gpio,delay-us = <2>;	/* ~100 kHz */
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +
> +	rv3029c2@56 {
> +		compatible = "rv3029c2";
> +		reg = <0x56>;
> +	};
> +};
> diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
> index 8b49c2c..29dc3d2 100644
> --- a/drivers/i2c/busses/i2c-gpio.c
> +++ b/drivers/i2c/busses/i2c-gpio.c
> @@ -15,6 +15,7 @@
>  #include <i2c/i2c-gpio.h>
>  #include <init.h>
>  #include <gpio.h>
> +#include <of_gpio.h>
>  
>  struct i2c_gpio_private_data {
>  	struct i2c_adapter adap;
> @@ -83,6 +84,38 @@ static int i2c_gpio_getscl(void *data)
>  	return gpio_get_value(pdata->scl_pin);
>  }
>  
> +static int of_i2c_gpio_probe(struct device_node *np,
> +			     struct i2c_gpio_platform_data *pdata)
> +{
> +	u32 reg;
> +

Consider adding a

	is (!IS_ENABLED(CONFIG_OFDEVICE))
		return -ENODEV;

to allow the compiler to throw away the rest of this function.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2014-06-24  7:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-23 21:21 [PATCH 0/7] MIPS: malta: enable gpio & i2c stuff Antony Pavlov
2014-06-23 21:21 ` [PATCH 1/7] gpio: add Malta CBUS FPGA I2C driver Antony Pavlov
2014-06-23 21:21 ` [PATCH 2/7] MIPS: add <asm/gpio.h> header file Antony Pavlov
2014-06-23 21:21 ` [PATCH 3/7] MIPS: malta: enable gpiolib Antony Pavlov
2014-06-23 21:21 ` [PATCH 4/7] MIPS: dts: qemu-malta.dts: enable CBUS FPGA I2C gpio driver Antony Pavlov
2014-06-23 21:21 ` [PATCH 5/7] i2c: i2c_gpio: add devicetree support Antony Pavlov
2014-06-24  7:03   ` Sascha Hauer [this message]
2014-06-23 21:21 ` [PATCH 6/7] MIPS: dts: qemu-malta.dts: use i2c-gpio for accessing CBUS FPGA I2C bus Antony Pavlov
2014-06-23 21:21 ` [PATCH 7/7] MIPS: qemu-malta_defconfig: enable gpio & i2c stuff Antony Pavlov
2014-06-24  7:09 ` [PATCH 0/7] MIPS: malta: " Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140624070356.GB15686@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox