All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/10] OMAP4: Add DT support for i2c and twl6030
@ 2011-12-09 14:02 ` Benoit Cousson
  0 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: tony, rob.herring
  Cc: devicetree-discuss, grant.likely, linux-omap, linux-arm-kernel,
	Benoit Cousson

Hi Tony and Rob,

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

This update, compared to v1 [1], is mainly due to the merge into 3.2 of
Andy's i2c cleanup series that was introducing a lot of pdata accesses
at runtime.

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://lists.ozlabs.org/pipermail/devicetree-discuss/2011-September/007821.html


Benoit Cousson (10):
  ARM: OMAP2+: pm: Do not init statically the SR and voltage layer with DT
  i2c: OMAP: Add DT support for i2c controller
  mfd: twl-core: Add initial DT support for twl4030/twl6030
  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: 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 |   42 ++++++++
 .../devicetree/bindings/mfd/twl-familly.txt        |   47 +++++++++
 Documentation/devicetree/bindings/rtc/twl-rtc.txt  |   12 +++
 arch/arm/boot/dts/omap3-beagle.dts                 |   38 ++++++++
 arch/arm/boot/dts/omap3.dtsi                       |   28 ++++++
 arch/arm/boot/dts/omap4-panda.dts                  |   45 +++++++++
 arch/arm/boot/dts/omap4-sdp.dts                    |   63 ++++++++++++
 arch/arm/boot/dts/omap4.dtsi                       |   28 ++++++
 arch/arm/mach-omap2/board-generic.c                |   48 +---------
 arch/arm/mach-omap2/pm.c                           |    8 ++
 drivers/i2c/busses/i2c-omap.c                      |  100 +++++++++++++-------
 drivers/mfd/twl-core.c                             |   53 ++++++++++-
 drivers/rtc/rtc-twl.c                              |   10 ++-
 13 files changed, 435 insertions(+), 87 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/twl-familly.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/twl-rtc.txt


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

* [PATCH v2 00/10] OMAP4: Add DT support for i2c and twl6030
@ 2011-12-09 14:02 ` Benoit Cousson
  0 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Tony and Rob,

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

This update, compared to v1 [1], is mainly due to the merge into 3.2 of
Andy's i2c cleanup series that was introducing a lot of pdata accesses
at runtime.

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://lists.ozlabs.org/pipermail/devicetree-discuss/2011-September/007821.html


Benoit Cousson (10):
  ARM: OMAP2+: pm: Do not init statically the SR and voltage layer with DT
  i2c: OMAP: Add DT support for i2c controller
  mfd: twl-core: Add initial DT support for twl4030/twl6030
  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: 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 |   42 ++++++++
 .../devicetree/bindings/mfd/twl-familly.txt        |   47 +++++++++
 Documentation/devicetree/bindings/rtc/twl-rtc.txt  |   12 +++
 arch/arm/boot/dts/omap3-beagle.dts                 |   38 ++++++++
 arch/arm/boot/dts/omap3.dtsi                       |   28 ++++++
 arch/arm/boot/dts/omap4-panda.dts                  |   45 +++++++++
 arch/arm/boot/dts/omap4-sdp.dts                    |   63 ++++++++++++
 arch/arm/boot/dts/omap4.dtsi                       |   28 ++++++
 arch/arm/mach-omap2/board-generic.c                |   48 +---------
 arch/arm/mach-omap2/pm.c                           |    8 ++
 drivers/i2c/busses/i2c-omap.c                      |  100 +++++++++++++-------
 drivers/mfd/twl-core.c                             |   53 ++++++++++-
 drivers/rtc/rtc-twl.c                              |   10 ++-
 13 files changed, 435 insertions(+), 87 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/twl-familly.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/twl-rtc.txt

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

* [PATCH v2 01/10] ARM: OMAP2+: pm: Do not init statically the SR and voltage layer with DT
  2011-12-09 14:02 ` Benoit Cousson
@ 2011-12-09 14:02   ` Benoit Cousson
  -1 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: tony, rob.herring
  Cc: devicetree-discuss, grant.likely, linux-omap, linux-arm-kernel,
	Benoit Cousson, Kevin Hilman

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.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/pm.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 1881fe9..ad4f693 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -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();
-- 
1.7.0.4


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

* [PATCH v2 01/10] ARM: OMAP2+: pm: Do not init statically the SR and voltage layer with DT
@ 2011-12-09 14:02   ` Benoit Cousson
  0 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/pm.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 1881fe9..ad4f693 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -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();
-- 
1.7.0.4

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

* [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
  2011-12-09 14:02 ` Benoit Cousson
@ 2011-12-09 14:02   ` Benoit Cousson
  -1 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: tony, rob.herring
  Cc: devicetree-discuss, grant.likely, linux-omap, linux-arm-kernel,
	Benoit Cousson, Ben Dooks

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.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Ben Dooks <ben-linux@fluff.org>
---
 Documentation/devicetree/bindings/i2c/omap-i2c.txt |   42 ++++++++
 drivers/i2c/busses/i2c-omap.c                      |  100 +++++++++++++-------
 2 files changed, 107 insertions(+), 35 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt

diff --git a/Documentation/devicetree/bindings/i2c/omap-i2c.txt b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
new file mode 100644
index 0000000..d259a17
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
@@ -0,0 +1,42 @@
+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
+- ti,flags : u32: settings or errata relative to the i2c
+    0x1:   OMAP_I2C_FLAG_NO_FIFO
+    0x2:   OMAP_I2C_FLAG_SIMPLE_CLOCK
+    0x4:   OMAP_I2C_FLAG_16BIT_DATA_REG
+    0x8:   OMAP_I2C_FLAG_RESET_REGS_POSTIDLE
+    0x10:  OMAP_I2C_FLAG_APPLY_ERRATA_I207
+    0x20:  OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK
+    0x40:  OMAP_I2C_FLAG_FORCE_19200_INT_CLK
+  Valid for ti,omap3-i2c only:
+    0x80:  OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers
+    0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registers
+
+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@0 {
+    compatible = "ti,omap3-i2c";
+    #address-cells = <1>;
+    #size-cells = <0>;
+    ti,hwmods = "i2c1";
+    clock-frequency = <400000>;
+    ti,flags = <0x118>;
+};
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index a43d002..b4a8eee 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -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>
@@ -182,7 +184,9 @@ struct omap_i2c_dev {
 	u32			latency;	/* maximum mpu wkup latency */
 	void			(*set_mpu_wkup_lat)(struct device *dev,
 						    long latency);
-	u32			speed;		/* Speed of bus in Khz */
+	u32			speed;		/* Speed of bus in kHz */
+	u32			dtrev;		/* extra revision from DT */
+	u32			flags;
 	u16			cmd_err;
 	u8			*buf;
 	u8			*regs;
@@ -266,11 +270,7 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
 
 static void omap_i2c_unidle(struct omap_i2c_dev *dev)
 {
-	struct omap_i2c_bus_platform_data *pdata;
-
-	pdata = dev->dev->platform_data;
-
-	if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
+	if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
 		omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
 		omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, dev->pscstate);
 		omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, dev->scllstate);
@@ -291,13 +291,10 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev)
 
 static void omap_i2c_idle(struct omap_i2c_dev *dev)
 {
-	struct omap_i2c_bus_platform_data *pdata;
 	u16 iv;
 
-	pdata = dev->dev->platform_data;
-
 	dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
-	if (pdata->rev == OMAP_I2C_IP_VERSION_2)
+	if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
 		omap_i2c_write_reg(dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
 	else
 		omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
@@ -320,9 +317,6 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
 	unsigned long timeout;
 	unsigned long internal_clk = 0;
 	struct clk *fclk;
-	struct omap_i2c_bus_platform_data *pdata;
-
-	pdata = dev->dev->platform_data;
 
 	if (dev->rev >= OMAP_I2C_OMAP1_REV_2) {
 		/* Disable I2C controller before soft reset */
@@ -373,7 +367,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
 	}
 	omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
 
-	if (pdata->flags & OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK) {
+	if (dev->flags & OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK) {
 		/*
 		 * The I2C functional clock is the armxor_ck, so there's
 		 * no need to get "armxor_ck" separately.  Now, if OMAP2420
@@ -397,7 +391,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
 			psc = fclk_rate / 12000000;
 	}
 
-	if (!(pdata->flags & OMAP_I2C_FLAG_SIMPLE_CLOCK)) {
+	if (!(dev->flags & OMAP_I2C_FLAG_SIMPLE_CLOCK)) {
 
 		/*
 		 * HSI2C controller internal clk rate should be 19.2 Mhz for
@@ -406,7 +400,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
 		 * The filter is iclk (fclk for HS) period.
 		 */
 		if (dev->speed > 400 ||
-			       pdata->flags & OMAP_I2C_FLAG_FORCE_19200_INT_CLK)
+			       dev->flags & OMAP_I2C_FLAG_FORCE_19200_INT_CLK)
 			internal_clk = 19200;
 		else if (dev->speed > 100)
 			internal_clk = 9600;
@@ -475,7 +469,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
 
 	dev->errata = 0;
 
-	if (pdata->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
+	if (dev->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
 		dev->errata |= I2C_OMAP_ERRATA_I207;
 
 	/* Enable interrupts */
@@ -484,7 +478,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
 			OMAP_I2C_IE_AL)  | ((dev->fifo_size) ?
 				(OMAP_I2C_IE_RDR | OMAP_I2C_IE_XDR) : 0);
 	omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
-	if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
+	if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
 		dev->pscstate = psc;
 		dev->scllstate = scll;
 		dev->sclhstate = sclh;
@@ -804,9 +798,6 @@ omap_i2c_isr(int this_irq, void *dev_id)
 	u16 bits;
 	u16 stat, w;
 	int err, count = 0;
-	struct omap_i2c_bus_platform_data *pdata;
-
-	pdata = dev->dev->platform_data;
 
 	if (pm_runtime_suspended(dev->dev))
 		return IRQ_NONE;
@@ -875,7 +866,7 @@ complete:
 					 * Data reg in 2430, omap3 and
 					 * omap4 is 8 bit wide
 					 */
-					if (pdata->flags &
+					if (dev->flags &
 						 OMAP_I2C_FLAG_16BIT_DATA_REG) {
 						if (dev->buf_len) {
 							*dev->buf++ = w >> 8;
@@ -918,7 +909,7 @@ complete:
 					 * Data reg in 2430, omap3 and
 					 * omap4 is 8 bit wide
 					 */
-					if (pdata->flags &
+					if (dev->flags &
 						 OMAP_I2C_FLAG_16BIT_DATA_REG) {
 						if (dev->buf_len) {
 							w |= *dev->buf++ << 8;
@@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = {
 	.functionality	= omap_i2c_func,
 };
 
+#ifdef CONFIG_OF
+static struct omap_i2c_bus_platform_data omap3_pdata = {
+	.rev = OMAP_I2C_IP_VERSION_1,
+};
+
+static struct omap_i2c_bus_platform_data omap4_pdata = {
+	.rev = OMAP_I2C_IP_VERSION_2,
+};
+
+static const struct of_device_id omap_i2c_of_match[] = {
+	{
+		.compatible = "ti,omap4-i2c",
+		.data = &omap4_pdata,
+	},
+	{
+		.compatible = "ti,omap3-i2c",
+		.data = &omap3_pdata,
+	},
+	{ },
+};
+MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
+#else
+#define omap_i2c_of_match NULL
+#endif
+
 static int __devinit
 omap_i2c_probe(struct platform_device *pdev)
 {
@@ -972,9 +988,10 @@ omap_i2c_probe(struct platform_device *pdev)
 	struct i2c_adapter	*adap;
 	struct resource		*mem, *irq, *ioarea;
 	struct omap_i2c_bus_platform_data *pdata = pdev->dev.platform_data;
+	struct device_node	*node = pdev->dev.of_node;
+	const struct of_device_id *match;
 	irq_handler_t isr;
 	int r;
-	u32 speed = 0;
 
 	/* NOTE: driver uses the static register mapping */
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1001,15 +1018,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;
+
+		of_property_read_u32(node, "clock-frequency", &freq);
+		/* convert DT freq value in Hz into kHz for speed */
+		dev->speed = freq / 1000;
+		of_property_read_u32(node, "ti,flags", &dev->flags);
+		dev->dtrev = pdata->rev;
+
+	} 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;
 	}
 
-	dev->speed = speed;
 	dev->dev = &pdev->dev;
 	dev->irq = irq->start;
 	dev->base = ioremap(mem->start, resource_size(mem));
@@ -1020,9 +1046,9 @@ omap_i2c_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, dev);
 
-	dev->reg_shift = (pdata->flags >> OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
+	dev->reg_shift = (dev->flags >> OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
 
-	if (pdata->rev == OMAP_I2C_IP_VERSION_2)
+	if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
 		dev->regs = (u8 *)reg_map_ip_v2;
 	else
 		dev->regs = (u8 *)reg_map_ip_v1;
@@ -1035,7 +1061,7 @@ omap_i2c_probe(struct platform_device *pdev)
 	if (dev->rev <= OMAP_I2C_REV_ON_3430)
 		dev->errata |= I2C_OMAP3_1P153;
 
-	if (!(pdata->flags & OMAP_I2C_FLAG_NO_FIFO)) {
+	if (!(dev->flags & OMAP_I2C_FLAG_NO_FIFO)) {
 		u16 s;
 
 		/* Set up the fifo size - Get total size */
@@ -1057,7 +1083,7 @@ omap_i2c_probe(struct platform_device *pdev)
 		/* calculate wakeup latency constraint for MPU */
 		if (dev->set_mpu_wkup_lat != NULL)
 			dev->latency = (1000000 * dev->fifo_size) /
-				       (1000 * speed / 8);
+				       (1000 * dev->speed / 8);
 	}
 
 	/* reset ASAP, clearing any IRQs */
@@ -1073,7 +1099,7 @@ omap_i2c_probe(struct platform_device *pdev)
 	}
 
 	dev_info(dev->dev, "bus %d rev%d.%d.%d at %d kHz\n", pdev->id,
-		 pdata->rev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
+		 dev->dtrev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
 
 	pm_runtime_put(dev->dev);
 
@@ -1084,6 +1110,7 @@ omap_i2c_probe(struct platform_device *pdev)
 	strlcpy(adap->name, "OMAP I2C adapter", sizeof(adap->name));
 	adap->algo = &omap_i2c_algo;
 	adap->dev.parent = &pdev->dev;
+	adap->dev.of_node = pdev->dev.of_node;
 
 	/* i2c device drivers may be active on return from add_adapter() */
 	adap->nr = pdev->id;
@@ -1093,6 +1120,8 @@ omap_i2c_probe(struct platform_device *pdev)
 		goto err_free_irq;
 	}
 
+	of_i2c_register_devices(adap);
+
 	return 0;
 
 err_free_irq:
@@ -1165,6 +1194,7 @@ static struct platform_driver omap_i2c_driver = {
 		.name	= "omap_i2c",
 		.owner	= THIS_MODULE,
 		.pm	= OMAP_I2C_PM_OPS,
+		.of_match_table = omap_i2c_of_match,
 	},
 };
 
-- 
1.7.0.4


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

* [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
@ 2011-12-09 14:02   ` Benoit Cousson
  0 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Ben Dooks <ben-linux@fluff.org>
---
 Documentation/devicetree/bindings/i2c/omap-i2c.txt |   42 ++++++++
 drivers/i2c/busses/i2c-omap.c                      |  100 +++++++++++++-------
 2 files changed, 107 insertions(+), 35 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt

diff --git a/Documentation/devicetree/bindings/i2c/omap-i2c.txt b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
new file mode 100644
index 0000000..d259a17
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
@@ -0,0 +1,42 @@
+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
+- ti,flags : u32: settings or errata relative to the i2c
+    0x1:   OMAP_I2C_FLAG_NO_FIFO
+    0x2:   OMAP_I2C_FLAG_SIMPLE_CLOCK
+    0x4:   OMAP_I2C_FLAG_16BIT_DATA_REG
+    0x8:   OMAP_I2C_FLAG_RESET_REGS_POSTIDLE
+    0x10:  OMAP_I2C_FLAG_APPLY_ERRATA_I207
+    0x20:  OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK
+    0x40:  OMAP_I2C_FLAG_FORCE_19200_INT_CLK
+  Valid for ti,omap3-i2c only:
+    0x80:  OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers
+    0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registers
+
+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>;
+    ti,flags = <0x118>;
+};
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index a43d002..b4a8eee 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -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>
@@ -182,7 +184,9 @@ struct omap_i2c_dev {
 	u32			latency;	/* maximum mpu wkup latency */
 	void			(*set_mpu_wkup_lat)(struct device *dev,
 						    long latency);
-	u32			speed;		/* Speed of bus in Khz */
+	u32			speed;		/* Speed of bus in kHz */
+	u32			dtrev;		/* extra revision from DT */
+	u32			flags;
 	u16			cmd_err;
 	u8			*buf;
 	u8			*regs;
@@ -266,11 +270,7 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
 
 static void omap_i2c_unidle(struct omap_i2c_dev *dev)
 {
-	struct omap_i2c_bus_platform_data *pdata;
-
-	pdata = dev->dev->platform_data;
-
-	if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
+	if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
 		omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
 		omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, dev->pscstate);
 		omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, dev->scllstate);
@@ -291,13 +291,10 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev)
 
 static void omap_i2c_idle(struct omap_i2c_dev *dev)
 {
-	struct omap_i2c_bus_platform_data *pdata;
 	u16 iv;
 
-	pdata = dev->dev->platform_data;
-
 	dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
-	if (pdata->rev == OMAP_I2C_IP_VERSION_2)
+	if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
 		omap_i2c_write_reg(dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
 	else
 		omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
@@ -320,9 +317,6 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
 	unsigned long timeout;
 	unsigned long internal_clk = 0;
 	struct clk *fclk;
-	struct omap_i2c_bus_platform_data *pdata;
-
-	pdata = dev->dev->platform_data;
 
 	if (dev->rev >= OMAP_I2C_OMAP1_REV_2) {
 		/* Disable I2C controller before soft reset */
@@ -373,7 +367,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
 	}
 	omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
 
-	if (pdata->flags & OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK) {
+	if (dev->flags & OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK) {
 		/*
 		 * The I2C functional clock is the armxor_ck, so there's
 		 * no need to get "armxor_ck" separately.  Now, if OMAP2420
@@ -397,7 +391,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
 			psc = fclk_rate / 12000000;
 	}
 
-	if (!(pdata->flags & OMAP_I2C_FLAG_SIMPLE_CLOCK)) {
+	if (!(dev->flags & OMAP_I2C_FLAG_SIMPLE_CLOCK)) {
 
 		/*
 		 * HSI2C controller internal clk rate should be 19.2 Mhz for
@@ -406,7 +400,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
 		 * The filter is iclk (fclk for HS) period.
 		 */
 		if (dev->speed > 400 ||
-			       pdata->flags & OMAP_I2C_FLAG_FORCE_19200_INT_CLK)
+			       dev->flags & OMAP_I2C_FLAG_FORCE_19200_INT_CLK)
 			internal_clk = 19200;
 		else if (dev->speed > 100)
 			internal_clk = 9600;
@@ -475,7 +469,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
 
 	dev->errata = 0;
 
-	if (pdata->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
+	if (dev->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
 		dev->errata |= I2C_OMAP_ERRATA_I207;
 
 	/* Enable interrupts */
@@ -484,7 +478,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
 			OMAP_I2C_IE_AL)  | ((dev->fifo_size) ?
 				(OMAP_I2C_IE_RDR | OMAP_I2C_IE_XDR) : 0);
 	omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
-	if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
+	if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
 		dev->pscstate = psc;
 		dev->scllstate = scll;
 		dev->sclhstate = sclh;
@@ -804,9 +798,6 @@ omap_i2c_isr(int this_irq, void *dev_id)
 	u16 bits;
 	u16 stat, w;
 	int err, count = 0;
-	struct omap_i2c_bus_platform_data *pdata;
-
-	pdata = dev->dev->platform_data;
 
 	if (pm_runtime_suspended(dev->dev))
 		return IRQ_NONE;
@@ -875,7 +866,7 @@ complete:
 					 * Data reg in 2430, omap3 and
 					 * omap4 is 8 bit wide
 					 */
-					if (pdata->flags &
+					if (dev->flags &
 						 OMAP_I2C_FLAG_16BIT_DATA_REG) {
 						if (dev->buf_len) {
 							*dev->buf++ = w >> 8;
@@ -918,7 +909,7 @@ complete:
 					 * Data reg in 2430, omap3 and
 					 * omap4 is 8 bit wide
 					 */
-					if (pdata->flags &
+					if (dev->flags &
 						 OMAP_I2C_FLAG_16BIT_DATA_REG) {
 						if (dev->buf_len) {
 							w |= *dev->buf++ << 8;
@@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = {
 	.functionality	= omap_i2c_func,
 };
 
+#ifdef CONFIG_OF
+static struct omap_i2c_bus_platform_data omap3_pdata = {
+	.rev = OMAP_I2C_IP_VERSION_1,
+};
+
+static struct omap_i2c_bus_platform_data omap4_pdata = {
+	.rev = OMAP_I2C_IP_VERSION_2,
+};
+
+static const struct of_device_id omap_i2c_of_match[] = {
+	{
+		.compatible = "ti,omap4-i2c",
+		.data = &omap4_pdata,
+	},
+	{
+		.compatible = "ti,omap3-i2c",
+		.data = &omap3_pdata,
+	},
+	{ },
+};
+MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
+#else
+#define omap_i2c_of_match NULL
+#endif
+
 static int __devinit
 omap_i2c_probe(struct platform_device *pdev)
 {
@@ -972,9 +988,10 @@ omap_i2c_probe(struct platform_device *pdev)
 	struct i2c_adapter	*adap;
 	struct resource		*mem, *irq, *ioarea;
 	struct omap_i2c_bus_platform_data *pdata = pdev->dev.platform_data;
+	struct device_node	*node = pdev->dev.of_node;
+	const struct of_device_id *match;
 	irq_handler_t isr;
 	int r;
-	u32 speed = 0;
 
 	/* NOTE: driver uses the static register mapping */
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1001,15 +1018,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;
+
+		of_property_read_u32(node, "clock-frequency", &freq);
+		/* convert DT freq value in Hz into kHz for speed */
+		dev->speed = freq / 1000;
+		of_property_read_u32(node, "ti,flags", &dev->flags);
+		dev->dtrev = pdata->rev;
+
+	} 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;
 	}
 
-	dev->speed = speed;
 	dev->dev = &pdev->dev;
 	dev->irq = irq->start;
 	dev->base = ioremap(mem->start, resource_size(mem));
@@ -1020,9 +1046,9 @@ omap_i2c_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, dev);
 
-	dev->reg_shift = (pdata->flags >> OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
+	dev->reg_shift = (dev->flags >> OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
 
-	if (pdata->rev == OMAP_I2C_IP_VERSION_2)
+	if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
 		dev->regs = (u8 *)reg_map_ip_v2;
 	else
 		dev->regs = (u8 *)reg_map_ip_v1;
@@ -1035,7 +1061,7 @@ omap_i2c_probe(struct platform_device *pdev)
 	if (dev->rev <= OMAP_I2C_REV_ON_3430)
 		dev->errata |= I2C_OMAP3_1P153;
 
-	if (!(pdata->flags & OMAP_I2C_FLAG_NO_FIFO)) {
+	if (!(dev->flags & OMAP_I2C_FLAG_NO_FIFO)) {
 		u16 s;
 
 		/* Set up the fifo size - Get total size */
@@ -1057,7 +1083,7 @@ omap_i2c_probe(struct platform_device *pdev)
 		/* calculate wakeup latency constraint for MPU */
 		if (dev->set_mpu_wkup_lat != NULL)
 			dev->latency = (1000000 * dev->fifo_size) /
-				       (1000 * speed / 8);
+				       (1000 * dev->speed / 8);
 	}
 
 	/* reset ASAP, clearing any IRQs */
@@ -1073,7 +1099,7 @@ omap_i2c_probe(struct platform_device *pdev)
 	}
 
 	dev_info(dev->dev, "bus %d rev%d.%d.%d at %d kHz\n", pdev->id,
-		 pdata->rev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
+		 dev->dtrev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
 
 	pm_runtime_put(dev->dev);
 
@@ -1084,6 +1110,7 @@ omap_i2c_probe(struct platform_device *pdev)
 	strlcpy(adap->name, "OMAP I2C adapter", sizeof(adap->name));
 	adap->algo = &omap_i2c_algo;
 	adap->dev.parent = &pdev->dev;
+	adap->dev.of_node = pdev->dev.of_node;
 
 	/* i2c device drivers may be active on return from add_adapter() */
 	adap->nr = pdev->id;
@@ -1093,6 +1120,8 @@ omap_i2c_probe(struct platform_device *pdev)
 		goto err_free_irq;
 	}
 
+	of_i2c_register_devices(adap);
+
 	return 0;
 
 err_free_irq:
@@ -1165,6 +1194,7 @@ static struct platform_driver omap_i2c_driver = {
 		.name	= "omap_i2c",
 		.owner	= THIS_MODULE,
 		.pm	= OMAP_I2C_PM_OPS,
+		.of_match_table = omap_i2c_of_match,
 	},
 };
 
-- 
1.7.0.4

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

* [PATCH v2 03/10] mfd: twl-core: Add initial DT support for twl4030/twl6030
  2011-12-09 14:02 ` Benoit Cousson
@ 2011-12-09 14:02   ` Benoit Cousson
  -1 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: tony, rob.herring
  Cc: devicetree-discuss, grant.likely, linux-omap, linux-arm-kernel,
	Benoit Cousson, Balaji T K, Graeme Gregory, Samuel Ortiz

Add initial device-tree support for twl familly chips.
The current version is missing the regulator entries due
to the lack of DT regulator bindings for the moment.
Only the simple sub-modules that do not depend on
platform_data information can be initialized properly.

Add documentation for the Texas Instruments TWL Integrated Chip.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Balaji T K <balajitk@ti.com>
Cc: Graeme Gregory <gg@slimlogic.co.uk>
Cc: Samuel Ortiz <sameo@linux.intel.com>
---
 .../devicetree/bindings/mfd/twl-familly.txt        |   47 +++++++++++++++++
 drivers/mfd/twl-core.c                             |   53 ++++++++++++++++++--
 2 files changed, 96 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/twl-familly.txt

diff --git a/Documentation/devicetree/bindings/mfd/twl-familly.txt b/Documentation/devicetree/bindings/mfd/twl-familly.txt
new file mode 100644
index 0000000..ff4cacd
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/twl-familly.txt
@@ -0,0 +1,47 @@
+Texas Instruments TWL family
+
+The TWLs are Integrated Power Management Chips.
+Some version might contain much more analog function like
+USB transceiver or Audio amplifier.
+These chips are connected to an i2c bus.
+
+
+Required properties:
+- compatible : Must be "ti,twl4030";
+  For Integrated power-management/audio CODEC device used in OMAP3
+  based boards
+- compatible : Must be "ti,twl6030";
+  For Integrated power-management used in OMAP4 based boards
+- interrupts : This i2c device has an IRQ line connected to the main SoC
+- interrupt-controller : Since the twl support several interrupts internally,
+  it is considered as an interrupt controller cascaded to the SoC one.
+- #interrupt-cells = <1>;
+- interrupt-parent : The parent interrupt controller.
+
+Optional node:
+- Child nodes contain in the twl. The twl family is made of severals variants
+  that support a different number of features.
+  The children nodes will thus depend of the capabilty of the variant.
+
+
+Example:
+/*
+ * Integrated Power Management Chip
+ * http://www.ti.com/lit/ds/symlink/twl6030.pdf
+ */
+twl@48 {
+    compatible = "ti,twl6030";
+    reg = <0x48>;
+    interrupts = <39>; /* IRQ_SYS_1N cascaded to gic */
+    interrupt-controller;
+    #interrupt-cells = <1>;
+    interrupt-parent = <&gic>;
+    #address-cells = <1>;
+    #size-cells = <0>;
+
+    twl_rtc {
+        compatible = "ti,twl_rtc";
+        interrupts = <11>;
+        reg = <0>;
+    };
+};
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index bfbd660..524d9d8 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -34,6 +34,10 @@
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/err.h>
+#include <linux/slab.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <linux/irqdomain.h>
 
 #include <linux/regulator/machine.h>
 
@@ -1183,22 +1187,53 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	int				status;
 	unsigned			i;
 	struct twl4030_platform_data	*pdata = client->dev.platform_data;
+	struct device_node		*node = client->dev.of_node;
 	u8 temp;
 	int ret = 0;
 
+	if (node && !pdata) {
+		/*
+		 * XXX: Temporary fake pdata until the information
+		 * is correctly retrieved by every TWL modules from DT.
+		 */
+		pdata = kzalloc(sizeof(struct twl4030_platform_data),
+				GFP_KERNEL);
+		if (!pdata) {
+			status = -ENOMEM;
+			goto exit;
+		}
+
+		/*
+		 * XXX: For the moment the IRQs for TWL seems to be encoded in
+		 * the global OMAP space. That should be cleaned to allow
+		 * dynamically adding a new IRQ controller.
+		 */
+		if ((id->driver_data) & TWL6030_CLASS) {
+			pdata->irq_base = TWL6030_IRQ_BASE;
+			pdata->irq_end = pdata->irq_base + TWL6030_BASE_NR_IRQS;
+		} else {
+			pdata->irq_base = TWL4030_IRQ_BASE;
+			pdata->irq_end = pdata->irq_base + TWL4030_BASE_NR_IRQS;
+		}
+		irq_domain_add_simple(node, pdata->irq_base);
+	}
+
 	if (!pdata) {
 		dev_dbg(&client->dev, "no platform data?\n");
-		return -EINVAL;
+		status = -EINVAL;
+		goto fail_free;
 	}
 
 	if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C) == 0) {
 		dev_dbg(&client->dev, "can't talk I2C?\n");
-		return -EIO;
+		status = -EIO;
+		goto fail_free;
 	}
 
 	if (inuse) {
 		dev_dbg(&client->dev, "driver is already in use\n");
-		return -EBUSY;
+		status = -EBUSY;
+		goto fail_free;
 	}
 
 	for (i = 0; i < TWL_NUM_SLAVES; i++) {
@@ -1270,10 +1305,20 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1);
 	}
 
-	status = add_children(pdata, id->driver_data);
+#ifdef CONFIG_OF_DEVICE
+	if (node)
+		status = of_platform_populate(node, NULL, NULL, &client->dev);
+	else
+#endif
+		status = add_children(pdata, id->driver_data);
+
 fail:
 	if (status < 0)
 		twl_remove(client);
+fail_free:
+	if (node)
+		kfree(pdata);
+exit:
 	return status;
 }
 
-- 
1.7.0.4


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

* [PATCH v2 03/10] mfd: twl-core: Add initial DT support for twl4030/twl6030
@ 2011-12-09 14:02   ` Benoit Cousson
  0 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

Add initial device-tree support for twl familly chips.
The current version is missing the regulator entries due
to the lack of DT regulator bindings for the moment.
Only the simple sub-modules that do not depend on
platform_data information can be initialized properly.

Add documentation for the Texas Instruments TWL Integrated Chip.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Balaji T K <balajitk@ti.com>
Cc: Graeme Gregory <gg@slimlogic.co.uk>
Cc: Samuel Ortiz <sameo@linux.intel.com>
---
 .../devicetree/bindings/mfd/twl-familly.txt        |   47 +++++++++++++++++
 drivers/mfd/twl-core.c                             |   53 ++++++++++++++++++--
 2 files changed, 96 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/twl-familly.txt

diff --git a/Documentation/devicetree/bindings/mfd/twl-familly.txt b/Documentation/devicetree/bindings/mfd/twl-familly.txt
new file mode 100644
index 0000000..ff4cacd
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/twl-familly.txt
@@ -0,0 +1,47 @@
+Texas Instruments TWL family
+
+The TWLs are Integrated Power Management Chips.
+Some version might contain much more analog function like
+USB transceiver or Audio amplifier.
+These chips are connected to an i2c bus.
+
+
+Required properties:
+- compatible : Must be "ti,twl4030";
+  For Integrated power-management/audio CODEC device used in OMAP3
+  based boards
+- compatible : Must be "ti,twl6030";
+  For Integrated power-management used in OMAP4 based boards
+- interrupts : This i2c device has an IRQ line connected to the main SoC
+- interrupt-controller : Since the twl support several interrupts internally,
+  it is considered as an interrupt controller cascaded to the SoC one.
+- #interrupt-cells = <1>;
+- interrupt-parent : The parent interrupt controller.
+
+Optional node:
+- Child nodes contain in the twl. The twl family is made of severals variants
+  that support a different number of features.
+  The children nodes will thus depend of the capabilty of the variant.
+
+
+Example:
+/*
+ * Integrated Power Management Chip
+ * http://www.ti.com/lit/ds/symlink/twl6030.pdf
+ */
+twl at 48 {
+    compatible = "ti,twl6030";
+    reg = <0x48>;
+    interrupts = <39>; /* IRQ_SYS_1N cascaded to gic */
+    interrupt-controller;
+    #interrupt-cells = <1>;
+    interrupt-parent = <&gic>;
+    #address-cells = <1>;
+    #size-cells = <0>;
+
+    twl_rtc {
+        compatible = "ti,twl_rtc";
+        interrupts = <11>;
+        reg = <0>;
+    };
+};
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index bfbd660..524d9d8 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -34,6 +34,10 @@
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/err.h>
+#include <linux/slab.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <linux/irqdomain.h>
 
 #include <linux/regulator/machine.h>
 
@@ -1183,22 +1187,53 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	int				status;
 	unsigned			i;
 	struct twl4030_platform_data	*pdata = client->dev.platform_data;
+	struct device_node		*node = client->dev.of_node;
 	u8 temp;
 	int ret = 0;
 
+	if (node && !pdata) {
+		/*
+		 * XXX: Temporary fake pdata until the information
+		 * is correctly retrieved by every TWL modules from DT.
+		 */
+		pdata = kzalloc(sizeof(struct twl4030_platform_data),
+				GFP_KERNEL);
+		if (!pdata) {
+			status = -ENOMEM;
+			goto exit;
+		}
+
+		/*
+		 * XXX: For the moment the IRQs for TWL seems to be encoded in
+		 * the global OMAP space. That should be cleaned to allow
+		 * dynamically adding a new IRQ controller.
+		 */
+		if ((id->driver_data) & TWL6030_CLASS) {
+			pdata->irq_base = TWL6030_IRQ_BASE;
+			pdata->irq_end = pdata->irq_base + TWL6030_BASE_NR_IRQS;
+		} else {
+			pdata->irq_base = TWL4030_IRQ_BASE;
+			pdata->irq_end = pdata->irq_base + TWL4030_BASE_NR_IRQS;
+		}
+		irq_domain_add_simple(node, pdata->irq_base);
+	}
+
 	if (!pdata) {
 		dev_dbg(&client->dev, "no platform data?\n");
-		return -EINVAL;
+		status = -EINVAL;
+		goto fail_free;
 	}
 
 	if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C) == 0) {
 		dev_dbg(&client->dev, "can't talk I2C?\n");
-		return -EIO;
+		status = -EIO;
+		goto fail_free;
 	}
 
 	if (inuse) {
 		dev_dbg(&client->dev, "driver is already in use\n");
-		return -EBUSY;
+		status = -EBUSY;
+		goto fail_free;
 	}
 
 	for (i = 0; i < TWL_NUM_SLAVES; i++) {
@@ -1270,10 +1305,20 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1);
 	}
 
-	status = add_children(pdata, id->driver_data);
+#ifdef CONFIG_OF_DEVICE
+	if (node)
+		status = of_platform_populate(node, NULL, NULL, &client->dev);
+	else
+#endif
+		status = add_children(pdata, id->driver_data);
+
 fail:
 	if (status < 0)
 		twl_remove(client);
+fail_free:
+	if (node)
+		kfree(pdata);
+exit:
 	return status;
 }
 
-- 
1.7.0.4

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

* [PATCH v2 04/10] rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030
  2011-12-09 14:02 ` Benoit Cousson
@ 2011-12-09 14:02   ` Benoit Cousson
  -1 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: tony, rob.herring
  Cc: devicetree-discuss, grant.likely, linux-omap, linux-arm-kernel,
	Benoit Cousson, Alessandro Zummo

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

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
---
 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

diff --git a/Documentation/devicetree/bindings/rtc/twl-rtc.txt b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
new file mode 100644
index 0000000..596e0c9
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
@@ -0,0 +1,12 @@
+* TI twl RTC
+
+The TWL family (twl4030/6030) contains a RTC.
+
+Required properties:
+- compatible : Should be twl4030-rtc
+
+Examples:
+
+rtc@0 {
+    compatible = "ti,twl4030-rtc";
+};
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 20687d5..d43b4f6 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -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,
 	},
 };
 
-- 
1.7.0.4


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

* [PATCH v2 04/10] rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030
@ 2011-12-09 14:02   ` Benoit Cousson
  0 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
---
 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

diff --git a/Documentation/devicetree/bindings/rtc/twl-rtc.txt b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
new file mode 100644
index 0000000..596e0c9
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
@@ -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";
+};
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 20687d5..d43b4f6 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -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,
 	},
 };
 
-- 
1.7.0.4

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

* [PATCH v2 05/10] arm/dts: OMAP4: Add i2c controller nodes
  2011-12-09 14:02 ` Benoit Cousson
@ 2011-12-09 14:02   ` Benoit Cousson
  -1 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: tony, rob.herring
  Cc: devicetree-discuss, grant.likely, linux-omap, linux-arm-kernel,
	Benoit Cousson

Add i2c controllers nodes into the main ocp bus.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
---
 arch/arm/boot/dts/omap4.dtsi |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index bede009..9872283 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -100,5 +100,33 @@
 			reg = <0x48241000 0x1000>,
 			      <0x48240100 0x0100>;
 		};
+
+		i2c1: i2c@1 {
+			compatible = "ti,omap4-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c1";
+		};
+
+		i2c2: i2c@2 {
+			compatible = "ti,omap4-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c2";
+		};
+
+		i2c3: i2c@3 {
+			compatible = "ti,omap4-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c3";
+		};
+
+		i2c4: i2c@4 {
+			compatible = "ti,omap4-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c4";
+		};
 	};
 };
-- 
1.7.0.4


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

* [PATCH v2 05/10] arm/dts: OMAP4: Add i2c controller nodes
@ 2011-12-09 14:02   ` Benoit Cousson
  0 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

Add i2c controllers nodes into the main ocp bus.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
---
 arch/arm/boot/dts/omap4.dtsi |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index bede009..9872283 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -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";
+		};
 	};
 };
-- 
1.7.0.4

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

* [PATCH v2 06/10] arm/dts: OMAP3: Add i2c controller nodes
  2011-12-09 14:02 ` Benoit Cousson
@ 2011-12-09 14:02   ` Benoit Cousson
  -1 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: tony, rob.herring
  Cc: devicetree-discuss, grant.likely, linux-omap, linux-arm-kernel,
	Benoit Cousson

Add i2c controllers nodes into the main ocp bus.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
---
 arch/arm/boot/dts/omap3.dtsi |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 6866dc7..81d8e2c 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -61,5 +61,33 @@
 			ti,intc-size = <96>;
 			reg = <0x48200000 0x1000>;
 		};
+
+		/*
+		 * Flags for all i2c instances: 0x118
+		 * APPLY_ERRATA_I207 | RESET_REGS_POSTIDLE | BUS_SHIFT_2
+		 */
+		i2c1: i2c@1 {
+			compatible = "ti,omap3-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c1";
+			ti,flags = <0x118>;
+		};
+
+		i2c2: i2c@2 {
+			compatible = "ti,omap3-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c2";
+			ti,flags = <0x118>;
+		};
+
+		i2c3: i2c@3 {
+			compatible = "ti,omap3-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c3";
+			ti,flags = <0x118>;
+		};
 	};
 };
-- 
1.7.0.4


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

* [PATCH v2 06/10] arm/dts: OMAP3: Add i2c controller nodes
@ 2011-12-09 14:02   ` Benoit Cousson
  0 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

Add i2c controllers nodes into the main ocp bus.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
---
 arch/arm/boot/dts/omap3.dtsi |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 6866dc7..81d8e2c 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -61,5 +61,33 @@
 			ti,intc-size = <96>;
 			reg = <0x48200000 0x1000>;
 		};
+
+		/*
+		 * Flags for all i2c instances: 0x118
+		 * APPLY_ERRATA_I207 | RESET_REGS_POSTIDLE | BUS_SHIFT_2
+		 */
+		i2c1: i2c at 1 {
+			compatible = "ti,omap3-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c1";
+			ti,flags = <0x118>;
+		};
+
+		i2c2: i2c at 2 {
+			compatible = "ti,omap3-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c2";
+			ti,flags = <0x118>;
+		};
+
+		i2c3: i2c at 3 {
+			compatible = "ti,omap3-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ti,hwmods = "i2c3";
+			ti,flags = <0x118>;
+		};
 	};
 };
-- 
1.7.0.4

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

* [PATCH v2 07/10] arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
  2011-12-09 14:02 ` Benoit Cousson
@ 2011-12-09 14:02   ` Benoit Cousson
  -1 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: tony, rob.herring
  Cc: devicetree-discuss, grant.likely, linux-omap, linux-arm-kernel,
	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.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
---
 arch/arm/boot/dts/omap4-panda.dts |   45 +++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index 9755ad5..b66bcd6 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -18,3 +18,48 @@
 		reg = <0x80000000 0x40000000>; /* 1 GB */
 	};
 };
+
+&i2c1 {
+	clock-frequency = <400000>;
+
+	/*
+	 * Integrated Power Management Chip
+	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
+	 */
+	twl@48 {
+		compatible = "ti,twl6030";
+		reg = <0x48>;
+		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
+		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		interrupt-parent = <&gic>;
+
+		/* twl is a MFD, so it will contain a bunch of sub-ips */
+		rtc {
+			compatible = "ti,twl4030-rtc";
+			interrupts = <11>;
+		};
+	};
+};
+
+&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@50 {
+		compatible = "ti,eeprom";
+		reg = <0x50>;
+	};
+};
+
+&i2c4 {
+	clock-frequency = <400000>;
+};
-- 
1.7.0.4


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

* [PATCH v2 07/10] arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
@ 2011-12-09 14:02   ` Benoit Cousson
  0 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
---
 arch/arm/boot/dts/omap4-panda.dts |   45 +++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index 9755ad5..b66bcd6 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -18,3 +18,48 @@
 		reg = <0x80000000 0x40000000>; /* 1 GB */
 	};
 };
+
+&i2c1 {
+	clock-frequency = <400000>;
+
+	/*
+	 * Integrated Power Management Chip
+	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
+	 */
+	twl at 48 {
+		compatible = "ti,twl6030";
+		reg = <0x48>;
+		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
+		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		interrupt-parent = <&gic>;
+
+		/* twl is a MFD, so it will contain a bunch of sub-ips */
+		rtc {
+			compatible = "ti,twl4030-rtc";
+			interrupts = <11>;
+		};
+	};
+};
+
+&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>;
+};
-- 
1.7.0.4

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

* [PATCH v2 08/10] arm/dts: omap4-sdp: Add twl6030, i2c3 and i2c4 devices
  2011-12-09 14:02 ` Benoit Cousson
@ 2011-12-09 14:02   ` Benoit Cousson
  -1 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: tony, rob.herring
  Cc: devicetree-discuss, grant.likely, linux-omap, linux-arm-kernel,
	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

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
---
 arch/arm/boot/dts/omap4-sdp.dts |   63 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 63c6b2b..0ab14cb 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -18,3 +18,66 @@
 		reg = <0x80000000 0x40000000>; /* 1 GB */
 	};
 };
+
+&i2c1 {
+	clock-frequency = <400000>;
+
+	/*
+	 * Integrated Power Management Chip
+	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
+	 */
+	twl@48 {
+		compatible = "ti,twl6030";
+		reg = <0x48>;
+		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
+		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		interrupt-parent = <&gic>;
+
+		/* twl is a MFD, so it will contain a bunch of sub-ips */
+		rtc {
+			compatible = "ti,twl4030-rtc";
+			interrupts = <11>;
+		};
+	};
+};
+
+&i2c2 {
+	clock-frequency = <400000>;
+};
+
+&i2c3 {
+	clock-frequency = <400000>;
+
+	/*
+	 * Temperature Sensor
+	 * http://www.ti.com/lit/ds/symlink/tmp105.pdf
+	 */
+	tmp105@48 {
+		compatible = "ti,tmp105";
+		reg = <0x48>;
+	};
+
+	/*
+	 * Ambient Light Sensor
+	 * http://www.rohm.com/products/databook/sensor/pdf/bh1780gli-e.pdf
+	 */
+	bh1780@29 {
+		compatible = "rohm,bh1780";
+		reg = <0x29>;
+	};
+};
+
+&i2c4 {
+	clock-frequency = <400000>;
+
+	/*
+	 * 3-Axis Digital Compass
+	 * http://www.sparkfun.com/datasheets/Sensors/Magneto/HMC5843.pdf
+	 */
+	hmc5843@1e {
+		compatible = "honeywell,hmc5843";
+		reg = <0x1e>;
+	};
+};
-- 
1.7.0.4


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

* [PATCH v2 08/10] arm/dts: omap4-sdp: Add twl6030, i2c3 and i2c4 devices
@ 2011-12-09 14:02   ` Benoit Cousson
  0 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
---
 arch/arm/boot/dts/omap4-sdp.dts |   63 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 63c6b2b..0ab14cb 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -18,3 +18,66 @@
 		reg = <0x80000000 0x40000000>; /* 1 GB */
 	};
 };
+
+&i2c1 {
+	clock-frequency = <400000>;
+
+	/*
+	 * Integrated Power Management Chip
+	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
+	 */
+	twl at 48 {
+		compatible = "ti,twl6030";
+		reg = <0x48>;
+		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
+		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		interrupt-parent = <&gic>;
+
+		/* twl is a MFD, so it will contain a bunch of sub-ips */
+		rtc {
+			compatible = "ti,twl4030-rtc";
+			interrupts = <11>;
+		};
+	};
+};
+
+&i2c2 {
+	clock-frequency = <400000>;
+};
+
+&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>;
+	};
+};
-- 
1.7.0.4

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

* [PATCH v2 09/10] arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM
  2011-12-09 14:02 ` Benoit Cousson
@ 2011-12-09 14:02   ` Benoit Cousson
  -1 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: tony, rob.herring
  Cc: devicetree-discuss, grant.likely, linux-omap, linux-arm-kernel,
	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

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
---
 arch/arm/boot/dts/omap3-beagle.dts |   38 ++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
index 9f72cd4..b648279 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -18,3 +18,41 @@
 		reg = <0x80000000 0x20000000>; /* 512 MB */
 	};
 };
+
+&i2c1 {
+	clock-frequency = <2600000>;
+
+	/*
+	 * Integrated Power Management Chip
+	 */
+	twl@48 {
+		compatible = "ti,twl4030";
+		reg = <0x48>;
+		interrupts = <7>; /* SYS_NIRQ cascaded to intc */
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		interrupt-parent = <&intc>;
+
+		twl_rtc {
+			compatible = "ti,twl4030-rtc";
+			interrupts = <11>;
+		};
+	};
+};
+
+&i2c2 {
+	clock-frequency = <400000>;
+};
+
+&i2c3 {
+	clock-frequency = <100000>;
+
+	/*
+	 * Display monitor features are burnt in the EEPROM
+	 * as EDID data.
+	 */
+	eeprom@50 {
+		compatible = "ti,eeprom";
+		reg = <0x50>;
+	};
+};
-- 
1.7.0.4


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

* [PATCH v2 09/10] arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM
@ 2011-12-09 14:02   ` Benoit Cousson
  0 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
---
 arch/arm/boot/dts/omap3-beagle.dts |   38 ++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
index 9f72cd4..b648279 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -18,3 +18,41 @@
 		reg = <0x80000000 0x20000000>; /* 512 MB */
 	};
 };
+
+&i2c1 {
+	clock-frequency = <2600000>;
+
+	/*
+	 * Integrated Power Management Chip
+	 */
+	twl at 48 {
+		compatible = "ti,twl4030";
+		reg = <0x48>;
+		interrupts = <7>; /* SYS_NIRQ cascaded to intc */
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		interrupt-parent = <&intc>;
+
+		twl_rtc {
+			compatible = "ti,twl4030-rtc";
+			interrupts = <11>;
+		};
+	};
+};
+
+&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>;
+	};
+};
-- 
1.7.0.4

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

* [PATCH v2 10/10] ARM: OMAP2+: board-generic: Remove i2c static init
  2011-12-09 14:02 ` Benoit Cousson
@ 2011-12-09 14:02   ` Benoit Cousson
  -1 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: tony, rob.herring
  Cc: devicetree-discuss, grant.likely, linux-omap, linux-arm-kernel,
	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.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/board-generic.c |   48 +---------------------------------
 1 files changed, 2 insertions(+), 46 deletions(-)

diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 16c301e..63a2495 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -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
 
 #ifdef 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
-- 
1.7.0.4


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

* [PATCH v2 10/10] ARM: OMAP2+: board-generic: Remove i2c static init
@ 2011-12-09 14:02   ` Benoit Cousson
  0 siblings, 0 replies; 82+ messages in thread
From: Benoit Cousson @ 2011-12-09 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/board-generic.c |   48 +---------------------------------
 1 files changed, 2 insertions(+), 46 deletions(-)

diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 16c301e..63a2495 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -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
 
 #ifdef 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
-- 
1.7.0.4

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

* Re: [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
  2011-12-09 14:02   ` Benoit Cousson
@ 2011-12-14  1:06     ` Kevin Hilman
  -1 siblings, 0 replies; 82+ messages in thread
From: Kevin Hilman @ 2011-12-14  1:06 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: tony, rob.herring, devicetree-discuss, grant.likely, linux-omap,
	linux-arm-kernel, Ben Dooks

Benoit Cousson <b-cousson@ti.com> writes:

> 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.
>
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Ben Dooks <ben-linux@fluff.org>

This seems indepenent from the rest of the series, and I can queue up
for merge via the I2C tree.

Benoit, please confirm that we shouldn't have any problems if this patch
goes independently.

Grant/Rob, with your ack on the bindings, I can queue this up for the
I2C maintainers along with some other OMAP I2C changes for v3.3.

Kevin

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

* [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
@ 2011-12-14  1:06     ` Kevin Hilman
  0 siblings, 0 replies; 82+ messages in thread
From: Kevin Hilman @ 2011-12-14  1:06 UTC (permalink / raw)
  To: linux-arm-kernel

Benoit Cousson <b-cousson@ti.com> writes:

> 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.
>
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Ben Dooks <ben-linux@fluff.org>

This seems indepenent from the rest of the series, and I can queue up
for merge via the I2C tree.

Benoit, please confirm that we shouldn't have any problems if this patch
goes independently.

Grant/Rob, with your ack on the bindings, I can queue this up for the
I2C maintainers along with some other OMAP I2C changes for v3.3.

Kevin

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

* Re: [PATCH v2 07/10] arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
  2011-12-09 14:02   ` Benoit Cousson
@ 2011-12-14  5:06     ` Kevin Hilman
  -1 siblings, 0 replies; 82+ messages in thread
From: Kevin Hilman @ 2011-12-14  5:06 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: tony, rob.herring, devicetree-discuss, grant.likely, linux-omap,
	linux-arm-kernel

Hi Benoit,

Benoit Cousson <b-cousson@ti.com> writes:

> 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.
>
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> ---
>  arch/arm/boot/dts/omap4-panda.dts |   45 +++++++++++++++++++++++++++++++++++++
>  1 files changed, 45 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
> index 9755ad5..b66bcd6 100644
> --- a/arch/arm/boot/dts/omap4-panda.dts
> +++ b/arch/arm/boot/dts/omap4-panda.dts
> @@ -18,3 +18,48 @@
>  		reg = <0x80000000 0x40000000>; /* 1 GB */
>  	};
>  };
> +
> +&i2c1 {
> +	clock-frequency = <400000>;
> +
> +	/*
> +	 * Integrated Power Management Chip
> +	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
> +	 */
> +	twl@48 {
> +		compatible = "ti,twl6030";
> +		reg = <0x48>;
> +		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
> +		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
> +		interrupt-controller;
> +		#interrupt-cells = <1>;
> +		interrupt-parent = <&gic>;
> +
> +		/* twl is a MFD, so it will contain a bunch of sub-ips */
> +		rtc {
> +			compatible = "ti,twl4030-rtc";
> +			interrupts = <11>;
> +		};

After seeing the mostly cut & paste in Rajendra's regulator series, I'm
wondering if it wouldn't be better to just have a twl4030.dtsi here
which has the RTC and all the regulators with the default voltage ranges
from the TWL data sheet.   

Not knowing much about how includes work in DT, would it then be
possible for board files to override things like default voltage ranges
for regulators?

Kevin

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

* [PATCH v2 07/10] arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
@ 2011-12-14  5:06     ` Kevin Hilman
  0 siblings, 0 replies; 82+ messages in thread
From: Kevin Hilman @ 2011-12-14  5:06 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Benoit,

Benoit Cousson <b-cousson@ti.com> writes:

> 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.
>
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> ---
>  arch/arm/boot/dts/omap4-panda.dts |   45 +++++++++++++++++++++++++++++++++++++
>  1 files changed, 45 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
> index 9755ad5..b66bcd6 100644
> --- a/arch/arm/boot/dts/omap4-panda.dts
> +++ b/arch/arm/boot/dts/omap4-panda.dts
> @@ -18,3 +18,48 @@
>  		reg = <0x80000000 0x40000000>; /* 1 GB */
>  	};
>  };
> +
> +&i2c1 {
> +	clock-frequency = <400000>;
> +
> +	/*
> +	 * Integrated Power Management Chip
> +	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
> +	 */
> +	twl at 48 {
> +		compatible = "ti,twl6030";
> +		reg = <0x48>;
> +		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
> +		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
> +		interrupt-controller;
> +		#interrupt-cells = <1>;
> +		interrupt-parent = <&gic>;
> +
> +		/* twl is a MFD, so it will contain a bunch of sub-ips */
> +		rtc {
> +			compatible = "ti,twl4030-rtc";
> +			interrupts = <11>;
> +		};

After seeing the mostly cut & paste in Rajendra's regulator series, I'm
wondering if it wouldn't be better to just have a twl4030.dtsi here
which has the RTC and all the regulators with the default voltage ranges
from the TWL data sheet.   

Not knowing much about how includes work in DT, would it then be
possible for board files to override things like default voltage ranges
for regulators?

Kevin

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

* Re: [PATCH v2 07/10] arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
  2011-12-14  5:06     ` Kevin Hilman
@ 2011-12-14 16:50       ` Cousson, Benoit
  -1 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2011-12-14 16:50 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: tony, rob.herring, devicetree-discuss, grant.likely, linux-omap,
	linux-arm-kernel

Hi Kevin,

On 12/14/2011 6:06 AM, Kevin Hilman wrote:
> Hi Benoit,
>
> Benoit Cousson<b-cousson@ti.com>  writes:
>
>> 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.
>>
>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>> Cc: Grant Likely<grant.likely@secretlab.ca>
>> ---
>>   arch/arm/boot/dts/omap4-panda.dts |   45 +++++++++++++++++++++++++++++++++++++
>>   1 files changed, 45 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
>> index 9755ad5..b66bcd6 100644
>> --- a/arch/arm/boot/dts/omap4-panda.dts
>> +++ b/arch/arm/boot/dts/omap4-panda.dts
>> @@ -18,3 +18,48 @@
>>   		reg =<0x80000000 0x40000000>; /* 1 GB */
>>   	};
>>   };
>> +
>> +&i2c1 {
>> +	clock-frequency =<400000>;
>> +
>> +	/*
>> +	 * Integrated Power Management Chip
>> +	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
>> +	 */
>> +	twl@48 {
>> +		compatible = "ti,twl6030";
>> +		reg =<0x48>;
>> +		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
>> +		interrupts =<0 7 4>; /* IRQ_SYS_1N cascaded to gic */
>> +		interrupt-controller;
>> +		#interrupt-cells =<1>;
>> +		interrupt-parent =<&gic>;
>> +
>> +		/* twl is a MFD, so it will contain a bunch of sub-ips */
>> +		rtc {
>> +			compatible = "ti,twl4030-rtc";
>> +			interrupts =<11>;
>> +		};
>
> After seeing the mostly cut&  paste in Rajendra's regulator series, I'm
> wondering if it wouldn't be better to just have a twl4030.dtsi here
> which has the RTC and all the regulators with the default voltage ranges
> from the TWL data sheet.

Yes, indeed, it is still small here but will become much bigger with the 
regulators.
In fact twl6030 is a SoC like OMAP, so all the TWL specific internal 
details can be located in a single file.
The board will just have to provide the i2c address and the IRQ information.

> Not knowing much about how includes work in DT, would it then be
> possible for board files to override things like default voltage ranges
> for regulators?

To be honest, I was wondering as well how to do that with the /include/ 
functionality :-)
But I've just done a couple of DTC test, and this seems to be pretty 
straightforward.

The boards will contain that:
&i2c1 {
	clock-frequency = <400000>;

	twl: twl@48 {
		reg = <0x48>;
		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
		interrupt-controller;
		interrupt-parent = <&gic>;
	};
};

/include/ "twl6030.dtsi"

...

And the twl6030.dtsi will contain that for the moment:

/*
  * Integrated Power Management Chip
  * http://www.ti.com/lit/ds/symlink/twl6030.pdf
  */
&twl {
	compatible = "ti,twl6030";
	#interrupt-cells = <1>;

	/* twl is a MFD, so it will contain a bunch of sub-ips */
	rtc {
		compatible = "ti,twl4030-rtc";
		interrupts = <11>;
	};
};

And then all the regulators from Rajendra's series will be there as well.

This will avoid the duplication between sdp and panda. Beagle will need 
a twl4030.dtsi which is different than the twl6030.

I'll update and repost the series soon.

Thanks,
Benoit

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

* [PATCH v2 07/10] arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
@ 2011-12-14 16:50       ` Cousson, Benoit
  0 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2011-12-14 16:50 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kevin,

On 12/14/2011 6:06 AM, Kevin Hilman wrote:
> Hi Benoit,
>
> Benoit Cousson<b-cousson@ti.com>  writes:
>
>> 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.
>>
>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>> Cc: Grant Likely<grant.likely@secretlab.ca>
>> ---
>>   arch/arm/boot/dts/omap4-panda.dts |   45 +++++++++++++++++++++++++++++++++++++
>>   1 files changed, 45 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
>> index 9755ad5..b66bcd6 100644
>> --- a/arch/arm/boot/dts/omap4-panda.dts
>> +++ b/arch/arm/boot/dts/omap4-panda.dts
>> @@ -18,3 +18,48 @@
>>   		reg =<0x80000000 0x40000000>; /* 1 GB */
>>   	};
>>   };
>> +
>> +&i2c1 {
>> +	clock-frequency =<400000>;
>> +
>> +	/*
>> +	 * Integrated Power Management Chip
>> +	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
>> +	 */
>> +	twl at 48 {
>> +		compatible = "ti,twl6030";
>> +		reg =<0x48>;
>> +		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
>> +		interrupts =<0 7 4>; /* IRQ_SYS_1N cascaded to gic */
>> +		interrupt-controller;
>> +		#interrupt-cells =<1>;
>> +		interrupt-parent =<&gic>;
>> +
>> +		/* twl is a MFD, so it will contain a bunch of sub-ips */
>> +		rtc {
>> +			compatible = "ti,twl4030-rtc";
>> +			interrupts =<11>;
>> +		};
>
> After seeing the mostly cut&  paste in Rajendra's regulator series, I'm
> wondering if it wouldn't be better to just have a twl4030.dtsi here
> which has the RTC and all the regulators with the default voltage ranges
> from the TWL data sheet.

Yes, indeed, it is still small here but will become much bigger with the 
regulators.
In fact twl6030 is a SoC like OMAP, so all the TWL specific internal 
details can be located in a single file.
The board will just have to provide the i2c address and the IRQ information.

> Not knowing much about how includes work in DT, would it then be
> possible for board files to override things like default voltage ranges
> for regulators?

To be honest, I was wondering as well how to do that with the /include/ 
functionality :-)
But I've just done a couple of DTC test, and this seems to be pretty 
straightforward.

The boards will contain that:
&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-controller;
		interrupt-parent = <&gic>;
	};
};

/include/ "twl6030.dtsi"

...

And the twl6030.dtsi will contain that for the moment:

/*
  * Integrated Power Management Chip
  * http://www.ti.com/lit/ds/symlink/twl6030.pdf
  */
&twl {
	compatible = "ti,twl6030";
	#interrupt-cells = <1>;

	/* twl is a MFD, so it will contain a bunch of sub-ips */
	rtc {
		compatible = "ti,twl4030-rtc";
		interrupts = <11>;
	};
};

And then all the regulators from Rajendra's series will be there as well.

This will avoid the duplication between sdp and panda. Beagle will need 
a twl4030.dtsi which is different than the twl6030.

I'll update and repost the series soon.

Thanks,
Benoit

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

* Re: [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
  2011-12-09 14:02   ` Benoit Cousson
@ 2011-12-14 16:58     ` Rob Herring
  -1 siblings, 0 replies; 82+ messages in thread
From: Rob Herring @ 2011-12-14 16:58 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: tony, devicetree-discuss, grant.likely, linux-omap,
	linux-arm-kernel, Ben Dooks

Benoit,

On 12/09/2011 08:02 AM, Benoit Cousson wrote:
> 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.
> 
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Ben Dooks <ben-linux@fluff.org>
> ---
>  Documentation/devicetree/bindings/i2c/omap-i2c.txt |   42 ++++++++
>  drivers/i2c/busses/i2c-omap.c                      |  100 +++++++++++++-------
>  2 files changed, 107 insertions(+), 35 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
> 
> diff --git a/Documentation/devicetree/bindings/i2c/omap-i2c.txt b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
> new file mode 100644
> index 0000000..d259a17
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
> @@ -0,0 +1,42 @@
> +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
> +- ti,flags : u32: settings or errata relative to the i2c
> +    0x1:   OMAP_I2C_FLAG_NO_FIFO
> +    0x2:   OMAP_I2C_FLAG_SIMPLE_CLOCK
> +    0x4:   OMAP_I2C_FLAG_16BIT_DATA_REG
> +    0x8:   OMAP_I2C_FLAG_RESET_REGS_POSTIDLE
> +    0x10:  OMAP_I2C_FLAG_APPLY_ERRATA_I207
> +    0x20:  OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK
> +    0x40:  OMAP_I2C_FLAG_FORCE_19200_INT_CLK
> +  Valid for ti,omap3-i2c only:
> +    0x80:  OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers
> +    0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registers

It's generally preferred to split these out to separate properties since
there is not yet define capability in dts. Can some of these be removed
by having more specific compatible strings? That is the whole point in
having compatible strings not be generic. omap4-i2c and omap3-i2c is
still kind of generic.

> +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@0 {
> +    compatible = "ti,omap3-i2c";
> +    #address-cells = <1>;
> +    #size-cells = <0>;
> +    ti,hwmods = "i2c1";
> +    clock-frequency = <400000>;
> +    ti,flags = <0x118>;
> +};
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index a43d002..b4a8eee 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -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>
> @@ -182,7 +184,9 @@ struct omap_i2c_dev {
>  	u32			latency;	/* maximum mpu wkup latency */
>  	void			(*set_mpu_wkup_lat)(struct device *dev,
>  						    long latency);
> -	u32			speed;		/* Speed of bus in Khz */
> +	u32			speed;		/* Speed of bus in kHz */
> +	u32			dtrev;		/* extra revision from DT */
> +	u32			flags;
>  	u16			cmd_err;
>  	u8			*buf;
>  	u8			*regs;
> @@ -266,11 +270,7 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
>  
>  static void omap_i2c_unidle(struct omap_i2c_dev *dev)
>  {
> -	struct omap_i2c_bus_platform_data *pdata;
> -
> -	pdata = dev->dev->platform_data;
> -
> -	if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
> +	if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
>  		omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
>  		omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, dev->pscstate);
>  		omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, dev->scllstate);
> @@ -291,13 +291,10 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev)
>  
>  static void omap_i2c_idle(struct omap_i2c_dev *dev)
>  {
> -	struct omap_i2c_bus_platform_data *pdata;
>  	u16 iv;
>  
> -	pdata = dev->dev->platform_data;
> -
>  	dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
> -	if (pdata->rev == OMAP_I2C_IP_VERSION_2)
> +	if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
>  		omap_i2c_write_reg(dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
>  	else
>  		omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
> @@ -320,9 +317,6 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  	unsigned long timeout;
>  	unsigned long internal_clk = 0;
>  	struct clk *fclk;
> -	struct omap_i2c_bus_platform_data *pdata;
> -
> -	pdata = dev->dev->platform_data;
>  
>  	if (dev->rev >= OMAP_I2C_OMAP1_REV_2) {
>  		/* Disable I2C controller before soft reset */
> @@ -373,7 +367,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  	}
>  	omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
>  
> -	if (pdata->flags & OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK) {
> +	if (dev->flags & OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK) {
>  		/*
>  		 * The I2C functional clock is the armxor_ck, so there's
>  		 * no need to get "armxor_ck" separately.  Now, if OMAP2420
> @@ -397,7 +391,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  			psc = fclk_rate / 12000000;
>  	}
>  
> -	if (!(pdata->flags & OMAP_I2C_FLAG_SIMPLE_CLOCK)) {
> +	if (!(dev->flags & OMAP_I2C_FLAG_SIMPLE_CLOCK)) {
>  
>  		/*
>  		 * HSI2C controller internal clk rate should be 19.2 Mhz for
> @@ -406,7 +400,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  		 * The filter is iclk (fclk for HS) period.
>  		 */
>  		if (dev->speed > 400 ||
> -			       pdata->flags & OMAP_I2C_FLAG_FORCE_19200_INT_CLK)
> +			       dev->flags & OMAP_I2C_FLAG_FORCE_19200_INT_CLK)
>  			internal_clk = 19200;
>  		else if (dev->speed > 100)
>  			internal_clk = 9600;
> @@ -475,7 +469,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  
>  	dev->errata = 0;
>  
> -	if (pdata->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
> +	if (dev->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
>  		dev->errata |= I2C_OMAP_ERRATA_I207;
>  
>  	/* Enable interrupts */
> @@ -484,7 +478,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  			OMAP_I2C_IE_AL)  | ((dev->fifo_size) ?
>  				(OMAP_I2C_IE_RDR | OMAP_I2C_IE_XDR) : 0);
>  	omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
> -	if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
> +	if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
>  		dev->pscstate = psc;
>  		dev->scllstate = scll;
>  		dev->sclhstate = sclh;
> @@ -804,9 +798,6 @@ omap_i2c_isr(int this_irq, void *dev_id)
>  	u16 bits;
>  	u16 stat, w;
>  	int err, count = 0;
> -	struct omap_i2c_bus_platform_data *pdata;
> -
> -	pdata = dev->dev->platform_data;
>  
>  	if (pm_runtime_suspended(dev->dev))
>  		return IRQ_NONE;
> @@ -875,7 +866,7 @@ complete:
>  					 * Data reg in 2430, omap3 and
>  					 * omap4 is 8 bit wide
>  					 */
> -					if (pdata->flags &
> +					if (dev->flags &
>  						 OMAP_I2C_FLAG_16BIT_DATA_REG) {
>  						if (dev->buf_len) {
>  							*dev->buf++ = w >> 8;
> @@ -918,7 +909,7 @@ complete:
>  					 * Data reg in 2430, omap3 and
>  					 * omap4 is 8 bit wide
>  					 */
> -					if (pdata->flags &
> +					if (dev->flags &
>  						 OMAP_I2C_FLAG_16BIT_DATA_REG) {
>  						if (dev->buf_len) {
>  							w |= *dev->buf++ << 8;
> @@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = {
>  	.functionality	= omap_i2c_func,
>  };
>  
> +#ifdef CONFIG_OF
> +static struct omap_i2c_bus_platform_data omap3_pdata = {
> +	.rev = OMAP_I2C_IP_VERSION_1,
> +};
> +
> +static struct omap_i2c_bus_platform_data omap4_pdata = {
> +	.rev = OMAP_I2C_IP_VERSION_2,
> +};

This is redundant. The ip version can be determined from the compatible
string.

> +
> +static const struct of_device_id omap_i2c_of_match[] = {
> +	{
> +		.compatible = "ti,omap4-i2c",
> +		.data = &omap4_pdata,
> +	},
> +	{
> +		.compatible = "ti,omap3-i2c",
> +		.data = &omap3_pdata,
> +	},
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
> +#else
> +#define omap_i2c_of_match NULL

Use of_match_ptr instead of the #else.

> +#endif
> +
>  static int __devinit
>  omap_i2c_probe(struct platform_device *pdev)
>  {
> @@ -972,9 +988,10 @@ omap_i2c_probe(struct platform_device *pdev)
>  	struct i2c_adapter	*adap;
>  	struct resource		*mem, *irq, *ioarea;
>  	struct omap_i2c_bus_platform_data *pdata = pdev->dev.platform_data;
> +	struct device_node	*node = pdev->dev.of_node;
> +	const struct of_device_id *match;
>  	irq_handler_t isr;
>  	int r;
> -	u32 speed = 0;
>  
>  	/* NOTE: driver uses the static register mapping */
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -1001,15 +1018,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;
> +
> +		of_property_read_u32(node, "clock-frequency", &freq);
> +		/* convert DT freq value in Hz into kHz for speed */
> +		dev->speed = freq / 1000;
> +		of_property_read_u32(node, "ti,flags", &dev->flags);
> +		dev->dtrev = pdata->rev;
> +
> +	} 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;
>  	}
>  
> -	dev->speed = speed;
>  	dev->dev = &pdev->dev;
>  	dev->irq = irq->start;
>  	dev->base = ioremap(mem->start, resource_size(mem));
> @@ -1020,9 +1046,9 @@ omap_i2c_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, dev);
>  
> -	dev->reg_shift = (pdata->flags >> OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
> +	dev->reg_shift = (dev->flags >> OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
>  
> -	if (pdata->rev == OMAP_I2C_IP_VERSION_2)
> +	if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
>  		dev->regs = (u8 *)reg_map_ip_v2;
>  	else
>  		dev->regs = (u8 *)reg_map_ip_v1;
> @@ -1035,7 +1061,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  	if (dev->rev <= OMAP_I2C_REV_ON_3430)
>  		dev->errata |= I2C_OMAP3_1P153;
>  
> -	if (!(pdata->flags & OMAP_I2C_FLAG_NO_FIFO)) {
> +	if (!(dev->flags & OMAP_I2C_FLAG_NO_FIFO)) {
>  		u16 s;
>  
>  		/* Set up the fifo size - Get total size */
> @@ -1057,7 +1083,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  		/* calculate wakeup latency constraint for MPU */
>  		if (dev->set_mpu_wkup_lat != NULL)
>  			dev->latency = (1000000 * dev->fifo_size) /
> -				       (1000 * speed / 8);
> +				       (1000 * dev->speed / 8);
>  	}
>  
>  	/* reset ASAP, clearing any IRQs */
> @@ -1073,7 +1099,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  	}
>  
>  	dev_info(dev->dev, "bus %d rev%d.%d.%d at %d kHz\n", pdev->id,
> -		 pdata->rev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
> +		 dev->dtrev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
>  
>  	pm_runtime_put(dev->dev);
>  
> @@ -1084,6 +1110,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  	strlcpy(adap->name, "OMAP I2C adapter", sizeof(adap->name));
>  	adap->algo = &omap_i2c_algo;
>  	adap->dev.parent = &pdev->dev;
> +	adap->dev.of_node = pdev->dev.of_node;
>  
>  	/* i2c device drivers may be active on return from add_adapter() */
>  	adap->nr = pdev->id;
> @@ -1093,6 +1120,8 @@ omap_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> +	of_i2c_register_devices(adap);
> +
>  	return 0;
>  
>  err_free_irq:
> @@ -1165,6 +1194,7 @@ static struct platform_driver omap_i2c_driver = {
>  		.name	= "omap_i2c",
>  		.owner	= THIS_MODULE,
>  		.pm	= OMAP_I2C_PM_OPS,
> +		.of_match_table = omap_i2c_of_match,
>  	},
>  };
>  

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

* [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
@ 2011-12-14 16:58     ` Rob Herring
  0 siblings, 0 replies; 82+ messages in thread
From: Rob Herring @ 2011-12-14 16:58 UTC (permalink / raw)
  To: linux-arm-kernel

Benoit,

On 12/09/2011 08:02 AM, Benoit Cousson wrote:
> 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.
> 
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Ben Dooks <ben-linux@fluff.org>
> ---
>  Documentation/devicetree/bindings/i2c/omap-i2c.txt |   42 ++++++++
>  drivers/i2c/busses/i2c-omap.c                      |  100 +++++++++++++-------
>  2 files changed, 107 insertions(+), 35 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
> 
> diff --git a/Documentation/devicetree/bindings/i2c/omap-i2c.txt b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
> new file mode 100644
> index 0000000..d259a17
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
> @@ -0,0 +1,42 @@
> +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
> +- ti,flags : u32: settings or errata relative to the i2c
> +    0x1:   OMAP_I2C_FLAG_NO_FIFO
> +    0x2:   OMAP_I2C_FLAG_SIMPLE_CLOCK
> +    0x4:   OMAP_I2C_FLAG_16BIT_DATA_REG
> +    0x8:   OMAP_I2C_FLAG_RESET_REGS_POSTIDLE
> +    0x10:  OMAP_I2C_FLAG_APPLY_ERRATA_I207
> +    0x20:  OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK
> +    0x40:  OMAP_I2C_FLAG_FORCE_19200_INT_CLK
> +  Valid for ti,omap3-i2c only:
> +    0x80:  OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers
> +    0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registers

It's generally preferred to split these out to separate properties since
there is not yet define capability in dts. Can some of these be removed
by having more specific compatible strings? That is the whole point in
having compatible strings not be generic. omap4-i2c and omap3-i2c is
still kind of generic.

> +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>;
> +    ti,flags = <0x118>;
> +};
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index a43d002..b4a8eee 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -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>
> @@ -182,7 +184,9 @@ struct omap_i2c_dev {
>  	u32			latency;	/* maximum mpu wkup latency */
>  	void			(*set_mpu_wkup_lat)(struct device *dev,
>  						    long latency);
> -	u32			speed;		/* Speed of bus in Khz */
> +	u32			speed;		/* Speed of bus in kHz */
> +	u32			dtrev;		/* extra revision from DT */
> +	u32			flags;
>  	u16			cmd_err;
>  	u8			*buf;
>  	u8			*regs;
> @@ -266,11 +270,7 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
>  
>  static void omap_i2c_unidle(struct omap_i2c_dev *dev)
>  {
> -	struct omap_i2c_bus_platform_data *pdata;
> -
> -	pdata = dev->dev->platform_data;
> -
> -	if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
> +	if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
>  		omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
>  		omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, dev->pscstate);
>  		omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, dev->scllstate);
> @@ -291,13 +291,10 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev)
>  
>  static void omap_i2c_idle(struct omap_i2c_dev *dev)
>  {
> -	struct omap_i2c_bus_platform_data *pdata;
>  	u16 iv;
>  
> -	pdata = dev->dev->platform_data;
> -
>  	dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
> -	if (pdata->rev == OMAP_I2C_IP_VERSION_2)
> +	if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
>  		omap_i2c_write_reg(dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
>  	else
>  		omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
> @@ -320,9 +317,6 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  	unsigned long timeout;
>  	unsigned long internal_clk = 0;
>  	struct clk *fclk;
> -	struct omap_i2c_bus_platform_data *pdata;
> -
> -	pdata = dev->dev->platform_data;
>  
>  	if (dev->rev >= OMAP_I2C_OMAP1_REV_2) {
>  		/* Disable I2C controller before soft reset */
> @@ -373,7 +367,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  	}
>  	omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
>  
> -	if (pdata->flags & OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK) {
> +	if (dev->flags & OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK) {
>  		/*
>  		 * The I2C functional clock is the armxor_ck, so there's
>  		 * no need to get "armxor_ck" separately.  Now, if OMAP2420
> @@ -397,7 +391,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  			psc = fclk_rate / 12000000;
>  	}
>  
> -	if (!(pdata->flags & OMAP_I2C_FLAG_SIMPLE_CLOCK)) {
> +	if (!(dev->flags & OMAP_I2C_FLAG_SIMPLE_CLOCK)) {
>  
>  		/*
>  		 * HSI2C controller internal clk rate should be 19.2 Mhz for
> @@ -406,7 +400,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  		 * The filter is iclk (fclk for HS) period.
>  		 */
>  		if (dev->speed > 400 ||
> -			       pdata->flags & OMAP_I2C_FLAG_FORCE_19200_INT_CLK)
> +			       dev->flags & OMAP_I2C_FLAG_FORCE_19200_INT_CLK)
>  			internal_clk = 19200;
>  		else if (dev->speed > 100)
>  			internal_clk = 9600;
> @@ -475,7 +469,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  
>  	dev->errata = 0;
>  
> -	if (pdata->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
> +	if (dev->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
>  		dev->errata |= I2C_OMAP_ERRATA_I207;
>  
>  	/* Enable interrupts */
> @@ -484,7 +478,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  			OMAP_I2C_IE_AL)  | ((dev->fifo_size) ?
>  				(OMAP_I2C_IE_RDR | OMAP_I2C_IE_XDR) : 0);
>  	omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
> -	if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
> +	if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
>  		dev->pscstate = psc;
>  		dev->scllstate = scll;
>  		dev->sclhstate = sclh;
> @@ -804,9 +798,6 @@ omap_i2c_isr(int this_irq, void *dev_id)
>  	u16 bits;
>  	u16 stat, w;
>  	int err, count = 0;
> -	struct omap_i2c_bus_platform_data *pdata;
> -
> -	pdata = dev->dev->platform_data;
>  
>  	if (pm_runtime_suspended(dev->dev))
>  		return IRQ_NONE;
> @@ -875,7 +866,7 @@ complete:
>  					 * Data reg in 2430, omap3 and
>  					 * omap4 is 8 bit wide
>  					 */
> -					if (pdata->flags &
> +					if (dev->flags &
>  						 OMAP_I2C_FLAG_16BIT_DATA_REG) {
>  						if (dev->buf_len) {
>  							*dev->buf++ = w >> 8;
> @@ -918,7 +909,7 @@ complete:
>  					 * Data reg in 2430, omap3 and
>  					 * omap4 is 8 bit wide
>  					 */
> -					if (pdata->flags &
> +					if (dev->flags &
>  						 OMAP_I2C_FLAG_16BIT_DATA_REG) {
>  						if (dev->buf_len) {
>  							w |= *dev->buf++ << 8;
> @@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = {
>  	.functionality	= omap_i2c_func,
>  };
>  
> +#ifdef CONFIG_OF
> +static struct omap_i2c_bus_platform_data omap3_pdata = {
> +	.rev = OMAP_I2C_IP_VERSION_1,
> +};
> +
> +static struct omap_i2c_bus_platform_data omap4_pdata = {
> +	.rev = OMAP_I2C_IP_VERSION_2,
> +};

This is redundant. The ip version can be determined from the compatible
string.

> +
> +static const struct of_device_id omap_i2c_of_match[] = {
> +	{
> +		.compatible = "ti,omap4-i2c",
> +		.data = &omap4_pdata,
> +	},
> +	{
> +		.compatible = "ti,omap3-i2c",
> +		.data = &omap3_pdata,
> +	},
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
> +#else
> +#define omap_i2c_of_match NULL

Use of_match_ptr instead of the #else.

> +#endif
> +
>  static int __devinit
>  omap_i2c_probe(struct platform_device *pdev)
>  {
> @@ -972,9 +988,10 @@ omap_i2c_probe(struct platform_device *pdev)
>  	struct i2c_adapter	*adap;
>  	struct resource		*mem, *irq, *ioarea;
>  	struct omap_i2c_bus_platform_data *pdata = pdev->dev.platform_data;
> +	struct device_node	*node = pdev->dev.of_node;
> +	const struct of_device_id *match;
>  	irq_handler_t isr;
>  	int r;
> -	u32 speed = 0;
>  
>  	/* NOTE: driver uses the static register mapping */
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -1001,15 +1018,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;
> +
> +		of_property_read_u32(node, "clock-frequency", &freq);
> +		/* convert DT freq value in Hz into kHz for speed */
> +		dev->speed = freq / 1000;
> +		of_property_read_u32(node, "ti,flags", &dev->flags);
> +		dev->dtrev = pdata->rev;
> +
> +	} 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;
>  	}
>  
> -	dev->speed = speed;
>  	dev->dev = &pdev->dev;
>  	dev->irq = irq->start;
>  	dev->base = ioremap(mem->start, resource_size(mem));
> @@ -1020,9 +1046,9 @@ omap_i2c_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, dev);
>  
> -	dev->reg_shift = (pdata->flags >> OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
> +	dev->reg_shift = (dev->flags >> OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
>  
> -	if (pdata->rev == OMAP_I2C_IP_VERSION_2)
> +	if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
>  		dev->regs = (u8 *)reg_map_ip_v2;
>  	else
>  		dev->regs = (u8 *)reg_map_ip_v1;
> @@ -1035,7 +1061,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  	if (dev->rev <= OMAP_I2C_REV_ON_3430)
>  		dev->errata |= I2C_OMAP3_1P153;
>  
> -	if (!(pdata->flags & OMAP_I2C_FLAG_NO_FIFO)) {
> +	if (!(dev->flags & OMAP_I2C_FLAG_NO_FIFO)) {
>  		u16 s;
>  
>  		/* Set up the fifo size - Get total size */
> @@ -1057,7 +1083,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  		/* calculate wakeup latency constraint for MPU */
>  		if (dev->set_mpu_wkup_lat != NULL)
>  			dev->latency = (1000000 * dev->fifo_size) /
> -				       (1000 * speed / 8);
> +				       (1000 * dev->speed / 8);
>  	}
>  
>  	/* reset ASAP, clearing any IRQs */
> @@ -1073,7 +1099,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  	}
>  
>  	dev_info(dev->dev, "bus %d rev%d.%d.%d at %d kHz\n", pdev->id,
> -		 pdata->rev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
> +		 dev->dtrev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
>  
>  	pm_runtime_put(dev->dev);
>  
> @@ -1084,6 +1110,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  	strlcpy(adap->name, "OMAP I2C adapter", sizeof(adap->name));
>  	adap->algo = &omap_i2c_algo;
>  	adap->dev.parent = &pdev->dev;
> +	adap->dev.of_node = pdev->dev.of_node;
>  
>  	/* i2c device drivers may be active on return from add_adapter() */
>  	adap->nr = pdev->id;
> @@ -1093,6 +1120,8 @@ omap_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> +	of_i2c_register_devices(adap);
> +
>  	return 0;
>  
>  err_free_irq:
> @@ -1165,6 +1194,7 @@ static struct platform_driver omap_i2c_driver = {
>  		.name	= "omap_i2c",
>  		.owner	= THIS_MODULE,
>  		.pm	= OMAP_I2C_PM_OPS,
> +		.of_match_table = omap_i2c_of_match,
>  	},
>  };
>  

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

* Re: [PATCH v2 07/10] arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
  2011-12-14 16:50       ` Cousson, Benoit
@ 2011-12-15  0:31         ` Kevin Hilman
  -1 siblings, 0 replies; 82+ messages in thread
From: Kevin Hilman @ 2011-12-15  0:31 UTC (permalink / raw)
  To: Cousson, Benoit
  Cc: tony, devicetree-discuss, rob.herring, linux-omap, linux-arm-kernel

"Cousson, Benoit" <b-cousson@ti.com> writes:

> Hi Kevin,
>
> On 12/14/2011 6:06 AM, Kevin Hilman wrote:
>> Hi Benoit,
>>
>> Benoit Cousson<b-cousson@ti.com>  writes:
>>
>>> 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.
>>>
>>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>>> Cc: Grant Likely<grant.likely@secretlab.ca>
>>> ---
>>>   arch/arm/boot/dts/omap4-panda.dts |   45 +++++++++++++++++++++++++++++++++++++
>>>   1 files changed, 45 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
>>> index 9755ad5..b66bcd6 100644
>>> --- a/arch/arm/boot/dts/omap4-panda.dts
>>> +++ b/arch/arm/boot/dts/omap4-panda.dts
>>> @@ -18,3 +18,48 @@
>>>   		reg =<0x80000000 0x40000000>; /* 1 GB */
>>>   	};
>>>   };
>>> +
>>> +&i2c1 {
>>> +	clock-frequency =<400000>;
>>> +
>>> +	/*
>>> +	 * Integrated Power Management Chip
>>> +	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
>>> +	 */
>>> +	twl@48 {
>>> +		compatible = "ti,twl6030";
>>> +		reg =<0x48>;
>>> +		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
>>> +		interrupts =<0 7 4>; /* IRQ_SYS_1N cascaded to gic */
>>> +		interrupt-controller;
>>> +		#interrupt-cells =<1>;
>>> +		interrupt-parent =<&gic>;
>>> +
>>> +		/* twl is a MFD, so it will contain a bunch of sub-ips */
>>> +		rtc {
>>> +			compatible = "ti,twl4030-rtc";
>>> +			interrupts =<11>;
>>> +		};
>>
>> After seeing the mostly cut&  paste in Rajendra's regulator series, I'm
>> wondering if it wouldn't be better to just have a twl4030.dtsi here
>> which has the RTC and all the regulators with the default voltage ranges
>> from the TWL data sheet.
>
> Yes, indeed, it is still small here but will become much bigger with
> the regulators.
> In fact twl6030 is a SoC like OMAP, so all the TWL specific internal
> details can be located in a single file.
> The board will just have to provide the i2c address and the IRQ information.
>
>> Not knowing much about how includes work in DT, would it then be
>> possible for board files to override things like default voltage ranges
>> for regulators?
>
> To be honest, I was wondering as well how to do that with the
> /include/ functionality :-)
> But I've just done a couple of DTC test, and this seems to be pretty
> straightforward.
>
> The boards will contain that:
> &i2c1 {
> 	clock-frequency = <400000>;
>
> 	twl: twl@48 {
> 		reg = <0x48>;
> 		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
> 		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
> 		interrupt-controller;
> 		interrupt-parent = <&gic>;
> 	};
> };
>
> /include/ "twl6030.dtsi"
>

Nice.

> ...
>
> And the twl6030.dtsi will contain that for the moment:
>
> /*
>  * Integrated Power Management Chip
>  * http://www.ti.com/lit/ds/symlink/twl6030.pdf
>  */
> &twl {
> 	compatible = "ti,twl6030";
> 	#interrupt-cells = <1>;
>
> 	/* twl is a MFD, so it will contain a bunch of sub-ips */
> 	rtc {
> 		compatible = "ti,twl4030-rtc";
> 		interrupts = <11>;
> 	};
> };
>
> And then all the regulators from Rajendra's series will be there as well.
>
> This will avoid the duplication between sdp and panda. Beagle will
> need a twl4030.dtsi which is different than the twl6030.

Great!

> I'll update and repost the series soon.

Thanks,

Kevin

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

* [PATCH v2 07/10] arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
@ 2011-12-15  0:31         ` Kevin Hilman
  0 siblings, 0 replies; 82+ messages in thread
From: Kevin Hilman @ 2011-12-15  0:31 UTC (permalink / raw)
  To: linux-arm-kernel

"Cousson, Benoit" <b-cousson@ti.com> writes:

> Hi Kevin,
>
> On 12/14/2011 6:06 AM, Kevin Hilman wrote:
>> Hi Benoit,
>>
>> Benoit Cousson<b-cousson@ti.com>  writes:
>>
>>> 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.
>>>
>>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>>> Cc: Grant Likely<grant.likely@secretlab.ca>
>>> ---
>>>   arch/arm/boot/dts/omap4-panda.dts |   45 +++++++++++++++++++++++++++++++++++++
>>>   1 files changed, 45 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
>>> index 9755ad5..b66bcd6 100644
>>> --- a/arch/arm/boot/dts/omap4-panda.dts
>>> +++ b/arch/arm/boot/dts/omap4-panda.dts
>>> @@ -18,3 +18,48 @@
>>>   		reg =<0x80000000 0x40000000>; /* 1 GB */
>>>   	};
>>>   };
>>> +
>>> +&i2c1 {
>>> +	clock-frequency =<400000>;
>>> +
>>> +	/*
>>> +	 * Integrated Power Management Chip
>>> +	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
>>> +	 */
>>> +	twl at 48 {
>>> +		compatible = "ti,twl6030";
>>> +		reg =<0x48>;
>>> +		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
>>> +		interrupts =<0 7 4>; /* IRQ_SYS_1N cascaded to gic */
>>> +		interrupt-controller;
>>> +		#interrupt-cells =<1>;
>>> +		interrupt-parent =<&gic>;
>>> +
>>> +		/* twl is a MFD, so it will contain a bunch of sub-ips */
>>> +		rtc {
>>> +			compatible = "ti,twl4030-rtc";
>>> +			interrupts =<11>;
>>> +		};
>>
>> After seeing the mostly cut&  paste in Rajendra's regulator series, I'm
>> wondering if it wouldn't be better to just have a twl4030.dtsi here
>> which has the RTC and all the regulators with the default voltage ranges
>> from the TWL data sheet.
>
> Yes, indeed, it is still small here but will become much bigger with
> the regulators.
> In fact twl6030 is a SoC like OMAP, so all the TWL specific internal
> details can be located in a single file.
> The board will just have to provide the i2c address and the IRQ information.
>
>> Not knowing much about how includes work in DT, would it then be
>> possible for board files to override things like default voltage ranges
>> for regulators?
>
> To be honest, I was wondering as well how to do that with the
> /include/ functionality :-)
> But I've just done a couple of DTC test, and this seems to be pretty
> straightforward.
>
> The boards will contain that:
> &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-controller;
> 		interrupt-parent = <&gic>;
> 	};
> };
>
> /include/ "twl6030.dtsi"
>

Nice.

> ...
>
> And the twl6030.dtsi will contain that for the moment:
>
> /*
>  * Integrated Power Management Chip
>  * http://www.ti.com/lit/ds/symlink/twl6030.pdf
>  */
> &twl {
> 	compatible = "ti,twl6030";
> 	#interrupt-cells = <1>;
>
> 	/* twl is a MFD, so it will contain a bunch of sub-ips */
> 	rtc {
> 		compatible = "ti,twl4030-rtc";
> 		interrupts = <11>;
> 	};
> };
>
> And then all the regulators from Rajendra's series will be there as well.
>
> This will avoid the duplication between sdp and panda. Beagle will
> need a twl4030.dtsi which is different than the twl6030.

Great!

> I'll update and repost the series soon.

Thanks,

Kevin

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

* Re: [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
  2011-12-14 16:58     ` Rob Herring
@ 2011-12-15 15:05       ` Cousson, Benoit
  -1 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2011-12-15 15:05 UTC (permalink / raw)
  To: Rob Herring
  Cc: tony, devicetree-discuss, grant.likely, linux-omap,
	linux-arm-kernel, Ben Dooks

Hi Rob,

On 12/14/2011 5:58 PM, Rob Herring wrote:
> Benoit,
>
> On 12/09/2011 08:02 AM, Benoit Cousson wrote:
>> 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.
>>
>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>> Cc: Ben Dooks<ben-linux@fluff.org>
>> ---
>>   Documentation/devicetree/bindings/i2c/omap-i2c.txt |   42 ++++++++
>>   drivers/i2c/busses/i2c-omap.c                      |  100 +++++++++++++-------
>>   2 files changed, 107 insertions(+), 35 deletions(-)
>>   create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/omap-i2c.txt b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
>> new file mode 100644
>> index 0000000..d259a17
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
>> @@ -0,0 +1,42 @@
>> +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
>> +- ti,flags : u32: settings or errata relative to the i2c
>> +    0x1:   OMAP_I2C_FLAG_NO_FIFO
>> +    0x2:   OMAP_I2C_FLAG_SIMPLE_CLOCK
>> +    0x4:   OMAP_I2C_FLAG_16BIT_DATA_REG
>> +    0x8:   OMAP_I2C_FLAG_RESET_REGS_POSTIDLE
>> +    0x10:  OMAP_I2C_FLAG_APPLY_ERRATA_I207
>> +    0x20:  OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK
>> +    0x40:  OMAP_I2C_FLAG_FORCE_19200_INT_CLK
>> +  Valid for ti,omap3-i2c only:
>> +    0x80:  OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers
>> +    0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registers
>
> It's generally preferred to split these out to separate properties since
> there is not yet define capability in dts.

Yeah, I was hoping that Stephen's DTC patches were accepted to avoid that.

> Can some of these be removed
> by having more specific compatible strings? That is the whole point in
> having compatible strings not be generic. omap4-i2c and omap3-i2c is
> still kind of generic.

Do you mean creating some attributes like that:

+    ti,16bits_shift;
+    ti,reset_postidle;
+    ti,errata_i207;

Or using some omap3-i2c or omap4-i2c to determine the proper version and 
thus populate the right flags during probe.

[...]

>> @@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = {
>>   	.functionality	= omap_i2c_func,
>>   };
>>
>> +#ifdef CONFIG_OF
>> +static struct omap_i2c_bus_platform_data omap3_pdata = {
>> +	.rev = OMAP_I2C_IP_VERSION_1,
>> +};
>> +
>> +static struct omap_i2c_bus_platform_data omap4_pdata = {
>> +	.rev = OMAP_I2C_IP_VERSION_2,
>> +};
>
> This is redundant. The ip version can be determined from the compatible
> string.

I'm confused...
I'm using the compatible string below to chose the proper value.
This flag is then used later at runtime.
I'm using a pseudo pdata because that driver is still used in old 
platform that does and will never not have DT support.

>> +static const struct of_device_id omap_i2c_of_match[] = {
>> +	{
>> +		.compatible = "ti,omap4-i2c",
>> +		.data =&omap4_pdata,
>> +	},
>> +	{
>> +		.compatible = "ti,omap3-i2c",
>> +		.data =&omap3_pdata,
>> +	},
>> +	{ },
>> +};
>> +MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
>> +#else
>> +#define omap_i2c_of_match NULL
>
> Use of_match_ptr instead of the #else.

OK, good point.

Thanks,
Benoit

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

* [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
@ 2011-12-15 15:05       ` Cousson, Benoit
  0 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2011-12-15 15:05 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Rob,

On 12/14/2011 5:58 PM, Rob Herring wrote:
> Benoit,
>
> On 12/09/2011 08:02 AM, Benoit Cousson wrote:
>> 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.
>>
>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>> Cc: Ben Dooks<ben-linux@fluff.org>
>> ---
>>   Documentation/devicetree/bindings/i2c/omap-i2c.txt |   42 ++++++++
>>   drivers/i2c/busses/i2c-omap.c                      |  100 +++++++++++++-------
>>   2 files changed, 107 insertions(+), 35 deletions(-)
>>   create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/omap-i2c.txt b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
>> new file mode 100644
>> index 0000000..d259a17
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
>> @@ -0,0 +1,42 @@
>> +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
>> +- ti,flags : u32: settings or errata relative to the i2c
>> +    0x1:   OMAP_I2C_FLAG_NO_FIFO
>> +    0x2:   OMAP_I2C_FLAG_SIMPLE_CLOCK
>> +    0x4:   OMAP_I2C_FLAG_16BIT_DATA_REG
>> +    0x8:   OMAP_I2C_FLAG_RESET_REGS_POSTIDLE
>> +    0x10:  OMAP_I2C_FLAG_APPLY_ERRATA_I207
>> +    0x20:  OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK
>> +    0x40:  OMAP_I2C_FLAG_FORCE_19200_INT_CLK
>> +  Valid for ti,omap3-i2c only:
>> +    0x80:  OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers
>> +    0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registers
>
> It's generally preferred to split these out to separate properties since
> there is not yet define capability in dts.

Yeah, I was hoping that Stephen's DTC patches were accepted to avoid that.

> Can some of these be removed
> by having more specific compatible strings? That is the whole point in
> having compatible strings not be generic. omap4-i2c and omap3-i2c is
> still kind of generic.

Do you mean creating some attributes like that:

+    ti,16bits_shift;
+    ti,reset_postidle;
+    ti,errata_i207;

Or using some omap3-i2c or omap4-i2c to determine the proper version and 
thus populate the right flags during probe.

[...]

>> @@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = {
>>   	.functionality	= omap_i2c_func,
>>   };
>>
>> +#ifdef CONFIG_OF
>> +static struct omap_i2c_bus_platform_data omap3_pdata = {
>> +	.rev = OMAP_I2C_IP_VERSION_1,
>> +};
>> +
>> +static struct omap_i2c_bus_platform_data omap4_pdata = {
>> +	.rev = OMAP_I2C_IP_VERSION_2,
>> +};
>
> This is redundant. The ip version can be determined from the compatible
> string.

I'm confused...
I'm using the compatible string below to chose the proper value.
This flag is then used later at runtime.
I'm using a pseudo pdata because that driver is still used in old 
platform that does and will never not have DT support.

>> +static const struct of_device_id omap_i2c_of_match[] = {
>> +	{
>> +		.compatible = "ti,omap4-i2c",
>> +		.data =&omap4_pdata,
>> +	},
>> +	{
>> +		.compatible = "ti,omap3-i2c",
>> +		.data =&omap3_pdata,
>> +	},
>> +	{ },
>> +};
>> +MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
>> +#else
>> +#define omap_i2c_of_match NULL
>
> Use of_match_ptr instead of the #else.

OK, good point.

Thanks,
Benoit

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

* Re: [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
  2011-12-15 15:05       ` Cousson, Benoit
@ 2011-12-15 15:48         ` Rob Herring
  -1 siblings, 0 replies; 82+ messages in thread
From: Rob Herring @ 2011-12-15 15:48 UTC (permalink / raw)
  To: Cousson, Benoit
  Cc: tony, devicetree-discuss, grant.likely, linux-omap,
	linux-arm-kernel, Ben Dooks

On 12/15/2011 09:05 AM, Cousson, Benoit wrote:
> Hi Rob,
> 
> On 12/14/2011 5:58 PM, Rob Herring wrote:
>> Benoit,
>>
>> On 12/09/2011 08:02 AM, Benoit Cousson wrote:
>>> 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.
>>>
>>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>>> Cc: Ben Dooks<ben-linux@fluff.org>
>>> ---
>>>   Documentation/devicetree/bindings/i2c/omap-i2c.txt |   42 ++++++++
>>>   drivers/i2c/busses/i2c-omap.c                      |  100
>>> +++++++++++++-------
>>>   2 files changed, 107 insertions(+), 35 deletions(-)
>>>   create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/i2c/omap-i2c.txt
>>> b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
>>> new file mode 100644
>>> index 0000000..d259a17
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
>>> @@ -0,0 +1,42 @@
>>> +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
>>> +- ti,flags : u32: settings or errata relative to the i2c
>>> +    0x1:   OMAP_I2C_FLAG_NO_FIFO
>>> +    0x2:   OMAP_I2C_FLAG_SIMPLE_CLOCK
>>> +    0x4:   OMAP_I2C_FLAG_16BIT_DATA_REG
>>> +    0x8:   OMAP_I2C_FLAG_RESET_REGS_POSTIDLE
>>> +    0x10:  OMAP_I2C_FLAG_APPLY_ERRATA_I207
>>> +    0x20:  OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK
>>> +    0x40:  OMAP_I2C_FLAG_FORCE_19200_INT_CLK
>>> +  Valid for ti,omap3-i2c only:
>>> +    0x80:  OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers
>>> +    0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registers
>>
>> It's generally preferred to split these out to separate properties since
>> there is not yet define capability in dts.
> 
> Yeah, I was hoping that Stephen's DTC patches were accepted to avoid that.
> 
>> Can some of these be removed
>> by having more specific compatible strings? That is the whole point in
>> having compatible strings not be generic. omap4-i2c and omap3-i2c is
>> still kind of generic.
> 
> Do you mean creating some attributes like that:
> 
> +    ti,16bits_shift;
> +    ti,reset_postidle;
> +    ti,errata_i207;
> 
> Or using some omap3-i2c or omap4-i2c to determine the proper version and
> thus populate the right flags during probe.
> 

If that's specific enough, then yes. I meant that if say only the
omap3578 (making up numbers here) has errata i207, then define a
compatible string "ti,omap3578-i2c" that implies that and possibly other
flags.

To put it another way, there are only N valid combinations of flags and
N is probably fairly small as long as the flags are dictated by the i2c
h/w rev or how it was integrated into a particular SOC. So you should
have N compatible strings that reflect those valid combinations. The
driver can still use the flags internally.

For any flags that are in fact board level configuration, they should be
broken out as individual properties. Most of these sound like they are
properties of the h/w and not user configuration of the h/w.


> [...]
> 
>>> @@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = {
>>>       .functionality    = omap_i2c_func,
>>>   };
>>>
>>> +#ifdef CONFIG_OF
>>> +static struct omap_i2c_bus_platform_data omap3_pdata = {
>>> +    .rev = OMAP_I2C_IP_VERSION_1,
>>> +};
>>> +
>>> +static struct omap_i2c_bus_platform_data omap4_pdata = {
>>> +    .rev = OMAP_I2C_IP_VERSION_2,
>>> +};
>>
>> This is redundant. The ip version can be determined from the compatible
>> string.
> 
> I'm confused...
> I'm using the compatible string below to chose the proper value.
> This flag is then used later at runtime.
> I'm using a pseudo pdata because that driver is still used in old
> platform that does and will never not have DT support.
> 

After more thought, never mind. You'll probably need it for handling the
flags as I proposed above.

Rob

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

* [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
@ 2011-12-15 15:48         ` Rob Herring
  0 siblings, 0 replies; 82+ messages in thread
From: Rob Herring @ 2011-12-15 15:48 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/15/2011 09:05 AM, Cousson, Benoit wrote:
> Hi Rob,
> 
> On 12/14/2011 5:58 PM, Rob Herring wrote:
>> Benoit,
>>
>> On 12/09/2011 08:02 AM, Benoit Cousson wrote:
>>> 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.
>>>
>>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>>> Cc: Ben Dooks<ben-linux@fluff.org>
>>> ---
>>>   Documentation/devicetree/bindings/i2c/omap-i2c.txt |   42 ++++++++
>>>   drivers/i2c/busses/i2c-omap.c                      |  100
>>> +++++++++++++-------
>>>   2 files changed, 107 insertions(+), 35 deletions(-)
>>>   create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/i2c/omap-i2c.txt
>>> b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
>>> new file mode 100644
>>> index 0000000..d259a17
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
>>> @@ -0,0 +1,42 @@
>>> +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
>>> +- ti,flags : u32: settings or errata relative to the i2c
>>> +    0x1:   OMAP_I2C_FLAG_NO_FIFO
>>> +    0x2:   OMAP_I2C_FLAG_SIMPLE_CLOCK
>>> +    0x4:   OMAP_I2C_FLAG_16BIT_DATA_REG
>>> +    0x8:   OMAP_I2C_FLAG_RESET_REGS_POSTIDLE
>>> +    0x10:  OMAP_I2C_FLAG_APPLY_ERRATA_I207
>>> +    0x20:  OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK
>>> +    0x40:  OMAP_I2C_FLAG_FORCE_19200_INT_CLK
>>> +  Valid for ti,omap3-i2c only:
>>> +    0x80:  OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers
>>> +    0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registers
>>
>> It's generally preferred to split these out to separate properties since
>> there is not yet define capability in dts.
> 
> Yeah, I was hoping that Stephen's DTC patches were accepted to avoid that.
> 
>> Can some of these be removed
>> by having more specific compatible strings? That is the whole point in
>> having compatible strings not be generic. omap4-i2c and omap3-i2c is
>> still kind of generic.
> 
> Do you mean creating some attributes like that:
> 
> +    ti,16bits_shift;
> +    ti,reset_postidle;
> +    ti,errata_i207;
> 
> Or using some omap3-i2c or omap4-i2c to determine the proper version and
> thus populate the right flags during probe.
> 

If that's specific enough, then yes. I meant that if say only the
omap3578 (making up numbers here) has errata i207, then define a
compatible string "ti,omap3578-i2c" that implies that and possibly other
flags.

To put it another way, there are only N valid combinations of flags and
N is probably fairly small as long as the flags are dictated by the i2c
h/w rev or how it was integrated into a particular SOC. So you should
have N compatible strings that reflect those valid combinations. The
driver can still use the flags internally.

For any flags that are in fact board level configuration, they should be
broken out as individual properties. Most of these sound like they are
properties of the h/w and not user configuration of the h/w.


> [...]
> 
>>> @@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = {
>>>       .functionality    = omap_i2c_func,
>>>   };
>>>
>>> +#ifdef CONFIG_OF
>>> +static struct omap_i2c_bus_platform_data omap3_pdata = {
>>> +    .rev = OMAP_I2C_IP_VERSION_1,
>>> +};
>>> +
>>> +static struct omap_i2c_bus_platform_data omap4_pdata = {
>>> +    .rev = OMAP_I2C_IP_VERSION_2,
>>> +};
>>
>> This is redundant. The ip version can be determined from the compatible
>> string.
> 
> I'm confused...
> I'm using the compatible string below to chose the proper value.
> This flag is then used later at runtime.
> I'm using a pseudo pdata because that driver is still used in old
> platform that does and will never not have DT support.
> 

After more thought, never mind. You'll probably need it for handling the
flags as I proposed above.

Rob

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

* Re: [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
  2011-12-15 15:48         ` Rob Herring
@ 2011-12-15 16:09           ` Cousson, Benoit
  -1 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2011-12-15 16:09 UTC (permalink / raw)
  To: Rob Herring
  Cc: tony, devicetree-discuss, grant.likely, linux-omap,
	linux-arm-kernel, Ben Dooks

On 12/15/2011 4:48 PM, Rob Herring wrote:
> On 12/15/2011 09:05 AM, Cousson, Benoit wrote:

[...]

>> Or using some omap3-i2c or omap4-i2c to determine the proper version and
>> thus populate the right flags during probe.
>>
>
> If that's specific enough, then yes. I meant that if say only the
> omap3578 (making up numbers here) has errata i207, then define a
> compatible string "ti,omap3578-i2c" that implies that and possibly other
> flags.
>
> To put it another way, there are only N valid combinations of flags and
> N is probably fairly small as long as the flags are dictated by the i2c
> h/w rev or how it was integrated into a particular SOC. So you should
> have N compatible strings that reflect those valid combinations. The
> driver can still use the flags internally.
>
> For any flags that are in fact board level configuration, they should be
> broken out as individual properties. Most of these sound like they are
> properties of the h/w and not user configuration of the h/w.

Yes, indeed, I got the point. This is even much better for the 
implementation standpoint. The whole stuff is located inside the driver 
where it should belong.

>> [...]
>>
>>>> @@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = {
>>>>        .functionality    = omap_i2c_func,
>>>>    };
>>>>
>>>> +#ifdef CONFIG_OF
>>>> +static struct omap_i2c_bus_platform_data omap3_pdata = {
>>>> +    .rev = OMAP_I2C_IP_VERSION_1,
>>>> +};
>>>> +
>>>> +static struct omap_i2c_bus_platform_data omap4_pdata = {
>>>> +    .rev = OMAP_I2C_IP_VERSION_2,
>>>> +};
>>>
>>> This is redundant. The ip version can be determined from the compatible
>>> string.
>>
>> I'm confused...
>> I'm using the compatible string below to chose the proper value.
>> This flag is then used later at runtime.
>> I'm using a pseudo pdata because that driver is still used in old
>> platform that does and will never not have DT support.
>>
>
> After more thought, never mind. You'll probably need it for handling the
> flags as I proposed above.

Yes, I'm taking advantage of the existing pdata structure to provide the 
proper flags.

Thanks for that feedback,
Benoit


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

* [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
@ 2011-12-15 16:09           ` Cousson, Benoit
  0 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2011-12-15 16:09 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/15/2011 4:48 PM, Rob Herring wrote:
> On 12/15/2011 09:05 AM, Cousson, Benoit wrote:

[...]

>> Or using some omap3-i2c or omap4-i2c to determine the proper version and
>> thus populate the right flags during probe.
>>
>
> If that's specific enough, then yes. I meant that if say only the
> omap3578 (making up numbers here) has errata i207, then define a
> compatible string "ti,omap3578-i2c" that implies that and possibly other
> flags.
>
> To put it another way, there are only N valid combinations of flags and
> N is probably fairly small as long as the flags are dictated by the i2c
> h/w rev or how it was integrated into a particular SOC. So you should
> have N compatible strings that reflect those valid combinations. The
> driver can still use the flags internally.
>
> For any flags that are in fact board level configuration, they should be
> broken out as individual properties. Most of these sound like they are
> properties of the h/w and not user configuration of the h/w.

Yes, indeed, I got the point. This is even much better for the 
implementation standpoint. The whole stuff is located inside the driver 
where it should belong.

>> [...]
>>
>>>> @@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = {
>>>>        .functionality    = omap_i2c_func,
>>>>    };
>>>>
>>>> +#ifdef CONFIG_OF
>>>> +static struct omap_i2c_bus_platform_data omap3_pdata = {
>>>> +    .rev = OMAP_I2C_IP_VERSION_1,
>>>> +};
>>>> +
>>>> +static struct omap_i2c_bus_platform_data omap4_pdata = {
>>>> +    .rev = OMAP_I2C_IP_VERSION_2,
>>>> +};
>>>
>>> This is redundant. The ip version can be determined from the compatible
>>> string.
>>
>> I'm confused...
>> I'm using the compatible string below to chose the proper value.
>> This flag is then used later at runtime.
>> I'm using a pseudo pdata because that driver is still used in old
>> platform that does and will never not have DT support.
>>
>
> After more thought, never mind. You'll probably need it for handling the
> flags as I proposed above.

Yes, I'm taking advantage of the existing pdata structure to provide the 
proper flags.

Thanks for that feedback,
Benoit

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

* Re: [PATCH v2 03/10] mfd: twl-core: Add initial DT support for twl4030/twl6030
  2011-12-09 14:02   ` Benoit Cousson
@ 2011-12-19 12:03     ` Samuel Ortiz
  -1 siblings, 0 replies; 82+ messages in thread
From: Samuel Ortiz @ 2011-12-19 12:03 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: tony, rob.herring, devicetree-discuss, grant.likely, linux-omap,
	linux-arm-kernel, Balaji T K, Graeme Gregory

Hi Benoit,

On Fri, Dec 09, 2011 at 03:02:34PM +0100, Benoit Cousson wrote:
> Add initial device-tree support for twl familly chips.
> The current version is missing the regulator entries due
> to the lack of DT regulator bindings for the moment.
> Only the simple sub-modules that do not depend on
> platform_data information can be initialized properly.
> 
> Add documentation for the Texas Instruments TWL Integrated Chip.
Thanks, patch applied.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

* [PATCH v2 03/10] mfd: twl-core: Add initial DT support for twl4030/twl6030
@ 2011-12-19 12:03     ` Samuel Ortiz
  0 siblings, 0 replies; 82+ messages in thread
From: Samuel Ortiz @ 2011-12-19 12:03 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Benoit,

On Fri, Dec 09, 2011 at 03:02:34PM +0100, Benoit Cousson wrote:
> Add initial device-tree support for twl familly chips.
> The current version is missing the regulator entries due
> to the lack of DT regulator bindings for the moment.
> Only the simple sub-modules that do not depend on
> platform_data information can be initialized properly.
> 
> Add documentation for the Texas Instruments TWL Integrated Chip.
Thanks, patch applied.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

* Re: [PATCH v2 03/10] mfd: twl-core: Add initial DT support for twl4030/twl6030
  2011-12-19 12:03     ` Samuel Ortiz
@ 2011-12-19 13:53       ` Cousson, Benoit
  -1 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2011-12-19 13:53 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: tony, rob.herring, devicetree-discuss, grant.likely, linux-omap,
	linux-arm-kernel, Balaji T K, Graeme Gregory

Salut Samuel,

On 12/19/2011 1:03 PM, Samuel Ortiz wrote:
> Hi Benoit,
>
> On Fri, Dec 09, 2011 at 03:02:34PM +0100, Benoit Cousson wrote:
>> Add initial device-tree support for twl familly chips.
>> The current version is missing the regulator entries due
>> to the lack of DT regulator bindings for the moment.
>> Only the simple sub-modules that do not depend on
>> platform_data information can be initialized properly.
>>
>> Add documentation for the Texas Instruments TWL Integrated Chip.
> Thanks, patch applied.

Thanks,
Benoit



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

* [PATCH v2 03/10] mfd: twl-core: Add initial DT support for twl4030/twl6030
@ 2011-12-19 13:53       ` Cousson, Benoit
  0 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2011-12-19 13:53 UTC (permalink / raw)
  To: linux-arm-kernel

Salut Samuel,

On 12/19/2011 1:03 PM, Samuel Ortiz wrote:
> Hi Benoit,
>
> On Fri, Dec 09, 2011 at 03:02:34PM +0100, Benoit Cousson wrote:
>> Add initial device-tree support for twl familly chips.
>> The current version is missing the regulator entries due
>> to the lack of DT regulator bindings for the moment.
>> Only the simple sub-modules that do not depend on
>> platform_data information can be initialized properly.
>>
>> Add documentation for the Texas Instruments TWL Integrated Chip.
> Thanks, patch applied.

Thanks,
Benoit

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

* Re: [PATCH v2 04/10] rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030
  2011-12-09 14:02   ` Benoit Cousson
@ 2011-12-19 16:52       ` Cousson, Benoit
  -1 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2011-12-19 16:52 UTC (permalink / raw)
  To: Alessandro Zummo, rtc-linux-/JYPxA39Uh5TLH3MbocFFw
  Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi Alessandro,

Gentle ping on this patch.

Thanks,
Benoit

On 12/9/2011 3:02 PM, Benoit Cousson wrote:
> Add the DT support for the TI rtc-twl present in the twl4030
> and twl6030 devices.
>
> Signed-off-by: Benoit Cousson<b-cousson-l0cyMroinI0@public.gmane.org>
> Cc: Alessandro Zummo<a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org>
> ---
>   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
>
> diff --git a/Documentation/devicetree/bindings/rtc/twl-rtc.txt b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
> new file mode 100644
> index 0000000..596e0c9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
> @@ -0,0 +1,12 @@
> +* TI twl RTC
> +
> +The TWL family (twl4030/6030) contains a RTC.
> +
> +Required properties:
> +- compatible : Should be twl4030-rtc
> +
> +Examples:
> +
> +rtc@0 {
> +    compatible = "ti,twl4030-rtc";
> +};
> diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
> index 20687d5..d43b4f6 100644
> --- a/drivers/rtc/rtc-twl.c
> +++ b/drivers/rtc/rtc-twl.c
> @@ -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,
>   	},
>   };
>

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

* [PATCH v2 04/10] rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030
@ 2011-12-19 16:52       ` Cousson, Benoit
  0 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2011-12-19 16:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Alessandro,

Gentle ping on this patch.

Thanks,
Benoit

On 12/9/2011 3:02 PM, Benoit Cousson wrote:
> Add the DT support for the TI rtc-twl present in the twl4030
> and twl6030 devices.
>
> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
> Cc: Alessandro Zummo<a.zummo@towertech.it>
> ---
>   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
>
> diff --git a/Documentation/devicetree/bindings/rtc/twl-rtc.txt b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
> new file mode 100644
> index 0000000..596e0c9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
> @@ -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";
> +};
> diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
> index 20687d5..d43b4f6 100644
> --- a/drivers/rtc/rtc-twl.c
> +++ b/drivers/rtc/rtc-twl.c
> @@ -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,
>   	},
>   };
>

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

* Re: [PATCH v2 04/10] rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030
  2011-12-09 14:02   ` Benoit Cousson
@ 2011-12-20 15:13       ` Cousson, Benoit
  -1 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2011-12-20 15:13 UTC (permalink / raw)
  To: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, rtc-linux-/JYPxA39Uh5TLH3MbocFFw
  Cc: Alessandro Zummo, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi Andrew,

I've never got any feedback on this patch from Alessandro and it seems
that you took care of some rtc stuff recently.

Thanks in advance,
Benoit

On 12/9/2011 3:02 PM, Benoit Cousson wrote:
> Add the DT support for the TI rtc-twl present in the twl4030
> and twl6030 devices.
>
> Signed-off-by: Benoit Cousson<b-cousson-l0cyMroinI0@public.gmane.org>
> Cc: Alessandro Zummo<a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org>
> ---
>   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
>
> diff --git a/Documentation/devicetree/bindings/rtc/twl-rtc.txt b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
> new file mode 100644
> index 0000000..596e0c9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
> @@ -0,0 +1,12 @@
> +* TI twl RTC
> +
> +The TWL family (twl4030/6030) contains a RTC.
> +
> +Required properties:
> +- compatible : Should be twl4030-rtc
> +
> +Examples:
> +
> +rtc@0 {
> +    compatible = "ti,twl4030-rtc";
> +};
> diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
> index 20687d5..d43b4f6 100644
> --- a/drivers/rtc/rtc-twl.c
> +++ b/drivers/rtc/rtc-twl.c
> @@ -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,
>   	},
>   };
>

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

* [PATCH v2 04/10] rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030
@ 2011-12-20 15:13       ` Cousson, Benoit
  0 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2011-12-20 15:13 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Andrew,

I've never got any feedback on this patch from Alessandro and it seems
that you took care of some rtc stuff recently.

Thanks in advance,
Benoit

On 12/9/2011 3:02 PM, Benoit Cousson wrote:
> Add the DT support for the TI rtc-twl present in the twl4030
> and twl6030 devices.
>
> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
> Cc: Alessandro Zummo<a.zummo@towertech.it>
> ---
>   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
>
> diff --git a/Documentation/devicetree/bindings/rtc/twl-rtc.txt b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
> new file mode 100644
> index 0000000..596e0c9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
> @@ -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";
> +};
> diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
> index 20687d5..d43b4f6 100644
> --- a/drivers/rtc/rtc-twl.c
> +++ b/drivers/rtc/rtc-twl.c
> @@ -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,
>   	},
>   };
>

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

* Re: [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
  2011-12-09 14:02   ` Benoit Cousson
@ 2011-12-22  8:22       ` Shubhrajyoti
  -1 siblings, 0 replies; 82+ messages in thread
From: Shubhrajyoti @ 2011-12-22  8:22 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ, rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Ben Dooks,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

Since it touches the driver file
+linux-i2c
On Friday 09 December 2011 07:32 PM, Benoit Cousson wrote:
> 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.
>
> Signed-off-by: Benoit Cousson <b-cousson-l0cyMroinI0@public.gmane.org>
> Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/i2c/omap-i2c.txt |   42 ++++++++
>  drivers/i2c/busses/i2c-omap.c                      |  100 +++++++++++++-------
>  2 files changed, 107 insertions(+), 35 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
>
> diff --git a/Documentation/devicetree/bindings/i2c/omap-i2c.txt b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
> new file mode 100644
> index 0000000..d259a17
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
> @@ -0,0 +1,42 @@
> +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
> +- ti,flags : u32: settings or errata relative to the i2c
> +    0x1:   OMAP_I2C_FLAG_NO_FIFO
> +    0x2:   OMAP_I2C_FLAG_SIMPLE_CLOCK
> +    0x4:   OMAP_I2C_FLAG_16BIT_DATA_REG
> +    0x8:   OMAP_I2C_FLAG_RESET_REGS_POSTIDLE
> +    0x10:  OMAP_I2C_FLAG_APPLY_ERRATA_I207
> +    0x20:  OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK
> +    0x40:  OMAP_I2C_FLAG_FORCE_19200_INT_CLK
> +  Valid for ti,omap3-i2c only:
> +    0x80:  OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers
> +    0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registers
> +
> +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@0 {
> +    compatible = "ti,omap3-i2c";
> +    #address-cells = <1>;
> +    #size-cells = <0>;
> +    ti,hwmods = "i2c1";
> +    clock-frequency = <400000>;
> +    ti,flags = <0x118>;
> +};
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index a43d002..b4a8eee 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -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>
> @@ -182,7 +184,9 @@ struct omap_i2c_dev {
>  	u32			latency;	/* maximum mpu wkup latency */
>  	void			(*set_mpu_wkup_lat)(struct device *dev,
>  						    long latency);
> -	u32			speed;		/* Speed of bus in Khz */
> +	u32			speed;		/* Speed of bus in kHz */
> +	u32			dtrev;		/* extra revision from DT */
> +	u32			flags;
>  	u16			cmd_err;
>  	u8			*buf;
>  	u8			*regs;
> @@ -266,11 +270,7 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
>  
>  static void omap_i2c_unidle(struct omap_i2c_dev *dev)
>  {
> -	struct omap_i2c_bus_platform_data *pdata;
> -
> -	pdata = dev->dev->platform_data;
> -
> -	if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
> +	if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
>  		omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
>  		omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, dev->pscstate);
>  		omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, dev->scllstate);
> @@ -291,13 +291,10 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev)
>  
>  static void omap_i2c_idle(struct omap_i2c_dev *dev)
>  {
> -	struct omap_i2c_bus_platform_data *pdata;
>  	u16 iv;
>  
> -	pdata = dev->dev->platform_data;
> -
>  	dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
> -	if (pdata->rev == OMAP_I2C_IP_VERSION_2)
> +	if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
>  		omap_i2c_write_reg(dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
>  	else
>  		omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
> @@ -320,9 +317,6 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  	unsigned long timeout;
>  	unsigned long internal_clk = 0;
>  	struct clk *fclk;
> -	struct omap_i2c_bus_platform_data *pdata;
> -
> -	pdata = dev->dev->platform_data;
>  
>  	if (dev->rev >= OMAP_I2C_OMAP1_REV_2) {
>  		/* Disable I2C controller before soft reset */
> @@ -373,7 +367,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  	}
>  	omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
>  
> -	if (pdata->flags & OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK) {
> +	if (dev->flags & OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK) {
>  		/*
>  		 * The I2C functional clock is the armxor_ck, so there's
>  		 * no need to get "armxor_ck" separately.  Now, if OMAP2420
> @@ -397,7 +391,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  			psc = fclk_rate / 12000000;
>  	}
>  
> -	if (!(pdata->flags & OMAP_I2C_FLAG_SIMPLE_CLOCK)) {
> +	if (!(dev->flags & OMAP_I2C_FLAG_SIMPLE_CLOCK)) {
>  
>  		/*
>  		 * HSI2C controller internal clk rate should be 19.2 Mhz for
> @@ -406,7 +400,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  		 * The filter is iclk (fclk for HS) period.
>  		 */
>  		if (dev->speed > 400 ||
> -			       pdata->flags & OMAP_I2C_FLAG_FORCE_19200_INT_CLK)
> +			       dev->flags & OMAP_I2C_FLAG_FORCE_19200_INT_CLK)
>  			internal_clk = 19200;
>  		else if (dev->speed > 100)
>  			internal_clk = 9600;
> @@ -475,7 +469,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  
>  	dev->errata = 0;
>  
> -	if (pdata->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
> +	if (dev->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
>  		dev->errata |= I2C_OMAP_ERRATA_I207;
>  
>  	/* Enable interrupts */
> @@ -484,7 +478,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  			OMAP_I2C_IE_AL)  | ((dev->fifo_size) ?
>  				(OMAP_I2C_IE_RDR | OMAP_I2C_IE_XDR) : 0);
>  	omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
> -	if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
> +	if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
>  		dev->pscstate = psc;
>  		dev->scllstate = scll;
>  		dev->sclhstate = sclh;
> @@ -804,9 +798,6 @@ omap_i2c_isr(int this_irq, void *dev_id)
>  	u16 bits;
>  	u16 stat, w;
>  	int err, count = 0;
> -	struct omap_i2c_bus_platform_data *pdata;
> -
> -	pdata = dev->dev->platform_data;
>  
>  	if (pm_runtime_suspended(dev->dev))
>  		return IRQ_NONE;
> @@ -875,7 +866,7 @@ complete:
>  					 * Data reg in 2430, omap3 and
>  					 * omap4 is 8 bit wide
>  					 */
> -					if (pdata->flags &
> +					if (dev->flags &
>  						 OMAP_I2C_FLAG_16BIT_DATA_REG) {
>  						if (dev->buf_len) {
>  							*dev->buf++ = w >> 8;
> @@ -918,7 +909,7 @@ complete:
>  					 * Data reg in 2430, omap3 and
>  					 * omap4 is 8 bit wide
>  					 */
> -					if (pdata->flags &
> +					if (dev->flags &
>  						 OMAP_I2C_FLAG_16BIT_DATA_REG) {
>  						if (dev->buf_len) {
>  							w |= *dev->buf++ << 8;
> @@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = {
>  	.functionality	= omap_i2c_func,
>  };
>  
> +#ifdef CONFIG_OF
> +static struct omap_i2c_bus_platform_data omap3_pdata = {
> +	.rev = OMAP_I2C_IP_VERSION_1,
> +};
> +
> +static struct omap_i2c_bus_platform_data omap4_pdata = {
> +	.rev = OMAP_I2C_IP_VERSION_2,
> +};
> +
> +static const struct of_device_id omap_i2c_of_match[] = {
> +	{
> +		.compatible = "ti,omap4-i2c",
> +		.data = &omap4_pdata,
> +	},
> +	{
> +		.compatible = "ti,omap3-i2c",
> +		.data = &omap3_pdata,
> +	},
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
> +#else
> +#define omap_i2c_of_match NULL
> +#endif
> +
>  static int __devinit
>  omap_i2c_probe(struct platform_device *pdev)
>  {
> @@ -972,9 +988,10 @@ omap_i2c_probe(struct platform_device *pdev)
>  	struct i2c_adapter	*adap;
>  	struct resource		*mem, *irq, *ioarea;
>  	struct omap_i2c_bus_platform_data *pdata = pdev->dev.platform_data;
> +	struct device_node	*node = pdev->dev.of_node;
> +	const struct of_device_id *match;
>  	irq_handler_t isr;
>  	int r;
> -	u32 speed = 0;
>  
>  	/* NOTE: driver uses the static register mapping */
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -1001,15 +1018,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;
> +
> +		of_property_read_u32(node, "clock-frequency", &freq);
> +		/* convert DT freq value in Hz into kHz for speed */
> +		dev->speed = freq / 1000;
> +		of_property_read_u32(node, "ti,flags", &dev->flags);
> +		dev->dtrev = pdata->rev;
> +
> +	} 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;
>  	}
>  
> -	dev->speed = speed;
>  	dev->dev = &pdev->dev;
>  	dev->irq = irq->start;
>  	dev->base = ioremap(mem->start, resource_size(mem));
> @@ -1020,9 +1046,9 @@ omap_i2c_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, dev);
>  
> -	dev->reg_shift = (pdata->flags >> OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
> +	dev->reg_shift = (dev->flags >> OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
>  
> -	if (pdata->rev == OMAP_I2C_IP_VERSION_2)
> +	if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
>  		dev->regs = (u8 *)reg_map_ip_v2;
>  	else
>  		dev->regs = (u8 *)reg_map_ip_v1;
> @@ -1035,7 +1061,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  	if (dev->rev <= OMAP_I2C_REV_ON_3430)
>  		dev->errata |= I2C_OMAP3_1P153;
>  
> -	if (!(pdata->flags & OMAP_I2C_FLAG_NO_FIFO)) {
> +	if (!(dev->flags & OMAP_I2C_FLAG_NO_FIFO)) {
>  		u16 s;
>  
>  		/* Set up the fifo size - Get total size */
> @@ -1057,7 +1083,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  		/* calculate wakeup latency constraint for MPU */
>  		if (dev->set_mpu_wkup_lat != NULL)
>  			dev->latency = (1000000 * dev->fifo_size) /
> -				       (1000 * speed / 8);
> +				       (1000 * dev->speed / 8);
>  	}
>  
>  	/* reset ASAP, clearing any IRQs */
> @@ -1073,7 +1099,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  	}
>  
>  	dev_info(dev->dev, "bus %d rev%d.%d.%d at %d kHz\n", pdev->id,
> -		 pdata->rev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
> +		 dev->dtrev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
>  
>  	pm_runtime_put(dev->dev);
>  
> @@ -1084,6 +1110,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  	strlcpy(adap->name, "OMAP I2C adapter", sizeof(adap->name));
>  	adap->algo = &omap_i2c_algo;
>  	adap->dev.parent = &pdev->dev;
> +	adap->dev.of_node = pdev->dev.of_node;
>  
>  	/* i2c device drivers may be active on return from add_adapter() */
>  	adap->nr = pdev->id;
> @@ -1093,6 +1120,8 @@ omap_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> +	of_i2c_register_devices(adap);
> +
>  	return 0;
>  
>  err_free_irq:
> @@ -1165,6 +1194,7 @@ static struct platform_driver omap_i2c_driver = {
>  		.name	= "omap_i2c",
>  		.owner	= THIS_MODULE,
>  		.pm	= OMAP_I2C_PM_OPS,
> +		.of_match_table = omap_i2c_of_match,
>  	},
>  };
>  

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

* [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
@ 2011-12-22  8:22       ` Shubhrajyoti
  0 siblings, 0 replies; 82+ messages in thread
From: Shubhrajyoti @ 2011-12-22  8:22 UTC (permalink / raw)
  To: linux-arm-kernel

Since it touches the driver file
+linux-i2c
On Friday 09 December 2011 07:32 PM, Benoit Cousson wrote:
> 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.
>
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Ben Dooks <ben-linux@fluff.org>
> ---
>  Documentation/devicetree/bindings/i2c/omap-i2c.txt |   42 ++++++++
>  drivers/i2c/busses/i2c-omap.c                      |  100 +++++++++++++-------
>  2 files changed, 107 insertions(+), 35 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
>
> diff --git a/Documentation/devicetree/bindings/i2c/omap-i2c.txt b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
> new file mode 100644
> index 0000000..d259a17
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
> @@ -0,0 +1,42 @@
> +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
> +- ti,flags : u32: settings or errata relative to the i2c
> +    0x1:   OMAP_I2C_FLAG_NO_FIFO
> +    0x2:   OMAP_I2C_FLAG_SIMPLE_CLOCK
> +    0x4:   OMAP_I2C_FLAG_16BIT_DATA_REG
> +    0x8:   OMAP_I2C_FLAG_RESET_REGS_POSTIDLE
> +    0x10:  OMAP_I2C_FLAG_APPLY_ERRATA_I207
> +    0x20:  OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK
> +    0x40:  OMAP_I2C_FLAG_FORCE_19200_INT_CLK
> +  Valid for ti,omap3-i2c only:
> +    0x80:  OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers
> +    0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registers
> +
> +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>;
> +    ti,flags = <0x118>;
> +};
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index a43d002..b4a8eee 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -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>
> @@ -182,7 +184,9 @@ struct omap_i2c_dev {
>  	u32			latency;	/* maximum mpu wkup latency */
>  	void			(*set_mpu_wkup_lat)(struct device *dev,
>  						    long latency);
> -	u32			speed;		/* Speed of bus in Khz */
> +	u32			speed;		/* Speed of bus in kHz */
> +	u32			dtrev;		/* extra revision from DT */
> +	u32			flags;
>  	u16			cmd_err;
>  	u8			*buf;
>  	u8			*regs;
> @@ -266,11 +270,7 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
>  
>  static void omap_i2c_unidle(struct omap_i2c_dev *dev)
>  {
> -	struct omap_i2c_bus_platform_data *pdata;
> -
> -	pdata = dev->dev->platform_data;
> -
> -	if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
> +	if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
>  		omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
>  		omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, dev->pscstate);
>  		omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, dev->scllstate);
> @@ -291,13 +291,10 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev)
>  
>  static void omap_i2c_idle(struct omap_i2c_dev *dev)
>  {
> -	struct omap_i2c_bus_platform_data *pdata;
>  	u16 iv;
>  
> -	pdata = dev->dev->platform_data;
> -
>  	dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
> -	if (pdata->rev == OMAP_I2C_IP_VERSION_2)
> +	if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
>  		omap_i2c_write_reg(dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
>  	else
>  		omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
> @@ -320,9 +317,6 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  	unsigned long timeout;
>  	unsigned long internal_clk = 0;
>  	struct clk *fclk;
> -	struct omap_i2c_bus_platform_data *pdata;
> -
> -	pdata = dev->dev->platform_data;
>  
>  	if (dev->rev >= OMAP_I2C_OMAP1_REV_2) {
>  		/* Disable I2C controller before soft reset */
> @@ -373,7 +367,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  	}
>  	omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
>  
> -	if (pdata->flags & OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK) {
> +	if (dev->flags & OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK) {
>  		/*
>  		 * The I2C functional clock is the armxor_ck, so there's
>  		 * no need to get "armxor_ck" separately.  Now, if OMAP2420
> @@ -397,7 +391,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  			psc = fclk_rate / 12000000;
>  	}
>  
> -	if (!(pdata->flags & OMAP_I2C_FLAG_SIMPLE_CLOCK)) {
> +	if (!(dev->flags & OMAP_I2C_FLAG_SIMPLE_CLOCK)) {
>  
>  		/*
>  		 * HSI2C controller internal clk rate should be 19.2 Mhz for
> @@ -406,7 +400,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  		 * The filter is iclk (fclk for HS) period.
>  		 */
>  		if (dev->speed > 400 ||
> -			       pdata->flags & OMAP_I2C_FLAG_FORCE_19200_INT_CLK)
> +			       dev->flags & OMAP_I2C_FLAG_FORCE_19200_INT_CLK)
>  			internal_clk = 19200;
>  		else if (dev->speed > 100)
>  			internal_clk = 9600;
> @@ -475,7 +469,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  
>  	dev->errata = 0;
>  
> -	if (pdata->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
> +	if (dev->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
>  		dev->errata |= I2C_OMAP_ERRATA_I207;
>  
>  	/* Enable interrupts */
> @@ -484,7 +478,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
>  			OMAP_I2C_IE_AL)  | ((dev->fifo_size) ?
>  				(OMAP_I2C_IE_RDR | OMAP_I2C_IE_XDR) : 0);
>  	omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
> -	if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
> +	if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
>  		dev->pscstate = psc;
>  		dev->scllstate = scll;
>  		dev->sclhstate = sclh;
> @@ -804,9 +798,6 @@ omap_i2c_isr(int this_irq, void *dev_id)
>  	u16 bits;
>  	u16 stat, w;
>  	int err, count = 0;
> -	struct omap_i2c_bus_platform_data *pdata;
> -
> -	pdata = dev->dev->platform_data;
>  
>  	if (pm_runtime_suspended(dev->dev))
>  		return IRQ_NONE;
> @@ -875,7 +866,7 @@ complete:
>  					 * Data reg in 2430, omap3 and
>  					 * omap4 is 8 bit wide
>  					 */
> -					if (pdata->flags &
> +					if (dev->flags &
>  						 OMAP_I2C_FLAG_16BIT_DATA_REG) {
>  						if (dev->buf_len) {
>  							*dev->buf++ = w >> 8;
> @@ -918,7 +909,7 @@ complete:
>  					 * Data reg in 2430, omap3 and
>  					 * omap4 is 8 bit wide
>  					 */
> -					if (pdata->flags &
> +					if (dev->flags &
>  						 OMAP_I2C_FLAG_16BIT_DATA_REG) {
>  						if (dev->buf_len) {
>  							w |= *dev->buf++ << 8;
> @@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = {
>  	.functionality	= omap_i2c_func,
>  };
>  
> +#ifdef CONFIG_OF
> +static struct omap_i2c_bus_platform_data omap3_pdata = {
> +	.rev = OMAP_I2C_IP_VERSION_1,
> +};
> +
> +static struct omap_i2c_bus_platform_data omap4_pdata = {
> +	.rev = OMAP_I2C_IP_VERSION_2,
> +};
> +
> +static const struct of_device_id omap_i2c_of_match[] = {
> +	{
> +		.compatible = "ti,omap4-i2c",
> +		.data = &omap4_pdata,
> +	},
> +	{
> +		.compatible = "ti,omap3-i2c",
> +		.data = &omap3_pdata,
> +	},
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
> +#else
> +#define omap_i2c_of_match NULL
> +#endif
> +
>  static int __devinit
>  omap_i2c_probe(struct platform_device *pdev)
>  {
> @@ -972,9 +988,10 @@ omap_i2c_probe(struct platform_device *pdev)
>  	struct i2c_adapter	*adap;
>  	struct resource		*mem, *irq, *ioarea;
>  	struct omap_i2c_bus_platform_data *pdata = pdev->dev.platform_data;
> +	struct device_node	*node = pdev->dev.of_node;
> +	const struct of_device_id *match;
>  	irq_handler_t isr;
>  	int r;
> -	u32 speed = 0;
>  
>  	/* NOTE: driver uses the static register mapping */
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -1001,15 +1018,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;
> +
> +		of_property_read_u32(node, "clock-frequency", &freq);
> +		/* convert DT freq value in Hz into kHz for speed */
> +		dev->speed = freq / 1000;
> +		of_property_read_u32(node, "ti,flags", &dev->flags);
> +		dev->dtrev = pdata->rev;
> +
> +	} 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;
>  	}
>  
> -	dev->speed = speed;
>  	dev->dev = &pdev->dev;
>  	dev->irq = irq->start;
>  	dev->base = ioremap(mem->start, resource_size(mem));
> @@ -1020,9 +1046,9 @@ omap_i2c_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, dev);
>  
> -	dev->reg_shift = (pdata->flags >> OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
> +	dev->reg_shift = (dev->flags >> OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
>  
> -	if (pdata->rev == OMAP_I2C_IP_VERSION_2)
> +	if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
>  		dev->regs = (u8 *)reg_map_ip_v2;
>  	else
>  		dev->regs = (u8 *)reg_map_ip_v1;
> @@ -1035,7 +1061,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  	if (dev->rev <= OMAP_I2C_REV_ON_3430)
>  		dev->errata |= I2C_OMAP3_1P153;
>  
> -	if (!(pdata->flags & OMAP_I2C_FLAG_NO_FIFO)) {
> +	if (!(dev->flags & OMAP_I2C_FLAG_NO_FIFO)) {
>  		u16 s;
>  
>  		/* Set up the fifo size - Get total size */
> @@ -1057,7 +1083,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  		/* calculate wakeup latency constraint for MPU */
>  		if (dev->set_mpu_wkup_lat != NULL)
>  			dev->latency = (1000000 * dev->fifo_size) /
> -				       (1000 * speed / 8);
> +				       (1000 * dev->speed / 8);
>  	}
>  
>  	/* reset ASAP, clearing any IRQs */
> @@ -1073,7 +1099,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  	}
>  
>  	dev_info(dev->dev, "bus %d rev%d.%d.%d at %d kHz\n", pdev->id,
> -		 pdata->rev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
> +		 dev->dtrev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
>  
>  	pm_runtime_put(dev->dev);
>  
> @@ -1084,6 +1110,7 @@ omap_i2c_probe(struct platform_device *pdev)
>  	strlcpy(adap->name, "OMAP I2C adapter", sizeof(adap->name));
>  	adap->algo = &omap_i2c_algo;
>  	adap->dev.parent = &pdev->dev;
> +	adap->dev.of_node = pdev->dev.of_node;
>  
>  	/* i2c device drivers may be active on return from add_adapter() */
>  	adap->nr = pdev->id;
> @@ -1093,6 +1120,8 @@ omap_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> +	of_i2c_register_devices(adap);
> +
>  	return 0;
>  
>  err_free_irq:
> @@ -1165,6 +1194,7 @@ static struct platform_driver omap_i2c_driver = {
>  		.name	= "omap_i2c",
>  		.owner	= THIS_MODULE,
>  		.pm	= OMAP_I2C_PM_OPS,
> +		.of_match_table = omap_i2c_of_match,
>  	},
>  };
>  

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

* Re: [PATCH v2 04/10] rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030
  2011-12-19 16:52       ` Cousson, Benoit
@ 2011-12-26  1:18         ` Alessandro Zummo
  -1 siblings, 0 replies; 82+ messages in thread
From: Alessandro Zummo @ 2011-12-26  1:18 UTC (permalink / raw)
  To: Cousson, Benoit
  Cc: rtc-linux, tony, devicetree-discuss, rob.herring, grant.likely,
	akpm, linux-omap, linux-arm-kernel

On Mon, 19 Dec 2011 17:52:26 +0100
"Cousson, Benoit" <b-cousson@ti.com> wrote:

> Hi Alessandro,
> 
> Gentle ping on this patch.

 Hi, 

 Acked-by: Alessandro Zummo <a.zummo@towertech.it>

 Andrew will probably pick it up. ty.

-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it

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

* [PATCH v2 04/10] rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030
@ 2011-12-26  1:18         ` Alessandro Zummo
  0 siblings, 0 replies; 82+ messages in thread
From: Alessandro Zummo @ 2011-12-26  1:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 19 Dec 2011 17:52:26 +0100
"Cousson, Benoit" <b-cousson@ti.com> wrote:

> Hi Alessandro,
> 
> Gentle ping on this patch.

 Hi, 

 Acked-by: Alessandro Zummo <a.zummo@towertech.it>

 Andrew will probably pick it up. ty.

-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it

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

* Re: [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
  2011-12-14  1:06     ` Kevin Hilman
@ 2012-01-04 13:36       ` Cousson, Benoit
  -1 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2012-01-04 13:36 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: tony, rob.herring, devicetree-discuss, grant.likely, linux-omap,
	linux-arm-kernel, Ben Dooks

Hi Kevin,

On 12/14/2011 2:06 AM, Kevin Hilman wrote:
> Benoit Cousson<b-cousson@ti.com>  writes:
>
>> 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.
>>
>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>> Cc: Ben Dooks<ben-linux@fluff.org>
>
> This seems indepenent from the rest of the series, and I can queue up
> for merge via the I2C tree.
>
> Benoit, please confirm that we shouldn't have any problems if this patch
> goes independently.
>
> Grant/Rob, with your ack on the bindings, I can queue this up for the
> I2C maintainers along with some other OMAP I2C changes for v3.3.

I removed the nasty bindings and got the Reviewed-by: from Rob for the 
v4 [1].

Could you take it in your branch? I've just tried merging your 
for_3.3/i2c/misc on top of my for_3.3/3_omap_dt_i2c_twl branch and 
tested it successfully on OMAP4 DT boot.

Thanks,
Benoit


[1] http://lkml.org/lkml/2011/12/22/176


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

* [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
@ 2012-01-04 13:36       ` Cousson, Benoit
  0 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2012-01-04 13:36 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kevin,

On 12/14/2011 2:06 AM, Kevin Hilman wrote:
> Benoit Cousson<b-cousson@ti.com>  writes:
>
>> 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.
>>
>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>> Cc: Ben Dooks<ben-linux@fluff.org>
>
> This seems indepenent from the rest of the series, and I can queue up
> for merge via the I2C tree.
>
> Benoit, please confirm that we shouldn't have any problems if this patch
> goes independently.
>
> Grant/Rob, with your ack on the bindings, I can queue this up for the
> I2C maintainers along with some other OMAP I2C changes for v3.3.

I removed the nasty bindings and got the Reviewed-by: from Rob for the 
v4 [1].

Could you take it in your branch? I've just tried merging your 
for_3.3/i2c/misc on top of my for_3.3/3_omap_dt_i2c_twl branch and 
tested it successfully on OMAP4 DT boot.

Thanks,
Benoit


[1] http://lkml.org/lkml/2011/12/22/176

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

* Re: [PATCH v2 01/10] ARM: OMAP2+: pm: Do not init statically the SR and voltage layer with DT
  2011-12-09 14:02   ` Benoit Cousson
@ 2012-01-04 18:04     ` Grant Likely
  -1 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:04 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: tony, rob.herring, Kevin Hilman, devicetree-discuss, linux-omap,
	linux-arm-kernel

On Fri, Dec 09, 2011 at 03:02:32PM +0100, Benoit Cousson wrote:
> 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.
> 
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> Cc: Kevin Hilman <khilman@ti.com>
> ---
>  arch/arm/mach-omap2/pm.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
> index 1881fe9..ad4f693 100644
> --- a/arch/arm/mach-omap2/pm.c
> +++ b/arch/arm/mach-omap2/pm.c
> @@ -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();
> -- 
> 1.7.0.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 01/10] ARM: OMAP2+: pm: Do not init statically the SR and voltage layer with DT
@ 2012-01-04 18:04     ` Grant Likely
  0 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Dec 09, 2011 at 03:02:32PM +0100, Benoit Cousson wrote:
> 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.
> 
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> Cc: Kevin Hilman <khilman@ti.com>
> ---
>  arch/arm/mach-omap2/pm.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
> index 1881fe9..ad4f693 100644
> --- a/arch/arm/mach-omap2/pm.c
> +++ b/arch/arm/mach-omap2/pm.c
> @@ -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();
> -- 
> 1.7.0.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
  2012-01-04 13:36       ` Cousson, Benoit
@ 2012-01-04 18:08         ` Grant Likely
  -1 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:08 UTC (permalink / raw)
  To: Cousson, Benoit
  Cc: Kevin Hilman, tony, devicetree-discuss, rob.herring, Ben Dooks,
	linux-omap, linux-arm-kernel

On Wed, Jan 04, 2012 at 02:36:24PM +0100, Cousson, Benoit wrote:
> Hi Kevin,
> 
> On 12/14/2011 2:06 AM, Kevin Hilman wrote:
> >Benoit Cousson<b-cousson@ti.com>  writes:
> >
> >>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.
> >>
> >>Signed-off-by: Benoit Cousson<b-cousson@ti.com>
> >>Cc: Ben Dooks<ben-linux@fluff.org>
> >
> >This seems indepenent from the rest of the series, and I can queue up
> >for merge via the I2C tree.
> >
> >Benoit, please confirm that we shouldn't have any problems if this patch
> >goes independently.
> >
> >Grant/Rob, with your ack on the bindings, I can queue this up for the
> >I2C maintainers along with some other OMAP I2C changes for v3.3.
> 
> I removed the nasty bindings and got the Reviewed-by: from Rob for
> the v4 [1].
> 
> Could you take it in your branch? I've just tried merging your
> for_3.3/i2c/misc on top of my for_3.3/3_omap_dt_i2c_twl branch and
> tested it successfully on OMAP4 DT boot.

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> 
> Thanks,
> Benoit
> 
> 
> [1] http://lkml.org/lkml/2011/12/22/176
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
@ 2012-01-04 18:08         ` Grant Likely
  0 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jan 04, 2012 at 02:36:24PM +0100, Cousson, Benoit wrote:
> Hi Kevin,
> 
> On 12/14/2011 2:06 AM, Kevin Hilman wrote:
> >Benoit Cousson<b-cousson@ti.com>  writes:
> >
> >>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.
> >>
> >>Signed-off-by: Benoit Cousson<b-cousson@ti.com>
> >>Cc: Ben Dooks<ben-linux@fluff.org>
> >
> >This seems indepenent from the rest of the series, and I can queue up
> >for merge via the I2C tree.
> >
> >Benoit, please confirm that we shouldn't have any problems if this patch
> >goes independently.
> >
> >Grant/Rob, with your ack on the bindings, I can queue this up for the
> >I2C maintainers along with some other OMAP I2C changes for v3.3.
> 
> I removed the nasty bindings and got the Reviewed-by: from Rob for
> the v4 [1].
> 
> Could you take it in your branch? I've just tried merging your
> for_3.3/i2c/misc on top of my for_3.3/3_omap_dt_i2c_twl branch and
> tested it successfully on OMAP4 DT boot.

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> 
> Thanks,
> Benoit
> 
> 
> [1] http://lkml.org/lkml/2011/12/22/176
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 03/10] mfd: twl-core: Add initial DT support for twl4030/twl6030
  2011-12-09 14:02   ` Benoit Cousson
@ 2012-01-04 18:12       ` Grant Likely
  -1 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:12 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: Balaji T K, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Graeme Gregory,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Samuel Ortiz

On Fri, Dec 09, 2011 at 03:02:34PM +0100, Benoit Cousson wrote:
> Add initial device-tree support for twl familly chips.
> The current version is missing the regulator entries due
> to the lack of DT regulator bindings for the moment.
> Only the simple sub-modules that do not depend on
> platform_data information can be initialized properly.
> 
> Add documentation for the Texas Instruments TWL Integrated Chip.
> 
> Signed-off-by: Benoit Cousson <b-cousson-l0cyMroinI0@public.gmane.org>
> Cc: Balaji T K <balajitk-l0cyMroinI0@public.gmane.org>
> Cc: Graeme Gregory <gg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org>
> Cc: Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
>  .../devicetree/bindings/mfd/twl-familly.txt        |   47 +++++++++++++++++
>  drivers/mfd/twl-core.c                             |   53 ++++++++++++++++++--
>  2 files changed, 96 insertions(+), 4 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/mfd/twl-familly.txt
> 
> diff --git a/Documentation/devicetree/bindings/mfd/twl-familly.txt b/Documentation/devicetree/bindings/mfd/twl-familly.txt
> new file mode 100644
> index 0000000..ff4cacd
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/twl-familly.txt
> @@ -0,0 +1,47 @@
> +Texas Instruments TWL family
> +
> +The TWLs are Integrated Power Management Chips.
> +Some version might contain much more analog function like
> +USB transceiver or Audio amplifier.
> +These chips are connected to an i2c bus.
> +
> +
> +Required properties:
> +- compatible : Must be "ti,twl4030";
> +  For Integrated power-management/audio CODEC device used in OMAP3
> +  based boards
> +- compatible : Must be "ti,twl6030";
> +  For Integrated power-management used in OMAP4 based boards
> +- interrupts : This i2c device has an IRQ line connected to the main SoC
> +- interrupt-controller : Since the twl support several interrupts internally,
> +  it is considered as an interrupt controller cascaded to the SoC one.
> +- #interrupt-cells = <1>;
> +- interrupt-parent : The parent interrupt controller.
> +
> +Optional node:
> +- Child nodes contain in the twl. The twl family is made of severals variants
> +  that support a different number of features.
> +  The children nodes will thus depend of the capabilty of the variant.
> +
> +
> +Example:
> +/*
> + * Integrated Power Management Chip
> + * http://www.ti.com/lit/ds/symlink/twl6030.pdf
> + */
> +twl@48 {
> +    compatible = "ti,twl6030";
> +    reg = <0x48>;
> +    interrupts = <39>; /* IRQ_SYS_1N cascaded to gic */
> +    interrupt-controller;
> +    #interrupt-cells = <1>;
> +    interrupt-parent = <&gic>;
> +    #address-cells = <1>;
> +    #size-cells = <0>;
> +
> +    twl_rtc {
> +        compatible = "ti,twl_rtc";
> +        interrupts = <11>;
> +        reg = <0>;
> +    };
> +};
> diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
> index bfbd660..524d9d8 100644
> --- a/drivers/mfd/twl-core.c
> +++ b/drivers/mfd/twl-core.c
> @@ -34,6 +34,10 @@
>  #include <linux/platform_device.h>
>  #include <linux/clk.h>
>  #include <linux/err.h>
> +#include <linux/slab.h>
> +#include <linux/of_irq.h>
> +#include <linux/of_platform.h>
> +#include <linux/irqdomain.h>
>  
>  #include <linux/regulator/machine.h>
>  
> @@ -1183,22 +1187,53 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
>  	int				status;
>  	unsigned			i;
>  	struct twl4030_platform_data	*pdata = client->dev.platform_data;
> +	struct device_node		*node = client->dev.of_node;
>  	u8 temp;
>  	int ret = 0;
>  
> +	if (node && !pdata) {
> +		/*
> +		 * XXX: Temporary fake pdata until the information
> +		 * is correctly retrieved by every TWL modules from DT.
> +		 */
> +		pdata = kzalloc(sizeof(struct twl4030_platform_data),
> +				GFP_KERNEL);

devm_kzalloc() so that it gets cleaned up on remove.

> +		if (!pdata) {
> +			status = -ENOMEM;
> +			goto exit;
> +		}
> +
> +		/*
> +		 * XXX: For the moment the IRQs for TWL seems to be encoded in
> +		 * the global OMAP space. That should be cleaned to allow
> +		 * dynamically adding a new IRQ controller.
> +		 */
> +		if ((id->driver_data) & TWL6030_CLASS) {
> +			pdata->irq_base = TWL6030_IRQ_BASE;
> +			pdata->irq_end = pdata->irq_base + TWL6030_BASE_NR_IRQS;
> +		} else {
> +			pdata->irq_base = TWL4030_IRQ_BASE;
> +			pdata->irq_end = pdata->irq_base + TWL4030_BASE_NR_IRQS;
> +		}
> +		irq_domain_add_simple(node, pdata->irq_base);

Yes, you'll want a follow-up patch to convert to dynamically allocated
irqs... but I've got to merge the final irq_domain work first.  :-)

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> +	}
> +
>  	if (!pdata) {
>  		dev_dbg(&client->dev, "no platform data?\n");
> -		return -EINVAL;
> +		status = -EINVAL;
> +		goto fail_free;
>  	}
>  
>  	if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C) == 0) {
>  		dev_dbg(&client->dev, "can't talk I2C?\n");
> -		return -EIO;
> +		status = -EIO;
> +		goto fail_free;
>  	}
>  
>  	if (inuse) {
>  		dev_dbg(&client->dev, "driver is already in use\n");
> -		return -EBUSY;
> +		status = -EBUSY;
> +		goto fail_free;
>  	}
>  
>  	for (i = 0; i < TWL_NUM_SLAVES; i++) {
> @@ -1270,10 +1305,20 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
>  		twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1);
>  	}
>  
> -	status = add_children(pdata, id->driver_data);
> +#ifdef CONFIG_OF_DEVICE
> +	if (node)
> +		status = of_platform_populate(node, NULL, NULL, &client->dev);
> +	else
> +#endif
> +		status = add_children(pdata, id->driver_data);
> +
>  fail:
>  	if (status < 0)
>  		twl_remove(client);
> +fail_free:
> +	if (node)
> +		kfree(pdata);
> +exit:
>  	return status;
>  }
>  
> -- 
> 1.7.0.4
> 

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

* [PATCH v2 03/10] mfd: twl-core: Add initial DT support for twl4030/twl6030
@ 2012-01-04 18:12       ` Grant Likely
  0 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Dec 09, 2011 at 03:02:34PM +0100, Benoit Cousson wrote:
> Add initial device-tree support for twl familly chips.
> The current version is missing the regulator entries due
> to the lack of DT regulator bindings for the moment.
> Only the simple sub-modules that do not depend on
> platform_data information can be initialized properly.
> 
> Add documentation for the Texas Instruments TWL Integrated Chip.
> 
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Balaji T K <balajitk@ti.com>
> Cc: Graeme Gregory <gg@slimlogic.co.uk>
> Cc: Samuel Ortiz <sameo@linux.intel.com>
> ---
>  .../devicetree/bindings/mfd/twl-familly.txt        |   47 +++++++++++++++++
>  drivers/mfd/twl-core.c                             |   53 ++++++++++++++++++--
>  2 files changed, 96 insertions(+), 4 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/mfd/twl-familly.txt
> 
> diff --git a/Documentation/devicetree/bindings/mfd/twl-familly.txt b/Documentation/devicetree/bindings/mfd/twl-familly.txt
> new file mode 100644
> index 0000000..ff4cacd
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/twl-familly.txt
> @@ -0,0 +1,47 @@
> +Texas Instruments TWL family
> +
> +The TWLs are Integrated Power Management Chips.
> +Some version might contain much more analog function like
> +USB transceiver or Audio amplifier.
> +These chips are connected to an i2c bus.
> +
> +
> +Required properties:
> +- compatible : Must be "ti,twl4030";
> +  For Integrated power-management/audio CODEC device used in OMAP3
> +  based boards
> +- compatible : Must be "ti,twl6030";
> +  For Integrated power-management used in OMAP4 based boards
> +- interrupts : This i2c device has an IRQ line connected to the main SoC
> +- interrupt-controller : Since the twl support several interrupts internally,
> +  it is considered as an interrupt controller cascaded to the SoC one.
> +- #interrupt-cells = <1>;
> +- interrupt-parent : The parent interrupt controller.
> +
> +Optional node:
> +- Child nodes contain in the twl. The twl family is made of severals variants
> +  that support a different number of features.
> +  The children nodes will thus depend of the capabilty of the variant.
> +
> +
> +Example:
> +/*
> + * Integrated Power Management Chip
> + * http://www.ti.com/lit/ds/symlink/twl6030.pdf
> + */
> +twl at 48 {
> +    compatible = "ti,twl6030";
> +    reg = <0x48>;
> +    interrupts = <39>; /* IRQ_SYS_1N cascaded to gic */
> +    interrupt-controller;
> +    #interrupt-cells = <1>;
> +    interrupt-parent = <&gic>;
> +    #address-cells = <1>;
> +    #size-cells = <0>;
> +
> +    twl_rtc {
> +        compatible = "ti,twl_rtc";
> +        interrupts = <11>;
> +        reg = <0>;
> +    };
> +};
> diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
> index bfbd660..524d9d8 100644
> --- a/drivers/mfd/twl-core.c
> +++ b/drivers/mfd/twl-core.c
> @@ -34,6 +34,10 @@
>  #include <linux/platform_device.h>
>  #include <linux/clk.h>
>  #include <linux/err.h>
> +#include <linux/slab.h>
> +#include <linux/of_irq.h>
> +#include <linux/of_platform.h>
> +#include <linux/irqdomain.h>
>  
>  #include <linux/regulator/machine.h>
>  
> @@ -1183,22 +1187,53 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
>  	int				status;
>  	unsigned			i;
>  	struct twl4030_platform_data	*pdata = client->dev.platform_data;
> +	struct device_node		*node = client->dev.of_node;
>  	u8 temp;
>  	int ret = 0;
>  
> +	if (node && !pdata) {
> +		/*
> +		 * XXX: Temporary fake pdata until the information
> +		 * is correctly retrieved by every TWL modules from DT.
> +		 */
> +		pdata = kzalloc(sizeof(struct twl4030_platform_data),
> +				GFP_KERNEL);

devm_kzalloc() so that it gets cleaned up on remove.

> +		if (!pdata) {
> +			status = -ENOMEM;
> +			goto exit;
> +		}
> +
> +		/*
> +		 * XXX: For the moment the IRQs for TWL seems to be encoded in
> +		 * the global OMAP space. That should be cleaned to allow
> +		 * dynamically adding a new IRQ controller.
> +		 */
> +		if ((id->driver_data) & TWL6030_CLASS) {
> +			pdata->irq_base = TWL6030_IRQ_BASE;
> +			pdata->irq_end = pdata->irq_base + TWL6030_BASE_NR_IRQS;
> +		} else {
> +			pdata->irq_base = TWL4030_IRQ_BASE;
> +			pdata->irq_end = pdata->irq_base + TWL4030_BASE_NR_IRQS;
> +		}
> +		irq_domain_add_simple(node, pdata->irq_base);

Yes, you'll want a follow-up patch to convert to dynamically allocated
irqs... but I've got to merge the final irq_domain work first.  :-)

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> +	}
> +
>  	if (!pdata) {
>  		dev_dbg(&client->dev, "no platform data?\n");
> -		return -EINVAL;
> +		status = -EINVAL;
> +		goto fail_free;
>  	}
>  
>  	if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C) == 0) {
>  		dev_dbg(&client->dev, "can't talk I2C?\n");
> -		return -EIO;
> +		status = -EIO;
> +		goto fail_free;
>  	}
>  
>  	if (inuse) {
>  		dev_dbg(&client->dev, "driver is already in use\n");
> -		return -EBUSY;
> +		status = -EBUSY;
> +		goto fail_free;
>  	}
>  
>  	for (i = 0; i < TWL_NUM_SLAVES; i++) {
> @@ -1270,10 +1305,20 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
>  		twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1);
>  	}
>  
> -	status = add_children(pdata, id->driver_data);
> +#ifdef CONFIG_OF_DEVICE
> +	if (node)
> +		status = of_platform_populate(node, NULL, NULL, &client->dev);
> +	else
> +#endif
> +		status = add_children(pdata, id->driver_data);
> +
>  fail:
>  	if (status < 0)
>  		twl_remove(client);
> +fail_free:
> +	if (node)
> +		kfree(pdata);
> +exit:
>  	return status;
>  }
>  
> -- 
> 1.7.0.4
> 

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

* Re: [PATCH v2 04/10] rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030
  2011-12-09 14:02   ` Benoit Cousson
@ 2012-01-04 18:13       ` Grant Likely
  -1 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:13 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: Alessandro Zummo, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Fri, Dec 09, 2011 at 03:02:35PM +0100, Benoit Cousson wrote:
> Add the DT support for the TI rtc-twl present in the twl4030
> and twl6030 devices.
> 
> Signed-off-by: Benoit Cousson <b-cousson-l0cyMroinI0@public.gmane.org>
> Cc: Alessandro Zummo <a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org>

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> ---
>  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
> 
> diff --git a/Documentation/devicetree/bindings/rtc/twl-rtc.txt b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
> new file mode 100644
> index 0000000..596e0c9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
> @@ -0,0 +1,12 @@
> +* TI twl RTC
> +
> +The TWL family (twl4030/6030) contains a RTC.
> +
> +Required properties:
> +- compatible : Should be twl4030-rtc
> +
> +Examples:
> +
> +rtc@0 {
> +    compatible = "ti,twl4030-rtc";
> +};
> diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
> index 20687d5..d43b4f6 100644
> --- a/drivers/rtc/rtc-twl.c
> +++ b/drivers/rtc/rtc-twl.c
> @@ -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,
>  	},
>  };
>  
> -- 
> 1.7.0.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 04/10] rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030
@ 2012-01-04 18:13       ` Grant Likely
  0 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Dec 09, 2011 at 03:02:35PM +0100, Benoit Cousson wrote:
> Add the DT support for the TI rtc-twl present in the twl4030
> and twl6030 devices.
> 
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Alessandro Zummo <a.zummo@towertech.it>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  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
> 
> diff --git a/Documentation/devicetree/bindings/rtc/twl-rtc.txt b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
> new file mode 100644
> index 0000000..596e0c9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/twl-rtc.txt
> @@ -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";
> +};
> diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
> index 20687d5..d43b4f6 100644
> --- a/drivers/rtc/rtc-twl.c
> +++ b/drivers/rtc/rtc-twl.c
> @@ -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,
>  	},
>  };
>  
> -- 
> 1.7.0.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 05/10] arm/dts: OMAP4: Add i2c controller nodes
  2011-12-09 14:02   ` Benoit Cousson
@ 2012-01-04 18:13       ` Grant Likely
  -1 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:13 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

On Fri, Dec 09, 2011 at 03:02:36PM +0100, Benoit Cousson wrote:
> Add i2c controllers nodes into the main ocp bus.
> 
> Signed-off-by: Benoit Cousson <b-cousson-l0cyMroinI0@public.gmane.org>
> Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> Cc: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> ---
>  arch/arm/boot/dts/omap4.dtsi |   28 ++++++++++++++++++++++++++++
>  1 files changed, 28 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
> index bede009..9872283 100644
> --- a/arch/arm/boot/dts/omap4.dtsi
> +++ b/arch/arm/boot/dts/omap4.dtsi
> @@ -100,5 +100,33 @@
>  			reg = <0x48241000 0x1000>,
>  			      <0x48240100 0x0100>;
>  		};
> +
> +		i2c1: i2c@1 {
> +			compatible = "ti,omap4-i2c";
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +			ti,hwmods = "i2c1";
> +		};
> +
> +		i2c2: i2c@2 {
> +			compatible = "ti,omap4-i2c";
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +			ti,hwmods = "i2c2";
> +		};
> +
> +		i2c3: i2c@3 {
> +			compatible = "ti,omap4-i2c";
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +			ti,hwmods = "i2c3";
> +		};
> +
> +		i2c4: i2c@4 {
> +			compatible = "ti,omap4-i2c";
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +			ti,hwmods = "i2c4";
> +		};
>  	};
>  };
> -- 
> 1.7.0.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 05/10] arm/dts: OMAP4: Add i2c controller nodes
@ 2012-01-04 18:13       ` Grant Likely
  0 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Dec 09, 2011 at 03:02:36PM +0100, Benoit Cousson wrote:
> Add i2c controllers nodes into the main ocp bus.
> 
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Rob Herring <rob.herring@calxeda.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/boot/dts/omap4.dtsi |   28 ++++++++++++++++++++++++++++
>  1 files changed, 28 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
> index bede009..9872283 100644
> --- a/arch/arm/boot/dts/omap4.dtsi
> +++ b/arch/arm/boot/dts/omap4.dtsi
> @@ -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";
> +		};
>  	};
>  };
> -- 
> 1.7.0.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 06/10] arm/dts: OMAP3: Add i2c controller nodes
  2011-12-09 14:02   ` Benoit Cousson
@ 2012-01-04 18:14       ` Grant Likely
  -1 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:14 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

On Fri, Dec 09, 2011 at 03:02:37PM +0100, Benoit Cousson wrote:
> Add i2c controllers nodes into the main ocp bus.
> 
> Signed-off-by: Benoit Cousson <b-cousson-l0cyMroinI0@public.gmane.org>
> Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> Cc: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> ---
>  arch/arm/boot/dts/omap3.dtsi |   28 ++++++++++++++++++++++++++++
>  1 files changed, 28 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
> index 6866dc7..81d8e2c 100644
> --- a/arch/arm/boot/dts/omap3.dtsi
> +++ b/arch/arm/boot/dts/omap3.dtsi
> @@ -61,5 +61,33 @@
>  			ti,intc-size = <96>;
>  			reg = <0x48200000 0x1000>;
>  		};
> +
> +		/*
> +		 * Flags for all i2c instances: 0x118
> +		 * APPLY_ERRATA_I207 | RESET_REGS_POSTIDLE | BUS_SHIFT_2
> +		 */
> +		i2c1: i2c@1 {
> +			compatible = "ti,omap3-i2c";
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +			ti,hwmods = "i2c1";
> +			ti,flags = <0x118>;
> +		};
> +
> +		i2c2: i2c@2 {
> +			compatible = "ti,omap3-i2c";
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +			ti,hwmods = "i2c2";
> +			ti,flags = <0x118>;
> +		};
> +
> +		i2c3: i2c@3 {
> +			compatible = "ti,omap3-i2c";
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +			ti,hwmods = "i2c3";
> +			ti,flags = <0x118>;
> +		};
>  	};
>  };
> -- 
> 1.7.0.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 06/10] arm/dts: OMAP3: Add i2c controller nodes
@ 2012-01-04 18:14       ` Grant Likely
  0 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Dec 09, 2011 at 03:02:37PM +0100, Benoit Cousson wrote:
> Add i2c controllers nodes into the main ocp bus.
> 
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Rob Herring <rob.herring@calxeda.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/boot/dts/omap3.dtsi |   28 ++++++++++++++++++++++++++++
>  1 files changed, 28 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
> index 6866dc7..81d8e2c 100644
> --- a/arch/arm/boot/dts/omap3.dtsi
> +++ b/arch/arm/boot/dts/omap3.dtsi
> @@ -61,5 +61,33 @@
>  			ti,intc-size = <96>;
>  			reg = <0x48200000 0x1000>;
>  		};
> +
> +		/*
> +		 * Flags for all i2c instances: 0x118
> +		 * APPLY_ERRATA_I207 | RESET_REGS_POSTIDLE | BUS_SHIFT_2
> +		 */
> +		i2c1: i2c at 1 {
> +			compatible = "ti,omap3-i2c";
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +			ti,hwmods = "i2c1";
> +			ti,flags = <0x118>;
> +		};
> +
> +		i2c2: i2c at 2 {
> +			compatible = "ti,omap3-i2c";
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +			ti,hwmods = "i2c2";
> +			ti,flags = <0x118>;
> +		};
> +
> +		i2c3: i2c at 3 {
> +			compatible = "ti,omap3-i2c";
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +			ti,hwmods = "i2c3";
> +			ti,flags = <0x118>;
> +		};
>  	};
>  };
> -- 
> 1.7.0.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 07/10] arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
  2011-12-09 14:02   ` Benoit Cousson
@ 2012-01-04 18:14       ` Grant Likely
  -1 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:14 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

On Fri, Dec 09, 2011 at 03:02:38PM +0100, Benoit Cousson wrote:
> 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.
> 
> Signed-off-by: Benoit Cousson <b-cousson-l0cyMroinI0@public.gmane.org>
> Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> ---
>  arch/arm/boot/dts/omap4-panda.dts |   45 +++++++++++++++++++++++++++++++++++++
>  1 files changed, 45 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
> index 9755ad5..b66bcd6 100644
> --- a/arch/arm/boot/dts/omap4-panda.dts
> +++ b/arch/arm/boot/dts/omap4-panda.dts
> @@ -18,3 +18,48 @@
>  		reg = <0x80000000 0x40000000>; /* 1 GB */
>  	};
>  };
> +
> +&i2c1 {
> +	clock-frequency = <400000>;
> +
> +	/*
> +	 * Integrated Power Management Chip
> +	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
> +	 */
> +	twl@48 {
> +		compatible = "ti,twl6030";
> +		reg = <0x48>;
> +		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
> +		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
> +		interrupt-controller;
> +		#interrupt-cells = <1>;
> +		interrupt-parent = <&gic>;
> +
> +		/* twl is a MFD, so it will contain a bunch of sub-ips */
> +		rtc {
> +			compatible = "ti,twl4030-rtc";
> +			interrupts = <11>;
> +		};
> +	};
> +};
> +
> +&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@50 {
> +		compatible = "ti,eeprom";
> +		reg = <0x50>;
> +	};
> +};
> +
> +&i2c4 {
> +	clock-frequency = <400000>;
> +};
> -- 
> 1.7.0.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 07/10] arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
@ 2012-01-04 18:14       ` Grant Likely
  0 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Dec 09, 2011 at 03:02:38PM +0100, Benoit Cousson wrote:
> 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.
> 
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/boot/dts/omap4-panda.dts |   45 +++++++++++++++++++++++++++++++++++++
>  1 files changed, 45 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
> index 9755ad5..b66bcd6 100644
> --- a/arch/arm/boot/dts/omap4-panda.dts
> +++ b/arch/arm/boot/dts/omap4-panda.dts
> @@ -18,3 +18,48 @@
>  		reg = <0x80000000 0x40000000>; /* 1 GB */
>  	};
>  };
> +
> +&i2c1 {
> +	clock-frequency = <400000>;
> +
> +	/*
> +	 * Integrated Power Management Chip
> +	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
> +	 */
> +	twl at 48 {
> +		compatible = "ti,twl6030";
> +		reg = <0x48>;
> +		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
> +		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
> +		interrupt-controller;
> +		#interrupt-cells = <1>;
> +		interrupt-parent = <&gic>;
> +
> +		/* twl is a MFD, so it will contain a bunch of sub-ips */
> +		rtc {
> +			compatible = "ti,twl4030-rtc";
> +			interrupts = <11>;
> +		};
> +	};
> +};
> +
> +&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>;
> +};
> -- 
> 1.7.0.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 08/10] arm/dts: omap4-sdp: Add twl6030, i2c3 and i2c4 devices
  2011-12-09 14:02   ` Benoit Cousson
@ 2012-01-04 18:14     ` Grant Likely
  -1 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:14 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: tony, rob.herring, devicetree-discuss, linux-omap, linux-arm-kernel

On Fri, Dec 09, 2011 at 03:02:39PM +0100, Benoit Cousson wrote:
> 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
> 
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/boot/dts/omap4-sdp.dts |   63 +++++++++++++++++++++++++++++++++++++++
>  1 files changed, 63 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
> index 63c6b2b..0ab14cb 100644
> --- a/arch/arm/boot/dts/omap4-sdp.dts
> +++ b/arch/arm/boot/dts/omap4-sdp.dts
> @@ -18,3 +18,66 @@
>  		reg = <0x80000000 0x40000000>; /* 1 GB */
>  	};
>  };
> +
> +&i2c1 {
> +	clock-frequency = <400000>;
> +
> +	/*
> +	 * Integrated Power Management Chip
> +	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
> +	 */
> +	twl@48 {
> +		compatible = "ti,twl6030";
> +		reg = <0x48>;
> +		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
> +		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
> +		interrupt-controller;
> +		#interrupt-cells = <1>;
> +		interrupt-parent = <&gic>;
> +
> +		/* twl is a MFD, so it will contain a bunch of sub-ips */
> +		rtc {
> +			compatible = "ti,twl4030-rtc";
> +			interrupts = <11>;
> +		};
> +	};
> +};
> +
> +&i2c2 {
> +	clock-frequency = <400000>;
> +};
> +
> +&i2c3 {
> +	clock-frequency = <400000>;
> +
> +	/*
> +	 * Temperature Sensor
> +	 * http://www.ti.com/lit/ds/symlink/tmp105.pdf
> +	 */
> +	tmp105@48 {
> +		compatible = "ti,tmp105";
> +		reg = <0x48>;
> +	};
> +
> +	/*
> +	 * Ambient Light Sensor
> +	 * http://www.rohm.com/products/databook/sensor/pdf/bh1780gli-e.pdf
> +	 */
> +	bh1780@29 {
> +		compatible = "rohm,bh1780";
> +		reg = <0x29>;
> +	};
> +};
> +
> +&i2c4 {
> +	clock-frequency = <400000>;
> +
> +	/*
> +	 * 3-Axis Digital Compass
> +	 * http://www.sparkfun.com/datasheets/Sensors/Magneto/HMC5843.pdf
> +	 */
> +	hmc5843@1e {
> +		compatible = "honeywell,hmc5843";
> +		reg = <0x1e>;
> +	};
> +};
> -- 
> 1.7.0.4
> 

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

