Skip to contentSkip to conversation

OMAP4: Add DT support for i2c and twl6030

PATCH Superseded Benoit Cousson 3 participants 20 messages Dec 20, 2011 – Dec 23, 2011

Subsystems (9)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover OMAP4: Add DT support for i2c and twl6030

Hi Tony and Rob,

Here is the updated version of the i2c + twl DT adaptation series.

This update, compared to v2 [1], is adding some dedicated dtsi files for the twl PMIC and audio IC. These devices will contain a huge amount of regulator nodes and thus deserve a dedicated file to avoid every boards to redefine the same data.
The twl patch is now included in Samuel's for-next branch and thus dropped from this update.
The i2c binding was cleaned as suggested by Rob to avoid all the ugly hexa flags inside the DTS.

The pm.c was updated to prevent the SR / VP initialization in the DT context since none of them is DT aware for the moment.

A couple of basic i2c devices are added for panda, beagle and sdp board.

Patches are based on for_3.3/2_dt_irq, to get the latest GIC binding, and are available here:
git://gitorious.org/omap-pm/linux.git for_3.3/3_omap_dt_i2c_twl

Tested on Beagle and sdp4430.

Comments are welcome.

Regards,
Benoit

[1] http://www.spinics.net/lists/linux-omap/msg61260.html

Benoit Cousson (11):
ARM: OMAP2+: pm: Do not init statically the SR and voltage layer with DT
i2c: OMAP: Add DT support for i2c controller
rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030 arm/dts: OMAP4: Add i2c controller nodes
arm/dts: OMAP3: Add i2c controller nodes
arm/dts: twl6030: Add DTS file for twl6030 PMIC
arm/dts: twl4030: Add DTS file for twl4030 PM + Audio IC arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
arm/dts: omap4-sdp: Add twl6030, i2c3 and i2c4 devices arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM
ARM: OMAP2+: board-generic: Remove i2c static init

 Documentation/devicetree/bindings/i2c/omap-i2c.txt |   30 ++++++
 Documentation/devicetree/bindings/rtc/twl-rtc.txt  |   12 +++
 arch/arm/boot/dts/omap3-beagle.dts                 |   29 ++++++
 arch/arm/boot/dts/omap3.dtsi                       |   21 ++++
 arch/arm/boot/dts/omap4-panda.dts                  |   34 +++++++
 arch/arm/boot/dts/omap4-sdp.dts                    |   53 ++++++++++
 arch/arm/boot/dts/omap4.dtsi                       |   28 ++++++
 arch/arm/boot/dts/twl4030.dtsi                     |   21 ++++
 arch/arm/boot/dts/twl6030.dtsi                     |   22 ++++
 arch/arm/mach-omap2/board-generic.c                |   48 +---------
 arch/arm/mach-omap2/pm.c                           |    8 ++
 drivers/i2c/busses/i2c-omap.c                      |  101 +++++++++++++-------
 drivers/rtc/rtc-twl.c                              |   10 ++-
 13 files changed, 334 insertions(+), 83 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/twl-rtc.txt
 create mode 100644 arch/arm/boot/dts/twl4030.dtsi
 create mode 100644 arch/arm/boot/dts/twl6030.dtsi
#1 lore raw

PATCH v3 1/11 ARM: OMAP2+: pm: Do not init statically the SR and voltage layer with DT

In the case of DT, the PMIC and SR initialization will be done using a completely different mechanism.

Disable this part if a DT blob is available.

---
 arch/arm/mach-omap2/pm.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm.c +8 -0
