Skip to contentSkip to conversation

fixes and DT support based on Nikolaus TWI driver

RFC PATCH New ludovic.desroches at atmel.com 4 participants 14 messages Aug 21, 2012 – Aug 22, 2012

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover fixes and DT support based on Nikolaus TWI driver

From: Ludovic Desroches <[email protected]>

Hi Nikolaus,

First of all, thanks for the work you have done on i2c-at91 driver and sorry to have been so long to answer you.

This set of patches is based on:
http://article.gmane.org/gmane.linux.kernel/1285193/match=patch+v10+0+4+at91+replace+broken+twi+driver+i2c+c

On my side, I don't see any issue with this new driver. I am not an I2C guru but it works with all the I2C devices I have and your patches have already been reviewed and tested. I'll continue to test it with other I2C devices and on several chips.

So the goal of this set of patches is to get feedback on the fix I added, on the DT support and to resurect your set of patches.

Regards

Ludovic

Ludovic Desroches (5):
i2c: at91: add new fixes for some TWI ip versions
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          | 29 +++++++++
 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/at91sam9g20ek_common.dtsi        | 28 ++++-----
 arch/arm/boot/dts/at91sam9g25ek.dts                | 12 ++++
 arch/arm/boot/dts/at91sam9g45.dtsi                 | 33 ++++++----
 arch/arm/boot/dts/at91sam9m10g45ek.dts             | 14 +++++
 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_devices.c            |  9 ---
 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                    |  3 +
 drivers/i2c/busses/i2c-at91.c                      | 71 ++++++++++++++++------
 18 files changed, 239 insertions(+), 142 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/atmel-i2c.txt
Signature · 1 line
1.7.11.3
#1 lore raw

PATCH 1/5 i2c: at91: add new fixes for some TWI ip versions

From: Ludovic Desroches <[email protected]>

The at91sam9261 TWI ip version requires also some fixes. The id_entry field from the platform device structure has been replaced by the use of cpu_is_xxx function to determine when to use these fixes.

---
 arch/arm/mach-at91/at91rm9200_devices.c |  9 -------
 drivers/i2c/busses/i2c-at91.c           | 42 +++++++++++++++++++--------------
 2 files changed, 24 insertions(+), 27 deletions(-)
arch/arm/mach-at91/at91rm9200_devices.c +0 -9
index 2b9b493..e6b7d05 100644
@@ -494,18 +494,9 @@ static struct resource twi_resources[] = {
 	},
 };
 
-static const struct platform_device_id twi_id = {
-	/*
-	 * driver_data is "1" for hardware with ckdiv upper limit == 5
-	 * (AT91RM9200 erratum 22), "0" for twi modules without this bug
-	 */
-	.driver_data	= 1,
-};
-
 static struct platform_device at91rm9200_twi_device = {
 	.name		= "at91_i2c",
 	.id		= -1,
-	.id_entry	= &twi_id,
 	.resource	= twi_resources,
 	.num_resources	= ARRAY_SIZE(twi_resources),
 };
drivers/i2c/busses/i2c-at91.c +24 -18

66 lines not on this page · raw message

Signature · 1 line
1.7.11.3
#2 lore raw

PATCH 1/5 i2c: at91: add new fixes for some TWI ip versions

On 08/21/2012 04:29 PM, ludovic.desroches at atmel.com :

Quoted 5 lines

From: Ludovic Desroches <[email protected]>

The at91sam9261 TWI ip version requires also some fixes. The id_entry field from the platform device structure has been replaced by the use of cpu_is_xxx function to determine when to use these fixes.

No, for this one. The current tendency is to remove the use of cpu_is_xxx() functions.

So yes, you will have to keep the use of struct platform_device_id in this driver and extend it with the device tree information.

Quoted 104 lines
---
 arch/arm/mach-at91/at91rm9200_devices.c |  9 -------
 drivers/i2c/busses/i2c-at91.c           | 42 +++++++++++++++++++--------------
 2 files changed, 24 insertions(+), 27 deletions(-)
arch/arm/mach-at91/at91rm9200_devices.c +0 -9
index 2b9b493..e6b7d05 100644
@@ -494,18 +494,9 @@ static struct resource twi_resources[] = {
 	},
 };
 