* [PATCH v2 08/10] arm/dts: omap4-sdp: Add twl6030, i2c3 and i2c4 devices
@ 2012-01-04 18:14     ` Grant Likely
  0 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Dec 09, 2011 at 03:02:39PM +0100, Benoit Cousson wrote:
> 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
> 
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/boot/dts/omap4-sdp.dts |   63 +++++++++++++++++++++++++++++++++++++++
>  1 files changed, 63 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
> index 63c6b2b..0ab14cb 100644
> --- a/arch/arm/boot/dts/omap4-sdp.dts
> +++ b/arch/arm/boot/dts/omap4-sdp.dts
> @@ -18,3 +18,66 @@
>  		reg = <0x80000000 0x40000000>; /* 1 GB */
>  	};
>  };
> +
> +&i2c1 {
> +	clock-frequency = <400000>;
> +
> +	/*
> +	 * Integrated Power Management Chip
> +	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
> +	 */
> +	twl at 48 {
> +		compatible = "ti,twl6030";
> +		reg = <0x48>;
> +		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
> +		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
> +		interrupt-controller;
> +		#interrupt-cells = <1>;
> +		interrupt-parent = <&gic>;
> +
> +		/* twl is a MFD, so it will contain a bunch of sub-ips */
> +		rtc {
> +			compatible = "ti,twl4030-rtc";
> +			interrupts = <11>;
> +		};
> +	};
> +};
> +
> +&i2c2 {
> +	clock-frequency = <400000>;
> +};
> +
> +&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>;
> +	};
> +};
> -- 
> 1.7.0.4
> 

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

* Re: [PATCH v2 09/10] arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM
  2011-12-09 14:02   ` Benoit Cousson