index 1881fe9..ad4f693 100644
@@ -227,6 +227,14 @@ postcore_initcall(omap2_common_pm_init);
 
 static int __init omap2_common_pm_late_init(void)
 {
+	/*
+	 * In the case of DT, the PMIC and SR initialization will be done using
+	 * a completely different mechanism.
+	 * Disable this part if a DT blob is available.
+	 */
+	if (of_have_populated_dt())
+		return 0;
+
 	/* Init the voltage layer */
 	omap_pmic_late_init();
 	omap_voltage_late_init();
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH v3 2/11 i2c: OMAP: Add DT support for i2c controller

In reply to Benoit Cousson

Add initial DT support to retrieve the frequency using a DT attribute instead of the pdata pointer if of_node exist.

Add documentation for omap i2c controller binding.

Based on original patches from Manju and Grant.

---
 Documentation/devicetree/bindings/i2c/omap-i2c.txt |   30 ++++++
 drivers/i2c/busses/i2c-omap.c                      |  101 +++++++++++++-------
 2 files changed, 96 insertions(+), 35 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
Documentation/devicetree/bindings/i2c/omap-i2c.txt new file +30 -0
new file mode 100644
index 0000000..56564aa
@@ -0,0 +1,30 @@
+I2C for OMAP platforms
+
+Required properties :
+- compatible : Must be "ti,omap3-i2c" or "ti,omap4-i2c"
+- ti,hwmods : Must be "i2c<n>", n being the instance number (1-based)
+- #address-cells = <1>;
+- #size-cells = <0>;
+
+Recommended properties :
+- clock-frequency : Desired I2C bus clock frequency in Hz. Otherwise
+  the default 100 kHz frequency will be used.
+
+Optional properties:
+- Child nodes conforming to i2c bus binding
+
+Note: Current implementation will fetch base address, irq and dma
+from omap hwmod data base during device registration.
+Future plan is to migrate hwmod data base contents into device tree
+blob so that, all the required data will be used from device tree dts
+file.
+
+Examples :
+
+i2c1: i2c at 0 {
+    compatible = "ti,omap3-i2c";
+    #address-cells = <1>;
+    #size-cells = <0>;
+    ti,hwmods = "i2c1";
+    clock-frequency = <400000>;
+};
drivers/i2c/busses/i2c-omap.c +66 -35

248 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#3 lore raw

PATCH v3 2/11 i2c: OMAP: Add DT support for i2c controller

Quoted 10 lines · Benoit Cousson

Add initial DT support to retrieve the frequency using a DT attribute instead of the pdata pointer if of_node exist.

Add documentation for omap i2c controller binding.

Based on original patches from Manju and Grant.

One issue below, otherwise:

Quoted 15 lines
drivers/i2c/busses/i2c-omap.c +9 -2
@@ -1001,15 +1019,24 @@ omap_i2c_probe(struct platform_device *pdev)
 		goto err_release_region;
 	}
 
-	if (pdata != NULL) {
-		speed = pdata->clkrate;
+	match = of_match_device(omap_i2c_of_match, &pdev->dev);
+	if (match) {
+		u32 freq = 100000; /* default to 100000 Hz */
+
+		pdata = match->data;
+		dev->dtrev = pdata->rev;
+		dev->flags = pdata->flags;
+
+		of_property_read_u32(node, "clock-frequency", &freq);

drivers/i2c/busses/i2c-omap.c omap_i2c_probe(struct platform_device *pdev) · line 1037

Quoted 10 lines
drivers/i2c/busses/i2c-omap.c +6 -3
+		/* convert DT freq value in Hz into kHz for speed */
+		dev->speed = freq / 1000;
+	} else if (pdata != NULL) {
+		dev->speed = pdata->clkrate;
+		dev->flags = pdata->flags;
 		dev->set_mpu_wkup_lat = pdata->set_mpu_wkup_lat;
-	} else {
-		speed = 100;	/* Default speed */
-		dev->set_mpu_wkup_lat = NULL;
+		dev->dtrev = pdata->rev;

If you get here, pdata is NULL.

Rob

#4 lore raw

PATCH v3 2/11 i2c: OMAP: Add DT support for i2c controller

Hi Rob,

Quoted 36 lines · Rob Herring
Quoted 10 lines · Benoit Cousson

Add initial DT support to retrieve the frequency using a DT attribute instead of the pdata pointer if of_node exist.

Add documentation for omap i2c controller binding.

Based on original patches from Manju and Grant.

One issue below, otherwise:

Quoted 19 lines
drivers/i2c/busses/i2c-omap.c +13 -2
@@ -1001,15 +1019,24 @@ omap_i2c_probe(struct platform_device *pdev)
  		goto err_release_region;
  	}
 
-	if (pdata != NULL) {
-		speed = pdata->clkrate;
+	match = of_match_device(omap_i2c_of_match,&pdev->dev);
+	if (match) {
+		u32 freq = 100000; /* default to 100000 Hz */
+
+		pdata = match->data;
+		dev->dtrev = pdata->rev;
+		dev->flags = pdata->flags;
+
+		of_property_read_u32(node, "clock-frequency",&freq);
+		/* convert DT freq value in Hz into kHz for speed */
+		dev->speed = freq / 1000;
+	} else if (pdata != NULL) {
+		dev->speed = pdata->clkrate;
Quoted 8 lines

drivers/i2c/busses/i2c-omap.c omap_i2c_probe(struct platform_device *pdev) · line 1037

Quoted 6 lines
drivers/i2c/busses/i2c-omap.c +2 -3
+		dev->flags = pdata->flags;
  		dev->set_mpu_wkup_lat = pdata->set_mpu_wkup_lat;
-	} else {
-		speed = 100;	/* Default speed */
-		dev->set_mpu_wkup_lat = NULL;
+		dev->dtrev = pdata->rev;

If you get here, pdata is NULL.

Mmm, it should not. It's true that the patch is not super readable, but here is the result:

	if (match) {
		u32 freq = 100000; /* default to 100000 Hz */

		pdata = match->data;
		dev->dtrev = pdata->rev;
		dev->flags = pdata->flags;

		of_property_read_u32(node, "clock-frequency", &freq);
		/* convert DT freq value in Hz into kHz for speed */
		dev->speed = freq / 1000;
	} else if (pdata != NULL) {
		dev->speed = pdata->clkrate;
		dev->flags = pdata->flags;
		dev->set_mpu_wkup_lat = pdata->set_mpu_wkup_lat;
		dev->dtrev = pdata->rev;
	}

I removed every other pdata reference after this point.

Regards,
Benoit

#5 lore raw

PATCH v3 2/11 i2c: OMAP: Add DT support for i2c controller

In reply to Benoit Cousson

Hi,

Quoted 13 lines · Benoit Cousson
drivers/i2c/busses/i2c-omap.c +0 -0
index a43d002..dcbc1ec 100644
@@ -37,6 +37,8 @@

?#include <linux/platform_device.h>
?#include <linux/clk.h>
?#include <linux/io.h>

drivers/i2c/busses/i2c-omap.c +2 -0
+#include <linux/of_i2c.h>
+#include <linux/of_device.h>

?#include <linux/slab.h>
?#include <linux/i2c-omap.h>
?#include <linux/pm_runtime.h>

[...]

drivers/i2c/busses/i2c-omap.c static struct platform_driver omap_i2c_driver = { · line 1200

Quoted 7 lines
drivers/i2c/busses/i2c-omap.c +1 -0
@@ -1165,6 +1195,7 @@ static struct platform_driver omap_i2c_driver = {
 ? ? ? ? ? ? ? ?.name ? = "omap_i2c",
 ? ? ? ? ? ? ? ?.owner ?= THIS_MODULE,
 ? ? ? ? ? ? ? ?.pm ? ? = OMAP_I2C_PM_OPS,
+ ? ? ? ? ? ? ? .of_match_table = of_match_ptr(omap_i2c_of_match),
 ? ? ? ?},
 ?};

of_match_ptr() comes from <linux/of.h>, so you need to include that to not break !CONFIG_OF builds.

-Olof

#6 lore raw

PATCH v3 2/11 i2c: OMAP: Add DT support for i2c controller

Hi Olof,

Quoted 18 lines · Olof Johansson

Hi,

Quoted 13 lines · Benoit Cousson
drivers/i2c/busses/i2c-omap.c +2 -0
index a43d002..dcbc1ec 100644
@@ -37,6 +37,8 @@
  #include<linux/platform_device.h>
  #include<linux/clk.h>
  #include<linux/io.h>
+#include<linux/of_i2c.h>
+#include<linux/of_device.h>
  #include<linux/slab.h>
  #include<linux/i2c-omap.h>
  #include<linux/pm_runtime.h>

[...]

Quoted 10 lines

drivers/i2c/busses/i2c-omap.c static struct platform_driver omap_i2c_driver = { · line 1200

Quoted 7 lines
drivers/i2c/busses/i2c-omap.c +1 -0
@@ -1165,6 +1195,7 @@ static struct platform_driver omap_i2c_driver = {
                .name   = "omap_i2c",
                .owner  = THIS_MODULE,
                .pm     = OMAP_I2C_PM_OPS,
+               .of_match_table = of_match_ptr(omap_i2c_of_match),
        },
  };

of_match_ptr() comes from<linux/of.h>, so you need to include that to not break !CONFIG_OF builds.

Good point, I'll fix that.

Thanks,
Benoit

#7 lore raw

PATCH v3 3/11 rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030

In reply to Benoit Cousson

Add the DT support for the TI rtc-twl present in the twl4030 and twl6030 devices.

Cc Alessandro Zummo <[email protected]>
---
 Documentation/devicetree/bindings/rtc/twl-rtc.txt |   12 ++++++++++++
 drivers/rtc/rtc-twl.c                             |   10 ++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/rtc/twl-rtc.txt
Documentation/devicetree/bindings/rtc/twl-rtc.txt new file +12 -0
new file mode 100644
index 0000000..596e0c9
@@ -0,0 +1,12 @@
+* TI twl RTC
+
+The TWL family (twl4030/6030) contains a RTC.
+
+Required properties:
+- compatible : Should be twl4030-rtc
+
+Examples:
+
+rtc at 0 {
+    compatible = "ti,twl4030-rtc";
+};
drivers/rtc/rtc-twl.c +8 -2
index 20687d5..d43b4f6 100644
@@ -550,6 +550,11 @@ static int twl_rtc_resume(struct platform_device *pdev)
 #define twl_rtc_resume  NULL
 #endif
 
+static const struct of_device_id twl_rtc_of_match[] = {
+	{.compatible = "ti,twl4030-rtc", },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, twl_rtc_of_match);
 MODULE_ALIAS("platform:twl_rtc");
 
 static struct platform_driver twl4030rtc_driver = {
@@ -559,8 +564,9 @@ static struct platform_driver twl4030rtc_driver = {
 	.suspend	= twl_rtc_suspend,
 	.resume		= twl_rtc_resume,
 	.driver		= {
-		.owner	= THIS_MODULE,
-		.name	= "twl_rtc",
+		.owner		= THIS_MODULE,
+		.name		= "twl_rtc",
+		.of_match_table = twl_rtc_of_match,
 	},
 };
 
Signature · 1 line
1.7.0.4
#8 lore raw

PATCH v3 4/11 arm/dts: OMAP4: Add i2c controller nodes

In reply to Benoit Cousson

Add i2c controllers nodes into the main ocp bus.

Cc Grant Likely <[email protected]>
Cc Rob Herring <[email protected]>
---
 arch/arm/boot/dts/omap4.dtsi |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4.dtsi +28 -0
index bede009..9872283 100644
@@ -100,5 +100,33 @@
 			reg = <0x48241000 0x1000>,
 			      <0x48240100 0x0100>;
 		};
+
+		i2c1: i2c at 1 {
+			compatible = "ti,omap4-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c1";
+		};
+
+		i2c2: i2c at 2 {
+			compatible = "ti,omap4-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c2";
+		};
+
+		i2c3: i2c at 3 {
+			compatible = "ti,omap4-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c3";
+		};
+
+		i2c4: i2c at 4 {
+			compatible = "ti,omap4-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c4";
+		};
 	};
 };
Signature · 1 line
1.7.0.4
#9 lore raw

PATCH v3 5/11 arm/dts: OMAP3: Add i2c controller nodes

In reply to Benoit Cousson

Add i2c controllers nodes into the main ocp bus.

Cc Grant Likely <[email protected]>
Cc Rob Herring <[email protected]>
---
 arch/arm/boot/dts/omap3.dtsi |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap3.dtsi +21 -0
index 6866dc7..697b210 100644
@@ -61,5 +61,26 @@
 			ti,intc-size = <96>;
 			reg = <0x48200000 0x1000>;
 		};