-static const struct platform_device_id twi_id = {
-	/*
-	 * driver_data is "1" for hardware with ckdiv upper limit == 5
-	 * (AT91RM9200 erratum 22), "0" for twi modules without this bug
-	 */
-	.driver_data	= 1,
-};
-
 static struct platform_device at91rm9200_twi_device = {
 	.name		= "at91_i2c",
 	.id		= -1,
-	.id_entry	= &twi_id,
 	.resource	= twi_resources,
 	.num_resources	= ARRAY_SIZE(twi_resources),
 };
drivers/i2c/busses/i2c-at91.c +24 -18
index b1cb780..4599522 100644
@@ -27,6 +27,8 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
+#include <mach/cpu.h>
+
 #define TWI_CLK_HZ		100000			/* max 400 Kbits/s */
 #define AT91_I2C_TIMEOUT	msecs_to_jiffies(100)	/* transfer timeout */
 
@@ -72,7 +74,6 @@ struct at91_twi_dev {
 	int			irq;
 	unsigned		transfer_status;
 	struct i2c_adapter	adapter;
-	bool			is_rm9200;
 	unsigned		twi_cwgr_reg;
 };
 
@@ -111,20 +112,28 @@ 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)
 {
-	const int offset = dev->is_rm9200 ? 3 : 4;
-	const int div = max(0, (int)DIV_ROUND_UP(clk_get_rate(dev->clk),
-						 2 * twi_clk) - offset);
-	int ckdiv = fls(div >> 8);
-	int cdiv = div >> ckdiv;
-
-	if (dev->is_rm9200 && (ckdiv > 5)) {
-		dev_warn(dev->dev, "AT91RM9200 erratum 22: using ckdiv = 5.\n");
-		ckdiv = 5;
-		cdiv = 255;
-	} else if (ckdiv > 7) {
-		dev_warn(dev->dev, "%d exceeds 3 bits for ckdiv, limiting.\n",
-			 ckdiv);
-		ckdiv = 7;
+	int offset, div, max_ckdiv, ckdiv, cdiv;
+
+	if (cpu_is_at91rm9200()) {
+		offset = 3;
+		max_ckdiv = 5;
+	} else if (cpu_is_at91sam9261()) {
+		offset = 4;
+		max_ckdiv = 5;
+	} else {
+		offset = 4;
+		max_ckdiv = 7;
+	}
+
+	div = max(0, (int)DIV_ROUND_UP(clk_get_rate(dev->clk),
+				       2 * twi_clk) - offset);
+	ckdiv = fls(div >> 8);
+	cdiv = div >> ckdiv;
+
+	if (ckdiv > max_ckdiv) {
+		dev_warn(dev->dev, "%d exceeds ckdiv max value which is %d.\n",
+			 ckdiv, max_ckdiv);
+		ckdiv = max_ckdiv;
 		cdiv = 255;
 	}
 
@@ -331,9 +340,6 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)
 		goto err_release_region;
 	}
 
-	if (pdev->id_entry && pdev->id_entry->driver_data == 1)
-		dev->is_rm9200 = 1;
-
 	init_completion(&dev->cmd_complete);
 
 	dev->dev = &pdev->dev;
Signature · 1 line
Nicolas Ferre
#3 lore raw

PATCH 1/5 i2c: at91: add new fixes for some TWI ip versions

In reply to ludovic.desroches at atmel.com

Hi Ludovic,

ludovic.desroches at atmel.com wrote on Tuesday, August 21, 2012 4:29 PM

Quoted 3 lines

The at91sam9261 TWI ip version requires also some fixes. The id_entry field from the platform device structure has been replaced by the use of cpu_is_xxx function to determine when to use these fixes.

I applied your calc_twi_clock() fix using the id_entry stuff instead of cpu_is_xxx functions as those are deprecated...

I will post the complete series later on. Please test it!

Niko

#4 lore raw

PATCH 1/5 i2c: at91: add new fixes for some TWI ip versions

In reply to ludovic.desroches at atmel.com
Quoted 76 lines · ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

The at91sam9261 TWI ip version requires also some fixes. The id_entry field from the platform device structure has been replaced by the use of cpu_is_xxx function to determine when to use these fixes.

---
 arch/arm/mach-at91/at91rm9200_devices.c |  9 -------
 drivers/i2c/busses/i2c-at91.c           | 42 +++++++++++++++++++--------------
 2 files changed, 24 insertions(+), 27 deletions(-)
arch/arm/mach-at91/at91rm9200_devices.c +0 -9
index 2b9b493..e6b7d05 100644
@@ -494,18 +494,9 @@ static struct resource twi_resources[] = {
 	},
 };
 
-static const struct platform_device_id twi_id = {
-	/*
-	 * driver_data is "1" for hardware with ckdiv upper limit == 5
-	 * (AT91RM9200 erratum 22), "0" for twi modules without this bug
-	 */
-	.driver_data	= 1,
-};
-
 static struct platform_device at91rm9200_twi_device = {
 	.name		= "at91_i2c",
 	.id		= -1,
-	.id_entry	= &twi_id,
 	.resource	= twi_resources,
 	.num_resources	= ARRAY_SIZE(twi_resources),
 };
drivers/i2c/busses/i2c-at91.c +4 -15
index b1cb780..4599522 100644
@@ -27,6 +27,8 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
+#include <mach/cpu.h>
+
 #define TWI_CLK_HZ		100000			/* max 400 Kbits/s */
 #define AT91_I2C_TIMEOUT	msecs_to_jiffies(100)	/* transfer timeout */
 
@@ -72,7 +74,6 @@ struct at91_twi_dev {
 	int			irq;
 	unsigned		transfer_status;
 	struct i2c_adapter	adapter;
-	bool			is_rm9200;
 	unsigned		twi_cwgr_reg;
 };
 
@@ -111,20 +112,28 @@ 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)
 {
-	const int offset = dev->is_rm9200 ? 3 : 4;
-	const int div = max(0, (int)DIV_ROUND_UP(clk_get_rate(dev->clk),
-						 2 * twi_clk) - offset);
-	int ckdiv = fls(div >> 8);
-	int cdiv = div >> ckdiv;
-
-	if (dev->is_rm9200 && (ckdiv > 5)) {
-		dev_warn(dev->dev, "AT91RM9200 erratum 22: using ckdiv = 5.\n");
-		ckdiv = 5;
-		cdiv = 255;
-	} else if (ckdiv > 7) {
-		dev_warn(dev->dev, "%d exceeds 3 bits for ckdiv, limiting.\n",
-			 ckdiv);
-		ckdiv = 7;
+	int offset, div, max_ckdiv, ckdiv, cdiv;
+

drivers/i2c/busses/i2c-at91.c static void at91_init_twi_bus(struct at91_twi_dev *dev) · line 126

Quoted 10 lines
drivers/i2c/busses/i2c-at91.c +10 -0
+	if (cpu_is_at91rm9200()) {
+		offset = 3;
+		max_ckdiv = 5;
+	} else if (cpu_is_at91sam9261()) {
+		offset = 4;
+		max_ckdiv = 5;
+	} else {
+		offset = 4;
+		max_ckdiv = 7;
+	}

can you read this from the IP version?

I do not like the cpu_is outside of the mach-at91

Best Regards,
J.

#5 lore raw

PATCH 2/5 i2c: at91: add dt support to i2c-at91

In reply to ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

---
 .../devicetree/bindings/i2c/atmel-i2c.txt          | 29 +++++++++++++
 drivers/i2c/busses/i2c-at91.c                      | 49 +++++++++++++++++-----
 2 files changed, 68 insertions(+), 10 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/atmel-i2c.txt
Documentation/devicetree/bindings/i2c/atmel-i2c.txt new file +29 -0
new file mode 100644
index 0000000..9e46289
@@ -0,0 +1,29 @@
+I2C for Atmel platforms
+
+Required properties :
+- compatible : Must be "atmel,at91rm9200-i2c", "atmel,at91sam9261-i2c" or
+     "atmel,at91sam9g20-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>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	24c512 at 50 {
+		compatible = "24c512";
+		reg = <0x50>;
+		pagesize = <128>;
+	}
+}
drivers/i2c/busses/i2c-at91.c +39 -10

86 lines not on this page · raw message

Signature · 1 line
1.7.11.3
#6 lore raw

PATCH 2/5 i2c: at91: add dt support to i2c-at91

On 08/21/2012 04:29 PM, ludovic.desroches at atmel.com :

