[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130620200454.GE2961@katana>
Date: Thu, 20 Jun 2013 22:04:54 +0200
From: Wolfram Sang <wsa@...-dreams.de>
To: Christian Ruppert <christian.ruppert@...lis.com>
Cc: Rob Herring <robherring2@...il.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
linux-i2c@...r.kernel.org,
"Ben Dooks (embedded platforms)" <ben-linux@...ff.org>,
Grant Likely <grant.likely@...retlab.ca>,
Rob Landley <rob@...dley.net>,
devicetree-discuss@...ts.ozlabs.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org,
Vineet Gupta <Vineet.Gupta1@...opsys.com>,
Pierrick Hascoet <pierrick.hascoet@...lis.com>
Subject: Re: [PATCH v8] i2c-designware: make SDA hold time configurable
On Tue, Jun 18, 2013 at 09:44:29AM +0200, Christian Ruppert wrote:
> This patch makes the SDA hold time configurable through device tree.
>
> Signed-off-by: Christian Ruppert <christian.ruppert@...lis.com>
> Signed-off-by: Pierrick Hascoet <pierrick.hascoet@...lis.com>
Okay, I am convinced of the property now...
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 35b70a1..81362e5 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -34,6 +34,7 @@
> #include <linux/sched.h>
> #include <linux/err.h>
> #include <linux/interrupt.h>
> +#include <linux/of.h>
> #include <linux/of_i2c.h>
> #include <linux/platform_device.h>
> #include <linux/pm.h>
> @@ -121,6 +122,15 @@ static int dw_i2c_probe(struct platform_device *pdev)
> return PTR_ERR(dev->clk);
> clk_prepare_enable(dev->clk);
>
> + if (pdev->dev.of_node) {
> + u32 ht;
> + u32 ic_clk = dev->get_clk_rate_khz(dev);
> +
> + of_property_read_u32(pdev->dev.of_node,
> + "i2c-sda-hold-time-ns", &ht);
> + dev->sda_holdO_time = ((u64)ic_clk * ht + 500000) / 1000000;
... but is this correct even if the property is not defined?
> + }
> +
Thanks for all the input so far!
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists