* [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver.
@ 2012-08-06 12:25 Lee Jones
2012-08-06 14:00 ` Linus Walleij
0 siblings, 1 reply; 8+ messages in thread
From: Lee Jones @ 2012-08-06 12:25 UTC (permalink / raw)
To: linux-arm-kernel
At this moment in time there is only one known configuration for the
Nomadik I2C driver. By not holding that configuration in the driver
adds some unnecessary overhead in platform code. The configuration
as already been removed from platform code, this patch checks for any
over-riding configurations. If there aren't any, the default is used.
Cc: linux-i2c at vger.kernel.org
Acked-by: srinidhi kasagar <srinidhi.kasagar@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
drivers/i2c/busses/i2c-nomadik.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index a92440d..34ab587 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -333,10 +333,6 @@ static void setup_i2c_controller(struct nmk_i2c_dev *dev)
i2c_clk = clk_get_rate(dev->clk);
- /* fallback to std. mode if machine has not provided it */
- if (dev->cfg.clk_freq == 0)
- dev->cfg.clk_freq = 100000;
-
/*
* The spec says, in case of std. mode the divider is
* 2 whereas it is 3 for fast and fastplus mode of
@@ -899,15 +895,31 @@ static const struct i2c_algorithm nmk_i2c_algo = {
.functionality = nmk_i2c_functionality
};
+static struct nmk_i2c_controller u8500_i2c = {
+ /*
+ * Slave data setup time; 250ns, 100ns, and 10ns, which
+ * is 14, 6 and 2 respectively for a 48Mhz i2c clock.
+ */
+ .slsu = 0xe,
+ .tft = 1, /* Tx FIFO threshold */
+ .rft = 8, /* Rx FIFO threshold */
+ .clk_freq = 400000, /* fast mode operation */
+ .timeout = 200, /* Slave response timeout(ms) */
+ .sm = I2C_FREQ_MODE_FAST,
+};
+
static int __devinit nmk_i2c_probe(struct platform_device *pdev)
{
int ret = 0;
struct resource *res;
- struct nmk_i2c_controller *pdata =
- pdev->dev.platform_data;
+ struct nmk_i2c_controller *pdata = pdev->dev.platform_data;
struct nmk_i2c_dev *dev;
struct i2c_adapter *adap;
+ if (!pdata)
+ /* No i2c configuration found, using the default. */
+ pdata = &u8500_i2c;
+
dev = kzalloc(sizeof(struct nmk_i2c_dev), GFP_KERNEL);
if (!dev) {
dev_err(&pdev->dev, "cannot allocate memory\n");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver.
2012-08-06 12:25 [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver Lee Jones
@ 2012-08-06 14:00 ` Linus Walleij
2012-08-06 14:11 ` Lee Jones
2012-08-06 15:18 ` Lee Jones
0 siblings, 2 replies; 8+ messages in thread
From: Linus Walleij @ 2012-08-06 14:00 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Aug 6, 2012 at 2:25 PM, Lee Jones <lee.jones@linaro.org> wrote:
> At this moment in time there is only one known configuration for the
> Nomadik I2C driver. By not holding that configuration in the driver
> adds some unnecessary overhead in platform code. The configuration
> as already been removed from platform code, this patch checks for any
> over-riding configurations. If there aren't any, the default is used.
>
> Cc: linux-i2c at vger.kernel.org
> Acked-by: srinidhi kasagar <srinidhi.kasagar@stericsson.com>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This still does not apply for me on v3.6-rc1 what did you base
this patch on?
Applying: i2c: Add default configuration into the Nomadik I2C driver.
error: patch failed: drivers/i2c/busses/i2c-nomadik.c:899
error: drivers/i2c/busses/i2c-nomadik.c: patch does not apply
Patch failed at 0001 i2c: Add default configuration into the Nomadik I2C driver.
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver.
2012-08-06 14:00 ` Linus Walleij
@ 2012-08-06 14:11 ` Lee Jones
2012-08-06 15:18 ` Lee Jones
1 sibling, 0 replies; 8+ messages in thread
From: Lee Jones @ 2012-08-06 14:11 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Aug 06, 2012 at 04:00:04PM +0200, Linus Walleij wrote:
> On Mon, Aug 6, 2012 at 2:25 PM, Lee Jones <lee.jones@linaro.org> wrote:
>
> > At this moment in time there is only one known configuration for the
> > Nomadik I2C driver. By not holding that configuration in the driver
> > adds some unnecessary overhead in platform code. The configuration
> > as already been removed from platform code, this patch checks for any
> > over-riding configurations. If there aren't any, the default is used.
> >
> > Cc: linux-i2c at vger.kernel.org
> > Acked-by: srinidhi kasagar <srinidhi.kasagar@stericsson.com>
> > Acked-by: Linus Walleij <linus.walleij@linaro.org>
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
>
> This still does not apply for me on v3.6-rc1 what did you base
> this patch on?
>
> Applying: i2c: Add default configuration into the Nomadik I2C driver.
> error: patch failed: drivers/i2c/busses/i2c-nomadik.c:899
> error: drivers/i2c/busses/i2c-nomadik.c: patch does not apply
> Patch failed at 0001 i2c: Add default configuration into the Nomadik I2C driver.
> When you have resolved this problem run "git am --resolved".
> If you would prefer to skip this patch, instead run "git am --skip".
> To restore the original branch and stop patching run "git am --abort".
Ah, my mistake.
I'll rebase to latest and re-submit.
--
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver.
2012-08-06 14:00 ` Linus Walleij
2012-08-06 14:11 ` Lee Jones
@ 2012-08-06 15:18 ` Lee Jones
1 sibling, 0 replies; 8+ messages in thread
From: Lee Jones @ 2012-08-06 15:18 UTC (permalink / raw)
To: linux-arm-kernel
> This still does not apply for me on v3.6-rc1 what did you base
> this patch on?
Resent based on v3.6-rc1, sorry for the mixup.
--
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver.
@ 2012-08-06 15:17 Lee Jones
0 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2012-08-06 15:17 UTC (permalink / raw)
To: linux-arm-kernel
At this moment in time there is only one known configuration for the
Nomadik I2C driver. By not holding that configuration in the driver
adds some unnecessary overhead in platform code. The configuration
as already been removed from platform code, this patch checks for any
over-riding configurations. If there aren't any, the default is used.
Cc: linux-i2c at vger.kernel.org
Acked-by: srinidhi kasagar <srinidhi.kasagar@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
drivers/i2c/busses/i2c-nomadik.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index 5e6f1ee..e42e526 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -350,10 +350,6 @@ static void setup_i2c_controller(struct nmk_i2c_dev *dev)
i2c_clk = clk_get_rate(dev->clk);
- /* fallback to std. mode if machine has not provided it */
- if (dev->cfg.clk_freq == 0)
- dev->cfg.clk_freq = 100000;
-
/*
* The spec says, in case of std. mode the divider is
* 2 whereas it is 3 for fast and fastplus mode of
@@ -911,20 +907,32 @@ static const struct i2c_algorithm nmk_i2c_algo = {
.functionality = nmk_i2c_functionality
};
+static struct nmk_i2c_controller u8500_i2c = {
+ /*
+ * Slave data setup time; 250ns, 100ns, and 10ns, which
+ * is 14, 6 and 2 respectively for a 48Mhz i2c clock.
+ */
+ .slsu = 0xe,
+ .tft = 1, /* Tx FIFO threshold */
+ .rft = 8, /* Rx FIFO threshold */
+ .clk_freq = 400000, /* fast mode operation */
+ .timeout = 200, /* Slave response timeout(ms) */
+ .sm = I2C_FREQ_MODE_FAST,
+};
+
static atomic_t adapter_id = ATOMIC_INIT(0);
static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
{
int ret = 0;
- struct nmk_i2c_controller *pdata =
- adev->dev.platform_data;
+ struct nmk_i2c_controller *pdata = pdev->dev.platform_data;
struct nmk_i2c_dev *dev;
struct i2c_adapter *adap;
- if (!pdata) {
- dev_warn(&adev->dev, "no platform data\n");
- return -ENODEV;
- }
+ if (!pdata)
+ /* No i2c configuration found, using the default. */
+ pdata = &u8500_i2c;
+
dev = kzalloc(sizeof(struct nmk_i2c_dev), GFP_KERNEL);
if (!dev) {
dev_err(&adev->dev, "cannot allocate memory\n");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] ARM: ux500: resurrect I2C platform data
@ 2012-08-06 8:52 Linus Walleij
2012-08-06 10:21 ` [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver Lee Jones
0 siblings, 1 reply; 8+ messages in thread
From: Linus Walleij @ 2012-08-06 8:52 UTC (permalink / raw)
To: linux-arm-kernel
From: Linus Walleij <linus.walleij@linaro.org>
Commit:
98582d9562b4bea6b0eb6e2bfafcd3fab3b60ccb
"ARM: ux500: Remove unused i2c platform_data initialisation code"
Deleted platform data intialization code that was used,
not unused as indicated in the commit. The boot log (without
devicetree) now looks like this:
nmk-i2c nmk-i2c.0: no platform data
nmk-i2c nmk-i2c.1: no platform data
nmk-i2c nmk-i2c.2: no platform data
nmk-i2c nmk-i2c.3: no platform data
And no I2C drivers register anymore.
Take this opportunity to bump the i2c bus speed to 400kHz.
Some recent discussion revealed inconsistency in the board file
for the MOP500 family. The board can very well do 400kHz on
the I2C busses, so make it do that.
Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
arch/arm/mach-ux500/board-mop500.c | 39 ++++++++++++++++++++++++++++++++++----
1 file changed, 35 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 8674a89..dbb9946 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -327,12 +327,43 @@ static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
},
};
+#define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, t_out, _sm) \
+static struct nmk_i2c_controller u8500_i2c##id##_data = { \
+ /* \
+ * slave data setup time, which is \
+ * 250 ns,100ns,10ns which is 14,6,2 \
+ * respectively for a 48 Mhz \
+ * i2c clock \
+ */ \
+ .slsu = _slsu, \
+ /* Tx FIFO threshold */ \
+ .tft = _tft, \
+ /* Rx FIFO threshold */ \
+ .rft = _rft, \
+ /* std. mode operation */ \
+ .clk_freq = clk, \
+ /* Slave response timeout(ms) */\
+ .timeout = t_out, \
+ .sm = _sm, \
+}
+
+/*
+ * The board uses 4 i2c controllers, initialize all of
+ * them with slave data setup time of 250 ns,
+ * Tx & Rx FIFO threshold values as 1 resp. 8 and fast
+ * mode of operation
+ */
+U8500_I2C_CONTROLLER(0, 0xe, 1, 8, 400000, 200, I2C_FREQ_MODE_FAST);
+U8500_I2C_CONTROLLER(1, 0xe, 1, 8, 400000, 200, I2C_FREQ_MODE_FAST);
+U8500_I2C_CONTROLLER(2, 0xe, 1, 8, 400000, 200, I2C_FREQ_MODE_FAST);
+U8500_I2C_CONTROLLER(3, 0xe, 1, 8, 400000, 200, I2C_FREQ_MODE_FAST);
+
static void __init mop500_i2c_init(struct device *parent)
{
- db8500_add_i2c0(parent, NULL);
- db8500_add_i2c1(parent, NULL);
- db8500_add_i2c2(parent, NULL);
- db8500_add_i2c3(parent, NULL);
+ db8500_add_i2c0(parent, &u8500_i2c0_data);
+ db8500_add_i2c1(parent, &u8500_i2c1_data);
+ db8500_add_i2c2(parent, &u8500_i2c2_data);
+ db8500_add_i2c3(parent, &u8500_i2c3_data);
}
static struct gpio_keys_button mop500_gpio_keys[] = {
--
1.7.11.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver
2012-08-06 8:52 [PATCH] ARM: ux500: resurrect I2C platform data Linus Walleij
@ 2012-08-06 10:21 ` Lee Jones
2012-08-06 11:23 ` Linus Walleij
2012-08-06 11:43 ` Srinidhi Kasagar
0 siblings, 2 replies; 8+ messages in thread
From: Lee Jones @ 2012-08-06 10:21 UTC (permalink / raw)
To: linux-arm-kernel
From: Lee Jones <lee.jones@linaro.org>
Date: Mon, 6 Aug 2012 11:04:14 +0100
Subject: [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C
driver.
At this moment in time there is only one known configuration for the
Nomadik I2C driver. By not holding that configuration in the driver
adds some unnecessary overhead in platform code. The configuration
as already been removed from platform code, this patch checks for any
over-riding configurations. If there aren't any, the default is used.
Cc: linux-i2c at vger.kernel.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
drivers/i2c/busses/i2c-nomadik.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index a92440d..86aa73d 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -333,10 +333,6 @@ static void setup_i2c_controller(struct nmk_i2c_dev *dev)
i2c_clk = clk_get_rate(dev->clk);
- /* fallback to std. mode if machine has not provided it */
- if (dev->cfg.clk_freq == 0)
- dev->cfg.clk_freq = 100000;
-
/*
* The spec says, in case of std. mode the divider is
* 2 whereas it is 3 for fast and fastplus mode of
@@ -899,15 +895,31 @@ static const struct i2c_algorithm nmk_i2c_algo = {
.functionality = nmk_i2c_functionality
};
+static struct nmk_i2c_controller u8500_i2c = {
+ /*
+ * Slave data setup time; 250ns, 100ns, and 10ns, which
+ * is 14, 6 and 2 respectively for a 48Mhz i2c clock.
+ */
+ .slsu = 0xe,
+ .tft = 1, /* Tx FIFO threshold */
+ .rft = 8, /* Rx FIFO threshold */
+ .clk_freq = 400000, /* std. mode operation */
+ .timeout = 200, /* Slave response timeout(ms) */
+ .sm = I2C_FREQ_MODE_FAST,
+};
+
static int __devinit nmk_i2c_probe(struct platform_device *pdev)
{
int ret = 0;
struct resource *res;
- struct nmk_i2c_controller *pdata =
- pdev->dev.platform_data;
+ struct nmk_i2c_controller *pdata = pdev->dev.platform_data;
struct nmk_i2c_dev *dev;
struct i2c_adapter *adap;
+ if (!pdata)
+ /* No i2c configuration found, using the default. */
+ pdata = &u8500_i2c;
+
dev = kzalloc(sizeof(struct nmk_i2c_dev), GFP_KERNEL);
if (!dev) {
dev_err(&pdev->dev, "cannot allocate memory\n");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver
2012-08-06 10:21 ` [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver Lee Jones
@ 2012-08-06 11:23 ` Linus Walleij
2012-08-06 11:43 ` Srinidhi Kasagar
1 sibling, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2012-08-06 11:23 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Aug 6, 2012 at 12:21 PM, Lee Jones <lee.jones@linaro.org> wrote:
> From: Lee Jones <lee.jones@linaro.org>
> Date: Mon, 6 Aug 2012 11:04:14 +0100
> Subject: [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C
> driver.
>
> At this moment in time there is only one known configuration for the
> Nomadik I2C driver. By not holding that configuration in the driver
> adds some unnecessary overhead in platform code. The configuration
> as already been removed from platform code, this patch checks for any
> over-riding configurations. If there aren't any, the default is used.
>
> Cc: linux-i2c at vger.kernel.org
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Ah, I created my own solution for this as well by reverting back
some platform data.
This works too, but the patch does not apply to v3.6-rc1.
Please rebase and repost, then you can add my
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Please not that you need to send I2C patches for embedded
to Wolfram Sang.
Wolfram, please pick this for the -rc series because it's a regression
in v3.6-rc1.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver
2012-08-06 10:21 ` [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver Lee Jones
2012-08-06 11:23 ` Linus Walleij
@ 2012-08-06 11:43 ` Srinidhi Kasagar
1 sibling, 0 replies; 8+ messages in thread
From: Srinidhi Kasagar @ 2012-08-06 11:43 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Aug 06, 2012 at 12:21:52 +0200, Lee Jones wrote:
> From: Lee Jones <lee.jones@linaro.org>
> Date: Mon, 6 Aug 2012 11:04:14 +0100
> Subject: [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C
> driver.
>
> At this moment in time there is only one known configuration for the
> Nomadik I2C driver. By not holding that configuration in the driver
> adds some unnecessary overhead in platform code. The configuration
> as already been removed from platform code, this patch checks for any
> over-riding configurations. If there aren't any, the default is used.
>
> Cc: linux-i2c at vger.kernel.org
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
> drivers/i2c/busses/i2c-nomadik.c | 24 ++++++++++++++++++------
> 1 file changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
> index a92440d..86aa73d 100644
> --- a/drivers/i2c/busses/i2c-nomadik.c
> +++ b/drivers/i2c/busses/i2c-nomadik.c
> @@ -333,10 +333,6 @@ static void setup_i2c_controller(struct nmk_i2c_dev *dev)
>
> i2c_clk = clk_get_rate(dev->clk);
>
> - /* fallback to std. mode if machine has not provided it */
> - if (dev->cfg.clk_freq == 0)
> - dev->cfg.clk_freq = 100000;
> -
> /*
> * The spec says, in case of std. mode the divider is
> * 2 whereas it is 3 for fast and fastplus mode of
> @@ -899,15 +895,31 @@ static const struct i2c_algorithm nmk_i2c_algo = {
> .functionality = nmk_i2c_functionality
> };
>
> +static struct nmk_i2c_controller u8500_i2c = {
> + /*
> + * Slave data setup time; 250ns, 100ns, and 10ns, which
> + * is 14, 6 and 2 respectively for a 48Mhz i2c clock.
> + */
> + .slsu = 0xe,
> + .tft = 1, /* Tx FIFO threshold */
> + .rft = 8, /* Rx FIFO threshold */
> + .clk_freq = 400000, /* std. mode operation */
"Fast mode operation" in comment, or use your favorite "upto" keyword.
Otherwise it is Acked-by: srinidhi kasagar <srinidhi.kasagar@stericsson.com>
/srinidhi
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-08-06 15:18 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-06 12:25 [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver Lee Jones
2012-08-06 14:00 ` Linus Walleij
2012-08-06 14:11 ` Lee Jones
2012-08-06 15:18 ` Lee Jones
-- strict thread matches above, loose matches on Subject: below --
2012-08-06 15:17 Lee Jones
2012-08-06 8:52 [PATCH] ARM: ux500: resurrect I2C platform data Linus Walleij
2012-08-06 10:21 ` [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver Lee Jones
2012-08-06 11:23 ` Linus Walleij
2012-08-06 11:43 ` Srinidhi Kasagar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).