Quoted 80 lines

From: Ludovic Desroches <[email protected]>

---
 .../devicetree/bindings/i2c/atmel-i2c.txt          | 29 +++++++++++++
 drivers/i2c/busses/i2c-at91.c                      | 49 +++++++++++++++++-----
 2 files changed, 68 insertions(+), 10 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/atmel-i2c.txt
Documentation/devicetree/bindings/i2c/atmel-i2c.txt new file +29 -0
new file mode 100644
index 0000000..9e46289
@@ -0,0 +1,29 @@
+I2C for Atmel platforms
+
+Required properties :
+- compatible : Must be "atmel,at91rm9200-i2c", "atmel,at91sam9261-i2c" or
+     "atmel,at91sam9g20-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>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	24c512 at 50 {
+		compatible = "24c512";
+		reg = <0x50>;
+		pagesize = <128>;
+	}
+}
drivers/i2c/busses/i2c-at91.c +13 -8
index 4599522..1c86b24 100644
@@ -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>
 
@@ -112,17 +115,27 @@ 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 offset, div, max_ckdiv, ckdiv, cdiv;
-
-	if (cpu_is_at91rm9200()) {
-		offset = 3;
-		max_ckdiv = 5;
-	} else if (cpu_is_at91sam9261()) {
-		offset = 4;
-		max_ckdiv = 5;
+	int offset = 4, max_ckdiv = 7;
+	int div, ckdiv, cdiv;
+
+	if (dev->dev->of_node) {
+		if (of_device_is_compatible(dev->dev->of_node,
+					    "atmel,at91rm9200-i2c")) {
+			offset = 3;
+			max_ckdiv = 5;
+		} else if (of_device_is_compatible(dev->dev->of_node,
+						   "atmel,at91sam9261-i2c")) {

drivers/i2c/busses/i2c-at91.c static void at91_init_twi_bus(struct at91_twi_dev *dev) · line 135

Quoted 10 lines
drivers/i2c/busses/i2c-at91.c +7 -2
+			offset = 4;
+			max_ckdiv = 5;
+		}
 	} else {
-		offset = 4;
-		max_ckdiv = 7;
+		if (cpu_is_at91rm9200()) {
+			offset = 3;
+			max_ckdiv = 5;
+		} else if (cpu_is_at91sam9261()) {

H?h? ;-) here also, you will have to review this part...

Quoted 50 lines
drivers/i2c/busses/i2c-at91.c +19 -0
+			offset = 4;
+			max_ckdiv = 5;
+		}
 	}
 
 	div = max(0, (int)DIV_ROUND_UP(clk_get_rate(dev->clk),
@@ -379,6 +392,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) {
@@ -387,6 +401,8 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)
 		goto err_free_irq;
 	}
 
+	of_i2c_register_devices(&dev->adapter);
+
 	dev_info(dev->dev, "AT91 i2c bus driver.\n");
 	return 0;
 
@@ -454,12 +470,25 @@ static const struct dev_pm_ops at91_twi_pm = {
 #define at91_twi_pm_ops NULL
 #endif
 
+#ifdef CONFIG_OF
+static const struct of_device_id at91_twi_dt_ids[] = {
+	{ .compatible = "atmel,at91rm9200-i2c", },
+	{ .compatible = "atmel,at91sam9260-i2c", },
+	{ .compatible = "atmel,at91sam9261-i2c", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, at91_twi_dt_ids);
+#else
+#define at91_twi_dt_ids NULL
+#endif
+
 static struct platform_driver at91_twi_driver = {
 	.probe		= at91_twi_probe,
 	.remove		= __devexit_p(at91_twi_remove),
 	.driver		= {
 		.name	= "at91_i2c",
 		.owner	= THIS_MODULE,
+		.of_match_table = at91_twi_dt_ids,
 		.pm	= at91_twi_pm_ops,
 	},
 };
Signature · 1 line
Nicolas Ferre
#7 lore raw

PATCH 3/5 ARM: at91: add clocks for i2c DT entries

In reply to ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

---
 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  | 3 +++
 5 files changed, 9 insertions(+)
arch/arm/mach-at91/at91sam9260.c +1 -0
index 2e56321..f3fdca7 100644
@@ -227,6 +227,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t1_clk", "fffdc000.timer", &tc4_clk),
 	CLKDEV_CON_DEV_ID("t2_clk", "fffdc000.timer", &tc5_clk),
 	CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &ohci_clk),
+	CLKDEV_CON_DEV_ID(NULL, "fffac000.i2c", &twi_clk),
 	/* fake hclk clock */
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
arch/arm/mach-at91/at91sam9263.c +1 -0
index 71305fa..15458ad 100644
@@ -210,6 +210,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[] = {
arch/arm/mach-at91/at91sam9g45.c +2 -0
index 2944fc7..dcc4e3c 100644
@@ -244,6 +244,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),
arch/arm/mach-at91/at91sam9n12.c +2 -0
index 0849466..732d3d3 100644
@@ -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),
arch/arm/mach-at91/at91sam9x5.c +3 -0
index 1b144b4..744ffc2 100644
@@ -231,6 +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, "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),
Signature · 1 line
1.7.11.3
#8 lore raw