@ 2012-01-04 18:15       ` Grant Likely
  -1 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:15 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

On Fri, Dec 09, 2011 at 03:02:40PM +0100, Benoit Cousson wrote:
> 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
> 
> Signed-off-by: Benoit Cousson <b-cousson-l0cyMroinI0@public.gmane.org>
> Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> Cc: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> ---
>  arch/arm/boot/dts/omap3-beagle.dts |   38 ++++++++++++++++++++++++++++++++++++
>  1 files changed, 38 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
> index 9f72cd4..b648279 100644
> --- a/arch/arm/boot/dts/omap3-beagle.dts
> +++ b/arch/arm/boot/dts/omap3-beagle.dts
> @@ -18,3 +18,41 @@
>  		reg = <0x80000000 0x20000000>; /* 512 MB */
>  	};
>  };
> +
> +&i2c1 {
> +	clock-frequency = <2600000>;
> +
> +	/*
> +	 * Integrated Power Management Chip
> +	 */
> +	twl@48 {
> +		compatible = "ti,twl4030";
> +		reg = <0x48>;
> +		interrupts = <7>; /* SYS_NIRQ cascaded to intc */
> +		interrupt-controller;
> +		#interrupt-cells = <1>;
> +		interrupt-parent = <&intc>;
> +
> +		twl_rtc {
> +			compatible = "ti,twl4030-rtc";
> +			interrupts = <11>;
> +		};
> +	};
> +};
> +
> +&i2c2 {
> +	clock-frequency = <400000>;
> +};
> +
> +&i2c3 {
> +	clock-frequency = <100000>;
> +
> +	/*
> +	 * Display monitor features are burnt in the EEPROM
> +	 * as EDID data.
> +	 */
> +	eeprom@50 {
> +		compatible = "ti,eeprom";
> +		reg = <0x50>;
> +	};
> +};
> -- 
> 1.7.0.4
> 

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

* [PATCH v2 09/10] arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM
@ 2012-01-04 18:15       ` Grant Likely
  0 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Dec 09, 2011 at 03:02:40PM +0100, Benoit Cousson wrote:
