All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] i2c: at91: cleanup and dt support
@ 2012-08-31  9:21 ` ludovic.desroches at atmel.com
  0 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches @ 2012-08-31  9:21 UTC (permalink / raw)
  To: linux-arm-kernel, linux-i2c, devicetree-discuss
  Cc: plagnioj, n.voss, nicolas.ferre, Ludovic Desroches

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Hi,

This set of patches is based on Nikolaus at91_i2c driver.

Ludovic Desroches (8):
  i2c: at91: use managed resources
  i2c: at91: add warning about transmission issues for some devices
  i2c: at91: use an id table for SoC dependent parameters
  ARM: at91: do not configure at91sam9g10 twi pio as open-drain
  i2c: at91: add dt support to i2c-at91
  ARM: at91: add clocks for I2C DT entries
  ARM: dts: add twi nodes for atmel SOCs
  ARM: dts: add twi nodes for atmel boards

 .../devicetree/bindings/i2c/atmel-i2c.txt          |  30 +++
 arch/arm/boot/dts/at91sam9260.dtsi                 |  23 +--
 arch/arm/boot/dts/at91sam9263.dtsi                 |  23 +--
 arch/arm/boot/dts/at91sam9263ek.dts                |  20 +-
 arch/arm/boot/dts/at91sam9g20.dtsi                 |   4 +
 arch/arm/boot/dts/at91sam9g20ek_common.dtsi        |  28 +--
 arch/arm/boot/dts/at91sam9g25ek.dts                |  12 ++
 arch/arm/boot/dts/at91sam9g45.dtsi                 |  33 ++--
 arch/arm/boot/dts/at91sam9m10g45ek.dts             |   8 +
 arch/arm/boot/dts/at91sam9n12.dtsi                 |  33 ++--
 arch/arm/boot/dts/at91sam9n12ek.dts                |   8 +
 arch/arm/boot/dts/at91sam9x5.dtsi                  |  69 +++----
 arch/arm/mach-at91/at91rm9200.c                    |   2 +-
 arch/arm/mach-at91/at91rm9200_devices.c            |  11 +-
 arch/arm/mach-at91/at91sam9260.c                   |   4 +-
 arch/arm/mach-at91/at91sam9260_devices.c           |   8 +-
 arch/arm/mach-at91/at91sam9261.c                   |   3 +-
 arch/arm/mach-at91/at91sam9261_devices.c           |  31 ++-
 arch/arm/mach-at91/at91sam9263.c                   |   3 +-
 arch/arm/mach-at91/at91sam9263_devices.c           |   2 +-
 arch/arm/mach-at91/at91sam9g45.c                   |   6 +-
 arch/arm/mach-at91/at91sam9g45_devices.c           |   4 +-
 arch/arm/mach-at91/at91sam9n12.c                   |   2 +
 arch/arm/mach-at91/at91sam9rl.c                    |   4 +-
 arch/arm/mach-at91/at91sam9rl_devices.c            |   2 +-
 arch/arm/mach-at91/at91sam9x5.c                    |   6 +-
 drivers/i2c/busses/Kconfig                         |   6 +
 drivers/i2c/busses/i2c-at91.c                      | 217 +++++++++++++--------
 28 files changed, 367 insertions(+), 235 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/atmel-i2c.txt

-- 
1.7.11.3

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 0/8] i2c: at91: cleanup and dt support
@ 2012-08-31  9:21 ` ludovic.desroches at atmel.com
  0 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches at atmel.com @ 2012-08-31  9:21 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Hi,

This set of patches is based on Nikolaus at91_i2c driver.

Ludovic Desroches (8):
  i2c: at91: use managed resources
  i2c: at91: add warning about transmission issues for some devices
  i2c: at91: use an id table for SoC dependent parameters
  ARM: at91: do not configure at91sam9g10 twi pio as open-drain
  i2c: at91: add dt support to i2c-at91
  ARM: at91: add clocks for I2C DT entries
  ARM: dts: add twi nodes for atmel SOCs
  ARM: dts: add twi nodes for atmel boards

 .../devicetree/bindings/i2c/atmel-i2c.txt          |  30 +++
 arch/arm/boot/dts/at91sam9260.dtsi                 |  23 +--
 arch/arm/boot/dts/at91sam9263.dtsi                 |  23 +--
 arch/arm/boot/dts/at91sam9263ek.dts                |  20 +-
 arch/arm/boot/dts/at91sam9g20.dtsi                 |   4 +
 arch/arm/boot/dts/at91sam9g20ek_common.dtsi        |  28 +--
 arch/arm/boot/dts/at91sam9g25ek.dts                |  12 ++
 arch/arm/boot/dts/at91sam9g45.dtsi                 |  33 ++--
 arch/arm/boot/dts/at91sam9m10g45ek.dts             |   8 +
 arch/arm/boot/dts/at91sam9n12.dtsi                 |  33 ++--
 arch/arm/boot/dts/at91sam9n12ek.dts                |   8 +
 arch/arm/boot/dts/at91sam9x5.dtsi                  |  69 +++----
 arch/arm/mach-at91/at91rm9200.c                    |   2 +-
 arch/arm/mach-at91/at91rm9200_devices.c            |  11 +-
 arch/arm/mach-at91/at91sam9260.c                   |   4 +-
 arch/arm/mach-at91/at91sam9260_devices.c           |   8 +-
 arch/arm/mach-at91/at91sam9261.c                   |   3 +-
 arch/arm/mach-at91/at91sam9261_devices.c           |  31 ++-
 arch/arm/mach-at91/at91sam9263.c                   |   3 +-
 arch/arm/mach-at91/at91sam9263_devices.c           |   2 +-
 arch/arm/mach-at91/at91sam9g45.c                   |   6 +-
 arch/arm/mach-at91/at91sam9g45_devices.c           |   4 +-
 arch/arm/mach-at91/at91sam9n12.c                   |   2 +
 arch/arm/mach-at91/at91sam9rl.c                    |   4 +-
 arch/arm/mach-at91/at91sam9rl_devices.c            |   2 +-
 arch/arm/mach-at91/at91sam9x5.c                    |   6 +-
 drivers/i2c/busses/Kconfig                         |   6 +
 drivers/i2c/busses/i2c-at91.c                      | 217 +++++++++++++--------
 28 files changed, 367 insertions(+), 235 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/atmel-i2c.txt

-- 
1.7.11.3

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 1/8] i2c: at91: use managed resources
  2012-08-31  9:21 ` ludovic.desroches at atmel.com
@ 2012-08-31  9:21   ` ludovic.desroches at atmel.com
  -1 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches @ 2012-08-31  9:21 UTC (permalink / raw)
  To: linux-arm-kernel, linux-i2c, devicetree-discuss
  Cc: plagnioj, n.voss, nicolas.ferre, Ludovic Desroches

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Use managed resources to ease the cleanup.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/i2c/busses/i2c-at91.c | 85 +++++++++++++------------------------------
 1 file changed, 25 insertions(+), 60 deletions(-)

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 2b8b2c2..08aaee7 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -326,61 +326,49 @@ static struct i2c_algorithm at91_twi_algorithm = {
 static int __devinit at91_twi_probe(struct platform_device *pdev)
 {
 	struct at91_twi_dev *dev;
-	struct resource *mem, *ioarea;
-	int irq, rc;
+	struct resource *mem;
+	int rc;
+
+	dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
+	if (!dev)
+		return -ENOMEM;
+	init_completion(&dev->cmd_complete);
+	dev->dev = &pdev->dev;
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!mem)
 		return -ENODEV;
 
-	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
-		return irq;
-
-	ioarea = request_mem_region(mem->start, resource_size(mem), pdev->name);
-	if (!ioarea)
+	dev->base = devm_request_and_ioremap(&pdev->dev, mem);
+	if (!dev->base)
 		return -EBUSY;
 
-	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
-	if (!dev) {
-		rc = -ENOMEM;
-		goto err_release_region;
+	dev->irq = platform_get_irq(pdev, 0);
+	if (dev->irq < 0)
+		return dev->irq;
+
+	rc = devm_request_irq(&pdev->dev, dev->irq, atmel_twi_interrupt, 0,
+			 dev_name(dev->dev), dev);
+	if (rc) {
+		dev_err(dev->dev, "Cannot get irq %d: %d\n", dev->irq, rc);
+		return rc;
 	}
 
 	if (pdev->id_entry)
 		dev->ip_id = pdev->id_entry->driver_data;
 
-	init_completion(&dev->cmd_complete);
-
-	dev->dev = &pdev->dev;
-	dev->irq = irq;
 	platform_set_drvdata(pdev, dev);
 
-	dev->clk = clk_get(dev->dev, NULL);
+	dev->clk = devm_clk_get(dev->dev, NULL);
 	if (IS_ERR(dev->clk)) {
 		dev_err(dev->dev, "no clock defined\n");
-		rc = -ENODEV;
-		goto err_free_mem;
-	}
-	clk_prepare(dev->clk);
-	clk_enable(dev->clk);
-
-	dev->base = ioremap(mem->start, resource_size(mem));
-	if (!dev->base) {
-		rc = -EBUSY;
-		goto err_mem_ioremap;
+		return -ENODEV;
 	}
+	clk_prepare_enable(dev->clk);
 
 	at91_calc_twi_clock(dev, TWI_CLK_HZ);
 	at91_init_twi_bus(dev);
 
-	rc = request_irq(dev->irq, atmel_twi_interrupt, 0,
-			 dev_name(dev->dev), dev);
-	if (rc) {
-		dev_err(dev->dev, "Cannot get irq %d: %d\n", dev->irq, rc);
-		goto err_unuse_clocks;
-	}
-
 	snprintf(dev->adapter.name, sizeof(dev->adapter.name), "AT91");
 	i2c_set_adapdata(&dev->adapter, dev);
 	dev->adapter.owner = THIS_MODULE;
@@ -394,44 +382,21 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)
 	if (rc) {
 		dev_err(dev->dev, "Adapter %s registration failed\n",
 			dev->adapter.name);
-		goto err_free_irq;
+		clk_disable_unprepare(dev->clk);
+		return rc;
 	}
 
 	dev_info(dev->dev, "AT91 i2c bus driver.\n");
 	return 0;
-
-err_free_irq:
-	free_irq(dev->irq, dev);
-err_unuse_clocks:
-	iounmap(dev->base);
-err_mem_ioremap:
-	clk_disable(dev->clk);
-	clk_unprepare(dev->clk);
-	clk_put(dev->clk);
-err_free_mem:
-	kfree(dev);
-err_release_region:
-	release_mem_region(mem->start, resource_size(mem));
-
-	return rc;
 }
 
 static int __devexit at91_twi_remove(struct platform_device *pdev)
 {
 	struct at91_twi_dev *dev = platform_get_drvdata(pdev);
-	struct resource *mem;
 	int rc;
 
 	rc = i2c_del_adapter(&dev->adapter);
-	clk_disable(dev->clk);
-	clk_unprepare(dev->clk);
-	clk_put(dev->clk);
-	free_irq(dev->irq, dev);
-	iounmap(dev->base);
-	kfree(dev);
-
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	release_mem_region(mem->start, resource_size(mem));
+	clk_disable_unprepare(dev->clk);
 
 	return rc;
 }
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 1/8] i2c: at91: use managed resources
@ 2012-08-31  9:21   ` ludovic.desroches at atmel.com
  0 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches at atmel.com @ 2012-08-31  9:21 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Use managed resources to ease the cleanup.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/i2c/busses/i2c-at91.c | 85 +++++++++++++------------------------------
 1 file changed, 25 insertions(+), 60 deletions(-)

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 2b8b2c2..08aaee7 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -326,61 +326,49 @@ static struct i2c_algorithm at91_twi_algorithm = {
 static int __devinit at91_twi_probe(struct platform_device *pdev)
 {
 	struct at91_twi_dev *dev;
-	struct resource *mem, *ioarea;
-	int irq, rc;
+	struct resource *mem;
+	int rc;
+
+	dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
+	if (!dev)
+		return -ENOMEM;
+	init_completion(&dev->cmd_complete);
+	dev->dev = &pdev->dev;
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!mem)
 		return -ENODEV;
 
-	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
-		return irq;
-
-	ioarea = request_mem_region(mem->start, resource_size(mem), pdev->name);
-	if (!ioarea)
+	dev->base = devm_request_and_ioremap(&pdev->dev, mem);
+	if (!dev->base)
 		return -EBUSY;
 
-	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
-	if (!dev) {
-		rc = -ENOMEM;
-		goto err_release_region;
+	dev->irq = platform_get_irq(pdev, 0);
+	if (dev->irq < 0)
+		return dev->irq;
+
+	rc = devm_request_irq(&pdev->dev, dev->irq, atmel_twi_interrupt, 0,
+			 dev_name(dev->dev), dev);
+	if (rc) {
+		dev_err(dev->dev, "Cannot get irq %d: %d\n", dev->irq, rc);
+		return rc;
 	}
 
 	if (pdev->id_entry)
 		dev->ip_id = pdev->id_entry->driver_data;
 
-	init_completion(&dev->cmd_complete);
-
-	dev->dev = &pdev->dev;
-	dev->irq = irq;
 	platform_set_drvdata(pdev, dev);
 
-	dev->clk = clk_get(dev->dev, NULL);
+	dev->clk = devm_clk_get(dev->dev, NULL);
 	if (IS_ERR(dev->clk)) {
 		dev_err(dev->dev, "no clock defined\n");
-		rc = -ENODEV;
-		goto err_free_mem;
-	}
-	clk_prepare(dev->clk);
-	clk_enable(dev->clk);
-
-	dev->base = ioremap(mem->start, resource_size(mem));
-	if (!dev->base) {
-		rc = -EBUSY;
-		goto err_mem_ioremap;
+		return -ENODEV;
 	}
+	clk_prepare_enable(dev->clk);
 
 	at91_calc_twi_clock(dev, TWI_CLK_HZ);
 	at91_init_twi_bus(dev);
 
-	rc = request_irq(dev->irq, atmel_twi_interrupt, 0,
-			 dev_name(dev->dev), dev);
-	if (rc) {
-		dev_err(dev->dev, "Cannot get irq %d: %d\n", dev->irq, rc);
-		goto err_unuse_clocks;
-	}
-
 	snprintf(dev->adapter.name, sizeof(dev->adapter.name), "AT91");
 	i2c_set_adapdata(&dev->adapter, dev);
 	dev->adapter.owner = THIS_MODULE;
@@ -394,44 +382,21 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)
 	if (rc) {
 		dev_err(dev->dev, "Adapter %s registration failed\n",
 			dev->adapter.name);
-		goto err_free_irq;
+		clk_disable_unprepare(dev->clk);
+		return rc;
 	}
 
 	dev_info(dev->dev, "AT91 i2c bus driver.\n");
 	return 0;
-
-err_free_irq:
-	free_irq(dev->irq, dev);
-err_unuse_clocks:
-	iounmap(dev->base);
-err_mem_ioremap:
-	clk_disable(dev->clk);
-	clk_unprepare(dev->clk);
-	clk_put(dev->clk);
-err_free_mem:
-	kfree(dev);
-err_release_region:
-	release_mem_region(mem->start, resource_size(mem));
-
-	return rc;
 }
 
 static int __devexit at91_twi_remove(struct platform_device *pdev)
 {
 	struct at91_twi_dev *dev = platform_get_drvdata(pdev);
-	struct resource *mem;
 	int rc;
 
 	rc = i2c_del_adapter(&dev->adapter);
-	clk_disable(dev->clk);
-	clk_unprepare(dev->clk);
-	clk_put(dev->clk);
-	free_irq(dev->irq, dev);
-	iounmap(dev->base);
-	kfree(dev);
-
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	release_mem_region(mem->start, resource_size(mem));
+	clk_disable_unprepare(dev->clk);
 
 	return rc;
 }
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 2/8] i2c: at91: add warning about transmission issues for some devices
  2012-08-31  9:21 ` ludovic.desroches at atmel.com
@ 2012-08-31  9:21     ` ludovic.desroches at atmel.com
  -1 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w @ 2012-08-31  9:21 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
  Cc: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
	plagnioj-sclMFOaUSTBWk0Htik3J/w, n.voss-+umVssTZoCsb1SvskN2V4Q,
	Ludovic Desroches

From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>

Some devices don't have clock streching in transmission mode. It can
lead to premature stop sendings if the latency to write data in the
transmission register is too long. In this case, prefer the i2c-gpio
driver.

Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---
 drivers/i2c/busses/Kconfig | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index d9c4918..da77c37 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -300,6 +300,12 @@ config I2C_AT91
 	  to support combined I2C messages.  Use the i2c-gpio driver
 	  unless your system can cope with this limitation.
 
+	  Caution! at91rm9200, at91sam9261, at91sam9260, at91sam9263 devices
+	  don't have clock stretching in transmission mode. For that reason,
+	  you can encounter underrun issues causing premature stop sendings if
+	  the latency to fill the transmission register is too long. If you
+	  are facing this situation, use the i2c-gpio driver.
+
 config I2C_AU1550
 	tristate "Au1550/Au1200/Au1300 SMBus interface"
 	depends on MIPS_ALCHEMY
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 2/8] i2c: at91: add warning about transmission issues for some devices
@ 2012-08-31  9:21     ` ludovic.desroches at atmel.com
  0 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches at atmel.com @ 2012-08-31  9:21 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Some devices don't have clock streching in transmission mode. It can
lead to premature stop sendings if the latency to write data in the
transmission register is too long. In this case, prefer the i2c-gpio
driver.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/i2c/busses/Kconfig | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index d9c4918..da77c37 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -300,6 +300,12 @@ config I2C_AT91
 	  to support combined I2C messages.  Use the i2c-gpio driver
 	  unless your system can cope with this limitation.
 
+	  Caution! at91rm9200, at91sam9261, at91sam9260, at91sam9263 devices
+	  don't have clock stretching in transmission mode. For that reason,
+	  you can encounter underrun issues causing premature stop sendings if
+	  the latency to fill the transmission register is too long. If you
+	  are facing this situation, use the i2c-gpio driver.
+
 config I2C_AU1550
 	tristate "Au1550/Au1200/Au1300 SMBus interface"
 	depends on MIPS_ALCHEMY
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
  2012-08-31  9:21 ` ludovic.desroches at atmel.com
@ 2012-08-31  9:21   ` ludovic.desroches at atmel.com
  -1 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches @ 2012-08-31  9:21 UTC (permalink / raw)
  To: linux-arm-kernel, linux-i2c, devicetree-discuss
  Cc: plagnioj, n.voss, nicolas.ferre, Ludovic Desroches

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Use the id_table to store configuration structures which are depending on
SoC.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 arch/arm/mach-at91/at91rm9200.c          |  2 +-
 arch/arm/mach-at91/at91rm9200_devices.c  | 11 +----
 arch/arm/mach-at91/at91sam9260.c         |  3 +-
 arch/arm/mach-at91/at91sam9260_devices.c |  8 ++-
 arch/arm/mach-at91/at91sam9261.c         |  3 +-
 arch/arm/mach-at91/at91sam9261_devices.c | 17 +++----
 arch/arm/mach-at91/at91sam9263.c         |  2 +-
 arch/arm/mach-at91/at91sam9263_devices.c |  2 +-
 arch/arm/mach-at91/at91sam9g45.c         |  4 +-
 arch/arm/mach-at91/at91sam9g45_devices.c |  4 +-
 arch/arm/mach-at91/at91sam9rl.c          |  4 +-
 arch/arm/mach-at91/at91sam9rl_devices.c  |  2 +-
 drivers/i2c/busses/i2c-at91.c            | 85 +++++++++++++++++++++++++-------
 13 files changed, 95 insertions(+), 52 deletions(-)

diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index f2112f9..0bc91e5 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c", &twi_clk),
 	/* fake hclk clock */
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 71e7387..cddfe02 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -494,18 +494,9 @@ static struct resource twi_resources[] = {
 	},
 };
 