PATCH 3/5 ARM: at91: add clocks for i2c DT entries

On 08/21/2012 04:29 PM, ludovic.desroches at atmel.com :

Quoted 3 lines

From: Ludovic Desroches <[email protected]>

Quoted 73 lines
---
 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  | 3 +++
 5 files changed, 9 insertions(+)
arch/arm/mach-at91/at91sam9260.c +1 -0
index 2e56321..f3fdca7 100644
@@ -227,6 +227,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t1_clk", "fffdc000.timer", &tc4_clk),
 	CLKDEV_CON_DEV_ID("t2_clk", "fffdc000.timer", &tc5_clk),
 	CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &ohci_clk),
+	CLKDEV_CON_DEV_ID(NULL, "fffac000.i2c", &twi_clk),
 	/* fake hclk clock */
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
arch/arm/mach-at91/at91sam9263.c +1 -0
index 71305fa..15458ad 100644
@@ -210,6 +210,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[] = {
arch/arm/mach-at91/at91sam9g45.c +2 -0
index 2944fc7..dcc4e3c 100644
@@ -244,6 +244,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),
arch/arm/mach-at91/at91sam9n12.c +2 -0
index 0849466..732d3d3 100644
@@ -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),
arch/arm/mach-at91/at91sam9x5.c +3 -0
index 1b144b4..744ffc2 100644
@@ -231,6 +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, "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),
Signature · 1 line
Nicolas Ferre
#9 lore raw

PATCH 4/5 ARM: dts: add twi nodes for atmel SOCs

In reply to ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

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

---
 arch/arm/boot/dts/at91sam9260.dtsi | 23 ++++++-------
 arch/arm/boot/dts/at91sam9263.dtsi | 23 ++++++-------
 arch/arm/boot/dts/at91sam9g45.dtsi | 33 +++++++++++-------
 arch/arm/boot/dts/at91sam9n12.dtsi | 33 +++++++++++-------
 arch/arm/boot/dts/at91sam9x5.dtsi  | 69 +++++++++++++++++---------------------
 5 files changed, 90 insertions(+), 91 deletions(-)
arch/arm/boot/dts/at91sam9260.dtsi +10 -13
index f449efc..0ab7a3c 100644
@@ -28,6 +28,7 @@
 		gpio2 = &pioC;
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
+		i2c0 = &i2c0;
 	};
 	cpus {
 		cpu at 0 {
@@ -198,6 +199,15 @@
 				status = "disabled";
 			};
 
+			i2c0: i2c at fffac000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xfffac000 0x100>;
+				interrupts = <11 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
 			adc0: adc at fffe0000 {
 				compatible = "atmel,at91sam9260-adc";
 				reg = <0xfffe0000 0x100>;
@@ -257,17 +267,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";
-	};
 };
arch/arm/boot/dts/at91sam9263.dtsi +10 -13
index 0209913..efb86dd 100644
@@ -24,6 +24,7 @@
 		gpio3 = &pioD;
 		gpio4 = &pioE;
 		tcb0 = &tcb0;
+		i2c0 = &i2c0;
 	};
 	cpus {
 		cpu at 0 {
@@ -179,6 +180,15 @@
 				interrupts = <24 4>;
 				status = "disabled";
 			};
+
+			i2c0: i2c at fff88000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xfff88000 0x100>;
+				interrupts = <13 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
 		};
 
 		nand0: nand at 40000000 {
@@ -204,17 +214,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";
-	};
 };