> 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
> 
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Rob Herring <rob.herring@calxeda.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/boot/dts/omap3-beagle.dts |   38 ++++++++++++++++++++++++++++++++++++
>  1 files changed, 38 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
> index 9f72cd4..b648279 100644
> --- a/arch/arm/boot/dts/omap3-beagle.dts
> +++ b/arch/arm/boot/dts/omap3-beagle.dts
> @@ -18,3 +18,41 @@
>  		reg = <0x80000000 0x20000000>; /* 512 MB */
>  	};
>  };
> +
> +&i2c1 {
> +	clock-frequency = <2600000>;
> +
> +	/*
> +	 * Integrated Power Management Chip
> +	 */
> +	twl at 48 {
> +		compatible = "ti,twl4030";
> +		reg = <0x48>;
> +		interrupts = <7>; /* SYS_NIRQ cascaded to intc */
> +		interrupt-controller;
> +		#interrupt-cells = <1>;
> +		interrupt-parent = <&intc>;
> +
> +		twl_rtc {
> +			compatible = "ti,twl4030-rtc";
> +			interrupts = <11>;
> +		};
> +	};
> +};
> +
> +&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>;
> +	};
> +};
> -- 
> 1.7.0.4
> 

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

* Re: [PATCH v2 10/10] ARM: OMAP2+: board-generic: Remove i2c static init
  2011-12-09 14:02   ` Benoit Cousson
@ 2012-01-04 18:15     ` Grant Likely
  -1 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:15 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: tony, rob.herring, devicetree-discuss, linux-omap, linux-arm-kernel