-static const struct platform_device_id twi_ip_type = {
-	/*
-	 * driver_data is 1 for RM9200 compatible ip, see enum twi_ip_id in
-	 * drivers/i2c/busses/i2c-at91.c
-	 */
-	.driver_data	= 1,
-};
-
 static struct platform_device at91rm9200_twi_device = {
-	.name		= "at91_i2c",
+	.name		= "at91rm9200_i2c",
 	.id		= -1,
-	.id_entry	= &twi_ip_type,
 	.resource	= twi_resources,
 	.num_resources	= ARRAY_SIZE(twi_resources),
 };
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 57c79ee..5f86e71 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -211,7 +211,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk),
 	CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9260_i2c", &twi_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9g20_i2c", &twi_clk),
 	/* more usart lookup table for DT entries */
 	CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
 	CLKDEV_CON_DEV_ID("usart", "fffb0000.serial", &usart0_clk),
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 7b9c2ba..ed02171 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -503,7 +503,6 @@ static struct resource twi_resources[] = {
 };
 
 static struct platform_device at91sam9260_twi_device = {
-	.name		= "at91_i2c",
 	.id		= -1,
 	.resource	= twi_resources,
 	.num_resources	= ARRAY_SIZE(twi_resources),
@@ -511,6 +510,13 @@ static struct platform_device at91sam9260_twi_device = {
 
 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
 {
+	/* IP version is not the same on 9260 and g20 */
+	if (cpu_is_at91sam9g20()) {
+		at91sam9260_twi_device.name = "at91sam9g20_i2c";
+	} else {
+		at91sam9260_twi_device.name = "at91sam9260_i2c";
+	}
+
 	/* pins used for TWI interface */
 	at91_set_A_periph(AT91_PIN_PA23, 0);		/* TWD */
 	at91_set_multi_drive(AT91_PIN_PA23, 1);
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 71ca1e0..0ccf63c 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -178,7 +178,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9261_i2c", &twi_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9g10_i2c", &twi_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
 	CLKDEV_CON_ID("pioB", &pioB_clk),
 	CLKDEV_CON_ID("pioC", &pioC_clk),
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index d830724..c94495d 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -316,24 +316,21 @@ static struct resource twi_resources[] = {
 	},
 };
 
-static const struct platform_device_id twi_ip_type = {
-	/*
-	 * driver_data is 2 for SAM9261 compatible ip, see enum twi_ip_id in
-	 * drivers/i2c/busses/i2c-at91.c
-	 */
-	.driver_data	= 2,
-};
-
 static struct platform_device at91sam9261_twi_device = {
-	.name		= "at91_i2c",
 	.id		= -1,
-	.id_entry	= &twi_ip_type,
 	.resource	= twi_resources,
 	.num_resources	= ARRAY_SIZE(twi_resources),
 };
 
 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
 {
+	/* IP version is not the same on 9261 and g10 */
+	if (cpu_is_at91sam9g10()) {
+		at91sam9261_twi_device.name = "at91sam9g10_i2c";
+	} else {
+		at91sam9261_twi_device.name = "at91sam9261_i2c";
+	}
+
 	/* pins used for TWI interface */
 	at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
 	at91_set_multi_drive(AT91_PIN_PA7, 1);
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 2a08305..a4d760c 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -193,7 +193,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9260_i2c", &twi_clk),
 	/* fake hclk clock */
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index eb6bbf8..7cff86c 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -574,7 +574,7 @@ static struct resource twi_resources[] = {
 };
 
 static struct platform_device at91sam9263_twi_device = {
-	.name		= "at91_i2c",
+	.name		= "at91sam9260_i2c",
 	.id		= -1,
 	.resource	= twi_resources,
 	.num_resources	= ARRAY_SIZE(twi_resources),
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index ddf3d37..15e62b9 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -237,8 +237,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb0_clk),
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.0", &twi0_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.1", &twi1_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9g10_i2c.0", &twi0_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9g10_i2c.1", &twi1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID(NULL, "atmel-trng", &trng_clk),
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index f001305..a61c7ec 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -653,7 +653,7 @@ static struct resource twi0_resources[] = {
 };
 
 static struct platform_device at91sam9g45_twi0_device = {
-	.name		= "at91_i2c",
+	.name		= "at91sam9g10_i2c",
 	.id		= 0,
 	.resource	= twi0_resources,
 	.num_resources	= ARRAY_SIZE(twi0_resources),
@@ -673,7 +673,7 @@ static struct resource twi1_resources[] = {
 };
 
 static struct platform_device at91sam9g45_twi1_device = {
-	.name		= "at91_i2c",
+	.name		= "at91sam9g10_i2c",
 	.id		= 1,
 	.resource	= twi1_resources,
 	.num_resources	= ARRAY_SIZE(twi1_resources),
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index bf79c1f..d708dfa 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -186,8 +186,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.0", &twi0_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.1", &twi1_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9g20_i2c.0", &twi0_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9g20_i2c.1", &twi1_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
 	CLKDEV_CON_ID("pioB", &pioB_clk),
 	CLKDEV_CON_ID("pioC", &pioC_clk),
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index f09fff9..2df7411 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -346,7 +346,7 @@ static struct resource twi_resources[] = {
 };
 
 static struct platform_device at91sam9rl_twi_device = {
-	.name		= "at91_i2c",
+	.name		= "at91sam9g20_i2c",
 	.id		= -1,
 	.resource	= twi_resources,
 	.num_resources	= ARRAY_SIZE(twi_resources),
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 08aaee7..bcf9a5c 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -61,10 +61,10 @@
 #define	AT91_TWI_RHR		0x0030	/* Receive Holding Register */
 #define	AT91_TWI_THR		0x0034	/* Transmit Holding Register */
 
-enum twi_ip_id {
-	DEFAULT		= 0, /* default ip, no known limitations */
-	RM9200		= 1,
-	SAM9261		= 2,
+struct at91_twi_pdata {
+	unsigned	clk_max_div;
+	unsigned	clk_offset;
+	bool		has_unre_flag;
 };
 
 struct at91_twi_dev {
@@ -78,8 +78,8 @@ struct at91_twi_dev {
 	int			irq;
 	unsigned		transfer_status;
 	struct i2c_adapter	adapter;
-	enum twi_ip_id		ip_id;
 	unsigned		twi_cwgr_reg;
+	struct at91_twi_pdata	*pdata;
 };
 
 static unsigned at91_twi_read(struct at91_twi_dev *dev, unsigned reg)
@@ -114,16 +114,9 @@ static void at91_init_twi_bus(struct at91_twi_dev *dev)
 static void __devinit at91_calc_twi_clock(struct at91_twi_dev *dev, int twi_clk)
 {
 	int ckdiv, cdiv, div;
-	int offset = 4;
-	int max_ckdiv = 7;
-
-	if (dev->ip_id == RM9200) {
-		offset = 3;
-		max_ckdiv = 5;
-	} else if (dev->ip_id == SAM9261) {
-		offset = 4;
-		max_ckdiv = 5;
-	}
+	struct at91_twi_pdata *pdata = dev->pdata;
+	int offset = pdata->clk_offset;
+	int max_ckdiv = pdata->clk_max_div;
 
 	div = max(0, (int)DIV_ROUND_UP(clk_get_rate(dev->clk),
 				       2 * twi_clk) - offset);
@@ -209,6 +202,7 @@ static irqreturn_t atmel_twi_interrupt(int irq, void *dev_id)
 static int at91_do_twi_transfer(struct at91_twi_dev *dev)
 {
 	int ret;
+	bool has_unre_flag = dev->pdata->has_unre_flag;
 
 	dev_dbg(dev->dev, "transfer: %s %d bytes.\n",
 		(dev->msg->flags & I2C_M_RD) ? "read" : "write", dev->buf_len);
@@ -250,7 +244,7 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev)
 		dev_err(dev->dev, "overrun while reading\n");
 		return -EIO;
 	}
-	if (dev->transfer_status & AT91_TWI_UNRE && dev->ip_id == RM9200) {
+	if (has_unre_flag && dev->transfer_status & AT91_TWI_UNRE) {
 		dev_err(dev->dev, "underrun while writing\n");
 		return -EIO;
 	}
@@ -323,6 +317,57 @@ static struct i2c_algorithm at91_twi_algorithm = {
 	.functionality	= at91_twi_func,
 };
 
+static struct at91_twi_pdata at91rm9200_config = {
+	.clk_max_div = 5,
+	.clk_offset = 3,
+	.has_unre_flag = true,
+};
+
+static struct at91_twi_pdata at91sam9261_config = {
+	.clk_max_div = 5,
+	.clk_offset = 4,
+	.has_unre_flag = false,
+};
+
+static struct at91_twi_pdata at91sam9260_config = {
+	.clk_max_div = 7,
+	.clk_offset = 4,
+	.has_unre_flag = false,
+};
+
+static struct at91_twi_pdata at91sam9g20_config = {
+	.clk_max_div = 7,
+	.clk_offset = 4,
+	.has_unre_flag = false,
+};
+
+static struct at91_twi_pdata at91sam9g10_config = {
+	.clk_max_div = 7,
+	.clk_offset = 4,
+	.has_unre_flag = false,
+};
+
+static const struct platform_device_id at91_twi_devtypes[] = {
+	{
+		.name = "at91rm9200_i2c",
+		.driver_data = (unsigned long) &at91rm9200_config,
+	}, {
+		.name = "at91sam9261_i2c",
+		.driver_data = (unsigned long) &at91sam9261_config,
+	}, {
+		.name = "at91sam9260_i2c",
+		.driver_data = (unsigned long) &at91sam9260_config,
+	}, {
+		.name = "at91sam9g20_i2c",
+		.driver_data = (unsigned long) &at91sam9g20_config,
+	}, {
+		.name = "at91sam9g10_i2c",
+		.driver_data = (unsigned long) &at91sam9g10_config,
+	}, {
+		/* sentinel */
+	}
+};
+
 static int __devinit at91_twi_probe(struct platform_device *pdev)
 {
 	struct at91_twi_dev *dev;
@@ -339,6 +384,10 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)
 	if (!mem)
 		return -ENODEV;
 
+	dev->pdata = at91_twi_get_driver_data(pdev);
+	if (!dev->pdata)
+		return -ENODEV;
+
 	dev->base = devm_request_and_ioremap(&pdev->dev, mem);
 	if (!dev->base)
 		return -EBUSY;
@@ -354,9 +403,6 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)
 		return rc;
 	}
 
-	if (pdev->id_entry)
-		dev->ip_id = pdev->id_entry->driver_data;
-
 	platform_set_drvdata(pdev, dev);
 
 	dev->clk = devm_clk_get(dev->dev, NULL);
@@ -432,6 +478,7 @@ static const struct dev_pm_ops at91_twi_pm = {
 static struct platform_driver at91_twi_driver = {
 	.probe		= at91_twi_probe,
 	.remove		= __devexit_p(at91_twi_remove),
+	.id_table	= at91_twi_devtypes,
 	.driver		= {
 		.name	= "at91_i2c",
 		.owner	= THIS_MODULE,
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
@ 2012-08-31  9:21   ` ludovic.desroches at atmel.com
  0 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches at atmel.com @ 2012-08-31  9:21 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Use the id_table to store configuration structures which are depending on
SoC.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 arch/arm/mach-at91/at91rm9200.c          |  2 +-
 arch/arm/mach-at91/at91rm9200_devices.c  | 11 +----
 arch/arm/mach-at91/at91sam9260.c         |  3 +-
 arch/arm/mach-at91/at91sam9260_devices.c |  8 ++-
 arch/arm/mach-at91/at91sam9261.c         |  3 +-
 arch/arm/mach-at91/at91sam9261_devices.c | 17 +++----
 arch/arm/mach-at91/at91sam9263.c         |  2 +-
 arch/arm/mach-at91/at91sam9263_devices.c |  2 +-
 arch/arm/mach-at91/at91sam9g45.c         |  4 +-
 arch/arm/mach-at91/at91sam9g45_devices.c |  4 +-
 arch/arm/mach-at91/at91sam9rl.c          |  4 +-
 arch/arm/mach-at91/at91sam9rl_devices.c  |  2 +-
 drivers/i2c/busses/i2c-at91.c            | 85 +++++++++++++++++++++++++-------
 13 files changed, 95 insertions(+), 52 deletions(-)

diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index f2112f9..0bc91e5 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c", &twi_clk),
 	/* fake hclk clock */
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 71e7387..cddfe02 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -494,18 +494,9 @@ static struct resource twi_resources[] = {
 	},
 };
 
-static const struct platform_device_id twi_ip_type = {
-	/*
-	 * driver_data is 1 for RM9200 compatible ip, see enum twi_ip_id in
-	 * drivers/i2c/busses/i2c-at91.c
-	 */
-	.driver_data	= 1,
-};
-
 static struct platform_device at91rm9200_twi_device = {
-	.name		= "at91_i2c",
+	.name		= "at91rm9200_i2c",
 	.id		= -1,
-	.id_entry	= &twi_ip_type,
 	.resource	= twi_resources,
 	.num_resources	= ARRAY_SIZE(twi_resources),
 };
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 57c79ee..5f86e71 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -211,7 +211,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk),
 	CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9260_i2c", &twi_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9g20_i2c", &twi_clk),
 	/* more usart lookup table for DT entries */
 	CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
 	CLKDEV_CON_DEV_ID("usart", "fffb0000.serial", &usart0_clk),
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 7b9c2ba..ed02171 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -503,7 +503,6 @@ static struct resource twi_resources[] = {
 };
 
 static struct platform_device at91sam9260_twi_device = {
-	.name		= "at91_i2c",
 	.id		= -1,
 	.resource	= twi_resources,
 	.num_resources	= ARRAY_SIZE(twi_resources),
@@ -511,6 +510,13 @@ static struct platform_device at91sam9260_twi_device = {
 
 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
 {
+	/* IP version is not the same on 9260 and g20 */
+	if (cpu_is_at91sam9g20()) {
+		at91sam9260_twi_device.name = "at91sam9g20_i2c";
+	} else {
+		at91sam9260_twi_device.name = "at91sam9260_i2c";
+	}
+
 	/* pins used for TWI interface */
 	at91_set_A_periph(AT91_PIN_PA23, 0);		/* TWD */
 	at91_set_multi_drive(AT91_PIN_PA23, 1);
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 71ca1e0..0ccf63c 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -178,7 +178,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9261_i2c", &twi_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9g10_i2c", &twi_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
 	CLKDEV_CON_ID("pioB", &pioB_clk),
 	CLKDEV_CON_ID("pioC", &pioC_clk),
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index d830724..c94495d 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -316,24 +316,21 @@ static struct resource twi_resources[] = {
 	},
 };
 
-static const struct platform_device_id twi_ip_type = {
-	/*
-	 * driver_data is 2 for SAM9261 compatible ip, see enum twi_ip_id in
-	 * drivers/i2c/busses/i2c-at91.c
-	 */
-	.driver_data	= 2,
-};
-
 static struct platform_device at91sam9261_twi_device = {
-	.name		= "at91_i2c",
 	.id		= -1,
-	.id_entry	= &twi_ip_type,
 	.resource	= twi_resources,
 	.num_resources	= ARRAY_SIZE(twi_resources),
 };
 
 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
 {
+	/* IP version is not the same on 9261 and g10 */
+	if (cpu_is_at91sam9g10()) {
+		at91sam9261_twi_device.name = "at91sam9g10_i2c";
+	} else {
+		at91sam9261_twi_device.name = "at91sam9261_i2c";
+	}
+
 	/* pins used for TWI interface */
 	at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
 	at91_set_multi_drive(AT91_PIN_PA7, 1);
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 2a08305..a4d760c 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -193,7 +193,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9260_i2c", &twi_clk),
 	/* fake hclk clock */
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index eb6bbf8..7cff86c 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -574,7 +574,7 @@ static struct resource twi_resources[] = {
 };
 
 static struct platform_device at91sam9263_twi_device = {
-	.name		= "at91_i2c",
+	.name		= "at91sam9260_i2c",
 	.id		= -1,
 	.resource	= twi_resources,
 	.num_resources	= ARRAY_SIZE(twi_resources),
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index ddf3d37..15e62b9 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -237,8 +237,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb0_clk),
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.0", &twi0_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.1", &twi1_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9g10_i2c.0", &twi0_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9g10_i2c.1", &twi1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID(NULL, "atmel-trng", &trng_clk),
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index f001305..a61c7ec 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -653,7 +653,7 @@ static struct resource twi0_resources[] = {
 };
 
 static struct platform_device at91sam9g45_twi0_device = {
-	.name		= "at91_i2c",
+	.name		= "at91sam9g10_i2c",
 	.id		= 0,
 	.resource	= twi0_resources,
 	.num_resources	= ARRAY_SIZE(twi0_resources),
@@ -673,7 +673,7 @@ static struct resource twi1_resources[] = {
 };
 
 static struct platform_device at91sam9g45_twi1_device = {
-	.name		= "at91_i2c",
+	.name		= "at91sam9g10_i2c",
 	.id		= 1,
 	.resource	= twi1_resources,
 	.num_resources	= ARRAY_SIZE(twi1_resources),
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index bf79c1f..d708dfa 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -186,8 +186,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.0", &twi0_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.1", &twi1_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9g20_i2c.0", &twi0_clk),
+	CLKDEV_CON_DEV_ID(NULL, "at91sam9g20_i2c.1", &twi1_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
 	CLKDEV_CON_ID("pioB", &pioB_clk),
 	CLKDEV_CON_ID("pioC", &pioC_clk),
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index f09fff9..2df7411 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -346,7 +346,7 @@ static struct resource twi_resources[] = {
 };
 
 static struct platform_device at91sam9rl_twi_device = {
-	.name		= "at91_i2c",
+	.name		= "at91sam9g20_i2c",
 	.id		= -1,
 	.resource	= twi_resources,
 	.num_resources	= ARRAY_SIZE(twi_resources),
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 08aaee7..bcf9a5c 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -61,10 +61,10 @@
 #define	AT91_TWI_RHR		0x0030	/* Receive Holding Register */
 #define	AT91_TWI_THR		0x0034	/* Transmit Holding Register */
 
-enum twi_ip_id {
-	DEFAULT		= 0, /* default ip, no known limitations */
-	RM9200		= 1,
-	SAM9261		= 2,
+struct at91_twi_pdata {
+	unsigned	clk_max_div;
+	unsigned	clk_offset;
+	bool		has_unre_flag;
 };
 
 struct at91_twi_dev {
@@ -78,8 +78,8 @@ struct at91_twi_dev {
 	int			irq;
 	unsigned		transfer_status;
 	struct i2c_adapter	adapter;
-	enum twi_ip_id		ip_id;
 	unsigned		twi_cwgr_reg;
+	struct at91_twi_pdata	*pdata;
 };
 
 static unsigned at91_twi_read(struct at91_twi_dev *dev, unsigned reg)
@@ -114,16 +114,9 @@ static void at91_init_twi_bus(struct at91_twi_dev *dev)
 static void __devinit at91_calc_twi_clock(struct at91_twi_dev *dev, int twi_clk)
 {
 	int ckdiv, cdiv, div;
-	int offset = 4;
-	int max_ckdiv = 7;
-
-	if (dev->ip_id == RM9200) {
-		offset = 3;
-		max_ckdiv = 5;
-	} else if (dev->ip_id == SAM9261) {
-		offset = 4;
-		max_ckdiv = 5;
-	}
+	struct at91_twi_pdata *pdata = dev->pdata;
+	int offset = pdata->clk_offset;
+	int max_ckdiv = pdata->clk_max_div;
 
 	div = max(0, (int)DIV_ROUND_UP(clk_get_rate(dev->clk),
 				       2 * twi_clk) - offset);
@@ -209,6 +202,7 @@ static irqreturn_t atmel_twi_interrupt(int irq, void *dev_id)
 static int at91_do_twi_transfer(struct at91_twi_dev *dev)
 {
 	int ret;
+	bool has_unre_flag = dev->pdata->has_unre_flag;
 
 	dev_dbg(dev->dev, "transfer: %s %d bytes.\n",
 		(dev->msg->flags & I2C_M_RD) ? "read" : "write", dev->buf_len);
@@ -250,7 +244,7 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev)
 		dev_err(dev->dev, "overrun while reading\n");
 		return -EIO;
 	}
-	if (dev->transfer_status & AT91_TWI_UNRE && dev->ip_id == RM9200) {
+	if (has_unre_flag && dev->transfer_status & AT91_TWI_UNRE) {
 		dev_err(dev->dev, "underrun while writing\n");
 		return -EIO;
 	}
@@ -323,6 +317,57 @@ static struct i2c_algorithm at91_twi_algorithm = {
 	.functionality	= at91_twi_func,
 };
 
+static struct at91_twi_pdata at91rm9200_config = {
+	.clk_max_div = 5,
+	.clk_offset = 3,
+	.has_unre_flag = true,
+};
+
+static struct at91_twi_pdata at91sam9261_config = {
+	.clk_max_div = 5,
+	.clk_offset = 4,
+	.has_unre_flag = false,
+};
+
+static struct at91_twi_pdata at91sam9260_config = {
+	.clk_max_div = 7,
+	.clk_offset = 4,
+	.has_unre_flag = false,
+};
+
+static struct at91_twi_pdata at91sam9g20_config = {
+	.clk_max_div = 7,
+	.clk_offset = 4,
+	.has_unre_flag = false,
+};
+
+static struct at91_twi_pdata at91sam9g10_config = {
+	.clk_max_div = 7,
+	.clk_offset = 4,
+	.has_unre_flag = false,
+};
+
+static const struct platform_device_id at91_twi_devtypes[] = {
+	{
+		.name = "at91rm9200_i2c",
+		.driver_data = (unsigned long) &at91rm9200_config,
+	}, {
+		.name = "at91sam9261_i2c",
+		.driver_data = (unsigned long) &at91sam9261_config,
+	}, {
+		.name = "at91sam9260_i2c",
+		.driver_data = (unsigned long) &at91sam9260_config,
+	}, {
+		.name = "at91sam9g20_i2c",
+		.driver_data = (unsigned long) &at91sam9g20_config,
+	}, {
+		.name = "at91sam9g10_i2c",
+		.driver_data = (unsigned long) &at91sam9g10_config,
+	}, {
+		/* sentinel */
+	}
+};
+
 static int __devinit at91_twi_probe(struct platform_device *pdev)
 {
 	struct at91_twi_dev *dev;
@@ -339,6 +384,10 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)
 	if (!mem)
 		return -ENODEV;
 
+	dev->pdata = at91_twi_get_driver_data(pdev);
+	if (!dev->pdata)
+		return -ENODEV;
+
 	dev->base = devm_request_and_ioremap(&pdev->dev, mem);
 	if (!dev->base)
 		return -EBUSY;
@@ -354,9 +403,6 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)
 		return rc;
 	}
 
-	if (pdev->id_entry)
-		dev->ip_id = pdev->id_entry->driver_data;
-
 	platform_set_drvdata(pdev, dev);
 
 	dev->clk = devm_clk_get(dev->dev, NULL);
@@ -432,6 +478,7 @@ static const struct dev_pm_ops at91_twi_pm = {
 static struct platform_driver at91_twi_driver = {
 	.probe		= at91_twi_probe,
 	.remove		= __devexit_p(at91_twi_remove),
+	.id_table	= at91_twi_devtypes,
 	.driver		= {
 		.name	= "at91_i2c",
 		.owner	= THIS_MODULE,
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 4/8] ARM: at91: do not configure at91sam9g10 twi pio as open-drain
  2012-08-31  9:21 ` ludovic.desroches at atmel.com
@ 2012-08-31  9:21     ` ludovic.desroches at atmel.com
  -1 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w @ 2012-08-31  9:21 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
  Cc: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
	plagnioj-sclMFOaUSTBWk0Htik3J/w, n.voss-+umVssTZoCsb1SvskN2V4Q,
	Ludovic Desroches

From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>

As indicated in the datasheet, TWD and TWCK must not be programmed as
open-drain.

Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---
 arch/arm/mach-at91/at91sam9261_devices.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index c94495d..405f603 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -324,20 +324,22 @@ static struct platform_device at91sam9261_twi_device = {
 
 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
 {
-	/* IP version is not the same on 9261 and g10 */
+	/*
+	 * IP version is not the same on 9261 and g10 and only 9261 one
+	 * requires to configure PIO as open-drain.
+	 */
 	if (cpu_is_at91sam9g10()) {
 		at91sam9261_twi_device.name = "at91sam9g10_i2c";
+		at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
+		at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
 	} else {
 		at91sam9261_twi_device.name = "at91sam9261_i2c";
+		at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
+		at91_set_multi_drive(AT91_PIN_PA7, 1);
+		at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
+		at91_set_multi_drive(AT91_PIN_PA8, 1);
 	}
 
-	/* pins used for TWI interface */
-	at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
-	at91_set_multi_drive(AT91_PIN_PA7, 1);
-
-	at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
-	at91_set_multi_drive(AT91_PIN_PA8, 1);
-
 	i2c_register_board_info(0, devices, nr_devices);
 	platform_device_register(&at91sam9261_twi_device);
 }
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 4/8] ARM: at91: do not configure at91sam9g10 twi pio as open-drain
@ 2012-08-31  9:21     ` ludovic.desroches at atmel.com
  0 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches at atmel.com @ 2012-08-31  9:21 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ludovic Desroches <ludovic.desroches@atmel.com>

As indicated in the datasheet, TWD and TWCK must not be programmed as
open-drain.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 arch/arm/mach-at91/at91sam9261_devices.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index c94495d..405f603 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -324,20 +324,22 @@ static struct platform_device at91sam9261_twi_device = {
 
 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
 {
-	/* IP version is not the same on 9261 and g10 */
+	/*
+	 * IP version is not the same on 9261 and g10 and only 9261 one
+	 * requires to configure PIO as open-drain.
+	 */
 	if (cpu_is_at91sam9g10()) {
 		at91sam9261_twi_device.name = "at91sam9g10_i2c";
+		at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
+		at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
 	} else {
 		at91sam9261_twi_device.name = "at91sam9261_i2c";
+		at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
+		at91_set_multi_drive(AT91_PIN_PA7, 1);
+		at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
+		at91_set_multi_drive(AT91_PIN_PA8, 1);
 	}
 
-	/* pins used for TWI interface */
-	at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
-	at91_set_multi_drive(AT91_PIN_PA7, 1);
-
-	at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
-	at91_set_multi_drive(AT91_PIN_PA8, 1);
-
 	i2c_register_board_info(0, devices, nr_devices);
 	platform_device_register(&at91sam9261_twi_device);
 }
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 4/8] ARM: at91: do not configure at91sam9g10 twi pio as open-drain
  2012-08-31  9:21 ` ludovic.desroches at atmel.com
@ 2012-08-31  9:23     ` ludovic.desroches at atmel.com
  -1 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w @ 2012-08-31  9:23 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
  Cc: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
	plagnioj-sclMFOaUSTBWk0Htik3J/w, n.voss-+umVssTZoCsb1SvskN2V4Q,
	Ludovic Desroches

From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>

As indicated in the datasheet, TWD and TWCK must not be programmed as
open-drain.

Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---
 arch/arm/mach-at91/at91sam9261_devices.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index c94495d..405f603 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -324,20 +324,22 @@ static struct platform_device at91sam9261_twi_device = {
 
 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
 {
-	/* IP version is not the same on 9261 and g10 */
+	/*
+	 * IP version is not the same on 9261 and g10 and only 9261 one
+	 * requires to configure PIO as open-drain.
+	 */
 	if (cpu_is_at91sam9g10()) {
 		at91sam9261_twi_device.name = "at91sam9g10_i2c";
+		at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
+		at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
 	} else {
 		at91sam9261_twi_device.name = "at91sam9261_i2c";
+		at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
+		at91_set_multi_drive(AT91_PIN_PA7, 1);
+		at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
+		at91_set_multi_drive(AT91_PIN_PA8, 1);
 	}
 
-	/* pins used for TWI interface */
-	at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
-	at91_set_multi_drive(AT91_PIN_PA7, 1);
-
-	at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
-	at91_set_multi_drive(AT91_PIN_PA8, 1);
-
 	i2c_register_board_info(0, devices, nr_devices);
 	platform_device_register(&at91sam9261_twi_device);
 }
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 4/8] ARM: at91: do not configure at91sam9g10 twi pio as open-drain
@ 2012-08-31  9:23     ` ludovic.desroches at atmel.com
  0 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches at atmel.com @ 2012-08-31  9:23 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ludovic Desroches <ludovic.desroches@atmel.com>

As indicated in the datasheet, TWD and TWCK must not be programmed as
open-drain.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 arch/arm/mach-at91/at91sam9261_devices.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index c94495d..405f603 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -324,20 +324,22 @@ static struct platform_device at91sam9261_twi_device = {
 
 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
 {
-	/* IP version is not the same on 9261 and g10 */
+	/*
+	 * IP version is not the same on 9261 and g10 and only 9261 one
+	 * requires to configure PIO as open-drain.
+	 */
 	if (cpu_is_at91sam9g10()) {
 		at91sam9261_twi_device.name = "at91sam9g10_i2c";
+		at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
+		at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
 	} else {
 		at91sam9261_twi_device.name = "at91sam9261_i2c";
+		at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
+		at91_set_multi_drive(AT91_PIN_PA7, 1);
+		at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
+		at91_set_multi_drive(AT91_PIN_PA8, 1);
 	}
 
-	/* pins used for TWI interface */
-	at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
-	at91_set_multi_drive(AT91_PIN_PA7, 1);
-
-	at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
-	at91_set_multi_drive(AT91_PIN_PA8, 1);
-
 	i2c_register_board_info(0, devices, nr_devices);
 	platform_device_register(&at91sam9261_twi_device);
 }
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 5/8] i2c: at91: add dt support to i2c-at91
  2012-08-31  9:21 ` ludovic.desroches at atmel.com
@ 2012-08-31  9:23     ` ludovic.desroches at atmel.com
  -1 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w @ 2012-08-31  9:23 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
  Cc: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
	plagnioj-sclMFOaUSTBWk0Htik3J/w, n.voss-+umVssTZoCsb1SvskN2V4Q,
	Ludovic Desroches

From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>

Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---
 .../devicetree/bindings/i2c/atmel-i2c.txt          | 30 +++++++++++++
 drivers/i2c/busses/i2c-at91.c                      | 49 ++++++++++++++++++++++
 2 files changed, 79 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/atmel-i2c.txt

diff --git a/Documentation/devicetree/bindings/i2c/atmel-i2c.txt b/Documentation/devicetree/bindings/i2c/atmel-i2c.txt
new file mode 100644
index 0000000..b689a0d
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/atmel-i2c.txt
@@ -0,0 +1,30 @@
+I2C for Atmel platforms
+
+Required properties :
+- compatible : Must be "atmel,at91rm9200-i2c", "atmel,at91sam9261-i2c",
+     "atmel,at91sam9260-i2c", "atmel,at91sam9g20-i2c", "atmel,at91sam9g10-i2c"
+     or "atmel,at91sam9x5-i2c"
+- reg: physical base address of the controller and length of memory mapped
+     region.
+- interrupts: interrupt number to the cpu.
+- #address-cells = <1>;
+- #size-cells = <0>;
+
+Optional properties:
+- Child nodes conforming to i2c bus binding
+
+Examples :
+
+i2c0: i2c@fff84000 {
+	compatible = "atmel,at91sam9g20-i2c";
+	reg = <0xfff84000 0x100>;
+	interrupts = <12 4 6>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	24c512@50 {
+		compatible = "24c512";
+		reg = <0x50>;
+		pagesize = <128>;
+	}
+}
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index bcf9a5c..7a80982 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -24,6 +24,9 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_i2c.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
@@ -347,6 +350,12 @@ static struct at91_twi_pdata at91sam9g10_config = {
 	.has_unre_flag = false,
 };
 
+static struct at91_twi_pdata at91sam9x5_config = {
+	.clk_max_div = 7,
+	.clk_offset = 4,
+	.has_unre_flag = false,
+};
+
 static const struct platform_device_id at91_twi_devtypes[] = {
 	{
 		.name = "at91rm9200_i2c",
@@ -368,6 +377,42 @@ static const struct platform_device_id at91_twi_devtypes[] = {
 	}
 };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_twi_dt_ids[] = {
+	{
+		.compatible = "atmel,at91sam9260-i2c",
+		.data = &at91sam9260_config,
+	} , {
+		.compatible = "atmel,at91sam9g20-i2c",
+		.data = &at91sam9g20_config,
+	} , {
+		.compatible = "atmel,at91sam9g10-i2c",
+		.data = &at91sam9g10_config,
+	}, {
+		.compatible = "atmel,at91sam9x5-i2c",
+		.data = &at91sam9x5_config,
+	}, {
+		/* sentinel */
+	}
+};
+MODULE_DEVICE_TABLE(of, atmel_twi_dt_ids);
+#else
+#define atmel_twi_dt_ids NULL
+#endif
+
+static struct at91_twi_pdata * __devinit at91_twi_get_driver_data(
+					struct platform_device *pdev)
+{
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(atmel_twi_dt_ids, pdev->dev.of_node);
+		if (!match)
+			return NULL;
+		return match->data;
+	}
+	return (struct at91_twi_pdata *) platform_get_device_id(pdev)->driver_data;
+}
+
 static int __devinit at91_twi_probe(struct platform_device *pdev)
 {
 	struct at91_twi_dev *dev;
@@ -423,6 +468,7 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)
 	dev->adapter.dev.parent = dev->dev;
 	dev->adapter.nr = pdev->id;
 	dev->adapter.timeout = AT91_I2C_TIMEOUT;
+	dev->adapter.dev.of_node = pdev->dev.of_node;
 
 	rc = i2c_add_numbered_adapter(&dev->adapter);
 	if (rc) {
@@ -432,6 +478,8 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)
 		return rc;
 	}
 
+	of_i2c_register_devices(&dev->adapter);
+
 	dev_info(dev->dev, "AT91 i2c bus driver.\n");
 	return 0;
 }
@@ -482,6 +530,7 @@ static struct platform_driver at91_twi_driver = {
 	.driver		= {
 		.name	= "at91_i2c",
 		.owner	= THIS_MODULE,
+		.of_match_table = atmel_twi_dt_ids,
 		.pm	= at91_twi_pm_ops,
 	},
 };
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 5/8] i2c: at91: add dt support to i2c-at91
@ 2012-08-31  9:23     ` ludovic.desroches at atmel.com
  0 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches at atmel.com @ 2012-08-31  9:23 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 .../devicetree/bindings/i2c/atmel-i2c.txt          | 30 +++++++++++++
 drivers/i2c/busses/i2c-at91.c                      | 49 ++++++++++++++++++++++
 2 files changed, 79 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/atmel-i2c.txt

diff --git a/Documentation/devicetree/bindings/i2c/atmel-i2c.txt b/Documentation/devicetree/bindings/i2c/atmel-i2c.txt
new file mode 100644
index 0000000..b689a0d
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/atmel-i2c.txt
@@ -0,0 +1,30 @@
+I2C for Atmel platforms
+
+Required properties :
+- compatible : Must be "atmel,at91rm9200-i2c", "atmel,at91sam9261-i2c",
+     "atmel,at91sam9260-i2c", "atmel,at91sam9g20-i2c", "atmel,at91sam9g10-i2c"
+     or "atmel,at91sam9x5-i2c"
+- reg: physical base address of the controller and length of memory mapped
+     region.
+- interrupts: interrupt number to the cpu.
+- #address-cells = <1>;
+- #size-cells = <0>;
+
+Optional properties:
+- Child nodes conforming to i2c bus binding
+
+Examples :
+
+i2c0: i2c at fff84000 {
+	compatible = "atmel,at91sam9g20-i2c";
+	reg = <0xfff84000 0x100>;
+	interrupts = <12 4 6>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	24c512 at 50 {
+		compatible = "24c512";
+		reg = <0x50>;
+		pagesize = <128>;
+	}
+}
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index bcf9a5c..7a80982 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -24,6 +24,9 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_i2c.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
@@ -347,6 +350,12 @@ static struct at91_twi_pdata at91sam9g10_config = {
 	.has_unre_flag = false,
 };
 
+static struct at91_twi_pdata at91sam9x5_config = {
+	.clk_max_div = 7,
+	.clk_offset = 4,
+	.has_unre_flag = false,
+};
+
 static const struct platform_device_id at91_twi_devtypes[] = {
 	{
 		.name = "at91rm9200_i2c",
@@ -368,6 +377,42 @@ static const struct platform_device_id at91_twi_devtypes[] = {
 	}
 };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_twi_dt_ids[] = {
+	{
+		.compatible = "atmel,at91sam9260-i2c",
+		.data = &at91sam9260_config,
+	} , {
+		.compatible = "atmel,at91sam9g20-i2c",
+		.data = &at91sam9g20_config,
+	} , {
+		.compatible = "atmel,at91sam9g10-i2c",
+		.data = &at91sam9g10_config,
+	}, {
+		.compatible = "atmel,at91sam9x5-i2c",
+		.data = &at91sam9x5_config,
+	}, {
+		/* sentinel */
+	}
+};
+MODULE_DEVICE_TABLE(of, atmel_twi_dt_ids);
+#else
+#define atmel_twi_dt_ids NULL
+#endif
+
+static struct at91_twi_pdata * __devinit at91_twi_get_driver_data(
+					struct platform_device *pdev)
+{
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(atmel_twi_dt_ids, pdev->dev.of_node);
+		if (!match)
+			return NULL;
+		return match->data;
+	}
+	return (struct at91_twi_pdata *) platform_get_device_id(pdev)->driver_data;
+}
+
 static int __devinit at91_twi_probe(struct platform_device *pdev)
 {
 	struct at91_twi_dev *dev;
@@ -423,6 +468,7 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)
 	dev->adapter.dev.parent = dev->dev;
 	dev->adapter.nr = pdev->id;
 	dev->adapter.timeout = AT91_I2C_TIMEOUT;
+	dev->adapter.dev.of_node = pdev->dev.of_node;
 
 	rc = i2c_add_numbered_adapter(&dev->adapter);
 	if (rc) {
@@ -432,6 +478,8 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)
 		return rc;
 	}
 
+	of_i2c_register_devices(&dev->adapter);
+
 	dev_info(dev->dev, "AT91 i2c bus driver.\n");
 	return 0;
 }
@@ -482,6 +530,7 @@ static struct platform_driver at91_twi_driver = {
 	.driver		= {
 		.name	= "at91_i2c",
 		.owner	= THIS_MODULE,
+		.of_match_table = atmel_twi_dt_ids,
 		.pm	= at91_twi_pm_ops,
 	},
 };
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 6/8] ARM: at91: add clocks for I2C DT entries
  2012-08-31  9:21 ` ludovic.desroches at atmel.com
@ 2012-08-31  9:24     ` ludovic.desroches at atmel.com
  -1 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w @ 2012-08-31  9:24 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
  Cc: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
	plagnioj-sclMFOaUSTBWk0Htik3J/w, n.voss-+umVssTZoCsb1SvskN2V4Q,
	Ludovic Desroches

From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>

Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---
 arch/arm/mach-at91/at91sam9260.c | 1 +
 arch/arm/mach-at91/at91sam9263.c | 1 +
 arch/arm/mach-at91/at91sam9g45.c | 2 ++
 arch/arm/mach-at91/at91sam9n12.c | 2 ++
 arch/arm/mach-at91/at91sam9x5.c  | 6 +++---
 5 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 5f86e71..43f529a 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -221,6 +221,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("usart", "fffd0000.serial", &usart3_clk),
 	CLKDEV_CON_DEV_ID("usart", "fffd4000.serial", &usart4_clk),
 	CLKDEV_CON_DEV_ID("usart", "fffd8000.serial", &usart5_clk),
+	CLKDEV_CON_DEV_ID(NULL, "fffac000.i2c", &twi_clk),
 	/* more tc lookup table for DT entries */
 	CLKDEV_CON_DEV_ID("t0_clk", "fffa0000.timer", &tc0_clk),
 	CLKDEV_CON_DEV_ID("t1_clk", "fffa0000.timer", &tc1_clk),
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index a4d760c..514757e 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -211,6 +211,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("hclk", "a00000.ohci", &ohci_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "fffa4000.spi", &spi0_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "fffa8000.spi", &spi1_clk),
+	CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 15e62b9..9f3beba 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -256,6 +256,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "fffd4000.timer", &tcb0_clk),
 	CLKDEV_CON_DEV_ID("hclk", "700000.ohci", &uhphs_clk),
 	CLKDEV_CON_DEV_ID("ehci_clk", "800000.ehci", &uhphs_clk),
+	CLKDEV_CON_DEV_ID(NULL, "fff84000.i2c", &twi0_clk),
+	CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi1_clk),
 	/* fake hclk clock */
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c
index 0849466..732d3d3 100644
--- a/arch/arm/mach-at91/at91sam9n12.c
+++ b/arch/arm/mach-at91/at91sam9n12.c
@@ -169,6 +169,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb_clk),
 	CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb_clk),
 	CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma_clk),
+	CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
+	CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
 	CLKDEV_CON_ID("pioA", &pioAB_clk),
 	CLKDEV_CON_ID("pioB", &pioAB_clk),
 	CLKDEV_CON_ID("pioC", &pioCD_clk),
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index 4bad4a2..e503538 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -231,9 +231,9 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk),
 	CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma0_clk),
 	CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller", &dma1_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.0", &twi0_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.1", &twi1_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.2", &twi2_clk),