arch/arm/boot/dts/at91sam9g45.dtsi +20 -13
index 7dbccaf..8dd3ff8 100644
@@ -29,6 +29,8 @@
 		gpio4 = &pioE;
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
+		i2c0 = &i2c0;
+		i2c1 = &i2c1;
 	};
 	cpus {
 		cpu at 0 {
@@ -200,6 +202,24 @@
 				status = "disabled";
 			};
 
+			i2c0: i2c at fff84000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xfff84000 0x100>;
+				interrupts = <12 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c1: i2c at fff88000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xfff88000 0x100>;
+				interrupts = <13 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
 			adc0: adc at fffb0000 {
 				compatible = "atmel,at91sam9260-adc";
 				reg = <0xfffb0000 0x100>;
@@ -268,17 +288,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";
-	};
 };
arch/arm/boot/dts/at91sam9n12.dtsi +20 -13
index cb84de7..8a1969d 100644
@@ -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,at91sam9260-i2c";
+				reg = <0xf8010000 0x100>;
+				interrupts = <9 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c1: i2c at f8014000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xf8014000 0x100>;
+				interrupts = <10 4>;
+				#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";
-	};
 };
arch/arm/boot/dts/at91sam9x5.dtsi +30 -39

85 lines not on this page · raw message

Signature · 1 line
1.7.11.3
#10 lore raw

PATCH 4/5 ARM: dts: add twi nodes for atmel SOCs

From: Ludovic Desroches <[email protected]>

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

---
 arch/arm/boot/dts/at91sam9260.dtsi | 23 ++++++-------
 arch/arm/boot/dts/at91sam9263.dtsi | 23 ++++++-------
 arch/arm/boot/dts/at91sam9g45.dtsi | 33 +++++++++++-------
 arch/arm/boot/dts/at91sam9n12.dtsi | 33 +++++++++++-------
 arch/arm/boot/dts/at91sam9x5.dtsi  | 69 +++++++++++++++++---------------------
 5 files changed, 90 insertions(+), 91 deletions(-)
arch/arm/boot/dts/at91sam9260.dtsi +10 -13
index f449efc..0ab7a3c 100644
@@ -28,6 +28,7 @@
 		gpio2 = &pioC;
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
+		i2c0 = &i2c0;
 	};
 	cpus {
 		cpu at 0 {
@@ -198,6 +199,15 @@
 				status = "disabled";
 			};
 
+			i2c0: i2c at fffac000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xfffac000 0x100>;
+				interrupts = <11 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
 			adc0: adc at fffe0000 {
 				compatible = "atmel,at91sam9260-adc";
 				reg = <0xfffe0000 0x100>;
@@ -257,17 +267,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";
-	};
 };
arch/arm/boot/dts/at91sam9263.dtsi +10 -13
index 0209913..efb86dd 100644
@@ -24,6 +24,7 @@
 		gpio3 = &pioD;
 		gpio4 = &pioE;
 		tcb0 = &tcb0;
+		i2c0 = &i2c0;
 	};
 	cpus {
 		cpu at 0 {
@@ -179,6 +180,15 @@
 				interrupts = <24 4>;
 				status = "disabled";
 			};
+
+			i2c0: i2c at fff88000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xfff88000 0x100>;
+				interrupts = <13 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
 		};
 
 		nand0: nand at 40000000 {
@@ -204,17 +214,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";
-	};
 };
arch/arm/boot/dts/at91sam9g45.dtsi +20 -13
index 7dbccaf..8dd3ff8 100644
@@ -29,6 +29,8 @@
 		gpio4 = &pioE;
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
+		i2c0 = &i2c0;
+		i2c1 = &i2c1;
 	};
 	cpus {
 		cpu at 0 {
@@ -200,6 +202,24 @@
 				status = "disabled";
 			};
 
+			i2c0: i2c at fff84000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xfff84000 0x100>;
+				interrupts = <12 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c1: i2c at fff88000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xfff88000 0x100>;
+				interrupts = <13 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
 			adc0: adc at fffb0000 {
 				compatible = "atmel,at91sam9260-adc";
 				reg = <0xfffb0000 0x100>;
@@ -268,17 +288,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";
-	};
 };