+
+		i2c1: i2c at 1 {
+			compatible = "ti,omap3-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c1";
+		};
+
+		i2c2: i2c at 2 {
+			compatible = "ti,omap3-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c2";
+		};
+
+		i2c3: i2c at 3 {
+			compatible = "ti,omap3-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c3";
+		};
 	};
 };
Signature · 1 line
1.7.0.4
#10 lore raw

PATCH v3 6/11 arm/dts: twl6030: Add DTS file for twl6030 PMIC

In reply to Benoit Cousson

Add a dedicated DTS file for the twl6030 Power IC. This chip is a big SoC that will be reused in a lot of various OMAP4+ boards.

Note: This file is supposed to be included in a board DTS that will create the twl node in order to allow the &twl reference to work.

Exmaple:
...

&i2c1 {
    twl: twl at 48 {
        reg = <0x48>;
        interrupts = <0 7 4>;
        interrupt-controller;
        interrupt-parent = <&gic>;
    };
};

/include/ "twl6030.dtsi"
...

Cc Grant Likely <[email protected]>
Cc Rob Herring <[email protected]>
---
 arch/arm/boot/dts/twl6030.dtsi |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/twl6030.dtsi
arch/arm/boot/dts/twl6030.dtsi new file +22 -0
new file mode 100644
index 0000000..b7b4e5e
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/*
+ * Integrated Power Management Chip
+ * http://www.ti.com/lit/ds/symlink/twl6030.pdf
+ */
+&twl {
+	compatible = "ti,twl6030";
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	rtc {
+		compatible = "ti,twl4030-rtc";
+		interrupts = <11>;
+	};
+};
Signature · 1 line
1.7.0.4
#11 lore raw

PATCH v3 7/11 arm/dts: twl4030: Add DTS file for twl4030 PM + Audio IC

In reply to Benoit Cousson

Add a dedicated DTS file for the twl4030/5030 Power + Audio IC. This chip is a big SoC that will be reused in a lot of various OMAP3 boards.

Cc Grant Likely <[email protected]>
Cc Rob Herring <[email protected]>
---
 arch/arm/boot/dts/twl4030.dtsi |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/twl4030.dtsi
arch/arm/boot/dts/twl4030.dtsi new file +21 -0
new file mode 100644
index 0000000..8be5223
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/*
+ * Integrated Power Management Chip
+ */
+&twl {
+	compatible = "ti,twl4030";
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	rtc {
+		compatible = "ti,twl4030-rtc";
+		interrupts = <11>;
+	};
+};
Signature · 1 line
1.7.0.4
#12 lore raw

PATCH v3 7/11 arm/dts: twl4030: Add DTS file for twl4030 PM + Audio IC

Quoted 27 lines · Benoit Cousson

Add a dedicated DTS file for the twl4030/5030 Power + Audio IC. This chip is a big SoC that will be reused in a lot of various OMAP3 boards.

Cc Grant Likely <[email protected]>
Cc Rob Herring <[email protected]>
---
 arch/arm/boot/dts/twl4030.dtsi |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/twl4030.dtsi