+	CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
+	CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
+	CLKDEV_CON_DEV_ID(NULL, "f8018000.i2c", &twi2_clk),
 	CLKDEV_CON_ID("pioA", &pioAB_clk),
 	CLKDEV_CON_ID("pioB", &pioAB_clk),
 	CLKDEV_CON_ID("pioC", &pioCD_clk),
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 6/8] ARM: at91: add clocks for I2C DT entries
@ 2012-08-31  9:24     ` ludovic.desroches at atmel.com
  0 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches at atmel.com @ 2012-08-31  9:24 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 arch/arm/mach-at91/at91sam9260.c | 1 +
 arch/arm/mach-at91/at91sam9263.c | 1 +
 arch/arm/mach-at91/at91sam9g45.c | 2 ++
 arch/arm/mach-at91/at91sam9n12.c | 2 ++
 arch/arm/mach-at91/at91sam9x5.c  | 6 +++---
 5 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 5f86e71..43f529a 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -221,6 +221,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("usart", "fffd0000.serial", &usart3_clk),
 	CLKDEV_CON_DEV_ID("usart", "fffd4000.serial", &usart4_clk),
 	CLKDEV_CON_DEV_ID("usart", "fffd8000.serial", &usart5_clk),
+	CLKDEV_CON_DEV_ID(NULL, "fffac000.i2c", &twi_clk),
 	/* more tc lookup table for DT entries */
 	CLKDEV_CON_DEV_ID("t0_clk", "fffa0000.timer", &tc0_clk),
 	CLKDEV_CON_DEV_ID("t1_clk", "fffa0000.timer", &tc1_clk),
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index a4d760c..514757e 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -211,6 +211,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("hclk", "a00000.ohci", &ohci_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "fffa4000.spi", &spi0_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "fffa8000.spi", &spi1_clk),
+	CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 15e62b9..9f3beba 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -256,6 +256,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "fffd4000.timer", &tcb0_clk),
 	CLKDEV_CON_DEV_ID("hclk", "700000.ohci", &uhphs_clk),
 	CLKDEV_CON_DEV_ID("ehci_clk", "800000.ehci", &uhphs_clk),
+	CLKDEV_CON_DEV_ID(NULL, "fff84000.i2c", &twi0_clk),
+	CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi1_clk),
 	/* fake hclk clock */
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c
index 0849466..732d3d3 100644
--- a/arch/arm/mach-at91/at91sam9n12.c
+++ b/arch/arm/mach-at91/at91sam9n12.c
@@ -169,6 +169,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb_clk),
 	CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb_clk),
 	CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma_clk),
+	CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
+	CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
 	CLKDEV_CON_ID("pioA", &pioAB_clk),
 	CLKDEV_CON_ID("pioB", &pioAB_clk),
 	CLKDEV_CON_ID("pioC", &pioCD_clk),
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index 4bad4a2..e503538 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -231,9 +231,9 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk),
 	CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma0_clk),
 	CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller", &dma1_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.0", &twi0_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.1", &twi1_clk),
-	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.2", &twi2_clk),
+	CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
+	CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
+	CLKDEV_CON_DEV_ID(NULL, "f8018000.i2c", &twi2_clk),
 	CLKDEV_CON_ID("pioA", &pioAB_clk),
 	CLKDEV_CON_ID("pioB", &pioAB_clk),
 	CLKDEV_CON_ID("pioC", &pioCD_clk),
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 7/8] ARM: dts: add twi nodes for atmel SOCs
  2012-08-31  9:21 ` ludovic.desroches at atmel.com
@ 2012-08-31  9:24   ` ludovic.desroches at atmel.com
  -1 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches @ 2012-08-31  9:24 UTC (permalink / raw)
  To: linux-arm-kernel, linux-i2c, devicetree-discuss
  Cc: plagnioj, n.voss, nicolas.ferre, Ludovic Desroches

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Add twi nodes for atmel SOCs and remove i2c-gpio ones.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 arch/arm/boot/dts/at91sam9260.dtsi | 23 ++++++-------
 arch/arm/boot/dts/at91sam9263.dtsi | 23 ++++++-------
 arch/arm/boot/dts/at91sam9g20.dtsi |  4 +++
 arch/arm/boot/dts/at91sam9g45.dtsi | 33 +++++++++++-------
 arch/arm/boot/dts/at91sam9n12.dtsi | 33 +++++++++++-------
 arch/arm/boot/dts/at91sam9x5.dtsi  | 69 +++++++++++++++++---------------------
 6 files changed, 94 insertions(+), 91 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index 66389c1..8128963 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -28,6 +28,7 @@
 		gpio2 = &pioC;
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
+		i2c0 = &i2c0;
 	};
 	cpus {
 		cpu@0 {
@@ -199,6 +200,15 @@
 				status = "disabled";
 			};
 
+			i2c0: i2c@fffac000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xfffac000 0x100>;
+				interrupts = <11 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
 			adc0: adc@fffe0000 {
 				compatible = "atmel,at91sam9260-adc";
 				reg = <0xfffe0000 0x100>;
@@ -258,17 +268,4 @@
 			status = "disabled";
 		};
 	};
-
-	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>;
-		status = "disabled";
-	};
 };
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index b460d6c..34dd4f5 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -24,6 +24,7 @@
 		gpio3 = &pioD;
 		gpio4 = &pioE;
 		tcb0 = &tcb0;
+		i2c0 = &i2c0;
 	};
 	cpus {
 		cpu@0 {
@@ -180,6 +181,15 @@
 				interrupts = <24 4 2>;
 				status = "disabled";
 			};
+
+			i2c0: i2c@fff88000 {
+				compatible = "atmel,at91sam9263-i2c";
+				reg = <0xfff88000 0x100>;
+				interrupts = <13 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
 		};
 
 		nand0: nand@40000000 {
@@ -205,17 +215,4 @@
 			status = "disabled";
 		};
 	};
-
-	i2c@0 {
-		compatible = "i2c-gpio";
-		gpios = <&pioB 4 0 /* sda */
-			 &pioB 5 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>;
-		status = "disabled";
-	};
 };
diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi
index 2a1d1ca..75ce6e7 100644
--- a/arch/arm/boot/dts/at91sam9g20.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20.dtsi
@@ -18,6 +18,10 @@
 
 	ahb {
 		apb {
+			i2c0: i2c@fffac000 {
+				compatible = "atmel,at91sam9g20-i2c";
+			};
+
 			adc0: adc@fffe0000 {
 				atmel,adc-startup-time = <40>;
 			};
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index bafa880..e06cb8a 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -29,6 +29,8 @@
 		gpio4 = &pioE;
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
+		i2c0 = &i2c0;
+		i2c1 = &i2c1;
 	};
 	cpus {
 		cpu@0 {
@@ -201,6 +203,24 @@
 				status = "disabled";
 			};
 
+			i2c0: i2c@fff84000 {
+				compatible = "atmel,at91sam9g10-i2c";
+				reg = <0xfff84000 0x100>;
+				interrupts = <12 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c1: i2c@fff88000 {
+				compatible = "atmel,at91sam9g10-i2c";
+				reg = <0xfff88000 0x100>;
+				interrupts = <13 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
 			adc0: adc@fffb0000 {
 				compatible = "atmel,at91sam9260-adc";
 				reg = <0xfffb0000 0x100>;
@@ -269,17 +289,4 @@
 			status = "disabled";
 		};
 	};
-
-	i2c@0 {
-		compatible = "i2c-gpio";
-		gpios = <&pioA 20 0 /* sda */
-			 &pioA 21 0 /* scl */
-			>;
-		i2c-gpio,sda-open-drain;
-		i2c-gpio,scl-open-drain;
-		i2c-gpio,delay-us = <5>;	/* ~100 kHz */
-		#address-cells = <1>;
-		#size-cells = <0>;
-		status = "disabled";
-	};
 };
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index bfac0df..0c05bb9 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -26,6 +26,8 @@
 		gpio3 = &pioD;
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
+		i2c0 = &i2c0;
+		i2c1 = &i2c1;
 	};
 	cpus {
 		cpu@0 {
@@ -178,6 +180,24 @@
 				atmel,use-dma-tx;
 				status = "disabled";
 			};
+
+			i2c0: i2c@f8010000 {
+				compatible = "atmel,at91sam9x5-i2c";
+				reg = <0xf8010000 0x100>;
+				interrupts = <9 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c1: i2c@f8014000 {
+				compatible = "atmel,at91sam9x5-i2c";
+				reg = <0xf8014000 0x100>;
+				interrupts = <10 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
 		};
 
 		nand0: nand@40000000 {
@@ -205,17 +225,4 @@
 			status = "disabled";
 		};
 	};
-
-	i2c@0 {
-		compatible = "i2c-gpio";
-		gpios = <&pioA 30 0 /* sda */
-			 &pioA 31 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>;
-		status = "disabled";
-	};
 };
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 4a18c39..907b89e 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -27,6 +27,9 @@
 		gpio3 = &pioD;
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
+		i2c0 = &i2c0;
+		i2c1 = &i2c1;
+		i2c2 = &i2c2;
 	};
 	cpus {
 		cpu@0 {
@@ -192,6 +195,33 @@
 				status = "disabled";
 			};
 
+			i2c0: i2c@f8010000 {
+				compatible = "atmel,at91sam9x5-i2c";
+				reg = <0xf8010000 0x100>;
+				interrupts = <9 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c1: i2c@f8014000 {
+				compatible = "atmel,at91sam9x5-i2c";
+				reg = <0xf8014000 0x100>;
+				interrupts = <10 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c2: i2c@f8018000 {
+				compatible = "atmel,at91sam9x5-i2c";
+				reg = <0xf8018000 0x100>;
+				interrupts = <11 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
 			adc0: adc@f804c000 {
 				compatible = "atmel,at91sam9260-adc";
 				reg = <0xf804c000 0x100>;
@@ -260,43 +290,4 @@
 			status = "disabled";
 		};
 	};
-
-	i2c@0 {
-		compatible = "i2c-gpio";
-		gpios = <&pioA 30 0 /* sda */
-			 &pioA 31 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>;
-		status = "disabled";
-	};
-
-	i2c@1 {
-		compatible = "i2c-gpio";
-		gpios = <&pioC 0 0 /* sda */
-			 &pioC 1 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>;
-		status = "disabled";
-	};
-
-	i2c@2 {
-		compatible = "i2c-gpio";
-		gpios = <&pioB 4 0 /* sda */
-			 &pioB 5 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>;
-		status = "disabled";
-	};
 };
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 7/8] ARM: dts: add twi nodes for atmel SOCs
@ 2012-08-31  9:24   ` ludovic.desroches at atmel.com
  0 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches at atmel.com @ 2012-08-31  9:24 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Add twi nodes for atmel SOCs and remove i2c-gpio ones.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 arch/arm/boot/dts/at91sam9260.dtsi | 23 ++++++-------
 arch/arm/boot/dts/at91sam9263.dtsi | 23 ++++++-------
 arch/arm/boot/dts/at91sam9g20.dtsi |  4 +++
 arch/arm/boot/dts/at91sam9g45.dtsi | 33 +++++++++++-------
 arch/arm/boot/dts/at91sam9n12.dtsi | 33 +++++++++++-------
 arch/arm/boot/dts/at91sam9x5.dtsi  | 69 +++++++++++++++++---------------------
 6 files changed, 94 insertions(+), 91 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index 66389c1..8128963 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -28,6 +28,7 @@
 		gpio2 = &pioC;
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
+		i2c0 = &i2c0;
 	};
 	cpus {
 		cpu at 0 {
@@ -199,6 +200,15 @@
 				status = "disabled";
 			};
 
+			i2c0: i2c at fffac000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xfffac000 0x100>;
+				interrupts = <11 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
 			adc0: adc at fffe0000 {
 				compatible = "atmel,at91sam9260-adc";
 				reg = <0xfffe0000 0x100>;
@@ -258,17 +268,4 @@
 			status = "disabled";
 		};
 	};
-
-	i2c at 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>;
-		status = "disabled";
-	};
 };
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index b460d6c..34dd4f5 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -24,6 +24,7 @@
 		gpio3 = &pioD;
 		gpio4 = &pioE;
 		tcb0 = &tcb0;
+		i2c0 = &i2c0;
 	};
 	cpus {
 		cpu at 0 {
@@ -180,6 +181,15 @@
 				interrupts = <24 4 2>;
 				status = "disabled";
 			};
+
+			i2c0: i2c at fff88000 {
+				compatible = "atmel,at91sam9263-i2c";
+				reg = <0xfff88000 0x100>;
+				interrupts = <13 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
 		};
 
 		nand0: nand at 40000000 {
@@ -205,17 +215,4 @@
 			status = "disabled";
 		};
 	};
-
-	i2c at 0 {
-		compatible = "i2c-gpio";
-		gpios = <&pioB 4 0 /* sda */
-			 &pioB 5 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>;
-		status = "disabled";
-	};
 };
diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi
index 2a1d1ca..75ce6e7 100644
--- a/arch/arm/boot/dts/at91sam9g20.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20.dtsi
@@ -18,6 +18,10 @@
 
 	ahb {
 		apb {
+			i2c0: i2c at fffac000 {
+				compatible = "atmel,at91sam9g20-i2c";
+			};
+
 			adc0: adc at fffe0000 {
 				atmel,adc-startup-time = <40>;
 			};
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index bafa880..e06cb8a 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -29,6 +29,8 @@
 		gpio4 = &pioE;
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
+		i2c0 = &i2c0;
+		i2c1 = &i2c1;
 	};
 	cpus {
 		cpu at 0 {
@@ -201,6 +203,24 @@
 				status = "disabled";
 			};
 
+			i2c0: i2c at fff84000 {
+				compatible = "atmel,at91sam9g10-i2c";
+				reg = <0xfff84000 0x100>;
+				interrupts = <12 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c1: i2c at fff88000 {
+				compatible = "atmel,at91sam9g10-i2c";
+				reg = <0xfff88000 0x100>;
+				interrupts = <13 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
 			adc0: adc at fffb0000 {
 				compatible = "atmel,at91sam9260-adc";
 				reg = <0xfffb0000 0x100>;
@@ -269,17 +289,4 @@
 			status = "disabled";
 		};
 	};
-
-	i2c at 0 {
-		compatible = "i2c-gpio";
-		gpios = <&pioA 20 0 /* sda */
-			 &pioA 21 0 /* scl */
-			>;
-		i2c-gpio,sda-open-drain;
-		i2c-gpio,scl-open-drain;
-		i2c-gpio,delay-us = <5>;	/* ~100 kHz */
-		#address-cells = <1>;
-		#size-cells = <0>;
-		status = "disabled";
-	};
 };
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index bfac0df..0c05bb9 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -26,6 +26,8 @@
 		gpio3 = &pioD;
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
+		i2c0 = &i2c0;
+		i2c1 = &i2c1;
 	};
 	cpus {
 		cpu at 0 {
@@ -178,6 +180,24 @@
 				atmel,use-dma-tx;
 				status = "disabled";
 			};
+
+			i2c0: i2c at f8010000 {
+				compatible = "atmel,at91sam9x5-i2c";
+				reg = <0xf8010000 0x100>;
+				interrupts = <9 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c1: i2c at f8014000 {
+				compatible = "atmel,at91sam9x5-i2c";
+				reg = <0xf8014000 0x100>;
+				interrupts = <10 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
 		};
 
 		nand0: nand at 40000000 {
@@ -205,17 +225,4 @@
 			status = "disabled";
 		};
 	};
-
-	i2c at 0 {
-		compatible = "i2c-gpio";
-		gpios = <&pioA 30 0 /* sda */
-			 &pioA 31 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>;
-		status = "disabled";
-	};
 };
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 4a18c39..907b89e 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -27,6 +27,9 @@
 		gpio3 = &pioD;
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
+		i2c0 = &i2c0;
+		i2c1 = &i2c1;
+		i2c2 = &i2c2;
 	};
 	cpus {
 		cpu at 0 {
@@ -192,6 +195,33 @@
 				status = "disabled";
 			};
 
+			i2c0: i2c at f8010000 {
+				compatible = "atmel,at91sam9x5-i2c";
+				reg = <0xf8010000 0x100>;
+				interrupts = <9 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c1: i2c at f8014000 {
+				compatible = "atmel,at91sam9x5-i2c";
+				reg = <0xf8014000 0x100>;
+				interrupts = <10 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c2: i2c at f8018000 {
+				compatible = "atmel,at91sam9x5-i2c";
+				reg = <0xf8018000 0x100>;
+				interrupts = <11 4 6>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
 			adc0: adc at f804c000 {
 				compatible = "atmel,at91sam9260-adc";
 				reg = <0xf804c000 0x100>;
@@ -260,43 +290,4 @@
 			status = "disabled";
 		};
 	};
-
-	i2c at 0 {
-		compatible = "i2c-gpio";
-		gpios = <&pioA 30 0 /* sda */
-			 &pioA 31 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>;
-		status = "disabled";
-	};
-
-	i2c at 1 {
-		compatible = "i2c-gpio";
-		gpios = <&pioC 0 0 /* sda */
-			 &pioC 1 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>;
-		status = "disabled";
-	};
-
-	i2c at 2 {
-		compatible = "i2c-gpio";
-		gpios = <&pioB 4 0 /* sda */
-			 &pioB 5 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>;
-		status = "disabled";
-	};
 };
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 8/8] ARM: dts: add twi nodes for atmel boards
  2012-08-31  9:21 ` ludovic.desroches at atmel.com
@ 2012-08-31  9:24     ` ludovic.desroches at atmel.com
  -1 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w @ 2012-08-31  9:24 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
  Cc: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
	plagnioj-sclMFOaUSTBWk0Htik3J/w, n.voss-+umVssTZoCsb1SvskN2V4Q,
	Ludovic Desroches

From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>

Use the atmel twi instead of gpio for i2c stuff.

Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---
 arch/arm/boot/dts/at91sam9263ek.dts         | 20 ++++++++++----------
 arch/arm/boot/dts/at91sam9g20ek_common.dtsi | 28 ++++++++++++++--------------
 arch/arm/boot/dts/at91sam9g25ek.dts         | 12 ++++++++++++
 arch/arm/boot/dts/at91sam9m10g45ek.dts      |  8 ++++++++
 arch/arm/boot/dts/at91sam9n12ek.dts         |  8 ++++++++
 5 files changed, 52 insertions(+), 24 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9263ek.dts b/arch/arm/boot/dts/at91sam9263ek.dts
index f86ac4b..772ab75 100644
--- a/arch/arm/boot/dts/at91sam9263ek.dts
+++ b/arch/arm/boot/dts/at91sam9263ek.dts
@@ -50,6 +50,16 @@
 				atmel,vbus-gpio = <&pioA 25 0>;
 				status = "okay";
 			};
+
+			i2c0: i2c@fff88000 {
+				status = "okay";
+
+				24c512@50 {
+					compatible = "24c512";
+					reg = <0x50>;
+					pagesize = <128>;
+				};
+			};
 		};
 
 		nand0: nand@40000000 {
@@ -143,14 +153,4 @@
 			gpio-key,wakeup;
 		};
 	};
-
-	i2c@0 {
-		status = "okay";
-
-		24c512@50 {
-			compatible = "24c512";
-			reg = <0x50>;
-			pagesize = <128>;
-		};
-	};
 };
diff --git a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
index b06c0db..712106b 100644
--- a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
@@ -51,6 +51,20 @@
 				atmel,vbus-gpio = <&pioC 5 0>;
 				status = "okay";
 			};
+
+			i2c0: i2c@fffac000 {
+				status = "okay";
+
+				24c512@50 {
+					compatible = "24c512";
+					reg = <0x50>;
+				};
+
+				wm8731@1b {
+					compatible = "wm8731";
+					reg = <0x1b>;
+				};
+			};
 		};
 
 		nand0: nand@40000000 {
@@ -106,20 +120,6 @@
 		};
 	};
 
-	i2c@0 {
-		status = "okay";
-
-		24c512@50 {
-			compatible = "24c512";
-			reg = <0x50>;
-		};
-
-		wm8731@1b {
-			compatible = "wm8731";
-			reg = <0x1b>;
-		};
-	};
-
 	gpio_keys {
 		compatible = "gpio-keys";
 		#address-cells = <1>;
diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts
index 7829a4d..3b0adbc 100644
--- a/arch/arm/boot/dts/at91sam9g25ek.dts
+++ b/arch/arm/boot/dts/at91sam9g25ek.dts
@@ -32,6 +32,18 @@
 				phy-mode = "rmii";
 				status = "okay";
 			};
+
+			i2c0: i2c@f8010000 {
+				status = "okay";
+			};
+
+			i2c1: i2c@f8014000 {
+				status = "okay";
+			};
+
+			i2c2: i2c@f8018000 {
+				status = "okay";
+			};
 		};
 
 		usb0: ohci@00600000 {
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
index a3633bd..15e1dd4 100644
--- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
+++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
@@ -46,6 +46,14 @@
 				phy-mode = "rmii";
 				status = "okay";
 			};
+
+			i2c0: i2c@fff84000 {
+				status = "okay";
+			};
+
+			i2c1: i2c@fff88000 {
+				status = "okay";
+			};
 		};
 
 		nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts
index f4e43e3..912b2c2 100644
--- a/arch/arm/boot/dts/at91sam9n12ek.dts
+++ b/arch/arm/boot/dts/at91sam9n12ek.dts
@@ -37,6 +37,14 @@
 			dbgu: serial@fffff200 {
 				status = "okay";
 			};
+
+			i2c0: i2c@f8010000 {
+				status = "okay";
+			};
+
+			i2c1: i2c@f8014000 {
+				status = "okay";
+			};
 		};
 
 		nand0: nand@40000000 {
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH 8/8] ARM: dts: add twi nodes for atmel boards
@ 2012-08-31  9:24     ` ludovic.desroches at atmel.com
  0 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches at atmel.com @ 2012-08-31  9:24 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Use the atmel twi instead of gpio for i2c stuff.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 arch/arm/boot/dts/at91sam9263ek.dts         | 20 ++++++++++----------
 arch/arm/boot/dts/at91sam9g20ek_common.dtsi | 28 ++++++++++++++--------------
 arch/arm/boot/dts/at91sam9g25ek.dts         | 12 ++++++++++++
 arch/arm/boot/dts/at91sam9m10g45ek.dts      |  8 ++++++++
 arch/arm/boot/dts/at91sam9n12ek.dts         |  8 ++++++++
 5 files changed, 52 insertions(+), 24 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9263ek.dts b/arch/arm/boot/dts/at91sam9263ek.dts
index f86ac4b..772ab75 100644
--- a/arch/arm/boot/dts/at91sam9263ek.dts
+++ b/arch/arm/boot/dts/at91sam9263ek.dts
@@ -50,6 +50,16 @@
 				atmel,vbus-gpio = <&pioA 25 0>;
 				status = "okay";
 			};
+
+			i2c0: i2c at fff88000 {
+				status = "okay";
+
+				24c512 at 50 {
+					compatible = "24c512";
+					reg = <0x50>;
+					pagesize = <128>;
+				};
+			};
 		};
 
 		nand0: nand at 40000000 {
@@ -143,14 +153,4 @@
 			gpio-key,wakeup;
 		};
 	};
-
-	i2c at 0 {
-		status = "okay";
-
-		24c512 at 50 {
-			compatible = "24c512";
-			reg = <0x50>;
-			pagesize = <128>;
-		};
-	};
 };
diff --git a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
index b06c0db..712106b 100644
--- a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
@@ -51,6 +51,20 @@
 				atmel,vbus-gpio = <&pioC 5 0>;
 				status = "okay";
 			};
+
+			i2c0: i2c at fffac000 {
+				status = "okay";
+
+				24c512 at 50 {
+					compatible = "24c512";
+					reg = <0x50>;
+				};
+
+				wm8731 at 1b {
+					compatible = "wm8731";
+					reg = <0x1b>;
+				};
+			};
 		};
 
 		nand0: nand at 40000000 {
@@ -106,20 +120,6 @@
 		};
 	};
 
-	i2c at 0 {
-		status = "okay";
-
-		24c512 at 50 {
-			compatible = "24c512";
-			reg = <0x50>;
-		};
-
-		wm8731 at 1b {
-			compatible = "wm8731";
-			reg = <0x1b>;
-		};
-	};
-
 	gpio_keys {
 		compatible = "gpio-keys";
 		#address-cells = <1>;
diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts
index 7829a4d..3b0adbc 100644
--- a/arch/arm/boot/dts/at91sam9g25ek.dts
+++ b/arch/arm/boot/dts/at91sam9g25ek.dts
@@ -32,6 +32,18 @@
 				phy-mode = "rmii";
 				status = "okay";
 			};
+
+			i2c0: i2c at f8010000 {
+				status = "okay";
+			};
+
+			i2c1: i2c at f8014000 {
+				status = "okay";
+			};
+
+			i2c2: i2c at f8018000 {
+				status = "okay";
+			};
 		};
 
 		usb0: ohci at 00600000 {
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
index a3633bd..15e1dd4 100644
--- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
+++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
@@ -46,6 +46,14 @@
 				phy-mode = "rmii";
 				status = "okay";
 			};
+
+			i2c0: i2c at fff84000 {
+				status = "okay";
+			};
+
+			i2c1: i2c at fff88000 {
+				status = "okay";
+			};
 		};
 
 		nand0: nand at 40000000 {
diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts
index f4e43e3..912b2c2 100644
--- a/arch/arm/boot/dts/at91sam9n12ek.dts
+++ b/arch/arm/boot/dts/at91sam9n12ek.dts
@@ -37,6 +37,14 @@
 			dbgu: serial at fffff200 {
 				status = "okay";
 			};
+
+			i2c0: i2c at f8010000 {
+				status = "okay";
+			};
+
+			i2c1: i2c at f8014000 {
+				status = "okay";
+			};
 		};
 
 		nand0: nand at 40000000 {
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 65+ messages in thread

* Re: [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
  2012-08-31  9:21   ` ludovic.desroches at atmel.com