arch/arm/boot/dts/at91sam9n12.dtsi +20 -13
index cb84de7..8a1969d 100644
@@ -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,at91sam9260-i2c";
+				reg = <0xf8010000 0x100>;
+				interrupts = <9 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c1: i2c at f8014000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xf8014000 0x100>;
+				interrupts = <10 4>;
+				#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";
-	};
 };
arch/arm/boot/dts/at91sam9x5.dtsi +30 -39

85 lines not on this page · raw message

Signature · 1 line
1.7.11.3
#11 lore raw

PATCH 4/5 ARM: dts: add twi nodes for atmel SOCs

In reply to ludovic.desroches at atmel.com

On 08/21/2012 04:29 PM, ludovic.desroches at atmel.com :

Quoted 5 lines

From: Ludovic Desroches <[email protected]>

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

Yes, we will move to it once people test it a little bit...

Quoted 305 lines
---
 arch/arm/boot/dts/at91sam9260.dtsi | 23 ++++++-------
 arch/arm/boot/dts/at91sam9263.dtsi | 23 ++++++-------
 arch/arm/boot/dts/at91sam9g45.dtsi | 33 +++++++++++-------
 arch/arm/boot/dts/at91sam9n12.dtsi | 33 +++++++++++-------
 arch/arm/boot/dts/at91sam9x5.dtsi  | 69 +++++++++++++++++---------------------
 5 files changed, 90 insertions(+), 91 deletions(-)
arch/arm/boot/dts/at91sam9260.dtsi +10 -13
index f449efc..0ab7a3c 100644
@@ -28,6 +28,7 @@
 		gpio2 = &pioC;
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
+		i2c0 = &i2c0;
 	};
 	cpus {
 		cpu at 0 {
@@ -198,6 +199,15 @@
 				status = "disabled";
 			};
 
+			i2c0: i2c at fffac000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xfffac000 0x100>;
+				interrupts = <11 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
 			adc0: adc at fffe0000 {
 				compatible = "atmel,at91sam9260-adc";
 				reg = <0xfffe0000 0x100>;
@@ -257,17 +267,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";
-	};
 };
arch/arm/boot/dts/at91sam9263.dtsi +10 -13
index 0209913..efb86dd 100644
@@ -24,6 +24,7 @@
 		gpio3 = &pioD;
 		gpio4 = &pioE;
 		tcb0 = &tcb0;
+		i2c0 = &i2c0;
 	};
 	cpus {
 		cpu at 0 {
@@ -179,6 +180,15 @@
 				interrupts = <24 4>;
 				status = "disabled";
 			};
+
+			i2c0: i2c at fff88000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xfff88000 0x100>;
+				interrupts = <13 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
 		};
 
 		nand0: nand at 40000000 {
@@ -204,17 +214,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";
-	};
 };
arch/arm/boot/dts/at91sam9g45.dtsi +20 -13
index 7dbccaf..8dd3ff8 100644
@@ -29,6 +29,8 @@
 		gpio4 = &pioE;
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
+		i2c0 = &i2c0;
+		i2c1 = &i2c1;
 	};
 	cpus {
 		cpu at 0 {
@@ -200,6 +202,24 @@
 				status = "disabled";
 			};
 
+			i2c0: i2c at fff84000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xfff84000 0x100>;
+				interrupts = <12 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c1: i2c at fff88000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xfff88000 0x100>;
+				interrupts = <13 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
 			adc0: adc at fffb0000 {
 				compatible = "atmel,at91sam9260-adc";
 				reg = <0xfffb0000 0x100>;
@@ -268,17 +288,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";
-	};
 };
arch/arm/boot/dts/at91sam9n12.dtsi +20 -13
index cb84de7..8a1969d 100644
@@ -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,at91sam9260-i2c";
+				reg = <0xf8010000 0x100>;
+				interrupts = <9 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c1: i2c at f8014000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xf8014000 0x100>;
+				interrupts = <10 4>;
+				#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";
-	};
 };
arch/arm/boot/dts/at91sam9x5.dtsi +30 -39
index 6b3ef43..ec56eaf 100644
@@ -27,6 +27,9 @@
 		gpio3 = &pioD;
 		tcb0 = &tcb0;
 		tcb1 = &tcb1;
+		i2c0 = &i2c0;
+		i2c1 = &i2c1;
+		i2c2 = &i2c2;
 	};
 	cpus {
 		cpu at 0 {
@@ -191,6 +194,33 @@
 				status = "disabled";
 			};
 
+			i2c0: i2c at f8010000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xf8010000 0x100>;
+				interrupts = <9 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c1: i2c at f8014000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xf8014000 0x100>;
+				interrupts = <10 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c2: i2c at f8018000 {
+				compatible = "atmel,at91sam9260-i2c";
+				reg = <0xf8018000 0x100>;
+				interrupts = <11 4>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
 			adc0: adc at f804c000 {
 				compatible = "atmel,at91sam9260-adc";
 				reg = <0xf804c000 0x100>;
@@ -259,43 +289,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";
-	};
 };
Signature · 1 line
Nicolas Ferre
#12 lore raw

PATCH 5/5 ARM: dts: add twi nodes for atmel boards

In reply to ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

Use the atmel twi instead of gpio for i2c stuff.

---
 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      | 14 ++++++++++++++
 arch/arm/boot/dts/at91sam9n12ek.dts         |  8 ++++++++
 5 files changed, 58 insertions(+), 24 deletions(-)
arch/arm/boot/dts/at91sam9263ek.dts +10 -10
index f86ac4b..772ab75 100644
@@ -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>;
-		};
-	};
 };
arch/arm/boot/dts/at91sam9g20ek_common.dtsi +14 -14
index b06c0db..712106b 100644
@@ -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>;
arch/arm/boot/dts/at91sam9g25ek.dts +12 -0
index 7829a4d..3b0adbc 100644
@@ -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 {
arch/arm/boot/dts/at91sam9m10g45ek.dts +14 -0
index a3633bd..4f94f23 100644
@@ -46,6 +46,20 @@
 				phy-mode = "rmii";
 				status = "okay";
 			};
+
+			i2c0: i2c at fff84000 {
+				status = "okay";
+
+				24c512 at 50 {
+					compatible = "24c512";
+					reg = <0x50>;
+					pagesize = <128>;
+				};
+			};
+			
+			i2c1: i2c at fff88000 {
+				status = "okay";
+			};
 		};
 
 		nand0: nand at 40000000 {
arch/arm/boot/dts/at91sam9n12ek.dts +8 -0
index f4e43e3..912b2c2 100644
@@ -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 {
Signature · 1 line
1.7.11.3
#13 lore raw

PATCH 5/5 ARM: dts: add twi nodes for atmel boards

On 08/21/2012 04:32 PM, ludovic.desroches at atmel.com :

Quoted 5 lines

From: Ludovic Desroches <[email protected]>

Use the atmel twi instead of gpio for i2c stuff.

Seems good. Maybe we will have to test wm8731 a little bit more.

Quoted 158 lines
---
 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      | 14 ++++++++++++++
 arch/arm/boot/dts/at91sam9n12ek.dts         |  8 ++++++++
 5 files changed, 58 insertions(+), 24 deletions(-)
arch/arm/boot/dts/at91sam9263ek.dts +10 -10
index f86ac4b..772ab75 100644
@@ -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>;
-		};
-	};
 };
arch/arm/boot/dts/at91sam9g20ek_common.dtsi +14 -14
index b06c0db..712106b 100644
@@ -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>;
arch/arm/boot/dts/at91sam9g25ek.dts +12 -0
index 7829a4d..3b0adbc 100644
@@ -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 {
arch/arm/boot/dts/at91sam9m10g45ek.dts +14 -0
index a3633bd..4f94f23 100644
@@ -46,6 +46,20 @@
 				phy-mode = "rmii";
 				status = "okay";
 			};
+
+			i2c0: i2c at fff84000 {
+				status = "okay";
+
+				24c512 at 50 {
+					compatible = "24c512";
+					reg = <0x50>;
+					pagesize = <128>;
+				};
+			};
+			
+			i2c1: i2c at fff88000 {
+				status = "okay";
+			};
 		};
 
 		nand0: nand at 40000000 {
arch/arm/boot/dts/at91sam9n12ek.dts +8 -0
index f4e43e3..912b2c2 100644
@@ -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 {
Signature · 1 line
Nicolas Ferre