arch/arm/boot/dts/twl4030.dtsi new file +9 -0
new file mode 100644
index 0000000..8be5223
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/*

arch/arm/boot/dts/twl4030.dtsi line 19

Quoted 10 lines
arch/arm/boot/dts/twl4030.dtsi new file +10 -0
+ * Integrated Power Management Chip
+ */
+&twl {
+	compatible = "ti,twl4030";
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	rtc {
+		compatible = "ti,twl4030-rtc";
+		interrupts = <11>;

Can't this vary? Not only the irq#, but the parent controller's number of cells can vary.

Rob

#13 lore raw

PATCH v3 7/11 arm/dts: twl4030: Add DTS file for twl4030 PM + Audio IC

Quoted 33 lines · Rob Herring
Quoted 32 lines · Benoit Cousson

Add a dedicated DTS file for the twl4030/5030 Power + Audio IC. This chip is a big SoC that will be reused in a lot of various OMAP3 boards.

Cc Grant Likely <[email protected]>
Cc Rob Herring <[email protected]>
---
 arch/arm/boot/dts/twl4030.dtsi |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/twl4030.dtsi
arch/arm/boot/dts/twl4030.dtsi new file +14 -0
new file mode 100644
index 0000000..8be5223
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/*
+ * Integrated Power Management Chip
+ */
+&twl {
+	compatible = "ti,twl4030";
+	interrupt-controller;
Quoted 8 lines

arch/arm/boot/dts/twl4030.dtsi line 19

Quoted 5 lines
arch/arm/boot/dts/twl4030.dtsi new file +5 -0
+	#interrupt-cells = <1>;
+
+	rtc {
+		compatible = "ti,twl4030-rtc";
+		interrupts = <11>;

Can't this vary? Not only the irq#, but the parent controller's number of cells can vary.

Never mind. I see this is the RTC interrupt within the twl4030 chip.

Rob

#14 lore raw

PATCH v3 8/11 arm/dts: omap4-panda: Add twl6030 and i2c EEPROM

In reply to Benoit Cousson

Update pandaboard dts file with required clock frequencies for the i2c client devices existing on pandaboard.

Add the twl6030 node in i2c1 controller.

This is the minimal support needed to boot OMAP4 boards without any crash.
The support for all the features included in this MFD will be added later.

Add a generic i2c EEPROM entry.

---
 arch/arm/boot/dts/omap4-panda.dts |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4-panda.dts +34 -0
index 9755ad5..29646dc 100644
@@ -18,3 +18,37 @@
 		reg = <0x80000000 0x40000000>; /* 1 GB */
 	};
 };
+
+&i2c1 {
+	clock-frequency = <400000>;
+
+	twl: twl at 48 {
+		reg = <0x48>;
+		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
+		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
+		interrupt-parent = <&gic>;
+	};
+};
+
+/include/ "twl6030.dtsi"
+
+&i2c2 {
+	clock-frequency = <400000>;
+};
+
+&i2c3 {
+	clock-frequency = <100000>;
+
+	/*
+	 * Display monitor features are burnt in their EEPROM as EDID data.
+	 * The EEPROM is connected as I2C slave device.
+	 */
+	eeprom at 50 {
+		compatible = "ti,eeprom";
+		reg = <0x50>;
+	};
+};
+
+&i2c4 {
+	clock-frequency = <400000>;
+};
Signature · 1 line
1.7.0.4
#15 lore raw

PATCH v3 9/11 arm/dts: omap4-sdp: Add twl6030, i2c3 and i2c4 devices

In reply to Benoit Cousson

Update DTS file with required clock frequencies for the i2c client devices existing on sdp4430.

Add the twl6030 node inside the i2c1 controller node. This is the minimal support needed to boot OMAP4 boards without any crash.
The support for all the features included in this MFD will be added later.

Add the RTC submodule inside the twl node.

Add tmp105 temperature sensor in i2c3
Add bh1780 Ambient Light Sensor in i2c3
Add hmc5843 3-Axis Digital Compass in i2c4

---
 arch/arm/boot/dts/omap4-sdp.dts |   53 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4-sdp.dts +53 -0
index 63c6b2b..17e829a 100644
@@ -18,3 +18,56 @@
 		reg = <0x80000000 0x40000000>; /* 1 GB */
 	};
 };
+
+&i2c1 {
+	clock-frequency = <400000>;
+
+	twl: twl at 48 {
+		reg = <0x48>;
+		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
+		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
+		interrupt-parent = <&gic>;
+	};
+};
+
+/include/ "twl6030.dtsi"
+
+&i2c2 {
+	clock-frequency = <400000>;
+	reg = <0x48072000 0x100>, <0x48072100 0x100>, <0x48072200 0x100>;
+};
+
+&i2c3 {
+	clock-frequency = <400000>;
+
+	/*
+	 * Temperature Sensor
+	 * http://www.ti.com/lit/ds/symlink/tmp105.pdf
+	 */
+	tmp105 at 48 {
+		compatible = "ti,tmp105";
+		reg = <0x48>;
+	};
+
+	/*
+	 * Ambient Light Sensor
+	 * http://www.rohm.com/products/databook/sensor/pdf/bh1780gli-e.pdf
+	 */
+	bh1780 at 29 {
+		compatible = "rohm,bh1780";
+		reg = <0x29>;
+	};
+};
+
+&i2c4 {
+	clock-frequency = <400000>;
+
+	/*
+	 * 3-Axis Digital Compass
+	 * http://www.sparkfun.com/datasheets/Sensors/Magneto/HMC5843.pdf
+	 */
+	hmc5843 at 1e {
+		compatible = "honeywell,hmc5843";
+		reg = <0x1e>;
+	};
+};
Signature · 1 line
1.7.0.4
#16 lore raw