@ 2012-08-31 14:29     ` Jean-Christophe PLAGNIOL-VILLARD
  -1 siblings, 0 replies; 65+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-31 14:29 UTC (permalink / raw)
  To: ludovic.desroches
  Cc: devicetree-discuss, n.voss, nicolas.ferre, linux-i2c, linux-arm-kernel

On 11:21 Fri 31 Aug     , ludovic.desroches@atmel.com wrote:
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Use the id_table to store configuration structures which are depending on
> SoC.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> ---
>  arch/arm/mach-at91/at91rm9200.c          |  2 +-
>  arch/arm/mach-at91/at91rm9200_devices.c  | 11 +----
>  arch/arm/mach-at91/at91sam9260.c         |  3 +-
>  arch/arm/mach-at91/at91sam9260_devices.c |  8 ++-
>  arch/arm/mach-at91/at91sam9261.c         |  3 +-
>  arch/arm/mach-at91/at91sam9261_devices.c | 17 +++----
>  arch/arm/mach-at91/at91sam9263.c         |  2 +-
>  arch/arm/mach-at91/at91sam9263_devices.c |  2 +-
>  arch/arm/mach-at91/at91sam9g45.c         |  4 +-
>  arch/arm/mach-at91/at91sam9g45_devices.c |  4 +-
>  arch/arm/mach-at91/at91sam9rl.c          |  4 +-
>  arch/arm/mach-at91/at91sam9rl_devices.c  |  2 +-
>  drivers/i2c/busses/i2c-at91.c            | 85 +++++++++++++++++++++++++-------
>  13 files changed, 95 insertions(+), 52 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
> index f2112f9..0bc91e5 100644
> --- a/arch/arm/mach-at91/at91rm9200.c
> +++ b/arch/arm/mach-at91/at91rm9200.c
> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>  	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
>  	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
>  	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c", &twi_clk),
use i2c-xxx as on other drivers

and I do not like to have platform_device_id

as we need to touch the driver to add a new soc

please use platform data

Best Regards,
J.

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
@ 2012-08-31 14:29     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 65+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-31 14:29 UTC (permalink / raw)
  To: linux-arm-kernel

On 11:21 Fri 31 Aug     , ludovic.desroches at atmel.com wrote:
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Use the id_table to store configuration structures which are depending on
> SoC.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> ---
>  arch/arm/mach-at91/at91rm9200.c          |  2 +-
>  arch/arm/mach-at91/at91rm9200_devices.c  | 11 +----
>  arch/arm/mach-at91/at91sam9260.c         |  3 +-
>  arch/arm/mach-at91/at91sam9260_devices.c |  8 ++-
>  arch/arm/mach-at91/at91sam9261.c         |  3 +-
>  arch/arm/mach-at91/at91sam9261_devices.c | 17 +++----
>  arch/arm/mach-at91/at91sam9263.c         |  2 +-
>  arch/arm/mach-at91/at91sam9263_devices.c |  2 +-
>  arch/arm/mach-at91/at91sam9g45.c         |  4 +-
>  arch/arm/mach-at91/at91sam9g45_devices.c |  4 +-
>  arch/arm/mach-at91/at91sam9rl.c          |  4 +-
>  arch/arm/mach-at91/at91sam9rl_devices.c  |  2 +-
>  drivers/i2c/busses/i2c-at91.c            | 85 +++++++++++++++++++++++++-------
>  13 files changed, 95 insertions(+), 52 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
> index f2112f9..0bc91e5 100644
> --- a/arch/arm/mach-at91/at91rm9200.c
> +++ b/arch/arm/mach-at91/at91rm9200.c
> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>  	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
>  	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
>  	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c", &twi_clk),
use i2c-xxx as on other drivers

and I do not like to have platform_device_id

as we need to touch the driver to add a new soc

please use platform data

Best Regards,
J.

^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH 7/8] ARM: dts: add twi nodes for atmel SOCs
  2012-08-31  9:24   ` ludovic.desroches at atmel.com
@ 2012-08-31 14:41     ` Jean-Christophe PLAGNIOL-VILLARD
  -1 siblings, 0 replies; 65+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-31 14:41 UTC (permalink / raw)
  To: ludovic.desroches
  Cc: devicetree-discuss, n.voss, nicolas.ferre, linux-i2c, linux-arm-kernel

On 11:24 Fri 31 Aug     , ludovic.desroches@atmel.com wrote:
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Add twi nodes for atmel SOCs and remove i2c-gpio ones.
Only drop the i2c-gpio on the soc that are kn own to have no issue on the hw
IP. For hte onther one keep both in the dtsi

Best Regards,
J.

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 7/8] ARM: dts: add twi nodes for atmel SOCs
@ 2012-08-31 14:41     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 65+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-31 14:41 UTC (permalink / raw)
  To: linux-arm-kernel

On 11:24 Fri 31 Aug     , ludovic.desroches at atmel.com wrote:
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Add twi nodes for atmel SOCs and remove i2c-gpio ones.
Only drop the i2c-gpio on the soc that are kn own to have no issue on the hw
IP. For hte onther one keep both in the dtsi

Best Regards,
J.

^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH 8/8] ARM: dts: add twi nodes for atmel boards
  2012-08-31  9:24     ` ludovic.desroches at atmel.com
@ 2012-08-31 14:42       ` Jean-Christophe PLAGNIOL-VILLARD
  -1 siblings, 0 replies; 65+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-31 14:42 UTC (permalink / raw)
  To: ludovic.desroches
  Cc: devicetree-discuss, n.voss, nicolas.ferre, linux-i2c, linux-arm-kernel

On 11:24 Fri 31 Aug     , ludovic.desroches@atmel.com wrote:
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Use the atmel twi instead of gpio for i2c stuff.
NACK as you do not update al the platform at the same time and break the Calao

Best Regards,
J.

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 8/8] ARM: dts: add twi nodes for atmel boards
@ 2012-08-31 14:42       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 65+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-31 14:42 UTC (permalink / raw)
  To: linux-arm-kernel

On 11:24 Fri 31 Aug     , ludovic.desroches at atmel.com wrote:
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Use the atmel twi instead of gpio for i2c stuff.
NACK as you do not update al the platform at the same time and break the Calao

Best Regards,
J.

^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH 7/8] ARM: dts: add twi nodes for atmel SOCs
  2012-08-31 14:41     ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-08-31 14:46         ` ludovic.desroches
  -1 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches @ 2012-08-31 14:46 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	n.voss-+umVssTZoCsb1SvskN2V4Q, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Le 08/31/2012 04:41 PM, Jean-Christophe PLAGNIOL-VILLARD a écrit :
> On 11:24 Fri 31 Aug     , ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org wrote:
>> From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
>>
>> Add twi nodes for atmel SOCs and remove i2c-gpio ones.
> Only drop the i2c-gpio on the soc that are kn own to have no issue on the hw
> IP. For hte onther one keep both in the dtsi
>

Ok I'll keep it.

Regards

Ludovic

> Best Regards,
> J.
>
>

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 7/8] ARM: dts: add twi nodes for atmel SOCs
@ 2012-08-31 14:46         ` ludovic.desroches
  0 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches @ 2012-08-31 14:46 UTC (permalink / raw)
  To: linux-arm-kernel

Le 08/31/2012 04:41 PM, Jean-Christophe PLAGNIOL-VILLARD a ?crit :
> On 11:24 Fri 31 Aug     , ludovic.desroches at atmel.com wrote:
>> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>>
>> Add twi nodes for atmel SOCs and remove i2c-gpio ones.
> Only drop the i2c-gpio on the soc that are kn own to have no issue on the hw
> IP. For hte onther one keep both in the dtsi
>

Ok I'll keep it.

Regards

Ludovic

> Best Regards,
> J.
>
>

^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
  2012-08-31 14:29     ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-08-31 14:51         ` Nicolas Ferre
  -1 siblings, 0 replies; 65+ messages in thread
From: Nicolas Ferre @ 2012-08-31 14:51 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD,
	ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	n.voss-+umVssTZoCsb1SvskN2V4Q

On 08/31/2012 04:29 PM, Jean-Christophe PLAGNIOL-VILLARD :
> On 11:21 Fri 31 Aug     , ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org wrote:
>> From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
>>
>> Use the id_table to store configuration structures which are depending on
>> SoC.
>>
>> Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
>> ---
>>  arch/arm/mach-at91/at91rm9200.c          |  2 +-
>>  arch/arm/mach-at91/at91rm9200_devices.c  | 11 +----
>>  arch/arm/mach-at91/at91sam9260.c         |  3 +-
>>  arch/arm/mach-at91/at91sam9260_devices.c |  8 ++-
>>  arch/arm/mach-at91/at91sam9261.c         |  3 +-
>>  arch/arm/mach-at91/at91sam9261_devices.c | 17 +++----
>>  arch/arm/mach-at91/at91sam9263.c         |  2 +-
>>  arch/arm/mach-at91/at91sam9263_devices.c |  2 +-
>>  arch/arm/mach-at91/at91sam9g45.c         |  4 +-
>>  arch/arm/mach-at91/at91sam9g45_devices.c |  4 +-
>>  arch/arm/mach-at91/at91sam9rl.c          |  4 +-
>>  arch/arm/mach-at91/at91sam9rl_devices.c  |  2 +-
>>  drivers/i2c/busses/i2c-at91.c            | 85 +++++++++++++++++++++++++-------
>>  13 files changed, 95 insertions(+), 52 deletions(-)
>>
>> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
>> index f2112f9..0bc91e5 100644
>> --- a/arch/arm/mach-at91/at91rm9200.c
>> +++ b/arch/arm/mach-at91/at91rm9200.c
>> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>>  	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
>>  	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
>>  	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
>> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
>> +	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c", &twi_clk),
> use i2c-xxx as on other drivers
> 
> and I do not like to have platform_device_id

Me, I like it and find this implementation very elegant.

> as we need to touch the driver to add a new soc

So what? We still keep the compatibility if the new SoC has it
compatibility assured with previous revision: there is nothing to modify.

> please use platform data

No, it does not have to be exposed to the user: these data are highly
dependent on the actual hardware (IP revision in fact). So, no need to
mess with platform data.

So I will acknowledge Ludo's patches.

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
@ 2012-08-31 14:51         ` Nicolas Ferre
  0 siblings, 0 replies; 65+ messages in thread
From: Nicolas Ferre @ 2012-08-31 14:51 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/31/2012 04:29 PM, Jean-Christophe PLAGNIOL-VILLARD :
> On 11:21 Fri 31 Aug     , ludovic.desroches at atmel.com wrote:
>> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>>
>> Use the id_table to store configuration structures which are depending on
>> SoC.
>>
>> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
>> ---
>>  arch/arm/mach-at91/at91rm9200.c          |  2 +-
>>  arch/arm/mach-at91/at91rm9200_devices.c  | 11 +----
>>  arch/arm/mach-at91/at91sam9260.c         |  3 +-
>>  arch/arm/mach-at91/at91sam9260_devices.c |  8 ++-
>>  arch/arm/mach-at91/at91sam9261.c         |  3 +-
>>  arch/arm/mach-at91/at91sam9261_devices.c | 17 +++----
>>  arch/arm/mach-at91/at91sam9263.c         |  2 +-
>>  arch/arm/mach-at91/at91sam9263_devices.c |  2 +-
>>  arch/arm/mach-at91/at91sam9g45.c         |  4 +-
>>  arch/arm/mach-at91/at91sam9g45_devices.c |  4 +-
>>  arch/arm/mach-at91/at91sam9rl.c          |  4 +-
>>  arch/arm/mach-at91/at91sam9rl_devices.c  |  2 +-
>>  drivers/i2c/busses/i2c-at91.c            | 85 +++++++++++++++++++++++++-------
>>  13 files changed, 95 insertions(+), 52 deletions(-)
>>
>> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
>> index f2112f9..0bc91e5 100644
>> --- a/arch/arm/mach-at91/at91rm9200.c
>> +++ b/arch/arm/mach-at91/at91rm9200.c
>> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>>  	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
>>  	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
>>  	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
>> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
>> +	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c", &twi_clk),
> use i2c-xxx as on other drivers
> 
> and I do not like to have platform_device_id

Me, I like it and find this implementation very elegant.

> as we need to touch the driver to add a new soc

So what? We still keep the compatibility if the new SoC has it
compatibility assured with previous revision: there is nothing to modify.

> please use platform data

No, it does not have to be exposed to the user: these data are highly
dependent on the actual hardware (IP revision in fact). So, no need to
mess with platform data.

So I will acknowledge Ludo's patches.

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH 7/8] ARM: dts: add twi nodes for atmel SOCs
  2012-08-31 14:41     ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-08-31 14:56         ` Nicolas Ferre
  -1 siblings, 0 replies; 65+ messages in thread
From: Nicolas Ferre @ 2012-08-31 14:56 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	n.voss-+umVssTZoCsb1SvskN2V4Q

On 08/31/2012 04:41 PM, Jean-Christophe PLAGNIOL-VILLARD :
> On 11:24 Fri 31 Aug     , ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org wrote:
>> From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
>>
>> Add twi nodes for atmel SOCs and remove i2c-gpio ones.
> Only drop the i2c-gpio on the soc that are kn own to have no issue on the hw
> IP. For hte onther one keep both in the dtsi

Yes, I agree with this.

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 7/8] ARM: dts: add twi nodes for atmel SOCs
@ 2012-08-31 14:56         ` Nicolas Ferre
  0 siblings, 0 replies; 65+ messages in thread
From: Nicolas Ferre @ 2012-08-31 14:56 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/31/2012 04:41 PM, Jean-Christophe PLAGNIOL-VILLARD :
> On 11:24 Fri 31 Aug     , ludovic.desroches at atmel.com wrote:
>> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>>
>> Add twi nodes for atmel SOCs and remove i2c-gpio ones.
> Only drop the i2c-gpio on the soc that are kn own to have no issue on the hw
> IP. For hte onther one keep both in the dtsi

Yes, I agree with this.

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH 8/8] ARM: dts: add twi nodes for atmel boards
  2012-08-31 14:42       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-08-31 15:07           ` Nicolas Ferre
  -1 siblings, 0 replies; 65+ messages in thread
From: Nicolas Ferre @ 2012-08-31 15:07 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	n.voss-+umVssTZoCsb1SvskN2V4Q

On 08/31/2012 04:42 PM, Jean-Christophe PLAGNIOL-VILLARD :
> On 11:24 Fri 31 Aug     , ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org wrote:
>> From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
>>
>> Use the atmel twi instead of gpio for i2c stuff.
> NACK as you do not update al the platform at the same time and break the Calao

Yes, Ludovic shall keep i2c-gpio at the side of the new twi driver.

But for the platform, the platform maintainer will have to choose the
one or the other.

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 8/8] ARM: dts: add twi nodes for atmel boards
@ 2012-08-31 15:07           ` Nicolas Ferre
  0 siblings, 0 replies; 65+ messages in thread
From: Nicolas Ferre @ 2012-08-31 15:07 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/31/2012 04:42 PM, Jean-Christophe PLAGNIOL-VILLARD :
> On 11:24 Fri 31 Aug     , ludovic.desroches at atmel.com wrote:
>> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>>
>> Use the atmel twi instead of gpio for i2c stuff.
> NACK as you do not update al the platform at the same time and break the Calao

Yes, Ludovic shall keep i2c-gpio at the side of the new twi driver.

But for the platform, the platform maintainer will have to choose the
one or the other.

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
  2012-08-31 14:51         ` Nicolas Ferre
@ 2012-08-31 20:47             ` Sylwester Nawrocki
  -1 siblings, 0 replies; 65+ messages in thread
From: Sylwester Nawrocki @ 2012-08-31 20:47 UTC (permalink / raw)
  To: Nicolas Ferre, Jean-Christophe PLAGNIOL-VILLARD
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	n.voss-+umVssTZoCsb1SvskN2V4Q, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 08/31/2012 04:51 PM, Nicolas Ferre wrote:
>>> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
>>> index f2112f9..0bc91e5 100644
>>> --- a/arch/arm/mach-at91/at91rm9200.c
>>> +++ b/arch/arm/mach-at91/at91rm9200.c
>>> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.0",&ssc0_clk),
>>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.1",&ssc1_clk),
>>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.2",&ssc2_clk),
>>> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c",&twi_clk),
>>> +	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c",&twi_clk),
>> use i2c-xxx as on other drivers
>>
>> and I do not like to have platform_device_id
> 
> Me, I like it and find this implementation very elegant.
> 
>> as we need to touch the driver to add a new soc
> 
> So what? We still keep the compatibility if the new SoC has it
> compatibility assured with previous revision: there is nothing to modify.

I agree. The driver would need to be touched to support new SoC only if
the IP there have had some differences, which would have needed to be 
resolved anyway.

>> please use platform data

Using platform data for the dt platforms would have been more troublesome,
wouldn't it ? I like Ludovic's approach which handles both: dt and non-dt 
cases in uniform way from the driver's POV.

> No, it does not have to be exposed to the user: these data are highly
> dependent on the actual hardware (IP revision in fact). So, no need to
> mess with platform data.

Agreed.
 
> So I will acknowledge Ludo's patches.
> 
> Bye,

--

Regards,
Sylwester

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
@ 2012-08-31 20:47             ` Sylwester Nawrocki
  0 siblings, 0 replies; 65+ messages in thread
From: Sylwester Nawrocki @ 2012-08-31 20:47 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/31/2012 04:51 PM, Nicolas Ferre wrote:
>>> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
>>> index f2112f9..0bc91e5 100644
>>> --- a/arch/arm/mach-at91/at91rm9200.c
>>> +++ b/arch/arm/mach-at91/at91rm9200.c
>>> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.0",&ssc0_clk),
>>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.1",&ssc1_clk),
>>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.2",&ssc2_clk),
>>> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c",&twi_clk),
>>> +	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c",&twi_clk),
>> use i2c-xxx as on other drivers
>>
>> and I do not like to have platform_device_id
> 
> Me, I like it and find this implementation very elegant.
> 
>> as we need to touch the driver to add a new soc
> 
> So what? We still keep the compatibility if the new SoC has it
> compatibility assured with previous revision: there is nothing to modify.

I agree. The driver would need to be touched to support new SoC only if
the IP there have had some differences, which would have needed to be 
resolved anyway.

>> please use platform data

Using platform data for the dt platforms would have been more troublesome,
wouldn't it ? I like Ludovic's approach which handles both: dt and non-dt 
cases in uniform way from the driver's POV.

> No, it does not have to be exposed to the user: these data are highly
> dependent on the actual hardware (IP revision in fact). So, no need to
> mess with platform data.

Agreed.
 
> So I will acknowledge Ludo's patches.
> 
> Bye,

--

Regards,
Sylwester

^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
  2012-08-31 20:47             ` Sylwester Nawrocki
@ 2012-09-01  9:10                 ` Jean-Christophe PLAGNIOL-VILLARD
  -1 siblings, 0 replies; 65+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-01  9:10 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	n.voss-+umVssTZoCsb1SvskN2V4Q, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 22:47 Fri 31 Aug     , Sylwester Nawrocki wrote:
> On 08/31/2012 04:51 PM, Nicolas Ferre wrote:
> >>> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
> >>> index f2112f9..0bc91e5 100644
> >>> --- a/arch/arm/mach-at91/at91rm9200.c
> >>> +++ b/arch/arm/mach-at91/at91rm9200.c
> >>> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
> >>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.0",&ssc0_clk),
> >>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.1",&ssc1_clk),
> >>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.2",&ssc2_clk),
> >>> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c",&twi_clk),
> >>> +	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c",&twi_clk),
> >> use i2c-xxx as on other drivers
> >>
> >> and I do not like to have platform_device_id
> > 
> > Me, I like it and find this implementation very elegant.
> > 
> >> as we need to touch the driver to add a new soc
> > 
> > So what? We still keep the compatibility if the new SoC has it
> > compatibility assured with previous revision: there is nothing to modify.
> 
> I agree. The driver would need to be touched to support new SoC only if
> the IP there have had some differences, which would have needed to be 
> resolved anyway.
> 
> >> please use platform data
> 
> Using platform data for the dt platforms would have been more troublesome,
> wouldn't it ? I like Ludovic's approach which handles both: dt and non-dt 
> cases in uniform way from the driver's POV.
no you will describe it via DT as done on all the other drivers
> 
> > No, it does not have to be exposed to the user: these data are highly
> > dependent on the actual hardware (IP revision in fact). So, no need to
> > mess with platform data.
no I really see no point on these list of platform_id it's does not look more
nice just more huggly to have x names. This is at the end the same as passing
platform data via soc info (add_xx or dtsi)

And here you just do the same as cpu_is via names.

The driver need to read IP revision instead

Best Regards,
J.

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
@ 2012-09-01  9:10                 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 65+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-01  9:10 UTC (permalink / raw)
  To: linux-arm-kernel

On 22:47 Fri 31 Aug     , Sylwester Nawrocki wrote:
> On 08/31/2012 04:51 PM, Nicolas Ferre wrote:
> >>> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
> >>> index f2112f9..0bc91e5 100644
> >>> --- a/arch/arm/mach-at91/at91rm9200.c
> >>> +++ b/arch/arm/mach-at91/at91rm9200.c
> >>> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
> >>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.0",&ssc0_clk),
> >>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.1",&ssc1_clk),
> >>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.2",&ssc2_clk),
> >>> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c",&twi_clk),
> >>> +	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c",&twi_clk),
> >> use i2c-xxx as on other drivers
> >>
> >> and I do not like to have platform_device_id
> > 
> > Me, I like it and find this implementation very elegant.
> > 
> >> as we need to touch the driver to add a new soc
> > 
> > So what? We still keep the compatibility if the new SoC has it
> > compatibility assured with previous revision: there is nothing to modify.
> 
> I agree. The driver would need to be touched to support new SoC only if
> the IP there have had some differences, which would have needed to be 
> resolved anyway.
> 
> >> please use platform data
> 
> Using platform data for the dt platforms would have been more troublesome,
> wouldn't it ? I like Ludovic's approach which handles both: dt and non-dt 
> cases in uniform way from the driver's POV.
no you will describe it via DT as done on all the other drivers
> 
> > No, it does not have to be exposed to the user: these data are highly
> > dependent on the actual hardware (IP revision in fact). So, no need to
> > mess with platform data.
no I really see no point on these list of platform_id it's does not look more
nice just more huggly to have x names. This is at the end the same as passing
platform data via soc info (add_xx or dtsi)

And here you just do the same as cpu_is via names.

The driver need to read IP revision instead

Best Regards,
J.

^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH 8/8] ARM: dts: add twi nodes for atmel boards
  2012-08-31 15:07           ` Nicolas Ferre
@ 2012-09-01  9:12               ` Jean-Christophe PLAGNIOL-VILLARD
  -1 siblings, 0 replies; 65+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-01  9:12 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	n.voss-+umVssTZoCsb1SvskN2V4Q

On 17:07 Fri 31 Aug     , Nicolas Ferre wrote:
> On 08/31/2012 04:42 PM, Jean-Christophe PLAGNIOL-VILLARD :
> > On 11:24 Fri 31 Aug     , ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org wrote:
> >> From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> >>
> >> Use the atmel twi instead of gpio for i2c stuff.
> > NACK as you do not update al the platform at the same time and break the Calao
> 
> Yes, Ludovic shall keep i2c-gpio at the side of the new twi driver.
> 
> But for the platform, the platform maintainer will have to choose the
> one or the other.
agreed the platform maintianer need to choose to switch or not

Best Regards,
J.

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 8/8] ARM: dts: add twi nodes for atmel boards
@ 2012-09-01  9:12               ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 65+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-01  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

On 17:07 Fri 31 Aug     , Nicolas Ferre wrote:
> On 08/31/2012 04:42 PM, Jean-Christophe PLAGNIOL-VILLARD :
> > On 11:24 Fri 31 Aug     , ludovic.desroches at atmel.com wrote:
> >> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> >>
> >> Use the atmel twi instead of gpio for i2c stuff.
> > NACK as you do not update al the platform at the same time and break the Calao
> 
> Yes, Ludovic shall keep i2c-gpio at the side of the new twi driver.
> 
> But for the platform, the platform maintainer will have to choose the
> one or the other.
agreed the platform maintianer need to choose to switch or not

Best Regards,
J.

^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
  2012-09-01  9:10                 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-02 17:21                     ` Sylwester Nawrocki
  -1 siblings, 0 replies; 65+ messages in thread
From: Sylwester Nawrocki @ 2012-09-02 17:21 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: Nicolas Ferre, ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	n.voss-+umVssTZoCsb1SvskN2V4Q

On 09/01/2012 11:10 AM, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 22:47 Fri 31 Aug     , Sylwester Nawrocki wrote:
>> On 08/31/2012 04:51 PM, Nicolas Ferre wrote:
>>>>> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
>>>>> index f2112f9..0bc91e5 100644
>>>>> --- a/arch/arm/mach-at91/at91rm9200.c
>>>>> +++ b/arch/arm/mach-at91/at91rm9200.c
>>>>> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>>>>>    	CLKDEV_CON_DEV_ID("pclk", "ssc.0",&ssc0_clk),
>>>>>    	CLKDEV_CON_DEV_ID("pclk", "ssc.1",&ssc1_clk),
>>>>>    	CLKDEV_CON_DEV_ID("pclk", "ssc.2",&ssc2_clk),
>>>>> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c",&twi_clk),
>>>>> +	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c",&twi_clk),
>>>> use i2c-xxx as on other drivers
>>>>
>>>> and I do not like to have platform_device_id
>>>
>>> Me, I like it and find this implementation very elegant.
>>>
>>>> as we need to touch the driver to add a new soc
>>>
>>> So what? We still keep the compatibility if the new SoC has it
>>> compatibility assured with previous revision: there is nothing to modify.
>>
>> I agree. The driver would need to be touched to support new SoC only if
>> the IP there have had some differences, which would have needed to be
>> resolved anyway.
>>
>>>> please use platform data
>>
>> Using platform data for the dt platforms would have been more troublesome,
>> wouldn't it ? I like Ludovic's approach which handles both: dt and non-dt
>> cases in uniform way from the driver's POV.
> no you will describe it via DT as done on all the other drivers

Yeah, makes sense. However there are drivers that deduce some parameters
only from the 'compatible' property, let's take drivers/dma/mxs-dma.c as an
example. I'm just trying to understand if there is a general preference on
how to handle those things. Of course we could have all detail properties
listed in a .dtsi file. But since we can derive these from a single property,
it might be more sensible to avoid parsing ?

>>> No, it does not have to be exposed to the user: these data are highly
>>> dependent on the actual hardware (IP revision in fact). So, no need to
>>> mess with platform data.
> no I really see no point on these list of platform_id it's does not look more
> nice just more huggly to have x names. This is at the end the same as passing
> platform data via soc info (add_xx or dtsi)
> 
> And here you just do the same as cpu_is via names.
> 
> The driver need to read IP revision instead

OK, but wouldn't it be needed to resolve an IP revision at run time, e.g.
with soc_is_*() anyway ? Having it set at each board doesn't look like an 
optimal method either.

--

Regards,
Sylwester

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
@ 2012-09-02 17:21                     ` Sylwester Nawrocki
  0 siblings, 0 replies; 65+ messages in thread
From: Sylwester Nawrocki @ 2012-09-02 17:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/01/2012 11:10 AM, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 22:47 Fri 31 Aug     , Sylwester Nawrocki wrote:
>> On 08/31/2012 04:51 PM, Nicolas Ferre wrote:
>>>>> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
>>>>> index f2112f9..0bc91e5 100644
>>>>> --- a/arch/arm/mach-at91/at91rm9200.c
>>>>> +++ b/arch/arm/mach-at91/at91rm9200.c
>>>>> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>>>>>    	CLKDEV_CON_DEV_ID("pclk", "ssc.0",&ssc0_clk),
>>>>>    	CLKDEV_CON_DEV_ID("pclk", "ssc.1",&ssc1_clk),
>>>>>    	CLKDEV_CON_DEV_ID("pclk", "ssc.2",&ssc2_clk),
>>>>> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c",&twi_clk),
>>>>> +	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c",&twi_clk),
>>>> use i2c-xxx as on other drivers
>>>>
>>>> and I do not like to have platform_device_id
>>>
>>> Me, I like it and find this implementation very elegant.
>>>
>>>> as we need to touch the driver to add a new soc
>>>
>>> So what? We still keep the compatibility if the new SoC has it
>>> compatibility assured with previous revision: there is nothing to modify.
>>
>> I agree. The driver would need to be touched to support new SoC only if
>> the IP there have had some differences, which would have needed to be
>> resolved anyway.
>>
>>>> please use platform data
>>
>> Using platform data for the dt platforms would have been more troublesome,
>> wouldn't it ? I like Ludovic's approach which handles both: dt and non-dt
>> cases in uniform way from the driver's POV.
> no you will describe it via DT as done on all the other drivers

Yeah, makes sense. However there are drivers that deduce some parameters
only from the 'compatible' property, let's take drivers/dma/mxs-dma.c as an
example. I'm just trying to understand if there is a general preference on
how to handle those things. Of course we could have all detail properties
listed in a .dtsi file. But since we can derive these from a single property,
it might be more sensible to avoid parsing ?

>>> No, it does not have to be exposed to the user: these data are highly
>>> dependent on the actual hardware (IP revision in fact). So, no need to
>>> mess with platform data.
> no I really see no point on these list of platform_id it's does not look more
> nice just more huggly to have x names. This is at the end the same as passing
> platform data via soc info (add_xx or dtsi)
> 
> And here you just do the same as cpu_is via names.
> 
> The driver need to read IP revision instead

OK, but wouldn't it be needed to resolve an IP revision at run time, e.g.
with soc_is_*() anyway ? Having it set at each board doesn't look like an 
optimal method either.

--

Regards,
Sylwester

^ permalink raw reply	[flat|nested] 65+ messages in thread

* RE: [PATCH 1/8] i2c: at91: use managed resources
  2012-08-31  9:21   ` ludovic.desroches at atmel.com
@ 2012-09-03  5:52       ` Voss, Nikolaus
  -1 siblings, 0 replies; 65+ messages in thread
From: Voss, Nikolaus @ 2012-09-03  5:52 UTC (permalink / raw)
  To: 'ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org',
	'linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org',
	'linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org',
	'devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org'
  Cc: 'nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org',
	'plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org'

ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org wrote on Friday, August 31, 2012 11:21 AM:
> From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> 
> Use managed resources to ease the cleanup.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Acked-by: Nikolaus Voss <n.voss-+umVssTZoCsb1SvskN2V4Q@public.gmane.org>

> ---
>  drivers/i2c/busses/i2c-at91.c | 85 +++++++++++++------------------------------
>  1 file changed, 25 insertions(+), 60 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
> index 2b8b2c2..08aaee7 100644
> --- a/drivers/i2c/busses/i2c-at91.c
> +++ b/drivers/i2c/busses/i2c-at91.c
> @@ -326,61 +326,49 @@ static struct i2c_algorithm at91_twi_algorithm = {
>  static int __devinit at91_twi_probe(struct platform_device *pdev)
>  {
>  	struct at91_twi_dev *dev;
> -	struct resource *mem, *ioarea;
> -	int irq, rc;
> +	struct resource *mem;
> +	int rc;
> +
> +	dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
> +	if (!dev)
> +		return -ENOMEM;
> +	init_completion(&dev->cmd_complete);
> +	dev->dev = &pdev->dev;
> 
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!mem)
>  		return -ENODEV;
> 
> -	irq = platform_get_irq(pdev, 0);
> -	if (irq < 0)
> -		return irq;
> -
> -	ioarea = request_mem_region(mem->start, resource_size(mem),
> pdev->name);
> -	if (!ioarea)
> +	dev->base = devm_request_and_ioremap(&pdev->dev, mem);
> +	if (!dev->base)
>  		return -EBUSY;
> 
> -	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
> -	if (!dev) {
> -		rc = -ENOMEM;
> -		goto err_release_region;
> +	dev->irq = platform_get_irq(pdev, 0);
> +	if (dev->irq < 0)
> +		return dev->irq;
> +
> +	rc = devm_request_irq(&pdev->dev, dev->irq, atmel_twi_interrupt,
> 0,
> +			 dev_name(dev->dev), dev);
> +	if (rc) {
> +		dev_err(dev->dev, "Cannot get irq %d: %d\n", dev->irq, rc);
> +		return rc;
>  	}
> 
>  	if (pdev->id_entry)
>  		dev->ip_id = pdev->id_entry->driver_data;
> 
> -	init_completion(&dev->cmd_complete);
> -
> -	dev->dev = &pdev->dev;
> -	dev->irq = irq;
>  	platform_set_drvdata(pdev, dev);
> 
> -	dev->clk = clk_get(dev->dev, NULL);
> +	dev->clk = devm_clk_get(dev->dev, NULL);
>  	if (IS_ERR(dev->clk)) {
>  		dev_err(dev->dev, "no clock defined\n");
> -		rc = -ENODEV;
> -		goto err_free_mem;
> -	}
> -	clk_prepare(dev->clk);
> -	clk_enable(dev->clk);
> -
> -	dev->base = ioremap(mem->start, resource_size(mem));
> -	if (!dev->base) {
> -		rc = -EBUSY;
> -		goto err_mem_ioremap;
> +		return -ENODEV;
>  	}
> +	clk_prepare_enable(dev->clk);
> 
>  	at91_calc_twi_clock(dev, TWI_CLK_HZ);
>  	at91_init_twi_bus(dev);
> 
> -	rc = request_irq(dev->irq, atmel_twi_interrupt, 0,
> -			 dev_name(dev->dev), dev);
> -	if (rc) {
> -		dev_err(dev->dev, "Cannot get irq %d: %d\n", dev->irq, rc);
> -		goto err_unuse_clocks;
> -	}
> -
>  	snprintf(dev->adapter.name, sizeof(dev->adapter.name), "AT91");
>  	i2c_set_adapdata(&dev->adapter, dev);
>  	dev->adapter.owner = THIS_MODULE;
> @@ -394,44 +382,21 @@ static int __devinit at91_twi_probe(struct
> platform_device *pdev)
>  	if (rc) {
>  		dev_err(dev->dev, "Adapter %s registration failed\n",
>  			dev->adapter.name);
> -		goto err_free_irq;
> +		clk_disable_unprepare(dev->clk);
> +		return rc;
>  	}
> 
>  	dev_info(dev->dev, "AT91 i2c bus driver.\n");
>  	return 0;
> -
> -err_free_irq:
> -	free_irq(dev->irq, dev);
> -err_unuse_clocks:
> -	iounmap(dev->base);
> -err_mem_ioremap:
> -	clk_disable(dev->clk);
> -	clk_unprepare(dev->clk);
> -	clk_put(dev->clk);
> -err_free_mem:
> -	kfree(dev);
> -err_release_region:
> -	release_mem_region(mem->start, resource_size(mem));
> -
> -	return rc;
>  }
> 
>  static int __devexit at91_twi_remove(struct platform_device *pdev)
>  {
>  	struct at91_twi_dev *dev = platform_get_drvdata(pdev);
> -	struct resource *mem;
>  	int rc;
> 
>  	rc = i2c_del_adapter(&dev->adapter);
> -	clk_disable(dev->clk);
> -	clk_unprepare(dev->clk);
> -	clk_put(dev->clk);
> -	free_irq(dev->irq, dev);
> -	iounmap(dev->base);
> -	kfree(dev);
> -
> -	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	release_mem_region(mem->start, resource_size(mem));
> +	clk_disable_unprepare(dev->clk);
> 
>  	return rc;
>  }
> --
> 1.7.11.3

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 1/8] i2c: at91: use managed resources
@ 2012-09-03  5:52       ` Voss, Nikolaus
  0 siblings, 0 replies; 65+ messages in thread
From: Voss, Nikolaus @ 2012-09-03  5:52 UTC (permalink / raw)
  To: linux-arm-kernel

ludovic.desroches at atmel.com wrote on Friday, August 31, 2012 11:21 AM:
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Use managed resources to ease the cleanup.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Nikolaus Voss <n.voss@weinmann.de>

> ---
>  drivers/i2c/busses/i2c-at91.c | 85 +++++++++++++------------------------------
>  1 file changed, 25 insertions(+), 60 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
> index 2b8b2c2..08aaee7 100644
> --- a/drivers/i2c/busses/i2c-at91.c
> +++ b/drivers/i2c/busses/i2c-at91.c
> @@ -326,61 +326,49 @@ static struct i2c_algorithm at91_twi_algorithm = {
>  static int __devinit at91_twi_probe(struct platform_device *pdev)
>  {
>  	struct at91_twi_dev *dev;
> -	struct resource *mem, *ioarea;
> -	int irq, rc;
> +	struct resource *mem;
> +	int rc;
> +
> +	dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
> +	if (!dev)
> +		return -ENOMEM;
> +	init_completion(&dev->cmd_complete);
> +	dev->dev = &pdev->dev;
> 
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!mem)
>  		return -ENODEV;
> 
> -	irq = platform_get_irq(pdev, 0);
> -	if (irq < 0)
> -		return irq;
> -
> -	ioarea = request_mem_region(mem->start, resource_size(mem),
> pdev->name);
> -	if (!ioarea)
> +	dev->base = devm_request_and_ioremap(&pdev->dev, mem);
> +	if (!dev->base)
>  		return -EBUSY;
> 
> -	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
> -	if (!dev) {
> -		rc = -ENOMEM;
> -		goto err_release_region;
> +	dev->irq = platform_get_irq(pdev, 0);
> +	if (dev->irq < 0)
> +		return dev->irq;
> +
> +	rc = devm_request_irq(&pdev->dev, dev->irq, atmel_twi_interrupt,
> 0,
> +			 dev_name(dev->dev), dev);
> +	if (rc) {
> +		dev_err(dev->dev, "Cannot get irq %d: %d\n", dev->irq, rc);
> +		return rc;
>  	}
> 
>  	if (pdev->id_entry)
>  		dev->ip_id = pdev->id_entry->driver_data;
> 
> -	init_completion(&dev->cmd_complete);
> -
> -	dev->dev = &pdev->dev;
> -	dev->irq = irq;
>  	platform_set_drvdata(pdev, dev);
> 
> -	dev->clk = clk_get(dev->dev, NULL);
> +	dev->clk = devm_clk_get(dev->dev, NULL);
>  	if (IS_ERR(dev->clk)) {
>  		dev_err(dev->dev, "no clock defined\n");
> -		rc = -ENODEV;
> -		goto err_free_mem;
> -	}
> -	clk_prepare(dev->clk);
> -	clk_enable(dev->clk);
> -
> -	dev->base = ioremap(mem->start, resource_size(mem));
> -	if (!dev->base) {
> -		rc = -EBUSY;
> -		goto err_mem_ioremap;
> +		return -ENODEV;
>  	}
> +	clk_prepare_enable(dev->clk);
> 
>  	at91_calc_twi_clock(dev, TWI_CLK_HZ);
>  	at91_init_twi_bus(dev);
> 
> -	rc = request_irq(dev->irq, atmel_twi_interrupt, 0,
> -			 dev_name(dev->dev), dev);
> -	if (rc) {
> -		dev_err(dev->dev, "Cannot get irq %d: %d\n", dev->irq, rc);
> -		goto err_unuse_clocks;
> -	}
> -
>  	snprintf(dev->adapter.name, sizeof(dev->adapter.name), "AT91");
>  	i2c_set_adapdata(&dev->adapter, dev);
>  	dev->adapter.owner = THIS_MODULE;
> @@ -394,44 +382,21 @@ static int __devinit at91_twi_probe(struct
> platform_device *pdev)
>  	if (rc) {
>  		dev_err(dev->dev, "Adapter %s registration failed\n",
>  			dev->adapter.name);
> -		goto err_free_irq;
> +		clk_disable_unprepare(dev->clk);
> +		return rc;
>  	}
> 
>  	dev_info(dev->dev, "AT91 i2c bus driver.\n");
>  	return 0;
> -
> -err_free_irq:
> -	free_irq(dev->irq, dev);
> -err_unuse_clocks:
> -	iounmap(dev->base);
> -err_mem_ioremap:
> -	clk_disable(dev->clk);
> -	clk_unprepare(dev->clk);
> -	clk_put(dev->clk);
> -err_free_mem:
> -	kfree(dev);
> -err_release_region:
> -	release_mem_region(mem->start, resource_size(mem));
> -
> -	return rc;
>  }
> 
>  static int __devexit at91_twi_remove(struct platform_device *pdev)
>  {
>  	struct at91_twi_dev *dev = platform_get_drvdata(pdev);
> -	struct resource *mem;
>  	int rc;
> 
>  	rc = i2c_del_adapter(&dev->adapter);
> -	clk_disable(dev->clk);
> -	clk_unprepare(dev->clk);
> -	clk_put(dev->clk);
> -	free_irq(dev->irq, dev);
> -	iounmap(dev->base);
> -	kfree(dev);
> -
> -	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	release_mem_region(mem->start, resource_size(mem));
> +	clk_disable_unprepare(dev->clk);
> 
>  	return rc;
>  }
> --
> 1.7.11.3

^ permalink raw reply	[flat|nested] 65+ messages in thread

* RE: [PATCH 2/8] i2c: at91: add warning about transmission issues for some devices
  2012-08-31  9:21     ` ludovic.desroches at atmel.com
@ 2012-09-03  5:54         ` Voss, Nikolaus
  -1 siblings, 0 replies; 65+ messages in thread
From: Voss, Nikolaus @ 2012-09-03  5:54 UTC (permalink / raw)
  To: 'ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org',
	'linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org',
	'linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org',
	'devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org'
  Cc: 'nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org',
	'plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org'

ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org wrote on Friday, August 31, 2012 11:21 AM
> From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> 
> Some devices don't have clock streching in transmission mode. It can
> lead to premature stop sendings if the latency to write data in the
> transmission register is too long. In this case, prefer the i2c-gpio
> driver.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Acked-by: Nikolaus Voss <n.voss-+umVssTZoCsb1SvskN2V4Q@public.gmane.org>

> ---
>  drivers/i2c/busses/Kconfig | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> index d9c4918..da77c37 100644
> --- a/drivers/i2c/busses/Kconfig
> +++ b/drivers/i2c/busses/Kconfig
> @@ -300,6 +300,12 @@ config I2C_AT91
>  	  to support combined I2C messages.  Use the i2c-gpio driver
>  	  unless your system can cope with this limitation.
> 
> +	  Caution! at91rm9200, at91sam9261, at91sam9260, at91sam9263
> devices
> +	  don't have clock stretching in transmission mode. For that reason,
> +	  you can encounter underrun issues causing premature stop
> sendings if
> +	  the latency to fill the transmission register is too long. If you
> +	  are facing this situation, use the i2c-gpio driver.
> +
>  config I2C_AU1550
>  	tristate "Au1550/Au1200/Au1300 SMBus interface"
>  	depends on MIPS_ALCHEMY
> --
> 1.7.11.3

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 2/8] i2c: at91: add warning about transmission issues for some devices
@ 2012-09-03  5:54         ` Voss, Nikolaus
  0 siblings, 0 replies; 65+ messages in thread
From: Voss, Nikolaus @ 2012-09-03  5:54 UTC (permalink / raw)
  To: linux-arm-kernel

ludovic.desroches at atmel.com wrote on Friday, August 31, 2012 11:21 AM
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Some devices don't have clock streching in transmission mode. It can
> lead to premature stop sendings if the latency to write data in the
> transmission register is too long. In this case, prefer the i2c-gpio
> driver.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Nikolaus Voss <n.voss@weinmann.de>

> ---
>  drivers/i2c/busses/Kconfig | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> index d9c4918..da77c37 100644
> --- a/drivers/i2c/busses/Kconfig
> +++ b/drivers/i2c/busses/Kconfig
> @@ -300,6 +300,12 @@ config I2C_AT91
>  	  to support combined I2C messages.  Use the i2c-gpio driver
>  	  unless your system can cope with this limitation.
> 
> +	  Caution! at91rm9200, at91sam9261, at91sam9260, at91sam9263
> devices
> +	  don't have clock stretching in transmission mode. For that reason,
> +	  you can encounter underrun issues causing premature stop
> sendings if
> +	  the latency to fill the transmission register is too long. If you
> +	  are facing this situation, use the i2c-gpio driver.
> +
>  config I2C_AU1550
>  	tristate "Au1550/Au1200/Au1300 SMBus interface"
>  	depends on MIPS_ALCHEMY
> --
> 1.7.11.3

^ permalink raw reply	[flat|nested] 65+ messages in thread

* RE: [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
  2012-08-31  9:21   ` ludovic.desroches at atmel.com
@ 2012-09-03  5:55       ` Voss, Nikolaus
  -1 siblings, 0 replies; 65+ messages in thread
From: Voss, Nikolaus @ 2012-09-03  5:55 UTC (permalink / raw)
  To: 'ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org',
	'linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org',
	'linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org',
	'devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org'
  Cc: 'nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org',
	'plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org'

ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org wrote on Friday, August 31, 2012 11:21 AM
> From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
>
> Use the id_table to store configuration structures which are depending on
> SoC.
>
> Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Nice solution!
Acked-by: Nikolaus Voss <n.voss-+umVssTZoCsb1SvskN2V4Q@public.gmane.org>

> ---
>  arch/arm/mach-at91/at91rm9200.c          |  2 +-
>  arch/arm/mach-at91/at91rm9200_devices.c  | 11 +----
>  arch/arm/mach-at91/at91sam9260.c         |  3 +-
>  arch/arm/mach-at91/at91sam9260_devices.c |  8 ++-
>  arch/arm/mach-at91/at91sam9261.c         |  3 +-
>  arch/arm/mach-at91/at91sam9261_devices.c | 17 +++----
>  arch/arm/mach-at91/at91sam9263.c         |  2 +-
>  arch/arm/mach-at91/at91sam9263_devices.c |  2 +-
>  arch/arm/mach-at91/at91sam9g45.c         |  4 +-
>  arch/arm/mach-at91/at91sam9g45_devices.c |  4 +-
>  arch/arm/mach-at91/at91sam9rl.c          |  4 +-
>  arch/arm/mach-at91/at91sam9rl_devices.c  |  2 +-
>  drivers/i2c/busses/i2c-at91.c            | 85 +++++++++++++++++++++++++-------
>  13 files changed, 95 insertions(+), 52 deletions(-)
>
> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-
> at91/at91rm9200.c
> index f2112f9..0bc91e5 100644
> --- a/arch/arm/mach-at91/at91rm9200.c
> +++ b/arch/arm/mach-at91/at91rm9200.c
> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>       CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c", &twi_clk),
>       /* fake hclk clock */
>       CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
>       CLKDEV_CON_ID("pioA", &pioA_clk),
> diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-
> at91/at91rm9200_devices.c
> index 71e7387..cddfe02 100644
> --- a/arch/arm/mach-at91/at91rm9200_devices.c
> +++ b/arch/arm/mach-at91/at91rm9200_devices.c
> @@ -494,18 +494,9 @@ static struct resource twi_resources[] = {
>       },
>  };
>
> -static const struct platform_device_id twi_ip_type = {
> -     /*
> -      * driver_data is 1 for RM9200 compatible ip, see enum twi_ip_id in
> -      * drivers/i2c/busses/i2c-at91.c
> -      */
> -     .driver_data    = 1,
> -};
> -
>  static struct platform_device at91rm9200_twi_device = {
> -     .name           = "at91_i2c",
> +     .name           = "at91rm9200_i2c",
>       .id             = -1,
> -     .id_entry       = &twi_ip_type,
>       .resource       = twi_resources,
>       .num_resources  = ARRAY_SIZE(twi_resources),
>  };
> diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-
> at91/at91sam9260.c
> index 57c79ee..5f86e71 100644
> --- a/arch/arm/mach-at91/at91sam9260.c
> +++ b/arch/arm/mach-at91/at91sam9260.c
> @@ -211,7 +211,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
>       CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk),
>       CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9260_i2c", &twi_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9g20_i2c", &twi_clk),
>       /* more usart lookup table for DT entries */
>       CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
>       CLKDEV_CON_DEV_ID("usart", "fffb0000.serial", &usart0_clk),
> diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-
> at91/at91sam9260_devices.c
> index 7b9c2ba..ed02171 100644
> --- a/arch/arm/mach-at91/at91sam9260_devices.c
> +++ b/arch/arm/mach-at91/at91sam9260_devices.c
> @@ -503,7 +503,6 @@ static struct resource twi_resources[] = {
>  };
>
>  static struct platform_device at91sam9260_twi_device = {
> -     .name           = "at91_i2c",
>       .id             = -1,
>       .resource       = twi_resources,
>       .num_resources  = ARRAY_SIZE(twi_resources),
> @@ -511,6 +510,13 @@ static struct platform_device
> at91sam9260_twi_device = {
>
>  void __init at91_add_device_i2c(struct i2c_board_info *devices, int
> nr_devices)
>  {
> +     /* IP version is not the same on 9260 and g20 */
> +     if (cpu_is_at91sam9g20()) {
> +             at91sam9260_twi_device.name = "at91sam9g20_i2c";
> +     } else {
> +             at91sam9260_twi_device.name = "at91sam9260_i2c";
> +     }
> +
>       /* pins used for TWI interface */
>       at91_set_A_periph(AT91_PIN_PA23, 0);            /* TWD */
>       at91_set_multi_drive(AT91_PIN_PA23, 1);
> diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-
> at91/at91sam9261.c
> index 71ca1e0..0ccf63c 100644
> --- a/arch/arm/mach-at91/at91sam9261.c
> +++ b/arch/arm/mach-at91/at91sam9261.c
> @@ -178,7 +178,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
>       CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
>       CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9261_i2c", &twi_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9g10_i2c", &twi_clk),
>       CLKDEV_CON_ID("pioA", &pioA_clk),
>       CLKDEV_CON_ID("pioB", &pioB_clk),
>       CLKDEV_CON_ID("pioC", &pioC_clk),
> diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-
> at91/at91sam9261_devices.c
> index d830724..c94495d 100644
> --- a/arch/arm/mach-at91/at91sam9261_devices.c
> +++ b/arch/arm/mach-at91/at91sam9261_devices.c
> @@ -316,24 +316,21 @@ static struct resource twi_resources[] = {
>       },
>  };
>
> -static const struct platform_device_id twi_ip_type = {
> -     /*
> -      * driver_data is 2 for SAM9261 compatible ip, see enum twi_ip_id in
> -      * drivers/i2c/busses/i2c-at91.c
> -      */
> -     .driver_data    = 2,
> -};
> -
>  static struct platform_device at91sam9261_twi_device = {
> -     .name           = "at91_i2c",
>       .id             = -1,
> -     .id_entry       = &twi_ip_type,
>       .resource       = twi_resources,
>       .num_resources  = ARRAY_SIZE(twi_resources),
>  };
>
>  void __init at91_add_device_i2c(struct i2c_board_info *devices, int
> nr_devices)
>  {
> +     /* IP version is not the same on 9261 and g10 */
> +     if (cpu_is_at91sam9g10()) {
> +             at91sam9261_twi_device.name = "at91sam9g10_i2c";
> +     } else {
> +             at91sam9261_twi_device.name = "at91sam9261_i2c";
> +     }
> +
>       /* pins used for TWI interface */
>       at91_set_A_periph(AT91_PIN_PA7, 0);             /* TWD */
>       at91_set_multi_drive(AT91_PIN_PA7, 1);
> diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-
> at91/at91sam9263.c
> index 2a08305..a4d760c 100644
> --- a/arch/arm/mach-at91/at91sam9263.c
> +++ b/arch/arm/mach-at91/at91sam9263.c
> @@ -193,7 +193,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>       CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
>       CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
>       CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9260_i2c", &twi_clk),
>       /* fake hclk clock */
>       CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
>       CLKDEV_CON_ID("pioA", &pioA_clk),
> diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-
> at91/at91sam9263_devices.c
> index eb6bbf8..7cff86c 100644
> --- a/arch/arm/mach-at91/at91sam9263_devices.c
> +++ b/arch/arm/mach-at91/at91sam9263_devices.c
> @@ -574,7 +574,7 @@ static struct resource twi_resources[] = {
>  };
>
>  static struct platform_device at91sam9263_twi_device = {
> -     .name           = "at91_i2c",
> +     .name           = "at91sam9260_i2c",
>       .id             = -1,
>       .resource       = twi_resources,
>       .num_resources  = ARRAY_SIZE(twi_resources),
> diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-
> at91/at91sam9g45.c
> index ddf3d37..15e62b9 100644
> --- a/arch/arm/mach-at91/at91sam9g45.c
> +++ b/arch/arm/mach-at91/at91sam9g45.c
> @@ -237,8 +237,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
>       CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
>       CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb0_clk),
>       CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c.0", &twi0_clk),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c.1", &twi1_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9g10_i2c.0", &twi0_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9g10_i2c.1", &twi1_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
>       CLKDEV_CON_DEV_ID(NULL, "atmel-trng", &trng_clk),
> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-
> at91/at91sam9g45_devices.c
> index f001305..a61c7ec 100644
> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
> @@ -653,7 +653,7 @@ static struct resource twi0_resources[] = {
>  };
>
>  static struct platform_device at91sam9g45_twi0_device = {
> -     .name           = "at91_i2c",
> +     .name           = "at91sam9g10_i2c",
>       .id             = 0,
>       .resource       = twi0_resources,
>       .num_resources  = ARRAY_SIZE(twi0_resources),
> @@ -673,7 +673,7 @@ static struct resource twi1_resources[] = {
>  };
>
>  static struct platform_device at91sam9g45_twi1_device = {
> -     .name           = "at91_i2c",
> +     .name           = "at91sam9g10_i2c",
>       .id             = 1,
>       .resource       = twi1_resources,
>       .num_resources  = ARRAY_SIZE(twi1_resources),
> diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-
> at91/at91sam9rl.c
> index bf79c1f..d708dfa 100644
> --- a/arch/arm/mach-at91/at91sam9rl.c
> +++ b/arch/arm/mach-at91/at91sam9rl.c
> @@ -186,8 +186,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
>       CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c.0", &twi0_clk),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c.1", &twi1_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9g20_i2c.0", &twi0_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9g20_i2c.1", &twi1_clk),
>       CLKDEV_CON_ID("pioA", &pioA_clk),
>       CLKDEV_CON_ID("pioB", &pioB_clk),
>       CLKDEV_CON_ID("pioC", &pioC_clk),
> diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-
> at91/at91sam9rl_devices.c
> index f09fff9..2df7411 100644
> --- a/arch/arm/mach-at91/at91sam9rl_devices.c
> +++ b/arch/arm/mach-at91/at91sam9rl_devices.c
> @@ -346,7 +346,7 @@ static struct resource twi_resources[] = {
>  };
>
>  static struct platform_device at91sam9rl_twi_device = {
> -     .name           = "at91_i2c",
> +     .name           = "at91sam9g20_i2c",
>       .id             = -1,
>       .resource       = twi_resources,
>       .num_resources  = ARRAY_SIZE(twi_resources),
> diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
> index 08aaee7..bcf9a5c 100644
> --- a/drivers/i2c/busses/i2c-at91.c
> +++ b/drivers/i2c/busses/i2c-at91.c
> @@ -61,10 +61,10 @@
>  #define      AT91_TWI_RHR            0x0030  /* Receive Holding
> Register */
>  #define      AT91_TWI_THR            0x0034  /* Transmit Holding Register
> */
>
> -enum twi_ip_id {
> -     DEFAULT         = 0, /* default ip, no known limitations */
> -     RM9200          = 1,
> -     SAM9261         = 2,
> +struct at91_twi_pdata {
> +     unsigned        clk_max_div;
> +     unsigned        clk_offset;
> +     bool            has_unre_flag;
>  };
>
>  struct at91_twi_dev {
> @@ -78,8 +78,8 @@ struct at91_twi_dev {
>       int                     irq;
>       unsigned                transfer_status;
>       struct i2c_adapter      adapter;
> -     enum twi_ip_id          ip_id;
>       unsigned                twi_cwgr_reg;
> +     struct at91_twi_pdata   *pdata;
>  };
>
>  static unsigned at91_twi_read(struct at91_twi_dev *dev, unsigned reg)
> @@ -114,16 +114,9 @@ static void at91_init_twi_bus(struct at91_twi_dev
> *dev)
>  static void __devinit at91_calc_twi_clock(struct at91_twi_dev *dev, int
> twi_clk)
>  {
>       int ckdiv, cdiv, div;
> -     int offset = 4;
> -     int max_ckdiv = 7;
> -
> -     if (dev->ip_id == RM9200) {
> -             offset = 3;
> -             max_ckdiv = 5;
> -     } else if (dev->ip_id == SAM9261) {
> -             offset = 4;
> -             max_ckdiv = 5;
> -     }
> +     struct at91_twi_pdata *pdata = dev->pdata;
> +     int offset = pdata->clk_offset;
> +     int max_ckdiv = pdata->clk_max_div;
>
>       div = max(0, (int)DIV_ROUND_UP(clk_get_rate(dev->clk),
>                                      2 * twi_clk) - offset);
> @@ -209,6 +202,7 @@ static irqreturn_t atmel_twi_interrupt(int irq, void
> *dev_id)
>  static int at91_do_twi_transfer(struct at91_twi_dev *dev)
>  {
>       int ret;
> +     bool has_unre_flag = dev->pdata->has_unre_flag;
>
>       dev_dbg(dev->dev, "transfer: %s %d bytes.\n",
>               (dev->msg->flags & I2C_M_RD) ? "read" : "write", dev-
> >buf_len);
> @@ -250,7 +244,7 @@ static int at91_do_twi_transfer(struct at91_twi_dev
> *dev)
>               dev_err(dev->dev, "overrun while reading\n");
>               return -EIO;
>       }
> -     if (dev->transfer_status & AT91_TWI_UNRE && dev->ip_id ==
> RM9200) {
> +     if (has_unre_flag && dev->transfer_status & AT91_TWI_UNRE) {
>               dev_err(dev->dev, "underrun while writing\n");
>               return -EIO;
>       }
> @@ -323,6 +317,57 @@ static struct i2c_algorithm at91_twi_algorithm = {
>       .functionality  = at91_twi_func,
>  };
>
> +static struct at91_twi_pdata at91rm9200_config = {
> +     .clk_max_div = 5,
> +     .clk_offset = 3,
> +     .has_unre_flag = true,
> +};
> +
> +static struct at91_twi_pdata at91sam9261_config = {
> +     .clk_max_div = 5,
> +     .clk_offset = 4,
> +     .has_unre_flag = false,
> +};
> +
> +static struct at91_twi_pdata at91sam9260_config = {
> +     .clk_max_div = 7,
> +     .clk_offset = 4,
> +     .has_unre_flag = false,
> +};
> +
> +static struct at91_twi_pdata at91sam9g20_config = {
> +     .clk_max_div = 7,
> +     .clk_offset = 4,
> +     .has_unre_flag = false,
> +};
> +
> +static struct at91_twi_pdata at91sam9g10_config = {
> +     .clk_max_div = 7,
> +     .clk_offset = 4,
> +     .has_unre_flag = false,
> +};
> +
> +static const struct platform_device_id at91_twi_devtypes[] = {
> +     {
> +             .name = "at91rm9200_i2c",
> +             .driver_data = (unsigned long) &at91rm9200_config,
> +     }, {
> +             .name = "at91sam9261_i2c",
> +             .driver_data = (unsigned long) &at91sam9261_config,
> +     }, {
> +             .name = "at91sam9260_i2c",
> +             .driver_data = (unsigned long) &at91sam9260_config,
> +     }, {
> +             .name = "at91sam9g20_i2c",
> +             .driver_data = (unsigned long) &at91sam9g20_config,
> +     }, {
> +             .name = "at91sam9g10_i2c",
> +             .driver_data = (unsigned long) &at91sam9g10_config,
> +     }, {
> +             /* sentinel */
> +     }
> +};
> +
>  static int __devinit at91_twi_probe(struct platform_device *pdev)
>  {
>       struct at91_twi_dev *dev;
> @@ -339,6 +384,10 @@ static int __devinit at91_twi_probe(struct
> platform_device *pdev)
>       if (!mem)
>               return -ENODEV;
>
> +     dev->pdata = at91_twi_get_driver_data(pdev);
> +     if (!dev->pdata)
> +             return -ENODEV;
> +
>       dev->base = devm_request_and_ioremap(&pdev->dev, mem);
>       if (!dev->base)
>               return -EBUSY;
> @@ -354,9 +403,6 @@ static int __devinit at91_twi_probe(struct
> platform_device *pdev)
>               return rc;
>       }
>
> -     if (pdev->id_entry)
> -             dev->ip_id = pdev->id_entry->driver_data;
> -
>       platform_set_drvdata(pdev, dev);
>
>       dev->clk = devm_clk_get(dev->dev, NULL);
> @@ -432,6 +478,7 @@ static const struct dev_pm_ops at91_twi_pm = {
>  static struct platform_driver at91_twi_driver = {
>       .probe          = at91_twi_probe,
>       .remove         = __devexit_p(at91_twi_remove),
> +     .id_table       = at91_twi_devtypes,
>       .driver         = {
>               .name   = "at91_i2c",
>               .owner  = THIS_MODULE,
> --
> 1.7.11.3

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
@ 2012-09-03  5:55       ` Voss, Nikolaus
  0 siblings, 0 replies; 65+ messages in thread
From: Voss, Nikolaus @ 2012-09-03  5:55 UTC (permalink / raw)
  To: linux-arm-kernel

ludovic.desroches at atmel.com wrote on Friday, August 31, 2012 11:21 AM
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>
> Use the id_table to store configuration structures which are depending on
> SoC.
>
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Nice solution!
Acked-by: Nikolaus Voss <n.voss@weinmann.de>

> ---
>  arch/arm/mach-at91/at91rm9200.c          |  2 +-
>  arch/arm/mach-at91/at91rm9200_devices.c  | 11 +----
>  arch/arm/mach-at91/at91sam9260.c         |  3 +-
>  arch/arm/mach-at91/at91sam9260_devices.c |  8 ++-
>  arch/arm/mach-at91/at91sam9261.c         |  3 +-
>  arch/arm/mach-at91/at91sam9261_devices.c | 17 +++----
>  arch/arm/mach-at91/at91sam9263.c         |  2 +-
>  arch/arm/mach-at91/at91sam9263_devices.c |  2 +-
>  arch/arm/mach-at91/at91sam9g45.c         |  4 +-
>  arch/arm/mach-at91/at91sam9g45_devices.c |  4 +-
>  arch/arm/mach-at91/at91sam9rl.c          |  4 +-
>  arch/arm/mach-at91/at91sam9rl_devices.c  |  2 +-
>  drivers/i2c/busses/i2c-at91.c            | 85 +++++++++++++++++++++++++-------
>  13 files changed, 95 insertions(+), 52 deletions(-)
>
> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-
> at91/at91rm9200.c
> index f2112f9..0bc91e5 100644
> --- a/arch/arm/mach-at91/at91rm9200.c
> +++ b/arch/arm/mach-at91/at91rm9200.c
> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>       CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c", &twi_clk),
>       /* fake hclk clock */
>       CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
>       CLKDEV_CON_ID("pioA", &pioA_clk),
> diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-
> at91/at91rm9200_devices.c
> index 71e7387..cddfe02 100644
> --- a/arch/arm/mach-at91/at91rm9200_devices.c
> +++ b/arch/arm/mach-at91/at91rm9200_devices.c
> @@ -494,18 +494,9 @@ static struct resource twi_resources[] = {
>       },
>  };
>
> -static const struct platform_device_id twi_ip_type = {
> -     /*
> -      * driver_data is 1 for RM9200 compatible ip, see enum twi_ip_id in
> -      * drivers/i2c/busses/i2c-at91.c
> -      */
> -     .driver_data    = 1,
> -};
> -
>  static struct platform_device at91rm9200_twi_device = {
> -     .name           = "at91_i2c",
> +     .name           = "at91rm9200_i2c",
>       .id             = -1,
> -     .id_entry       = &twi_ip_type,
>       .resource       = twi_resources,
>       .num_resources  = ARRAY_SIZE(twi_resources),
>  };
> diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-
> at91/at91sam9260.c
> index 57c79ee..5f86e71 100644
> --- a/arch/arm/mach-at91/at91sam9260.c
> +++ b/arch/arm/mach-at91/at91sam9260.c
> @@ -211,7 +211,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
>       CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk),
>       CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9260_i2c", &twi_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9g20_i2c", &twi_clk),
>       /* more usart lookup table for DT entries */
>       CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
>       CLKDEV_CON_DEV_ID("usart", "fffb0000.serial", &usart0_clk),
> diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-
> at91/at91sam9260_devices.c
> index 7b9c2ba..ed02171 100644
> --- a/arch/arm/mach-at91/at91sam9260_devices.c
> +++ b/arch/arm/mach-at91/at91sam9260_devices.c
> @@ -503,7 +503,6 @@ static struct resource twi_resources[] = {
>  };
>
>  static struct platform_device at91sam9260_twi_device = {
> -     .name           = "at91_i2c",
>       .id             = -1,
>       .resource       = twi_resources,
>       .num_resources  = ARRAY_SIZE(twi_resources),
> @@ -511,6 +510,13 @@ static struct platform_device
> at91sam9260_twi_device = {
>
>  void __init at91_add_device_i2c(struct i2c_board_info *devices, int
> nr_devices)
>  {
> +     /* IP version is not the same on 9260 and g20 */
> +     if (cpu_is_at91sam9g20()) {
> +             at91sam9260_twi_device.name = "at91sam9g20_i2c";
> +     } else {
> +             at91sam9260_twi_device.name = "at91sam9260_i2c";
> +     }
> +
>       /* pins used for TWI interface */
>       at91_set_A_periph(AT91_PIN_PA23, 0);            /* TWD */
>       at91_set_multi_drive(AT91_PIN_PA23, 1);
> diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-
> at91/at91sam9261.c
> index 71ca1e0..0ccf63c 100644
> --- a/arch/arm/mach-at91/at91sam9261.c
> +++ b/arch/arm/mach-at91/at91sam9261.c
> @@ -178,7 +178,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
>       CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
>       CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9261_i2c", &twi_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9g10_i2c", &twi_clk),
>       CLKDEV_CON_ID("pioA", &pioA_clk),
>       CLKDEV_CON_ID("pioB", &pioB_clk),
>       CLKDEV_CON_ID("pioC", &pioC_clk),
> diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-
> at91/at91sam9261_devices.c
> index d830724..c94495d 100644
> --- a/arch/arm/mach-at91/at91sam9261_devices.c
> +++ b/arch/arm/mach-at91/at91sam9261_devices.c
> @@ -316,24 +316,21 @@ static struct resource twi_resources[] = {
>       },
>  };
>
> -static const struct platform_device_id twi_ip_type = {
> -     /*
> -      * driver_data is 2 for SAM9261 compatible ip, see enum twi_ip_id in
> -      * drivers/i2c/busses/i2c-at91.c
> -      */
> -     .driver_data    = 2,
> -};
> -
>  static struct platform_device at91sam9261_twi_device = {
> -     .name           = "at91_i2c",
>       .id             = -1,
> -     .id_entry       = &twi_ip_type,
>       .resource       = twi_resources,
>       .num_resources  = ARRAY_SIZE(twi_resources),
>  };
>
>  void __init at91_add_device_i2c(struct i2c_board_info *devices, int
> nr_devices)
>  {
> +     /* IP version is not the same on 9261 and g10 */
> +     if (cpu_is_at91sam9g10()) {
> +             at91sam9261_twi_device.name = "at91sam9g10_i2c";
> +     } else {
> +             at91sam9261_twi_device.name = "at91sam9261_i2c";
> +     }
> +
>       /* pins used for TWI interface */
>       at91_set_A_periph(AT91_PIN_PA7, 0);             /* TWD */
>       at91_set_multi_drive(AT91_PIN_PA7, 1);
> diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-
> at91/at91sam9263.c
> index 2a08305..a4d760c 100644
> --- a/arch/arm/mach-at91/at91sam9263.c
> +++ b/arch/arm/mach-at91/at91sam9263.c
> @@ -193,7 +193,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>       CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
>       CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
>       CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c", &twi_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9260_i2c", &twi_clk),
>       /* fake hclk clock */
>       CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
>       CLKDEV_CON_ID("pioA", &pioA_clk),
> diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-
> at91/at91sam9263_devices.c
> index eb6bbf8..7cff86c 100644
> --- a/arch/arm/mach-at91/at91sam9263_devices.c
> +++ b/arch/arm/mach-at91/at91sam9263_devices.c
> @@ -574,7 +574,7 @@ static struct resource twi_resources[] = {
>  };
>
>  static struct platform_device at91sam9263_twi_device = {
> -     .name           = "at91_i2c",
> +     .name           = "at91sam9260_i2c",
>       .id             = -1,
>       .resource       = twi_resources,
>       .num_resources  = ARRAY_SIZE(twi_resources),
> diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-
> at91/at91sam9g45.c
> index ddf3d37..15e62b9 100644
> --- a/arch/arm/mach-at91/at91sam9g45.c
> +++ b/arch/arm/mach-at91/at91sam9g45.c
> @@ -237,8 +237,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
>       CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
>       CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb0_clk),
>       CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c.0", &twi0_clk),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c.1", &twi1_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9g10_i2c.0", &twi0_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9g10_i2c.1", &twi1_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
>       CLKDEV_CON_DEV_ID(NULL, "atmel-trng", &trng_clk),
> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-
> at91/at91sam9g45_devices.c
> index f001305..a61c7ec 100644
> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
> @@ -653,7 +653,7 @@ static struct resource twi0_resources[] = {
>  };
>
>  static struct platform_device at91sam9g45_twi0_device = {
> -     .name           = "at91_i2c",
> +     .name           = "at91sam9g10_i2c",
>       .id             = 0,
>       .resource       = twi0_resources,
>       .num_resources  = ARRAY_SIZE(twi0_resources),
> @@ -673,7 +673,7 @@ static struct resource twi1_resources[] = {
>  };
>
>  static struct platform_device at91sam9g45_twi1_device = {
> -     .name           = "at91_i2c",
> +     .name           = "at91sam9g10_i2c",
>       .id             = 1,
>       .resource       = twi1_resources,
>       .num_resources  = ARRAY_SIZE(twi1_resources),
> diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-
> at91/at91sam9rl.c
> index bf79c1f..d708dfa 100644
> --- a/arch/arm/mach-at91/at91sam9rl.c
> +++ b/arch/arm/mach-at91/at91sam9rl.c
> @@ -186,8 +186,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
>       CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
>       CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c.0", &twi0_clk),
> -     CLKDEV_CON_DEV_ID(NULL, "at91_i2c.1", &twi1_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9g20_i2c.0", &twi0_clk),
> +     CLKDEV_CON_DEV_ID(NULL, "at91sam9g20_i2c.1", &twi1_clk),
>       CLKDEV_CON_ID("pioA", &pioA_clk),
>       CLKDEV_CON_ID("pioB", &pioB_clk),
>       CLKDEV_CON_ID("pioC", &pioC_clk),
> diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-
> at91/at91sam9rl_devices.c
> index f09fff9..2df7411 100644
> --- a/arch/arm/mach-at91/at91sam9rl_devices.c
> +++ b/arch/arm/mach-at91/at91sam9rl_devices.c
> @@ -346,7 +346,7 @@ static struct resource twi_resources[] = {
>  };
>
>  static struct platform_device at91sam9rl_twi_device = {
> -     .name           = "at91_i2c",
> +     .name           = "at91sam9g20_i2c",
>       .id             = -1,
>       .resource       = twi_resources,
>       .num_resources  = ARRAY_SIZE(twi_resources),
> diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
> index 08aaee7..bcf9a5c 100644
> --- a/drivers/i2c/busses/i2c-at91.c
> +++ b/drivers/i2c/busses/i2c-at91.c
> @@ -61,10 +61,10 @@
>  #define      AT91_TWI_RHR            0x0030  /* Receive Holding
> Register */
>  #define      AT91_TWI_THR            0x0034  /* Transmit Holding Register
> */
>
> -enum twi_ip_id {
> -     DEFAULT         = 0, /* default ip, no known limitations */
> -     RM9200          = 1,
> -     SAM9261         = 2,
> +struct at91_twi_pdata {
> +     unsigned        clk_max_div;
> +     unsigned        clk_offset;
> +     bool            has_unre_flag;
>  };
>
>  struct at91_twi_dev {
> @@ -78,8 +78,8 @@ struct at91_twi_dev {
>       int                     irq;
>       unsigned                transfer_status;
>       struct i2c_adapter      adapter;
> -     enum twi_ip_id          ip_id;
>       unsigned                twi_cwgr_reg;
> +     struct at91_twi_pdata   *pdata;
>  };
>
>  static unsigned at91_twi_read(struct at91_twi_dev *dev, unsigned reg)
> @@ -114,16 +114,9 @@ static void at91_init_twi_bus(struct at91_twi_dev
> *dev)
>  static void __devinit at91_calc_twi_clock(struct at91_twi_dev *dev, int
> twi_clk)
>  {
>       int ckdiv, cdiv, div;
> -     int offset = 4;
> -     int max_ckdiv = 7;
> -
> -     if (dev->ip_id == RM9200) {
> -             offset = 3;
> -             max_ckdiv = 5;
> -     } else if (dev->ip_id == SAM9261) {
> -             offset = 4;
> -             max_ckdiv = 5;
> -     }
> +     struct at91_twi_pdata *pdata = dev->pdata;
> +     int offset = pdata->clk_offset;
> +     int max_ckdiv = pdata->clk_max_div;
>
>       div = max(0, (int)DIV_ROUND_UP(clk_get_rate(dev->clk),
>                                      2 * twi_clk) - offset);
> @@ -209,6 +202,7 @@ static irqreturn_t atmel_twi_interrupt(int irq, void
> *dev_id)
>  static int at91_do_twi_transfer(struct at91_twi_dev *dev)
>  {
>       int ret;
> +     bool has_unre_flag = dev->pdata->has_unre_flag;
>
>       dev_dbg(dev->dev, "transfer: %s %d bytes.\n",
>               (dev->msg->flags & I2C_M_RD) ? "read" : "write", dev-
> >buf_len);
> @@ -250,7 +244,7 @@ static int at91_do_twi_transfer(struct at91_twi_dev
> *dev)
>               dev_err(dev->dev, "overrun while reading\n");
>               return -EIO;
>       }
> -     if (dev->transfer_status & AT91_TWI_UNRE && dev->ip_id ==
> RM9200) {
> +     if (has_unre_flag && dev->transfer_status & AT91_TWI_UNRE) {
>               dev_err(dev->dev, "underrun while writing\n");
>               return -EIO;
>       }
> @@ -323,6 +317,57 @@ static struct i2c_algorithm at91_twi_algorithm = {
>       .functionality  = at91_twi_func,
>  };
>
> +static struct at91_twi_pdata at91rm9200_config = {
> +     .clk_max_div = 5,
> +     .clk_offset = 3,
> +     .has_unre_flag = true,
> +};
> +
> +static struct at91_twi_pdata at91sam9261_config = {
> +     .clk_max_div = 5,
> +     .clk_offset = 4,
> +     .has_unre_flag = false,
> +};
> +
> +static struct at91_twi_pdata at91sam9260_config = {
> +     .clk_max_div = 7,
> +     .clk_offset = 4,
> +     .has_unre_flag = false,
> +};
> +
> +static struct at91_twi_pdata at91sam9g20_config = {
> +     .clk_max_div = 7,
> +     .clk_offset = 4,
> +     .has_unre_flag = false,
> +};
> +
> +static struct at91_twi_pdata at91sam9g10_config = {
> +     .clk_max_div = 7,
> +     .clk_offset = 4,
> +     .has_unre_flag = false,
> +};
> +
> +static const struct platform_device_id at91_twi_devtypes[] = {
> +     {
> +             .name = "at91rm9200_i2c",
> +             .driver_data = (unsigned long) &at91rm9200_config,
> +     }, {
> +             .name = "at91sam9261_i2c",
> +             .driver_data = (unsigned long) &at91sam9261_config,
> +     }, {
> +             .name = "at91sam9260_i2c",
> +             .driver_data = (unsigned long) &at91sam9260_config,
> +     }, {
> +             .name = "at91sam9g20_i2c",
> +             .driver_data = (unsigned long) &at91sam9g20_config,
> +     }, {
> +             .name = "at91sam9g10_i2c",
> +             .driver_data = (unsigned long) &at91sam9g10_config,
> +     }, {
> +             /* sentinel */
> +     }
> +};
> +
>  static int __devinit at91_twi_probe(struct platform_device *pdev)
>  {
>       struct at91_twi_dev *dev;
> @@ -339,6 +384,10 @@ static int __devinit at91_twi_probe(struct
> platform_device *pdev)
>       if (!mem)
>               return -ENODEV;
>
> +     dev->pdata = at91_twi_get_driver_data(pdev);
> +     if (!dev->pdata)
> +             return -ENODEV;
> +
>       dev->base = devm_request_and_ioremap(&pdev->dev, mem);
>       if (!dev->base)
>               return -EBUSY;
> @@ -354,9 +403,6 @@ static int __devinit at91_twi_probe(struct
> platform_device *pdev)
>               return rc;
>       }
>
> -     if (pdev->id_entry)
> -             dev->ip_id = pdev->id_entry->driver_data;
> -
>       platform_set_drvdata(pdev, dev);
>
>       dev->clk = devm_clk_get(dev->dev, NULL);
> @@ -432,6 +478,7 @@ static const struct dev_pm_ops at91_twi_pm = {
>  static struct platform_driver at91_twi_driver = {
>       .probe          = at91_twi_probe,
>       .remove         = __devexit_p(at91_twi_remove),
> +     .id_table       = at91_twi_devtypes,
>       .driver         = {
>               .name   = "at91_i2c",
>               .owner  = THIS_MODULE,
> --
> 1.7.11.3

^ permalink raw reply	[flat|nested] 65+ messages in thread

* RE: [PATCH 4/8] ARM: at91: do not configure at91sam9g10 twi pio as open-drain
  2012-08-31  9:21     ` ludovic.desroches at atmel.com
@ 2012-09-03  5:57         ` Voss, Nikolaus
  -1 siblings, 0 replies; 65+ messages in thread
From: Voss, Nikolaus @ 2012-09-03  5:57 UTC (permalink / raw)
  To: 'ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org',
	'linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org',
	'linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org',
	'devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org'
  Cc: 'nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org',
	'plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org'

ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org wrote on Friday, August 31, 2012 11:21 AM
> From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> 
> As indicated in the datasheet, TWD and TWCK must not be programmed as
> open-drain.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Acked-by: Nikolaus Voss <n.voss-+umVssTZoCsb1SvskN2V4Q@public.gmane.org>


> ---
>  arch/arm/mach-at91/at91sam9261_devices.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-
> at91/at91sam9261_devices.c
> index c94495d..405f603 100644
> --- a/arch/arm/mach-at91/at91sam9261_devices.c
> +++ b/arch/arm/mach-at91/at91sam9261_devices.c
> @@ -324,20 +324,22 @@ static struct platform_device
> at91sam9261_twi_device = {
> 
>  void __init at91_add_device_i2c(struct i2c_board_info *devices, int
> nr_devices)
>  {
> -	/* IP version is not the same on 9261 and g10 */
> +	/*
> +	 * IP version is not the same on 9261 and g10 and only 9261 one
> +	 * requires to configure PIO as open-drain.
> +	 */
>  	if (cpu_is_at91sam9g10()) {
>  		at91sam9261_twi_device.name = "at91sam9g10_i2c";
> +		at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD
> */
> +		at91_set_A_periph(AT91_PIN_PA8, 0);		/*
> TWCK */
>  	} else {
>  		at91sam9261_twi_device.name = "at91sam9261_i2c";
> +		at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD
> */
> +		at91_set_multi_drive(AT91_PIN_PA7, 1);
> +		at91_set_A_periph(AT91_PIN_PA8, 0);		/*
> TWCK */
> +		at91_set_multi_drive(AT91_PIN_PA8, 1);
>  	}
> 
> -	/* pins used for TWI interface */
> -	at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
> -	at91_set_multi_drive(AT91_PIN_PA7, 1);
> -
> -	at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
> -	at91_set_multi_drive(AT91_PIN_PA8, 1);
> -
>  	i2c_register_board_info(0, devices, nr_devices);
>  	platform_device_register(&at91sam9261_twi_device);
>  }
> --
> 1.7.11.3

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 4/8] ARM: at91: do not configure at91sam9g10 twi pio as open-drain
@ 2012-09-03  5:57         ` Voss, Nikolaus
  0 siblings, 0 replies; 65+ messages in thread
From: Voss, Nikolaus @ 2012-09-03  5:57 UTC (permalink / raw)
  To: linux-arm-kernel

ludovic.desroches at atmel.com wrote on Friday, August 31, 2012 11:21 AM
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> As indicated in the datasheet, TWD and TWCK must not be programmed as
> open-drain.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Nikolaus Voss <n.voss@weinmann.de>


> ---
>  arch/arm/mach-at91/at91sam9261_devices.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-
> at91/at91sam9261_devices.c
> index c94495d..405f603 100644
> --- a/arch/arm/mach-at91/at91sam9261_devices.c
> +++ b/arch/arm/mach-at91/at91sam9261_devices.c
> @@ -324,20 +324,22 @@ static struct platform_device
> at91sam9261_twi_device = {
> 
>  void __init at91_add_device_i2c(struct i2c_board_info *devices, int
> nr_devices)
>  {
> -	/* IP version is not the same on 9261 and g10 */
> +	/*
> +	 * IP version is not the same on 9261 and g10 and only 9261 one
> +	 * requires to configure PIO as open-drain.
> +	 */
>  	if (cpu_is_at91sam9g10()) {
>  		at91sam9261_twi_device.name = "at91sam9g10_i2c";
> +		at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD
> */
> +		at91_set_A_periph(AT91_PIN_PA8, 0);		/*
> TWCK */
>  	} else {
>  		at91sam9261_twi_device.name = "at91sam9261_i2c";
> +		at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD
> */
> +		at91_set_multi_drive(AT91_PIN_PA7, 1);
> +		at91_set_A_periph(AT91_PIN_PA8, 0);		/*
> TWCK */
> +		at91_set_multi_drive(AT91_PIN_PA8, 1);
>  	}
> 
> -	/* pins used for TWI interface */
> -	at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
> -	at91_set_multi_drive(AT91_PIN_PA7, 1);
> -
> -	at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
> -	at91_set_multi_drive(AT91_PIN_PA8, 1);
> -
>  	i2c_register_board_info(0, devices, nr_devices);
>  	platform_device_register(&at91sam9261_twi_device);
>  }
> --
> 1.7.11.3

^ permalink raw reply	[flat|nested] 65+ messages in thread

* RE: [PATCH 5/8] i2c: at91: add dt support to i2c-at91
  2012-08-31  9:23     ` ludovic.desroches at atmel.com
@ 2012-09-03  5:58         ` Voss, Nikolaus
  -1 siblings, 0 replies; 65+ messages in thread
From: Voss, Nikolaus @ 2012-09-03  5:58 UTC (permalink / raw)
  To: 'ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org',
	'linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org',
	'linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org',
	'devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org'
  Cc: 'nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org',
	'plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org'

ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org wrote on Friday, August 31, 2012 11:24 AM
> From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Acked-by: Nikolaus Voss <n.voss-+umVssTZoCsb1SvskN2V4Q@public.gmane.org>

> ---
>  .../devicetree/bindings/i2c/atmel-i2c.txt          | 30 +++++++++++++
>  drivers/i2c/busses/i2c-at91.c                      | 49 ++++++++++++++++++++++
>  2 files changed, 79 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/i2c/atmel-i2c.txt
> 
> diff --git a/Documentation/devicetree/bindings/i2c/atmel-i2c.txt
> b/Documentation/devicetree/bindings/i2c/atmel-i2c.txt
> new file mode 100644
> index 0000000..b689a0d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/atmel-i2c.txt
> @@ -0,0 +1,30 @@
> +I2C for Atmel platforms
> +
> +Required properties :
> +- compatible : Must be "atmel,at91rm9200-i2c", "atmel,at91sam9261-i2c",
> +     "atmel,at91sam9260-i2c", "atmel,at91sam9g20-i2c",
> "atmel,at91sam9g10-i2c"
> +     or "atmel,at91sam9x5-i2c"
> +- reg: physical base address of the controller and length of memory
> mapped
> +     region.
> +- interrupts: interrupt number to the cpu.
> +- #address-cells = <1>;
> +- #size-cells = <0>;
> +
> +Optional properties:
> +- Child nodes conforming to i2c bus binding
> +
> +Examples :
> +
> +i2c0: i2c@fff84000 {
> +	compatible = "atmel,at91sam9g20-i2c";
> +	reg = <0xfff84000 0x100>;
> +	interrupts = <12 4 6>;
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +
> +	24c512@50 {
> +		compatible = "24c512";
> +		reg = <0x50>;
> +		pagesize = <128>;
> +	}
> +}
> diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
> index bcf9a5c..7a80982 100644
> --- a/drivers/i2c/busses/i2c-at91.c
> +++ b/drivers/i2c/busses/i2c-at91.c
> @@ -24,6 +24,9 @@
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
>  #include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
> +#include <linux/of_i2c.h>
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
> 
> @@ -347,6 +350,12 @@ static struct at91_twi_pdata at91sam9g10_config = {
>  	.has_unre_flag = false,
>  };
> 
> +static struct at91_twi_pdata at91sam9x5_config = {
> +	.clk_max_div = 7,
> +	.clk_offset = 4,
> +	.has_unre_flag = false,
> +};
> +
>  static const struct platform_device_id at91_twi_devtypes[] = {
>  	{
>  		.name = "at91rm9200_i2c",
> @@ -368,6 +377,42 @@ static const struct platform_device_id
> at91_twi_devtypes[] = {
>  	}
>  };
> 
> +#if defined(CONFIG_OF)
> +static const struct of_device_id atmel_twi_dt_ids[] = {
> +	{
> +		.compatible = "atmel,at91sam9260-i2c",
> +		.data = &at91sam9260_config,
> +	} , {
> +		.compatible = "atmel,at91sam9g20-i2c",
> +		.data = &at91sam9g20_config,
> +	} , {
> +		.compatible = "atmel,at91sam9g10-i2c",
> +		.data = &at91sam9g10_config,
> +	}, {
> +		.compatible = "atmel,at91sam9x5-i2c",
> +		.data = &at91sam9x5_config,
> +	}, {
> +		/* sentinel */
> +	}
> +};
> +MODULE_DEVICE_TABLE(of, atmel_twi_dt_ids);
> +#else
> +#define atmel_twi_dt_ids NULL
> +#endif
> +
> +static struct at91_twi_pdata * __devinit at91_twi_get_driver_data(
> +					struct platform_device *pdev)
> +{
> +	if (pdev->dev.of_node) {
> +		const struct of_device_id *match;
> +		match = of_match_node(atmel_twi_dt_ids, pdev-
> >dev.of_node);
> +		if (!match)
> +			return NULL;
> +		return match->data;
> +	}
> +	return (struct at91_twi_pdata *) platform_get_device_id(pdev)-
> >driver_data;
> +}
> +
>  static int __devinit at91_twi_probe(struct platform_device *pdev)
>  {
>  	struct at91_twi_dev *dev;
> @@ -423,6 +468,7 @@ static int __devinit at91_twi_probe(struct
> platform_device *pdev)
>  	dev->adapter.dev.parent = dev->dev;
>  	dev->adapter.nr = pdev->id;
>  	dev->adapter.timeout = AT91_I2C_TIMEOUT;
> +	dev->adapter.dev.of_node = pdev->dev.of_node;
> 
>  	rc = i2c_add_numbered_adapter(&dev->adapter);
>  	if (rc) {
> @@ -432,6 +478,8 @@ static int __devinit at91_twi_probe(struct
> platform_device *pdev)
>  		return rc;
>  	}
> 
> +	of_i2c_register_devices(&dev->adapter);
> +
>  	dev_info(dev->dev, "AT91 i2c bus driver.\n");
>  	return 0;
>  }
> @@ -482,6 +530,7 @@ static struct platform_driver at91_twi_driver = {
>  	.driver		= {
>  		.name	= "at91_i2c",
>  		.owner	= THIS_MODULE,
> +		.of_match_table = atmel_twi_dt_ids,
>  		.pm	= at91_twi_pm_ops,
>  	},
>  };
> --
> 1.7.11.3

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 5/8] i2c: at91: add dt support to i2c-at91
@ 2012-09-03  5:58         ` Voss, Nikolaus
  0 siblings, 0 replies; 65+ messages in thread
From: Voss, Nikolaus @ 2012-09-03  5:58 UTC (permalink / raw)
  To: linux-arm-kernel

ludovic.desroches at atmel.com wrote on Friday, August 31, 2012 11:24 AM
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Nikolaus Voss <n.voss@weinmann.de>

> ---
>  .../devicetree/bindings/i2c/atmel-i2c.txt          | 30 +++++++++++++
>  drivers/i2c/busses/i2c-at91.c                      | 49 ++++++++++++++++++++++
>  2 files changed, 79 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/i2c/atmel-i2c.txt
> 
> diff --git a/Documentation/devicetree/bindings/i2c/atmel-i2c.txt
> b/Documentation/devicetree/bindings/i2c/atmel-i2c.txt
> new file mode 100644
> index 0000000..b689a0d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/atmel-i2c.txt
> @@ -0,0 +1,30 @@
> +I2C for Atmel platforms
> +
> +Required properties :
> +- compatible : Must be "atmel,at91rm9200-i2c", "atmel,at91sam9261-i2c",
> +     "atmel,at91sam9260-i2c", "atmel,at91sam9g20-i2c",
> "atmel,at91sam9g10-i2c"
> +     or "atmel,at91sam9x5-i2c"
> +- reg: physical base address of the controller and length of memory
> mapped
> +     region.
> +- interrupts: interrupt number to the cpu.
> +- #address-cells = <1>;
> +- #size-cells = <0>;
> +
> +Optional properties:
> +- Child nodes conforming to i2c bus binding
> +
> +Examples :
> +
> +i2c0: i2c at fff84000 {
> +	compatible = "atmel,at91sam9g20-i2c";
> +	reg = <0xfff84000 0x100>;
> +	interrupts = <12 4 6>;
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +
> +	24c512 at 50 {
> +		compatible = "24c512";
> +		reg = <0x50>;
> +		pagesize = <128>;
> +	}
> +}
> diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
> index bcf9a5c..7a80982 100644
> --- a/drivers/i2c/busses/i2c-at91.c
> +++ b/drivers/i2c/busses/i2c-at91.c
> @@ -24,6 +24,9 @@
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
>  #include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
> +#include <linux/of_i2c.h>
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
> 
> @@ -347,6 +350,12 @@ static struct at91_twi_pdata at91sam9g10_config = {
>  	.has_unre_flag = false,
>  };
> 
> +static struct at91_twi_pdata at91sam9x5_config = {
> +	.clk_max_div = 7,
> +	.clk_offset = 4,
> +	.has_unre_flag = false,
> +};
> +
>  static const struct platform_device_id at91_twi_devtypes[] = {
>  	{
>  		.name = "at91rm9200_i2c",
> @@ -368,6 +377,42 @@ static const struct platform_device_id
> at91_twi_devtypes[] = {
>  	}
>  };
> 
> +#if defined(CONFIG_OF)
> +static const struct of_device_id atmel_twi_dt_ids[] = {
> +	{
> +		.compatible = "atmel,at91sam9260-i2c",
> +		.data = &at91sam9260_config,
> +	} , {
> +		.compatible = "atmel,at91sam9g20-i2c",
> +		.data = &at91sam9g20_config,
> +	} , {
> +		.compatible = "atmel,at91sam9g10-i2c",
> +		.data = &at91sam9g10_config,
> +	}, {
> +		.compatible = "atmel,at91sam9x5-i2c",
> +		.data = &at91sam9x5_config,
> +	}, {
> +		/* sentinel */
> +	}
> +};
> +MODULE_DEVICE_TABLE(of, atmel_twi_dt_ids);
> +#else
> +#define atmel_twi_dt_ids NULL
> +#endif
> +
> +static struct at91_twi_pdata * __devinit at91_twi_get_driver_data(
> +					struct platform_device *pdev)
> +{
> +	if (pdev->dev.of_node) {
> +		const struct of_device_id *match;
> +		match = of_match_node(atmel_twi_dt_ids, pdev-
> >dev.of_node);
> +		if (!match)
> +			return NULL;
> +		return match->data;
> +	}
> +	return (struct at91_twi_pdata *) platform_get_device_id(pdev)-
> >driver_data;
> +}
> +
>  static int __devinit at91_twi_probe(struct platform_device *pdev)
>  {
>  	struct at91_twi_dev *dev;
> @@ -423,6 +468,7 @@ static int __devinit at91_twi_probe(struct
> platform_device *pdev)
>  	dev->adapter.dev.parent = dev->dev;
>  	dev->adapter.nr = pdev->id;
>  	dev->adapter.timeout = AT91_I2C_TIMEOUT;
> +	dev->adapter.dev.of_node = pdev->dev.of_node;
> 
>  	rc = i2c_add_numbered_adapter(&dev->adapter);
>  	if (rc) {
> @@ -432,6 +478,8 @@ static int __devinit at91_twi_probe(struct
> platform_device *pdev)
>  		return rc;
>  	}
> 
> +	of_i2c_register_devices(&dev->adapter);
> +
>  	dev_info(dev->dev, "AT91 i2c bus driver.\n");
>  	return 0;
>  }
> @@ -482,6 +530,7 @@ static struct platform_driver at91_twi_driver = {
>  	.driver		= {
>  		.name	= "at91_i2c",
>  		.owner	= THIS_MODULE,
> +		.of_match_table = atmel_twi_dt_ids,
>  		.pm	= at91_twi_pm_ops,
>  	},
>  };
> --
> 1.7.11.3

^ permalink raw reply	[flat|nested] 65+ messages in thread

* RE: [PATCH 6/8] ARM: at91: add clocks for I2C DT entries
  2012-08-31  9:24     ` ludovic.desroches at atmel.com
@ 2012-09-03  5:58         ` Voss, Nikolaus
  -1 siblings, 0 replies; 65+ messages in thread
From: Voss, Nikolaus @ 2012-09-03  5:58 UTC (permalink / raw)
  To: 'ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org',
	'linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org',
	'linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org',
	'devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org'
  Cc: 'nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org',
	'plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org'

ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org wrote on Friday, August 31, 2012 11:24 AM
> From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Acked-by: Nikolaus Voss <n.voss-+umVssTZoCsb1SvskN2V4Q@public.gmane.org>


> ---
>  arch/arm/mach-at91/at91sam9260.c | 1 +
>  arch/arm/mach-at91/at91sam9263.c | 1 +
>  arch/arm/mach-at91/at91sam9g45.c | 2 ++
>  arch/arm/mach-at91/at91sam9n12.c | 2 ++
>  arch/arm/mach-at91/at91sam9x5.c  | 6 +++---
>  5 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-
> at91/at91sam9260.c
> index 5f86e71..43f529a 100644
> --- a/arch/arm/mach-at91/at91sam9260.c
> +++ b/arch/arm/mach-at91/at91sam9260.c
> @@ -221,6 +221,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>  	CLKDEV_CON_DEV_ID("usart", "fffd0000.serial", &usart3_clk),
>  	CLKDEV_CON_DEV_ID("usart", "fffd4000.serial", &usart4_clk),
>  	CLKDEV_CON_DEV_ID("usart", "fffd8000.serial", &usart5_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "fffac000.i2c", &twi_clk),
>  	/* more tc lookup table for DT entries */
>  	CLKDEV_CON_DEV_ID("t0_clk", "fffa0000.timer", &tc0_clk),
>  	CLKDEV_CON_DEV_ID("t1_clk", "fffa0000.timer", &tc1_clk),
> diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-
> at91/at91sam9263.c
> index a4d760c..514757e 100644
> --- a/arch/arm/mach-at91/at91sam9263.c
> +++ b/arch/arm/mach-at91/at91sam9263.c
> @@ -211,6 +211,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>  	CLKDEV_CON_DEV_ID("hclk", "a00000.ohci", &ohci_clk),
>  	CLKDEV_CON_DEV_ID("spi_clk", "fffa4000.spi", &spi0_clk),
>  	CLKDEV_CON_DEV_ID("spi_clk", "fffa8000.spi", &spi1_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi_clk),
>  };
> 
>  static struct clk_lookup usart_clocks_lookups[] = {
> diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-
> at91/at91sam9g45.c
> index 15e62b9..9f3beba 100644
> --- a/arch/arm/mach-at91/at91sam9g45.c
> +++ b/arch/arm/mach-at91/at91sam9g45.c
> @@ -256,6 +256,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
>  	CLKDEV_CON_DEV_ID("t0_clk", "fffd4000.timer", &tcb0_clk),
>  	CLKDEV_CON_DEV_ID("hclk", "700000.ohci", &uhphs_clk),
>  	CLKDEV_CON_DEV_ID("ehci_clk", "800000.ehci", &uhphs_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "fff84000.i2c", &twi0_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi1_clk),
>  	/* fake hclk clock */
>  	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk),
>  	CLKDEV_CON_ID("pioA", &pioA_clk),
> diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-
> at91/at91sam9n12.c
> index 0849466..732d3d3 100644
> --- a/arch/arm/mach-at91/at91sam9n12.c
> +++ b/arch/arm/mach-at91/at91sam9n12.c
> @@ -169,6 +169,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
>  	CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb_clk),
>  	CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb_clk),
>  	CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller",
> &dma_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
>  	CLKDEV_CON_ID("pioA", &pioAB_clk),
>  	CLKDEV_CON_ID("pioB", &pioAB_clk),
>  	CLKDEV_CON_ID("pioC", &pioCD_clk),
> diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-
> at91/at91sam9x5.c
> index 4bad4a2..e503538 100644
> --- a/arch/arm/mach-at91/at91sam9x5.c
> +++ b/arch/arm/mach-at91/at91sam9x5.c
> @@ -231,9 +231,9 @@ static struct clk_lookup periph_clocks_lookups[] = {
>  	CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk),
>  	CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller",
> &dma0_clk),
>  	CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller",
> &dma1_clk),
> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.0", &twi0_clk),
> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.1", &twi1_clk),
> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.2", &twi2_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "f8018000.i2c", &twi2_clk),
>  	CLKDEV_CON_ID("pioA", &pioAB_clk),
>  	CLKDEV_CON_ID("pioB", &pioAB_clk),
>  	CLKDEV_CON_ID("pioC", &pioCD_clk),
> --
> 1.7.11.3

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 6/8] ARM: at91: add clocks for I2C DT entries
@ 2012-09-03  5:58         ` Voss, Nikolaus
  0 siblings, 0 replies; 65+ messages in thread
From: Voss, Nikolaus @ 2012-09-03  5:58 UTC (permalink / raw)
  To: linux-arm-kernel

ludovic.desroches at atmel.com wrote on Friday, August 31, 2012 11:24 AM
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Nikolaus Voss <n.voss@weinmann.de>


> ---
>  arch/arm/mach-at91/at91sam9260.c | 1 +
>  arch/arm/mach-at91/at91sam9263.c | 1 +
>  arch/arm/mach-at91/at91sam9g45.c | 2 ++
>  arch/arm/mach-at91/at91sam9n12.c | 2 ++
>  arch/arm/mach-at91/at91sam9x5.c  | 6 +++---
>  5 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-
> at91/at91sam9260.c
> index 5f86e71..43f529a 100644
> --- a/arch/arm/mach-at91/at91sam9260.c
> +++ b/arch/arm/mach-at91/at91sam9260.c
> @@ -221,6 +221,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>  	CLKDEV_CON_DEV_ID("usart", "fffd0000.serial", &usart3_clk),
>  	CLKDEV_CON_DEV_ID("usart", "fffd4000.serial", &usart4_clk),
>  	CLKDEV_CON_DEV_ID("usart", "fffd8000.serial", &usart5_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "fffac000.i2c", &twi_clk),
>  	/* more tc lookup table for DT entries */
>  	CLKDEV_CON_DEV_ID("t0_clk", "fffa0000.timer", &tc0_clk),
>  	CLKDEV_CON_DEV_ID("t1_clk", "fffa0000.timer", &tc1_clk),
> diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-
> at91/at91sam9263.c
> index a4d760c..514757e 100644
> --- a/arch/arm/mach-at91/at91sam9263.c
> +++ b/arch/arm/mach-at91/at91sam9263.c
> @@ -211,6 +211,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>  	CLKDEV_CON_DEV_ID("hclk", "a00000.ohci", &ohci_clk),
>  	CLKDEV_CON_DEV_ID("spi_clk", "fffa4000.spi", &spi0_clk),
>  	CLKDEV_CON_DEV_ID("spi_clk", "fffa8000.spi", &spi1_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi_clk),
>  };
> 
>  static struct clk_lookup usart_clocks_lookups[] = {
> diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-
> at91/at91sam9g45.c
> index 15e62b9..9f3beba 100644
> --- a/arch/arm/mach-at91/at91sam9g45.c
> +++ b/arch/arm/mach-at91/at91sam9g45.c
> @@ -256,6 +256,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
>  	CLKDEV_CON_DEV_ID("t0_clk", "fffd4000.timer", &tcb0_clk),
>  	CLKDEV_CON_DEV_ID("hclk", "700000.ohci", &uhphs_clk),
>  	CLKDEV_CON_DEV_ID("ehci_clk", "800000.ehci", &uhphs_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "fff84000.i2c", &twi0_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi1_clk),
>  	/* fake hclk clock */
>  	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk),
>  	CLKDEV_CON_ID("pioA", &pioA_clk),
> diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-
> at91/at91sam9n12.c
> index 0849466..732d3d3 100644
> --- a/arch/arm/mach-at91/at91sam9n12.c
> +++ b/arch/arm/mach-at91/at91sam9n12.c
> @@ -169,6 +169,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
>  	CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb_clk),
>  	CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb_clk),
>  	CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller",
> &dma_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
>  	CLKDEV_CON_ID("pioA", &pioAB_clk),
>  	CLKDEV_CON_ID("pioB", &pioAB_clk),
>  	CLKDEV_CON_ID("pioC", &pioCD_clk),
> diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-
> at91/at91sam9x5.c
> index 4bad4a2..e503538 100644
> --- a/arch/arm/mach-at91/at91sam9x5.c
> +++ b/arch/arm/mach-at91/at91sam9x5.c
> @@ -231,9 +231,9 @@ static struct clk_lookup periph_clocks_lookups[] = {
>  	CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk),
>  	CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller",
> &dma0_clk),
>  	CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller",
> &dma1_clk),
> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.0", &twi0_clk),
> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.1", &twi1_clk),
> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c.2", &twi2_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
> +	CLKDEV_CON_DEV_ID(NULL, "f8018000.i2c", &twi2_clk),
>  	CLKDEV_CON_ID("pioA", &pioAB_clk),
>  	CLKDEV_CON_ID("pioB", &pioAB_clk),
>  	CLKDEV_CON_ID("pioC", &pioCD_clk),
> --
> 1.7.11.3

^ permalink raw reply	[flat|nested] 65+ messages in thread

* RE: [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
  2012-09-01  9:10                 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-03  6:16                     ` Voss, Nikolaus
  -1 siblings, 0 replies; 65+ messages in thread
From: Voss, Nikolaus @ 2012-09-03  6:16 UTC (permalink / raw)
  To: 'Jean-Christophe PLAGNIOL-VILLARD', 'Sylwester Nawrocki'
  Cc: 'Nicolas Ferre',
	'ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org',
	'linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org',
	'linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org',
	'devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org'

Jean-Christophe PLAGNIOL-VILLARD wrote on Saturday, September 01, 2012 11:11 AM:
> On 22:47 Fri 31 Aug     , Sylwester Nawrocki wrote:
> > On 08/31/2012 04:51 PM, Nicolas Ferre wrote:
> > >>> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-
> at91/at91rm9200.c
> > >>> index f2112f9..0bc91e5 100644
> > >>> --- a/arch/arm/mach-at91/at91rm9200.c
> > >>> +++ b/arch/arm/mach-at91/at91rm9200.c
> > >>> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[]
> = {
> > >>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.0",&ssc0_clk),
> > >>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.1",&ssc1_clk),
> > >>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.2",&ssc2_clk),
> > >>> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c",&twi_clk),
> > >>> +	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c",&twi_clk),
> > >> use i2c-xxx as on other drivers
> > >>
> > >> and I do not like to have platform_device_id
> > >
> > > Me, I like it and find this implementation very elegant.
> > >
> > >> as we need to touch the driver to add a new soc
> > >
> > > So what? We still keep the compatibility if the new SoC has it
> > > compatibility assured with previous revision: there is nothing to modify.
> >
> > I agree. The driver would need to be touched to support new SoC only if
> > the IP there have had some differences, which would have needed to be
> > resolved anyway.
> >
> > >> please use platform data
> >
> > Using platform data for the dt platforms would have been more
> troublesome,
> > wouldn't it ? I like Ludovic's approach which handles both: dt and non-dt
> > cases in uniform way from the driver's POV.
> no you will describe it via DT as done on all the other drivers
> >
> > > No, it does not have to be exposed to the user: these data are highly
> > > dependent on the actual hardware (IP revision in fact). So, no need to
> > > mess with platform data.
> no I really see no point on these list of platform_id it's does not look more
> nice just more huggly to have x names. This is at the end the same as
> passing
> platform data via soc info (add_xx or dtsi)
> 
> And here you just do the same as cpu_is via names.

That's what the names suggest, but it's not the case. What the DEV_IDs
stand for is actually an IP version which cannot be read out from the IP
directly. So the version information is coded at a place where it should
be available: in the SoC setup code (not in the driver code, as with the
cpu_is() variant). Example: the name at91sam9g10 does not stand for
the cpu type but for the IP class which is also used on g45 SoC. 

> 
> The driver need to read IP revision instead

That would be the easiest solution, but the IP does not know it's
version. The DEV_ID approach is a workaround for this limitation.

Regards,
Niko

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
@ 2012-09-03  6:16                     ` Voss, Nikolaus
  0 siblings, 0 replies; 65+ messages in thread
From: Voss, Nikolaus @ 2012-09-03  6:16 UTC (permalink / raw)
  To: linux-arm-kernel

Jean-Christophe PLAGNIOL-VILLARD wrote on Saturday, September 01, 2012 11:11 AM:
> On 22:47 Fri 31 Aug     , Sylwester Nawrocki wrote:
> > On 08/31/2012 04:51 PM, Nicolas Ferre wrote:
> > >>> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-
> at91/at91rm9200.c
> > >>> index f2112f9..0bc91e5 100644
> > >>> --- a/arch/arm/mach-at91/at91rm9200.c
> > >>> +++ b/arch/arm/mach-at91/at91rm9200.c
> > >>> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[]
> = {
> > >>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.0",&ssc0_clk),
> > >>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.1",&ssc1_clk),
> > >>>   	CLKDEV_CON_DEV_ID("pclk", "ssc.2",&ssc2_clk),
> > >>> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c",&twi_clk),
> > >>> +	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c",&twi_clk),
> > >> use i2c-xxx as on other drivers
> > >>
> > >> and I do not like to have platform_device_id
> > >
> > > Me, I like it and find this implementation very elegant.
> > >
> > >> as we need to touch the driver to add a new soc
> > >
> > > So what? We still keep the compatibility if the new SoC has it
> > > compatibility assured with previous revision: there is nothing to modify.
> >
> > I agree. The driver would need to be touched to support new SoC only if
> > the IP there have had some differences, which would have needed to be
> > resolved anyway.
> >
> > >> please use platform data
> >
> > Using platform data for the dt platforms would have been more
> troublesome,
> > wouldn't it ? I like Ludovic's approach which handles both: dt and non-dt
> > cases in uniform way from the driver's POV.
> no you will describe it via DT as done on all the other drivers
> >
> > > No, it does not have to be exposed to the user: these data are highly
> > > dependent on the actual hardware (IP revision in fact). So, no need to
> > > mess with platform data.
> no I really see no point on these list of platform_id it's does not look more
> nice just more huggly to have x names. This is at the end the same as
> passing
> platform data via soc info (add_xx or dtsi)
> 
> And here you just do the same as cpu_is via names.

That's what the names suggest, but it's not the case. What the DEV_IDs
stand for is actually an IP version which cannot be read out from the IP
directly. So the version information is coded at a place where it should
be available: in the SoC setup code (not in the driver code, as with the
cpu_is() variant). Example: the name at91sam9g10 does not stand for
the cpu type but for the IP class which is also used on g45 SoC. 

> 
> The driver need to read IP revision instead

That would be the easiest solution, but the IP does not know it's
version. The DEV_ID approach is a workaround for this limitation.

Regards,
Niko

^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
  2012-09-01  9:10                 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-03  7:24                     ` ludovic.desroches
  -1 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches @ 2012-09-03  7:24 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	n.voss-+umVssTZoCsb1SvskN2V4Q, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	Sylwester Nawrocki,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Le 09/01/2012 11:10 AM, Jean-Christophe PLAGNIOL-VILLARD a écrit :
> On 22:47 Fri 31 Aug     , Sylwester Nawrocki wrote:
>> On 08/31/2012 04:51 PM, Nicolas Ferre wrote:
>>>>> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
>>>>> index f2112f9..0bc91e5 100644
>>>>> --- a/arch/arm/mach-at91/at91rm9200.c
>>>>> +++ b/arch/arm/mach-at91/at91rm9200.c
>>>>> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>>>>>    	CLKDEV_CON_DEV_ID("pclk", "ssc.0",&ssc0_clk),
>>>>>    	CLKDEV_CON_DEV_ID("pclk", "ssc.1",&ssc1_clk),
>>>>>    	CLKDEV_CON_DEV_ID("pclk", "ssc.2",&ssc2_clk),
>>>>> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c",&twi_clk),
>>>>> +	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c",&twi_clk),
>>>> use i2c-xxx as on other drivers
>>>>
>>>> and I do not like to have platform_device_id
>>>
>>> Me, I like it and find this implementation very elegant.
>>>
>>>> as we need to touch the driver to add a new soc
>>>
>>> So what? We still keep the compatibility if the new SoC has it
>>> compatibility assured with previous revision: there is nothing to modify.
>>
>> I agree. The driver would need to be touched to support new SoC only if
>> the IP there have had some differences, which would have needed to be
>> resolved anyway.
>>
>>>> please use platform data
>>
>> Using platform data for the dt platforms would have been more troublesome,
>> wouldn't it ? I like Ludovic's approach which handles both: dt and non-dt
>> cases in uniform way from the driver's POV.
> no you will describe it via DT as done on all the other drivers
>>
>>> No, it does not have to be exposed to the user: these data are highly
>>> dependent on the actual hardware (IP revision in fact). So, no need to
>>> mess with platform data.
> no I really see no point on these list of platform_id it's does not look more
> nice just more huggly to have x names. This is at the end the same as passing
> platform data via soc info (add_xx or dtsi)
>
> And here you just do the same as cpu_is via names.
>
> The driver need to read IP revision instead
>

At the beginning it was planned to do this but:
- a new SoC, with a new IP version lead to update the driver also
- with the MCI driver which uses IP version, I have some cases where 
using the version was not enough, a SoC approach would be better. For 
instance, the IP version tells that we can use PDC feature but PDC is 
not connected.

> Best Regards,
> J.
>
>

Regards

Ludovic

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
@ 2012-09-03  7:24                     ` ludovic.desroches
  0 siblings, 0 replies; 65+ messages in thread
From: ludovic.desroches @ 2012-09-03  7:24 UTC (permalink / raw)
  To: linux-arm-kernel

Le 09/01/2012 11:10 AM, Jean-Christophe PLAGNIOL-VILLARD a ?crit :
> On 22:47 Fri 31 Aug     , Sylwester Nawrocki wrote:
>> On 08/31/2012 04:51 PM, Nicolas Ferre wrote:
>>>>> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
>>>>> index f2112f9..0bc91e5 100644
>>>>> --- a/arch/arm/mach-at91/at91rm9200.c
>>>>> +++ b/arch/arm/mach-at91/at91rm9200.c
>>>>> @@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
>>>>>    	CLKDEV_CON_DEV_ID("pclk", "ssc.0",&ssc0_clk),
>>>>>    	CLKDEV_CON_DEV_ID("pclk", "ssc.1",&ssc1_clk),
>>>>>    	CLKDEV_CON_DEV_ID("pclk", "ssc.2",&ssc2_clk),
>>>>> -	CLKDEV_CON_DEV_ID(NULL, "at91_i2c",&twi_clk),
>>>>> +	CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c",&twi_clk),
>>>> use i2c-xxx as on other drivers
>>>>
>>>> and I do not like to have platform_device_id
>>>
>>> Me, I like it and find this implementation very elegant.
>>>
>>>> as we need to touch the driver to add a new soc
>>>
>>> So what? We still keep the compatibility if the new SoC has it
>>> compatibility assured with previous revision: there is nothing to modify.
>>
>> I agree. The driver would need to be touched to support new SoC only if
>> the IP there have had some differences, which would have needed to be
>> resolved anyway.
>>
>>>> please use platform data
>>
>> Using platform data for the dt platforms would have been more troublesome,
>> wouldn't it ? I like Ludovic's approach which handles both: dt and non-dt
>> cases in uniform way from the driver's POV.
> no you will describe it via DT as done on all the other drivers
>>
>>> No, it does not have to be exposed to the user: these data are highly
>>> dependent on the actual hardware (IP revision in fact). So, no need to
>>> mess with platform data.
> no I really see no point on these list of platform_id it's does not look more
> nice just more huggly to have x names. This is at the end the same as passing
> platform data via soc info (add_xx or dtsi)
>
> And here you just do the same as cpu_is via names.
>
> The driver need to read IP revision instead
>

At the beginning it was planned to do this but:
- a new SoC, with a new IP version lead to update the driver also
- with the MCI driver which uses IP version, I have some cases where 
using the version was not enough, a SoC approach would be better. For 
instance, the IP version tells that we can use PDC feature but PDC is 
not connected.

> Best Regards,
> J.
>
>

Regards

Ludovic

^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
  2012-09-03  7:24                     ` ludovic.desroches
@ 2012-09-03  7:51                         ` Nicolas Ferre
  -1 siblings, 0 replies; 65+ messages in thread
From: Nicolas Ferre @ 2012-09-03  7:51 UTC (permalink / raw)
  To: ludovic.desroches, Jean-Christophe PLAGNIOL-VILLARD, Sylwester Nawrocki
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	n.voss-+umVssTZoCsb1SvskN2V4Q, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 09/03/2012 09:24 AM, ludovic.desroches :
> Le 09/01/2012 11:10 AM, Jean-Christophe PLAGNIOL-VILLARD a écrit :
>> On 22:47 Fri 31 Aug     , Sylwester Nawrocki wrote:
>>> On 08/31/2012 04:51 PM, Nicolas Ferre wrote:
>>>>>> diff --git a/arch/arm/mach-at91/at91rm9200.c
>>>>>> b/arch/arm/mach-at91/at91rm9200.c
>>>>>> index f2112f9..0bc91e5 100644
>>>>>> --- a/arch/arm/mach-at91/at91rm9200.c
>>>>>> +++ b/arch/arm/mach-at91/at91rm9200.c
>>>>>> @@ -187,7 +187,7 @@ static struct clk_lookup
>>>>>> periph_clocks_lookups[] = {
>>>>>>        CLKDEV_CON_DEV_ID("pclk", "ssc.0",&ssc0_clk),
>>>>>>        CLKDEV_CON_DEV_ID("pclk", "ssc.1",&ssc1_clk),
>>>>>>        CLKDEV_CON_DEV_ID("pclk", "ssc.2",&ssc2_clk),
>>>>>> -    CLKDEV_CON_DEV_ID(NULL, "at91_i2c",&twi_clk),
>>>>>> +    CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c",&twi_clk),
>>>>> use i2c-xxx as on other drivers
>>>>>
>>>>> and I do not like to have platform_device_id
>>>>
>>>> Me, I like it and find this implementation very elegant.
>>>>
>>>>> as we need to touch the driver to add a new soc
>>>>
>>>> So what? We still keep the compatibility if the new SoC has it
>>>> compatibility assured with previous revision: there is nothing to
>>>> modify.
>>>
>>> I agree. The driver would need to be touched to support new SoC only if
>>> the IP there have had some differences, which would have needed to be
>>> resolved anyway.
>>>
>>>>> please use platform data
>>>
>>> Using platform data for the dt platforms would have been more
>>> troublesome,
>>> wouldn't it ? I like Ludovic's approach which handles both: dt and
>>> non-dt
>>> cases in uniform way from the driver's POV.
>> no you will describe it via DT as done on all the other drivers
>>>
>>>> No, it does not have to be exposed to the user: these data are highly
>>>> dependent on the actual hardware (IP revision in fact). So, no need to
>>>> mess with platform data.
>> no I really see no point on these list of platform_id it's does not
>> look more
>> nice just more huggly to have x names. This is at the end the same as
>> passing
>> platform data via soc info (add_xx or dtsi)
>>
>> And here you just do the same as cpu_is via names.
>>
>> The driver need to read IP revision instead
>>
> 
> At the beginning it was planned to do this but:
> - a new SoC, with a new IP version lead to update the driver also
> - with the MCI driver which uses IP version, I have some cases where
> using the version was not enough, a SoC approach would be better. For
> instance, the IP version tells that we can use PDC feature but PDC is
> not connected.

Absolutely. Nikolaus and you have summarized clearly the situation.

I think there is a consensus here.

So, we can move to a v2 patch series...

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
@ 2012-09-03  7:51                         ` Nicolas Ferre
  0 siblings, 0 replies; 65+ messages in thread
From: Nicolas Ferre @ 2012-09-03  7:51 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/03/2012 09:24 AM, ludovic.desroches :
> Le 09/01/2012 11:10 AM, Jean-Christophe PLAGNIOL-VILLARD a ?crit :
>> On 22:47 Fri 31 Aug     , Sylwester Nawrocki wrote:
>>> On 08/31/2012 04:51 PM, Nicolas Ferre wrote:
>>>>>> diff --git a/arch/arm/mach-at91/at91rm9200.c
>>>>>> b/arch/arm/mach-at91/at91rm9200.c
>>>>>> index f2112f9..0bc91e5 100644
>>>>>> --- a/arch/arm/mach-at91/at91rm9200.c
>>>>>> +++ b/arch/arm/mach-at91/at91rm9200.c
>>>>>> @@ -187,7 +187,7 @@ static struct clk_lookup
>>>>>> periph_clocks_lookups[] = {
>>>>>>        CLKDEV_CON_DEV_ID("pclk", "ssc.0",&ssc0_clk),
>>>>>>        CLKDEV_CON_DEV_ID("pclk", "ssc.1",&ssc1_clk),
>>>>>>        CLKDEV_CON_DEV_ID("pclk", "ssc.2",&ssc2_clk),
>>>>>> -    CLKDEV_CON_DEV_ID(NULL, "at91_i2c",&twi_clk),
>>>>>> +    CLKDEV_CON_DEV_ID(NULL, "at91rm9200_i2c",&twi_clk),
>>>>> use i2c-xxx as on other drivers
>>>>>
>>>>> and I do not like to have platform_device_id
>>>>
>>>> Me, I like it and find this implementation very elegant.
>>>>
>>>>> as we need to touch the driver to add a new soc
>>>>
>>>> So what? We still keep the compatibility if the new SoC has it
>>>> compatibility assured with previous revision: there is nothing to
>>>> modify.
>>>
>>> I agree. The driver would need to be touched to support new SoC only if
>>> the IP there have had some differences, which would have needed to be
>>> resolved anyway.
>>>
>>>>> please use platform data
>>>
>>> Using platform data for the dt platforms would have been more
>>> troublesome,
>>> wouldn't it ? I like Ludovic's approach which handles both: dt and
>>> non-dt
>>> cases in uniform way from the driver's POV.
>> no you will describe it via DT as done on all the other drivers
>>>
>>>> No, it does not have to be exposed to the user: these data are highly
>>>> dependent on the actual hardware (IP revision in fact). So, no need to
>>>> mess with platform data.
>> no I really see no point on these list of platform_id it's does not
>> look more
>> nice just more huggly to have x names. This is at the end the same as
>> passing
>> platform data via soc info (add_xx or dtsi)
>>
>> And here you just do the same as cpu_is via names.
>>
>> The driver need to read IP revision instead
>>
> 
> At the beginning it was planned to do this but:
> - a new SoC, with a new IP version lead to update the driver also
> - with the MCI driver which uses IP version, I have some cases where
> using the version was not enough, a SoC approach would be better. For
> instance, the IP version tells that we can use PDC feature but PDC is
> not connected.

Absolutely. Nikolaus and you have summarized clearly the situation.

I think there is a consensus here.

So, we can move to a v2 patch series...

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH 0/8] i2c: at91: cleanup and dt support
  2012-08-31  9:21 ` ludovic.desroches at atmel.com
@ 2012-09-03  7:55     ` Nicolas Ferre
  -1 siblings, 0 replies; 65+ messages in thread
From: Nicolas Ferre @ 2012-09-03  7:55 UTC (permalink / raw)
  To: ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	plagnioj-sclMFOaUSTBWk0Htik3J/w, n.voss-+umVssTZoCsb1SvskN2V4Q

On 08/31/2012 11:21 AM, ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org :
> From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> 
> Hi,
> 
> This set of patches is based on Nikolaus at91_i2c driver.
> 
> Ludovic Desroches (8):
>   i2c: at91: use managed resources
>   i2c: at91: add warning about transmission issues for some devices
>   i2c: at91: use an id table for SoC dependent parameters
>   ARM: at91: do not configure at91sam9g10 twi pio as open-drain
>   i2c: at91: add dt support to i2c-at91
>   ARM: at91: add clocks for I2C DT entries
>   ARM: dts: add twi nodes for atmel SOCs
>   ARM: dts: add twi nodes for atmel boards

For the whole patch series (with Jean-Christophe remarks about *dts
modifications*):

Acked-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>


>  .../devicetree/bindings/i2c/atmel-i2c.txt          |  30 +++
>  arch/arm/boot/dts/at91sam9260.dtsi                 |  23 +--
>  arch/arm/boot/dts/at91sam9263.dtsi                 |  23 +--
>  arch/arm/boot/dts/at91sam9263ek.dts                |  20 +-
>  arch/arm/boot/dts/at91sam9g20.dtsi                 |   4 +
>  arch/arm/boot/dts/at91sam9g20ek_common.dtsi        |  28 +--
>  arch/arm/boot/dts/at91sam9g25ek.dts                |  12 ++
>  arch/arm/boot/dts/at91sam9g45.dtsi                 |  33 ++--
>  arch/arm/boot/dts/at91sam9m10g45ek.dts             |   8 +
>  arch/arm/boot/dts/at91sam9n12.dtsi                 |  33 ++--
>  arch/arm/boot/dts/at91sam9n12ek.dts                |   8 +
>  arch/arm/boot/dts/at91sam9x5.dtsi                  |  69 +++----
>  arch/arm/mach-at91/at91rm9200.c                    |   2 +-
>  arch/arm/mach-at91/at91rm9200_devices.c            |  11 +-
>  arch/arm/mach-at91/at91sam9260.c                   |   4 +-
>  arch/arm/mach-at91/at91sam9260_devices.c           |   8 +-
>  arch/arm/mach-at91/at91sam9261.c                   |   3 +-
>  arch/arm/mach-at91/at91sam9261_devices.c           |  31 ++-
>  arch/arm/mach-at91/at91sam9263.c                   |   3 +-
>  arch/arm/mach-at91/at91sam9263_devices.c           |   2 +-
>  arch/arm/mach-at91/at91sam9g45.c                   |   6 +-
>  arch/arm/mach-at91/at91sam9g45_devices.c           |   4 +-
>  arch/arm/mach-at91/at91sam9n12.c                   |   2 +
>  arch/arm/mach-at91/at91sam9rl.c                    |   4 +-
>  arch/arm/mach-at91/at91sam9rl_devices.c            |   2 +-
>  arch/arm/mach-at91/at91sam9x5.c                    |   6 +-
>  drivers/i2c/busses/Kconfig                         |   6 +
>  drivers/i2c/busses/i2c-at91.c                      | 217 +++++++++++++--------
>  28 files changed, 367 insertions(+), 235 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/i2c/atmel-i2c.txt
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 0/8] i2c: at91: cleanup and dt support
@ 2012-09-03  7:55     ` Nicolas Ferre
  0 siblings, 0 replies; 65+ messages in thread
From: Nicolas Ferre @ 2012-09-03  7:55 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/31/2012 11:21 AM, ludovic.desroches at atmel.com :
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Hi,
> 
> This set of patches is based on Nikolaus at91_i2c driver.
> 
> Ludovic Desroches (8):
>   i2c: at91: use managed resources
>   i2c: at91: add warning about transmission issues for some devices
>   i2c: at91: use an id table for SoC dependent parameters
>   ARM: at91: do not configure at91sam9g10 twi pio as open-drain
>   i2c: at91: add dt support to i2c-at91
>   ARM: at91: add clocks for I2C DT entries
>   ARM: dts: add twi nodes for atmel SOCs
>   ARM: dts: add twi nodes for atmel boards

For the whole patch series (with Jean-Christophe remarks about *dts
modifications*):

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>


>  .../devicetree/bindings/i2c/atmel-i2c.txt          |  30 +++
>  arch/arm/boot/dts/at91sam9260.dtsi                 |  23 +--
>  arch/arm/boot/dts/at91sam9263.dtsi                 |  23 +--
>  arch/arm/boot/dts/at91sam9263ek.dts                |  20 +-
>  arch/arm/boot/dts/at91sam9g20.dtsi                 |   4 +
>  arch/arm/boot/dts/at91sam9g20ek_common.dtsi        |  28 +--
>  arch/arm/boot/dts/at91sam9g25ek.dts                |  12 ++
>  arch/arm/boot/dts/at91sam9g45.dtsi                 |  33 ++--
>  arch/arm/boot/dts/at91sam9m10g45ek.dts             |   8 +
>  arch/arm/boot/dts/at91sam9n12.dtsi                 |  33 ++--
>  arch/arm/boot/dts/at91sam9n12ek.dts                |   8 +
>  arch/arm/boot/dts/at91sam9x5.dtsi                  |  69 +++----
>  arch/arm/mach-at91/at91rm9200.c                    |   2 +-
>  arch/arm/mach-at91/at91rm9200_devices.c            |  11 +-
>  arch/arm/mach-at91/at91sam9260.c                   |   4 +-
>  arch/arm/mach-at91/at91sam9260_devices.c           |   8 +-
>  arch/arm/mach-at91/at91sam9261.c                   |   3 +-
>  arch/arm/mach-at91/at91sam9261_devices.c           |  31 ++-
>  arch/arm/mach-at91/at91sam9263.c                   |   3 +-
>  arch/arm/mach-at91/at91sam9263_devices.c           |   2 +-
>  arch/arm/mach-at91/at91sam9g45.c                   |   6 +-
>  arch/arm/mach-at91/at91sam9g45_devices.c           |   4 +-
>  arch/arm/mach-at91/at91sam9n12.c                   |   2 +
>  arch/arm/mach-at91/at91sam9rl.c                    |   4 +-
>  arch/arm/mach-at91/at91sam9rl_devices.c            |   2 +-
>  arch/arm/mach-at91/at91sam9x5.c                    |   6 +-
>  drivers/i2c/busses/Kconfig                         |   6 +
>  drivers/i2c/busses/i2c-at91.c                      | 217 +++++++++++++--------
>  28 files changed, 367 insertions(+), 235 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/i2c/atmel-i2c.txt
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
  2012-09-02 17:21                     ` Sylwester Nawrocki
@ 2012-09-06  4:54                         ` Warner Losh
  -1 siblings, 0 replies; 65+ messages in thread
From: Warner Losh @ 2012-09-06  4:54 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	n.voss-+umVssTZoCsb1SvskN2V4Q, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r


On Sep 2, 2012, at 11:21 AM, Sylwester Nawrocki wrote:

> On 09/01/2012 11:10 AM, Jean-Christophe PLAGNIOL-VILLARD wrote:
>> On 22:47 Fri 31 Aug     , Sylwester Nawrocki wrote:
>>> On 08/31/2012 04:51 PM, Nicolas Ferre wrote:
>>>> No, it does not have to be exposed to the user: these data are highly
>>>> dependent on the actual hardware (IP revision in fact). So, no need to
>>>> mess with platform data.
>> no I really see no point on these list of platform_id it's does not look more
>> nice just more huggly to have x names. This is at the end the same as passing
>> platform data via soc info (add_xx or dtsi)
>> 
>> And here you just do the same as cpu_is via names.
>> 
>> The driver need to read IP revision instead
> 
> OK, but wouldn't it be needed to resolve an IP revision at run time, e.g.
> with soc_is_*() anyway ? Having it set at each board doesn't look like an 
> optimal method either.

I'd much rather have a DT setting that gives the IP version in some manner, so I can key work arounds off of that.  Not so important for legacy devices where the Errata are well known (since you could do the same thing with some kind of property that's a boolean like for the AT91RM9200's mci controller that needs to swap bytes).  However, given my experience of bringing the FreeBSD at91rm9200 port to life and taking a product to market with it, I'd anticipate that the Errata will evolve over time, as will the need for workarounds.  Having an IP version helps deploy new drivers to the field without needing new DT files.

As you can tell, I'm not a big soc_is_* fan...

Warner

^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters
@ 2012-09-06  4:54                         ` Warner Losh
  0 siblings, 0 replies; 65+ messages in thread
From: Warner Losh @ 2012-09-06  4:54 UTC (permalink / raw)
  To: linux-arm-kernel


On Sep 2, 2012, at 11:21 AM, Sylwester Nawrocki wrote:

> On 09/01/2012 11:10 AM, Jean-Christophe PLAGNIOL-VILLARD wrote:
>> On 22:47 Fri 31 Aug     , Sylwester Nawrocki wrote:
>>> On 08/31/2012 04:51 PM, Nicolas Ferre wrote:
>>>> No, it does not have to be exposed to the user: these data are highly
>>>> dependent on the actual hardware (IP revision in fact). So, no need to
>>>> mess with platform data.
>> no I really see no point on these list of platform_id it's does not look more
>> nice just more huggly to have x names. This is at the end the same as passing
>> platform data via soc info (add_xx or dtsi)
>> 
>> And here you just do the same as cpu_is via names.
>> 
>> The driver need to read IP revision instead
> 
> OK, but wouldn't it be needed to resolve an IP revision at run time, e.g.
> with soc_is_*() anyway ? Having it set at each board doesn't look like an 
> optimal method either.

I'd much rather have a DT setting that gives the IP version in some manner, so I can key work arounds off of that.  Not so important for legacy devices where the Errata are well known (since you could do the same thing with some kind of property that's a boolean like for the AT91RM9200's mci controller that needs to swap bytes).  However, given my experience of bringing the FreeBSD at91rm9200 port to life and taking a product to market with it, I'd anticipate that the Errata will evolve over time, as will the need for workarounds.  Having an IP version helps deploy new drivers to the field without needing new DT files.

As you can tell, I'm not a big soc_is_* fan...

Warner

^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH 4/8] ARM: at91: do not configure at91sam9g10 twi pio as open-drain
       [not found]     ` <1346404884-18451-5-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
  2012-09-03  5:57         ` Voss, Nikolaus
@ 2012-09-06  4:57       ` Warner Losh
  1 sibling, 0 replies; 65+ messages in thread
From: Warner Losh @ 2012-09-06  4:57 UTC (permalink / raw)
  To: ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	n.voss-+umVssTZoCsb1SvskN2V4Q, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r


On Aug 31, 2012, at 3:21 AM, <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> wrote:

> From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> 
> As indicated in the datasheet, TWD and TWCK must not be programmed as
> open-drain.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> ---
> arch/arm/mach-at91/at91sam9261_devices.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
> index c94495d..405f603 100644
> --- a/arch/arm/mach-at91/at91sam9261_devices.c
> +++ b/arch/arm/mach-at91/at91sam9261_devices.c
> @@ -324,20 +324,22 @@ static struct platform_device at91sam9261_twi_device = {
> 
> void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
> {
> -	/* IP version is not the same on 9261 and g10 */
> +	/*
> +	 * IP version is not the same on 9261 and g10 and only 9261 one
> +	 * requires to configure PIO as open-drain.

"The IP version is not the same on the 9261 and g10.  Only the 9261
 requires PIO configured as open-drain."

would be a better way to say this.

> +	 */
> 	if (cpu_is_at91sam9g10()) {
> 		at91sam9261_twi_device.name = "at91sam9g10_i2c";
> +		at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
> +		at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
> 	} else {
> 		at91sam9261_twi_device.name = "at91sam9261_i2c";
> +		at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
> +		at91_set_multi_drive(AT91_PIN_PA7, 1);
> +		at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
> +		at91_set_multi_drive(AT91_PIN_PA8, 1);
> 	}
> 
> -	/* pins used for TWI interface */
> -	at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
> -	at91_set_multi_drive(AT91_PIN_PA7, 1);
> -
> -	at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
> -	at91_set_multi_drive(AT91_PIN_PA8, 1);
> -

You could just move the two multi-drive lines up into the 9261 branch of the above if.  That would make it clearer that it is a workaround just for the 9261.

> 	i2c_register_board_info(0, devices, nr_devices);
> 	platform_device_register(&at91sam9261_twi_device);
> }
> -- 
> 1.7.11.3
> 
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply	[flat|nested] 65+ messages in thread

end of thread, other threads:[~2012-09-06  4:57 UTC | newest]

Thread overview: 65+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-31  9:21 [PATCH 0/8] i2c: at91: cleanup and dt support ludovic.desroches
2012-08-31  9:21 ` ludovic.desroches at atmel.com
2012-08-31  9:21 ` [PATCH 1/8] i2c: at91: use managed resources ludovic.desroches
2012-08-31  9:21   ` ludovic.desroches at atmel.com
     [not found]   ` <1346404884-18451-2-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-09-03  5:52     ` Voss, Nikolaus
2012-09-03  5:52       ` Voss, Nikolaus
2012-08-31  9:21 ` [PATCH 3/8] i2c: at91: use an id table for SoC dependent parameters ludovic.desroches
2012-08-31  9:21   ` ludovic.desroches at atmel.com
2012-08-31 14:29   ` Jean-Christophe PLAGNIOL-VILLARD
2012-08-31 14:29     ` Jean-Christophe PLAGNIOL-VILLARD
     [not found]     ` <20120831142944.GA23867-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>
2012-08-31 14:51       ` Nicolas Ferre
2012-08-31 14:51         ` Nicolas Ferre
     [not found]         ` <5040CF80.8060201-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-08-31 20:47           ` Sylwester Nawrocki
2012-08-31 20:47             ` Sylwester Nawrocki
     [not found]             ` <504122D3.70507-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-09-01  9:10               ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-01  9:10                 ` Jean-Christophe PLAGNIOL-VILLARD
     [not found]                 ` <20120901091054.GA17540-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>
2012-09-02 17:21                   ` Sylwester Nawrocki
2012-09-02 17:21                     ` Sylwester Nawrocki
     [not found]                     ` <504395B1.2040203-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-09-06  4:54                       ` Warner Losh
2012-09-06  4:54                         ` Warner Losh
2012-09-03  6:16                   ` Voss, Nikolaus
2012-09-03  6:16                     ` Voss, Nikolaus
2012-09-03  7:24                   ` ludovic.desroches
2012-09-03  7:24                     ` ludovic.desroches
     [not found]                     ` <50445B11.5050601-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-09-03  7:51                       ` Nicolas Ferre
2012-09-03  7:51                         ` Nicolas Ferre
     [not found]   ` <1346404884-18451-4-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-09-03  5:55     ` Voss, Nikolaus
2012-09-03  5:55       ` Voss, Nikolaus
     [not found] ` <1346404884-18451-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-08-31  9:21   ` [PATCH 2/8] i2c: at91: add warning about transmission issues for some devices ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w
2012-08-31  9:21     ` ludovic.desroches at atmel.com
     [not found]     ` <1346404884-18451-3-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-09-03  5:54       ` Voss, Nikolaus
2012-09-03  5:54         ` Voss, Nikolaus
2012-08-31  9:21   ` [PATCH 4/8] ARM: at91: do not configure at91sam9g10 twi pio as open-drain ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w
2012-08-31  9:21     ` ludovic.desroches at atmel.com
     [not found]     ` <1346404884-18451-5-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-09-03  5:57       ` Voss, Nikolaus
2012-09-03  5:57         ` Voss, Nikolaus
2012-09-06  4:57       ` Warner Losh
2012-08-31  9:23   ` ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w
2012-08-31  9:23     ` ludovic.desroches at atmel.com
2012-08-31  9:23   ` [PATCH 5/8] i2c: at91: add dt support to i2c-at91 ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w
2012-08-31  9:23     ` ludovic.desroches at atmel.com
     [not found]     ` <1346405029-18539-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-09-03  5:58       ` Voss, Nikolaus
2012-09-03  5:58         ` Voss, Nikolaus
2012-08-31  9:24   ` [PATCH 6/8] ARM: at91: add clocks for I2C DT entries ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w
2012-08-31  9:24     ` ludovic.desroches at atmel.com
     [not found]     ` <1346405058-18580-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-09-03  5:58       ` Voss, Nikolaus
2012-09-03  5:58         ` Voss, Nikolaus
2012-08-31  9:24   ` [PATCH 8/8] ARM: dts: add twi nodes for atmel boards ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w
2012-08-31  9:24     ` ludovic.desroches at atmel.com
2012-08-31 14:42     ` Jean-Christophe PLAGNIOL-VILLARD
2012-08-31 14:42       ` Jean-Christophe PLAGNIOL-VILLARD
     [not found]       ` <20120831144228.GC23867-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>
2012-08-31 15:07         ` Nicolas Ferre
2012-08-31 15:07           ` Nicolas Ferre
     [not found]           ` <5040D31E.8040306-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-09-01  9:12             ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-01  9:12               ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-03  7:55   ` [PATCH 0/8] i2c: at91: cleanup and dt support Nicolas Ferre
2012-09-03  7:55     ` Nicolas Ferre
2012-08-31  9:24 ` [PATCH 7/8] ARM: dts: add twi nodes for atmel SOCs ludovic.desroches
2012-08-31  9:24   ` ludovic.desroches at atmel.com
2012-08-31 14:41   ` Jean-Christophe PLAGNIOL-VILLARD
2012-08-31 14:41     ` Jean-Christophe PLAGNIOL-VILLARD
     [not found]     ` <20120831144105.GB23867-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>
2012-08-31 14:46       ` ludovic.desroches
2012-08-31 14:46         ` ludovic.desroches
2012-08-31 14:56       ` Nicolas Ferre
2012-08-31 14:56         ` Nicolas Ferre

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.