On Fri, Dec 09, 2011 at 03:02:41PM +0100, Benoit Cousson wrote:
> 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.
> 
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/mach-omap2/board-generic.c |   48 +---------------------------------
>  1 files changed, 2 insertions(+), 46 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
> index 16c301e..63a2495 100644
> --- a/arch/arm/mach-omap2/board-generic.c
> +++ b/arch/arm/mach-omap2/board-generic.c
> @@ -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
>  
>  #ifdef 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
> -- 
> 1.7.0.4
> 

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

* [PATCH v2 10/10] ARM: OMAP2+: board-generic: Remove i2c static init
@ 2012-01-04 18:15     ` Grant Likely
  0 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 18:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Dec 09, 2011 at 03:02:41PM +0100, Benoit Cousson wrote:
> 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.
> 
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/mach-omap2/board-generic.c |   48 +---------------------------------
>  1 files changed, 2 insertions(+), 46 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
> index 16c301e..63a2495 100644
> --- a/arch/arm/mach-omap2/board-generic.c
> +++ b/arch/arm/mach-omap2/board-generic.c
> @@ -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
>  
>  #ifdef 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
> -- 
> 1.7.0.4
> 

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

* Re: [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
  2012-01-04 13:36       ` Cousson, Benoit
@ 2012-01-04 21:28         ` Kevin Hilman
  -1 siblings, 0 replies; 82+ messages in thread
From: Kevin Hilman @ 2012-01-04 21:28 UTC (permalink / raw)
  To: Cousson, Benoit
  Cc: tony, rob.herring, devicetree-discuss, grant.likely, linux-omap,
	linux-arm-kernel, Ben Dooks

"Cousson, Benoit" <b-cousson@ti.com> writes:

> Hi Kevin,
>
> On 12/14/2011 2:06 AM, Kevin Hilman wrote:
>> Benoit Cousson<b-cousson@ti.com>  writes:
>>
>>> 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.
>>>
>>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>>> Cc: Ben Dooks<ben-linux@fluff.org>
>>
>> This seems indepenent from the rest of the series, and I can queue up
>> for merge via the I2C tree.
>>
>> Benoit, please confirm that we shouldn't have any problems if this patch
>> goes independently.
>>
>> Grant/Rob, with your ack on the bindings, I can queue this up for the
>> I2C maintainers along with some other OMAP I2C changes for v3.3.
>
> I removed the nasty bindings and got the Reviewed-by: from Rob for the
> v4 [1].
>
> Could you take it in your branch? I've just tried merging your
> for_3.3/i2c/misc on top of my for_3.3/3_omap_dt_i2c_twl branch and
> tested it successfully on OMAP4 DT boot.

Yes, I'll add v4 to my i2c/misc branch and add Grant's ack and queue.

Note that Ben Dooks has not responded to any of my queries or pull
requests, either for v3.2 fixes or for the v3.3 merge window, so
unfortunately it doesn't look like this will make it for v3.3 unless Ben
starts responding.  :(

Kevin

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

* [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
@ 2012-01-04 21:28         ` Kevin Hilman
  0 siblings, 0 replies; 82+ messages in thread
From: Kevin Hilman @ 2012-01-04 21:28 UTC (permalink / raw)
  To: linux-arm-kernel

"Cousson, Benoit" <b-cousson@ti.com> writes:

> Hi Kevin,
>
> On 12/14/2011 2:06 AM, Kevin Hilman wrote:
>> Benoit Cousson<b-cousson@ti.com>  writes:
>>
>>> 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.
>>>
>>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>>> Cc: Ben Dooks<ben-linux@fluff.org>
>>
>> This seems indepenent from the rest of the series, and I can queue up
>> for merge via the I2C tree.
>>
>> Benoit, please confirm that we shouldn't have any problems if this patch
>> goes independently.
>>
>> Grant/Rob, with your ack on the bindings, I can queue this up for the
>> I2C maintainers along with some other OMAP I2C changes for v3.3.
>
> I removed the nasty bindings and got the Reviewed-by: from Rob for the
> v4 [1].
>
> Could you take it in your branch? I've just tried merging your
> for_3.3/i2c/misc on top of my for_3.3/3_omap_dt_i2c_twl branch and
> tested it successfully on OMAP4 DT boot.

Yes, I'll add v4 to my i2c/misc branch and add Grant's ack and queue.

Note that Ben Dooks has not responded to any of my queries or pull
requests, either for v3.2 fixes or for the v3.3 merge window, so
unfortunately it doesn't look like this will make it for v3.3 unless Ben
starts responding.  :(

Kevin

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

* Re: [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
  2012-01-04 21:28         ` Kevin Hilman
@ 2012-01-04 21:56             ` Grant Likely
  -1 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 21:56 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Ben Dooks,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Wed, Jan 4, 2012 at 2:28 PM, Kevin Hilman <khilman-l0cyMroinI0@public.gmane.org> wrote:
> "Cousson, Benoit" <b-cousson-l0cyMroinI0@public.gmane.org> writes:
>
>> Hi Kevin,
>>
>> On 12/14/2011 2:06 AM, Kevin Hilman wrote:
>>> Benoit Cousson<b-cousson-l0cyMroinI0@public.gmane.org>  writes:
>>>
>>>> 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.
>>>>
>>>> Signed-off-by: Benoit Cousson<b-cousson-l0cyMroinI0@public.gmane.org>
>>>> Cc: Ben Dooks<ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
>>>
>>> This seems indepenent from the rest of the series, and I can queue up
>>> for merge via the I2C tree.
>>>
>>> Benoit, please confirm that we shouldn't have any problems if this patch
>>> goes independently.
>>>
>>> Grant/Rob, with your ack on the bindings, I can queue this up for the
>>> I2C maintainers along with some other OMAP I2C changes for v3.3.
>>
>> I removed the nasty bindings and got the Reviewed-by: from Rob for the
>> v4 [1].
>>
>> Could you take it in your branch? I've just tried merging your
>> for_3.3/i2c/misc on top of my for_3.3/3_omap_dt_i2c_twl branch and
>> tested it successfully on OMAP4 DT boot.
>
> Yes, I'll add v4 to my i2c/misc branch and add Grant's ack and queue.
>
> Note that Ben Dooks has not responded to any of my queries or pull
> requests, either for v3.2 fixes or for the v3.3 merge window, so
> unfortunately it doesn't look like this will make it for v3.3 unless Ben
> starts responding.  :(
>
> Kevin

Get it into linux-next anyway.  If Ben doesn't respond, then you can
ask Linus to pull directly near the end of the merge window.  I don't
see any benefit in making this sit out for another cycle.

g.



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
@ 2012-01-04 21:56             ` Grant Likely
  0 siblings, 0 replies; 82+ messages in thread
From: Grant Likely @ 2012-01-04 21:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jan 4, 2012 at 2:28 PM, Kevin Hilman <khilman@ti.com> wrote:
> "Cousson, Benoit" <b-cousson@ti.com> writes:
>
>> Hi Kevin,
>>
>> On 12/14/2011 2:06 AM, Kevin Hilman wrote:
>>> Benoit Cousson<b-cousson@ti.com> ?writes:
>>>
>>>> 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.
>>>>
>>>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>>>> Cc: Ben Dooks<ben-linux@fluff.org>
>>>
>>> This seems indepenent from the rest of the series, and I can queue up
>>> for merge via the I2C tree.
>>>
>>> Benoit, please confirm that we shouldn't have any problems if this patch
>>> goes independently.
>>>
>>> Grant/Rob, with your ack on the bindings, I can queue this up for the
>>> I2C maintainers along with some other OMAP I2C changes for v3.3.
>>
>> I removed the nasty bindings and got the Reviewed-by: from Rob for the
>> v4 [1].
>>
>> Could you take it in your branch? I've just tried merging your
>> for_3.3/i2c/misc on top of my for_3.3/3_omap_dt_i2c_twl branch and
>> tested it successfully on OMAP4 DT boot.
>
> Yes, I'll add v4 to my i2c/misc branch and add Grant's ack and queue.
>
> Note that Ben Dooks has not responded to any of my queries or pull
> requests, either for v3.2 fixes or for the v3.3 merge window, so
> unfortunately it doesn't look like this will make it for v3.3 unless Ben
> starts responding. ?:(
>
> Kevin

Get it into linux-next anyway.  If Ben doesn't respond, then you can
ask Linus to pull directly near the end of the merge window.  I don't
see any benefit in making this sit out for another cycle.

g.



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH v2 03/10] mfd: twl-core: Add initial DT support for twl4030/twl6030
  2012-01-04 18:12       ` Grant Likely
@ 2012-01-05 10:21           ` Cousson, Benoit
  -1 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2012-01-05 10:21 UTC (permalink / raw)
  To: Grant Likely
  Cc: Balaji T K, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Graeme Gregory,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Samuel Ortiz

Hi Grant,

On 1/4/2012 7:12 PM, Grant Likely wrote:
> On Fri, Dec 09, 2011 at 03:02:34PM +0100, Benoit Cousson wrote:

[...]

>> @@ -1183,22 +1187,53 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
>>   	int				status;
>>   	unsigned			i;
>>   	struct twl4030_platform_data	*pdata = client->dev.platform_data;
>> +	struct device_node		*node = client->dev.of_node;
>>   	u8 temp;
>>   	int ret = 0;
>>
>> +	if (node&&  !pdata) {
>> +		/*
>> +		 * XXX: Temporary fake pdata until the information
>> +		 * is correctly retrieved by every TWL modules from DT.
>> +		 */
>> +		pdata = kzalloc(sizeof(struct twl4030_platform_data),
>> +				GFP_KERNEL);
>
> devm_kzalloc() so that it gets cleaned up on remove.

Yep, it was already updated like that in the v4.

>> +		if (!pdata) {
>> +			status = -ENOMEM;
>> +			goto exit;
>> +		}
>> +
>> +		/*
>> +		 * XXX: For the moment the IRQs for TWL seems to be encoded in
>> +		 * the global OMAP space. That should be cleaned to allow
>> +		 * dynamically adding a new IRQ controller.
>> +		 */
>> +		if ((id->driver_data)&  TWL6030_CLASS) {
>> +			pdata->irq_base = TWL6030_IRQ_BASE;
>> +			pdata->irq_end = pdata->irq_base + TWL6030_BASE_NR_IRQS;
>> +		} else {
>> +			pdata->irq_base = TWL4030_IRQ_BASE;
>> +			pdata->irq_end = pdata->irq_base + TWL4030_BASE_NR_IRQS;
>> +		}
>> +		irq_domain_add_simple(node, pdata->irq_base);
>
> Yes, you'll want a follow-up patch to convert to dynamically allocated
> irqs... but I've got to merge the final irq_domain work first.  :-)

Yes. I already have a version based on Rob's series, but did not push it 
since Rob was not confident with the merge of that feature for 3.3.

> Acked-by: Grant Likely<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

Thanks,
Benoit

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

* [PATCH v2 03/10] mfd: twl-core: Add initial DT support for twl4030/twl6030
@ 2012-01-05 10:21           ` Cousson, Benoit
  0 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2012-01-05 10:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Grant,

On 1/4/2012 7:12 PM, Grant Likely wrote:
> On Fri, Dec 09, 2011 at 03:02:34PM +0100, Benoit Cousson wrote:

[...]

>> @@ -1183,22 +1187,53 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
>>   	int				status;
>>   	unsigned			i;
>>   	struct twl4030_platform_data	*pdata = client->dev.platform_data;
>> +	struct device_node		*node = client->dev.of_node;
>>   	u8 temp;
>>   	int ret = 0;
>>
>> +	if (node&&  !pdata) {
>> +		/*
>> +		 * XXX: Temporary fake pdata until the information
>> +		 * is correctly retrieved by every TWL modules from DT.
>> +		 */
>> +		pdata = kzalloc(sizeof(struct twl4030_platform_data),
>> +				GFP_KERNEL);
>
> devm_kzalloc() so that it gets cleaned up on remove.

Yep, it was already updated like that in the v4.

>> +		if (!pdata) {
>> +			status = -ENOMEM;
>> +			goto exit;
>> +		}
>> +
>> +		/*
>> +		 * XXX: For the moment the IRQs for TWL seems to be encoded in
>> +		 * the global OMAP space. That should be cleaned to allow
>> +		 * dynamically adding a new IRQ controller.
>> +		 */
>> +		if ((id->driver_data)&  TWL6030_CLASS) {
>> +			pdata->irq_base = TWL6030_IRQ_BASE;
>> +			pdata->irq_end = pdata->irq_base + TWL6030_BASE_NR_IRQS;
>> +		} else {
>> +			pdata->irq_base = TWL4030_IRQ_BASE;
>> +			pdata->irq_end = pdata->irq_base + TWL4030_BASE_NR_IRQS;
>> +		}
>> +		irq_domain_add_simple(node, pdata->irq_base);
>
> Yes, you'll want a follow-up patch to convert to dynamically allocated
> irqs... but I've got to merge the final irq_domain work first.  :-)

Yes. I already have a version based on Rob's series, but did not push it 
since Rob was not confident with the merge of that feature for 3.3.

> Acked-by: Grant Likely<grant.likely@secretlab.ca>

Thanks,
Benoit

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

* Re: [PATCH v2 09/10] arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM
  2011-12-09 14:02   ` Benoit Cousson
@ 2012-01-09 23:24     ` Tabi Timur-B04825
  -1 siblings, 0 replies; 82+ messages in thread
From: Tabi Timur-B04825 @ 2012-01-09 23:24 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: tony, rob.herring, grant.likely, devicetree-discuss, linux-omap,
	linux-arm-kernel

On Fri, Dec 9, 2011 at 8:02 AM, Benoit Cousson <b-cousson@ti.com> wrote:
>
> +       eeprom@50 {
> +               compatible = "ti,eeprom";
> +               reg = <0x50>;
> +       };

Why is this "ti,"?  For EDID, isn't the I2C device actually on the
monitor itself, and DVI cable just connects to the I2C bus?

The reason I ask is that I'm trying to do the same thing for a PowerPC
board.  I need to defined an EDID I2C node.

-- 
Timur Tabi
Linux kernel developer at Freescale
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 09/10] arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM
@ 2012-01-09 23:24     ` Tabi Timur-B04825
  0 siblings, 0 replies; 82+ messages in thread
From: Tabi Timur-B04825 @ 2012-01-09 23:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Dec 9, 2011 at 8:02 AM, Benoit Cousson <b-cousson@ti.com> wrote:
>
> + ? ? ? eeprom at 50 {
> + ? ? ? ? ? ? ? compatible = "ti,eeprom";
> + ? ? ? ? ? ? ? reg = <0x50>;
> + ? ? ? };

Why is this "ti,"?  For EDID, isn't the I2C device actually on the
monitor itself, and DVI cable just connects to the I2C bus?

The reason I ask is that I'm trying to do the same thing for a PowerPC
board.  I need to defined an EDID I2C node.

-- 
Timur Tabi
Linux kernel developer at Freescale

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

* Re: [PATCH v2 09/10] arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM
  2012-01-09 23:24     ` Tabi Timur-B04825
@ 2012-01-10 10:09       ` Cousson, Benoit
  -1 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2012-01-10 10:09 UTC (permalink / raw)
  To: Tabi Timur-B04825
  Cc: tony, rob.herring, grant.likely, devicetree-discuss, linux-omap,
	linux-arm-kernel

On 1/10/2012 12:24 AM, Tabi Timur-B04825 wrote:
> On Fri, Dec 9, 2011 at 8:02 AM, Benoit Cousson<b-cousson@ti.com>  wrote:
>>
>> +       eeprom@50 {
>> +               compatible = "ti,eeprom";
>> +               reg =<0x50>;
>> +       };
>
> Why is this "ti,"?  For EDID, isn't the I2C device actually on the
> monitor itself, and DVI cable just connects to the I2C bus?

Yes, in fact I didn't know what to put here, since I do not know what 
kind of eeprom the monitor will use.

And then I realized that the i2c driver is using the compatible name 
without the prefix, so any prefix can be used there...
OK, that's maybe not a very valid reason... but I did not find any 
better prefix at that time:-)

> The reason I ask is that I'm trying to do the same thing for a PowerPC
> board.  I need to defined an EDID I2C node.

Well, this seems to be generic i2c eeprom, so maybe a "ddc," prefix or 
"edid," will be a little bit better.

If later, we want to access that node from the display driver, we can 
just add a phandle to the node's label: "edid-eeprom: eeprom@50:"

Regards,
Benoit


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

* [PATCH v2 09/10] arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM
@ 2012-01-10 10:09       ` Cousson, Benoit
  0 siblings, 0 replies; 82+ messages in thread
From: Cousson, Benoit @ 2012-01-10 10:09 UTC (permalink / raw)
  To: linux-arm-kernel

On 1/10/2012 12:24 AM, Tabi Timur-B04825 wrote:
> On Fri, Dec 9, 2011 at 8:02 AM, Benoit Cousson<b-cousson@ti.com>  wrote:
>>
>> +       eeprom at 50 {
>> +               compatible = "ti,eeprom";
>> +               reg =<0x50>;
>> +       };
>
> Why is this "ti,"?  For EDID, isn't the I2C device actually on the
> monitor itself, and DVI cable just connects to the I2C bus?

Yes, in fact I didn't know what to put here, since I do not know what 
kind of eeprom the monitor will use.

And then I realized that the i2c driver is using the compatible name 
without the prefix, so any prefix can be used there...
OK, that's maybe not a very valid reason... but I did not find any 
better prefix at that time:-)

> The reason I ask is that I'm trying to do the same thing for a PowerPC
> board.  I need to defined an EDID I2C node.

Well, this seems to be generic i2c eeprom, so maybe a "ddc," prefix or 
"edid," will be a little bit better.

If later, we want to access that node from the display driver, we can 
just add a phandle to the node's label: "edid-eeprom: eeprom at 50:"

Regards,
Benoit

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

end of thread, other threads:[~2012-01-10 10:09 UTC | newest]

Thread overview: 82+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-09 14:02 [PATCH v2 00/10] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
2011-12-09 14:02 ` Benoit Cousson
2011-12-09 14:02 ` [PATCH v2 01/10] ARM: OMAP2+: pm: Do not init statically the SR and voltage layer with DT Benoit Cousson
2011-12-09 14:02   ` Benoit Cousson
2012-01-04 18:04   ` Grant Likely
2012-01-04 18:04     ` Grant Likely
2011-12-09 14:02 ` [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller Benoit Cousson
2011-12-09 14:02   ` Benoit Cousson
2011-12-14  1:06   ` Kevin Hilman
2011-12-14  1:06     ` Kevin Hilman
2012-01-04 13:36     ` Cousson, Benoit
2012-01-04 13:36       ` Cousson, Benoit
2012-01-04 18:08       ` Grant Likely
2012-01-04 18:08         ` Grant Likely
2012-01-04 21:28       ` Kevin Hilman
2012-01-04 21:28         ` Kevin Hilman
     [not found]         ` <87obujb1j2.fsf-l0cyMroinI0@public.gmane.org>
2012-01-04 21:56           ` Grant Likely
2012-01-04 21:56             ` Grant Likely
2011-12-14 16:58   ` Rob Herring
2011-12-14 16:58     ` Rob Herring
2011-12-15 15:05     ` Cousson, Benoit
2011-12-15 15:05       ` Cousson, Benoit
2011-12-15 15:48       ` Rob Herring
2011-12-15 15:48         ` Rob Herring
2011-12-15 16:09         ` Cousson, Benoit
2011-12-15 16:09           ` Cousson, Benoit
     [not found]   ` <1323439361-1647-3-git-send-email-b-cousson-l0cyMroinI0@public.gmane.org>
2011-12-22  8:22     ` Shubhrajyoti
2011-12-22  8:22       ` Shubhrajyoti
2011-12-09 14:02 ` [PATCH v2 03/10] mfd: twl-core: Add initial DT support for twl4030/twl6030 Benoit Cousson
2011-12-09 14:02   ` Benoit Cousson
2011-12-19 12:03   ` Samuel Ortiz
2011-12-19 12:03     ` Samuel Ortiz
2011-12-19 13:53     ` Cousson, Benoit
2011-12-19 13:53       ` Cousson, Benoit
     [not found]   ` <1323439361-1647-4-git-send-email-b-cousson-l0cyMroinI0@public.gmane.org>
2012-01-04 18:12     ` Grant Likely
2012-01-04 18:12       ` Grant Likely
     [not found]       ` <20120104181224.GJ15503-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2012-01-05 10:21         ` Cousson, Benoit
2012-01-05 10:21           ` Cousson, Benoit
2011-12-09 14:02 ` [PATCH v2 04/10] rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030 Benoit Cousson
2011-12-09 14:02   ` Benoit Cousson
     [not found]   ` <1323439361-1647-5-git-send-email-b-cousson-l0cyMroinI0@public.gmane.org>
2011-12-19 16:52     ` Cousson, Benoit
2011-12-19 16:52       ` Cousson, Benoit
2011-12-26  1:18       ` Alessandro Zummo
2011-12-26  1:18         ` Alessandro Zummo
2011-12-20 15:13     ` Cousson, Benoit
2011-12-20 15:13       ` Cousson, Benoit
2012-01-04 18:13     ` Grant Likely
2012-01-04 18:13       ` Grant Likely
2011-12-09 14:02 ` [PATCH v2 05/10] arm/dts: OMAP4: Add i2c controller nodes Benoit Cousson
2011-12-09 14:02   ` Benoit Cousson
     [not found]   ` <1323439361-1647-6-git-send-email-b-cousson-l0cyMroinI0@public.gmane.org>
2012-01-04 18:13     ` Grant Likely
2012-01-04 18:13       ` Grant Likely
2011-12-09 14:02 ` [PATCH v2 06/10] arm/dts: OMAP3: " Benoit Cousson
2011-12-09 14:02   ` Benoit Cousson
     [not found]   ` <1323439361-1647-7-git-send-email-b-cousson-l0cyMroinI0@public.gmane.org>
2012-01-04 18:14     ` Grant Likely
2012-01-04 18:14       ` Grant Likely
2011-12-09 14:02 ` [PATCH v2 07/10] arm/dts: omap4-panda: Add twl6030 and i2c EEPROM Benoit Cousson
2011-12-09 14:02   ` Benoit Cousson
2011-12-14  5:06   ` Kevin Hilman
2011-12-14  5:06     ` Kevin Hilman
2011-12-14 16:50     ` Cousson, Benoit
2011-12-14 16:50       ` Cousson, Benoit
2011-12-15  0:31       ` Kevin Hilman
2011-12-15  0:31         ` Kevin Hilman
     [not found]   ` <1323439361-1647-8-git-send-email-b-cousson-l0cyMroinI0@public.gmane.org>
2012-01-04 18:14     ` Grant Likely
2012-01-04 18:14       ` Grant Likely
2011-12-09 14:02 ` [PATCH v2 08/10] arm/dts: omap4-sdp: Add twl6030, i2c3 and i2c4 devices Benoit Cousson
2011-12-09 14:02   ` Benoit Cousson
2012-01-04 18:14   ` Grant Likely
2012-01-04 18:14     ` Grant Likely
2011-12-09 14:02 ` [PATCH v2 09/10] arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM Benoit Cousson
2011-12-09 14:02   ` Benoit Cousson
     [not found]   ` <1323439361-1647-10-git-send-email-b-cousson-l0cyMroinI0@public.gmane.org>
2012-01-04 18:15     ` Grant Likely
2012-01-04 18:15       ` Grant Likely
2012-01-09 23:24   ` Tabi Timur-B04825
2012-01-09 23:24     ` Tabi Timur-B04825
2012-01-10 10:09     ` Cousson, Benoit
2012-01-10 10:09       ` Cousson, Benoit
2011-12-09 14:02 ` [PATCH v2 10/10] ARM: OMAP2+: board-generic: Remove i2c static init Benoit Cousson
2011-12-09 14:02   ` Benoit Cousson
2012-01-04 18:15   ` Grant Likely
2012-01-04 18:15     ` Grant Likely

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.