PATCH v3 10/11 arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM

In reply to Benoit Cousson

Add required clock frequencies for the i2c client devices existing on beagle board.

Add the twl4030 basic description with only the twl_rtc module.

Add the EEPROM node.

Based on original patch from Manju:
http://www.spinics.net/lists/linux-omap/msg55831.html

Cc Grant Likely <[email protected]>
Cc Rob Herring <[email protected]>
---
 arch/arm/boot/dts/omap3-beagle.dts |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap3-beagle.dts +29 -0
index 9f72cd4..714ba5d 100644
@@ -18,3 +18,32 @@
 		reg = <0x80000000 0x20000000>; /* 512 MB */
 	};
 };
+
+&i2c1 {
+	clock-frequency = <2600000>;
+
+	twl: twl at 48 {
+		reg = <0x48>;
+		interrupts = <7>; /* SYS_NIRQ cascaded to intc */
+		interrupt-parent = <&intc>;
+	};
+};
+
+/include/ "twl4030.dtsi"
+
+&i2c2 {
+	clock-frequency = <400000>;
+};
+
+&i2c3 {
+	clock-frequency = <100000>;
+
+	/*
+	 * Display monitor features are burnt in the EEPROM
+	 * as EDID data.
+	 */
+	eeprom at 50 {
+		compatible = "ti,eeprom";
+		reg = <0x50>;
+	};
+};
Signature · 1 line
1.7.0.4
#17 lore raw

PATCH v3 11/11 ARM: OMAP2+: board-generic: Remove i2c static init

In reply to Benoit Cousson

This mainly reverts the commit that was adding the i2c static init.

Since the i2c and twl nodes are now present, there is no need for the static initialization anymore.

---
 arch/arm/mach-omap2/board-generic.c |   48 +---------------------------------
 1 files changed, 2 insertions(+), 46 deletions(-)
arch/arm/mach-omap2/board-generic.c +2 -46
index 2529017..38f105d 100644
@@ -15,7 +15,6 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/irqdomain.h>
-#include <linux/i2c/twl.h>
 
 #include <mach/hardware.h>
 #include <asm/hardware/gic.h>
@@ -36,34 +35,6 @@ static void __init omap_init_irq(void)
 	of_irq_init(irq_match);
 }
 
-/*
- * XXX: Still needed to boot until the i2c & twl driver is adapted to
- * device-tree
- */
-#ifdef CONFIG_ARCH_OMAP4
-static struct twl4030_platform_data sdp4430_twldata = {
-	.irq_base	= TWL6030_IRQ_BASE,
-	.irq_end	= TWL6030_IRQ_END,
-};
-
-static void __init omap4_i2c_init(void)
-{
-	omap4_pmic_init("twl6030", &sdp4430_twldata);
-}
-#endif
-
-#ifdef CONFIG_ARCH_OMAP3
-static struct twl4030_platform_data beagle_twldata = {
-	.irq_base	= TWL4030_IRQ_BASE,
-	.irq_end	= TWL4030_IRQ_END,
-};
-
-static void __init omap3_i2c_init(void)
-{
-	omap3_pmic_init("twl4030", &beagle_twldata);
-}
-#endif
-
 static struct of_device_id omap_dt_match_table[] __initdata = {
 	{ .compatible = "simple-bus", },
 	{ .compatible = "ti,omap-infra", },
@@ -78,21 +49,6 @@ static void __init omap_generic_init(void)
 	of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
 }
 
-#ifdef CONFIG_ARCH_OMAP4
-static void __init omap4_init(void)
-{
-	omap4_i2c_init();
-	omap_generic_init();
-}
-#endif
-
-#ifdef CONFIG_ARCH_OMAP3
-static void __init omap3_init(void)
-{
-	omap3_i2c_init();
-	omap_generic_init();
-}
-#endif
 
 #if defined(CONFIG_SOC_OMAP2420)
 static const char *omap242x_boards_compat[] __initdata = {
@@ -145,7 +101,7 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
 	.init_early	= omap3430_init_early,
 	.init_irq	= omap_init_irq,
 	.handle_irq	= omap3_intc_handle_irq,
-	.init_machine	= omap3_init,
+	.init_machine	= omap_generic_init,
 	.timer		= &omap3_timer,
 	.dt_compat	= omap3_boards_compat,
 MACHINE_END
@@ -164,7 +120,7 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
 	.init_early	= omap4430_init_early,
 	.init_irq	= omap_init_irq,
 	.handle_irq	= gic_handle_irq,
-	.init_machine	= omap4_init,
+	.init_machine	= omap_generic_init,
 	.timer		= &omap4_timer,
 	.dt_compat	= omap4_boards_compat,
 MACHINE_END
Signature · 1 line
1.7.0.4
#18 lore raw

v3 cover OMAP4: Add DT support for i2c and twl6030

In reply to Benoit Cousson
Quoted 55 lines · Benoit Cousson

Hi Tony and Rob,

Here is the updated version of the i2c + twl DT adaptation series.

This update, compared to v2 [1], is adding some dedicated dtsi files for the twl PMIC and audio IC. These devices will contain a huge amount of regulator nodes and thus deserve a dedicated file to avoid every boards to redefine the same data.
The twl patch is now included in Samuel's for-next branch and thus dropped from this update.
The i2c binding was cleaned as suggested by Rob to avoid all the ugly hexa flags inside the DTS.

The pm.c was updated to prevent the SR / VP initialization in the DT context since none of them is DT aware for the moment.

A couple of basic i2c devices are added for panda, beagle and sdp board.

Patches are based on for_3.3/2_dt_irq, to get the latest GIC binding, and are available here:
git://gitorious.org/omap-pm/linux.git for_3.3/3_omap_dt_i2c_twl

Tested on Beagle and sdp4430.

Comments are welcome.

Regards,
Benoit

[1] http://www.spinics.net/lists/linux-omap/msg61260.html

Benoit Cousson (11):
ARM: OMAP2+: pm: Do not init statically the SR and voltage layer with DT
i2c: OMAP: Add DT support for i2c controller
rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030 arm/dts: OMAP4: Add i2c controller nodes
arm/dts: OMAP3: Add i2c controller nodes
arm/dts: twl6030: Add DTS file for twl6030 PMIC
arm/dts: twl4030: Add DTS file for twl4030 PM + Audio IC arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
arm/dts: omap4-sdp: Add twl6030, i2c3 and i2c4 devices arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM
ARM: OMAP2+: board-generic: Remove i2c static init

 Documentation/devicetree/bindings/i2c/omap-i2c.txt |   30 ++++++
 Documentation/devicetree/bindings/rtc/twl-rtc.txt  |   12 +++
 arch/arm/boot/dts/omap3-beagle.dts                 |   29 ++++++
 arch/arm/boot/dts/omap3.dtsi                       |   21 ++++
 arch/arm/boot/dts/omap4-panda.dts                  |   34 +++++++
 arch/arm/boot/dts/omap4-sdp.dts                    |   53 ++++++++++
 arch/arm/boot/dts/omap4.dtsi                       |   28 ++++++
 arch/arm/boot/dts/twl4030.dtsi                     |   21 ++++
 arch/arm/boot/dts/twl6030.dtsi                     |   22 ++++
 arch/arm/mach-omap2/board-generic.c                |   48 +---------
Quoted 8 lines
 arch/arm/mach-omap2/pm.c                           |    8 ++
 drivers/i2c/busses/i2c-omap.c                      |  101 +++++++++++++-------
 drivers/rtc/rtc-twl.c                              |   10 ++-
 13 files changed, 334 insertions(+), 83 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/twl-rtc.txt
 create mode 100644 arch/arm/boot/dts/twl4030.dtsi
 create mode 100644 arch/arm/boot/dts/twl6030.dtsi

For the series: