All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] pm: Add power off control
@ 2012-11-05  9:42 ` AnilKumar Ch
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar Ch @ 2012-11-05  9:42 UTC (permalink / raw)
  To: a.zummo, sameo, tony
  Cc: rtc-linux, devicetree-discuss, rob.herring, grant.likely,
	AnilKumar Ch, linux-omap, linux-arm-kernel

Add PM power_off control to rtc driver, along with this PMIC status
is set to STATUS_OFF to shutdown PMIC if PWR_EN is toggled by RTC
module.

System power off sequence:-
* Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
* Enable PMIC_POWER_EN in rtc module
* Set rtc ALARM2 time
* Enable ALARM2 interrupt

These patches were tested on AM335x-Bone.

AnilKumar Ch (2):
  ARM: dts: AM33XX: Set pmic-shutdown-controller for BeagleBone
  ARM: dts: AM33XX: Enable system power off control in am335x-bone

Colin Foe-Parker (2):
  mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
  rtc: OMAP: Add system pm_power_off to rtc driver

 .../devicetree/bindings/regulator/tps65217.txt     |    4 +
 Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
 arch/arm/boot/dts/am335x-bone.dts                  |    6 ++
 drivers/mfd/tps65217.c                             |   12 +++
 drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
 5 files changed, 105 insertions(+), 1 deletion(-)

-- 
1.7.9.5

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

* [PATCH 0/4] pm: Add power off control
@ 2012-11-05  9:42 ` AnilKumar Ch
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar Ch @ 2012-11-05  9:42 UTC (permalink / raw)
  To: linux-arm-kernel

Add PM power_off control to rtc driver, along with this PMIC status
is set to STATUS_OFF to shutdown PMIC if PWR_EN is toggled by RTC
module.

System power off sequence:-
* Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
* Enable PMIC_POWER_EN in rtc module
* Set rtc ALARM2 time
* Enable ALARM2 interrupt

These patches were tested on AM335x-Bone.

AnilKumar Ch (2):
  ARM: dts: AM33XX: Set pmic-shutdown-controller for BeagleBone
  ARM: dts: AM33XX: Enable system power off control in am335x-bone

Colin Foe-Parker (2):
  mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
  rtc: OMAP: Add system pm_power_off to rtc driver

 .../devicetree/bindings/regulator/tps65217.txt     |    4 +
 Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
 arch/arm/boot/dts/am335x-bone.dts                  |    6 ++
 drivers/mfd/tps65217.c                             |   12 +++
 drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
 5 files changed, 105 insertions(+), 1 deletion(-)

-- 
1.7.9.5

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

* [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
  2012-11-05  9:42 ` AnilKumar Ch
@ 2012-11-05  9:42   ` AnilKumar Ch
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar Ch @ 2012-11-05  9:42 UTC (permalink / raw)
  To: a.zummo, sameo, tony
  Cc: grant.likely, rob.herring, rtc-linux, linux-omap,
	linux-arm-kernel, devicetree-discuss, Colin Foe-Parker,
	AnilKumar Ch

From: Colin Foe-Parker <colin.foeparker@logicpd.com>

Set tps65217 PMIC status to OFF if power enable toggle is
supported. Also adds platform data flag, which should be
passed from board init data.

Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
[anilkumar@ti.com: move the additions to tps65217 MFD driver]
Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
---
 .../devicetree/bindings/regulator/tps65217.txt     |    4 ++++
 drivers/mfd/tps65217.c                             |   12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/tps65217.txt b/Documentation/devicetree/bindings/regulator/tps65217.txt
index d316fb8..4f05d20 100644
--- a/Documentation/devicetree/bindings/regulator/tps65217.txt
+++ b/Documentation/devicetree/bindings/regulator/tps65217.txt
@@ -11,6 +11,9 @@ Required properties:
   using the standard binding for regulators found at
   Documentation/devicetree/bindings/regulator/regulator.txt.
 
+Optional properties:
+- ti,pmic-shutdown-controller: Telling the PMIC to shutdown on PWR_EN toggle.
+
   The valid names for regulators are:
   tps65217: dcdc1, dcdc2, dcdc3, ldo1, ldo2, ldo3 and ldo4
 
@@ -20,6 +23,7 @@ Example:
 
 	tps: tps@24 {
 		compatible = "ti,tps65217";
+		ti,pmic-shutdown-controller;
 
 		regulators {
 			dcdc1_reg: dcdc1 {
diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c
index 3fb32e6..c7f17d8 100644
--- a/drivers/mfd/tps65217.c
+++ b/drivers/mfd/tps65217.c
@@ -160,6 +160,7 @@ static int __devinit tps65217_probe(struct i2c_client *client,
 	unsigned int version;
 	unsigned int chip_id = ids->driver_data;
 	const struct of_device_id *match;
+	bool status_off = false;
 	int ret;
 
 	if (client->dev.of_node) {
@@ -170,6 +171,8 @@ static int __devinit tps65217_probe(struct i2c_client *client,
 			return -EINVAL;
 		}
 		chip_id = (unsigned int)match->data;
+		status_off = of_property_read_bool(client->dev.of_node,
+					"ti,pmic-shutdown-controller");
 	}
 
 	if (!chip_id) {
@@ -207,6 +210,15 @@ static int __devinit tps65217_probe(struct i2c_client *client,
 		return ret;
 	}
 
+	/* Set the PMIC to shutdown on PWR_EN toggle */
+	if (status_off) {
+		ret = tps65217_set_bits(tps, TPS65217_REG_STATUS,
+				TPS65217_STATUS_OFF, TPS65217_STATUS_OFF,
+				TPS65217_PROTECT_NONE);
+		if (ret)
+			dev_warn(tps->dev, "unable to set the status OFF\n");
+	}
+
 	dev_info(tps->dev, "TPS65217 ID %#x version 1.%d\n",
 			(version & TPS65217_CHIPID_CHIP_MASK) >> 4,
 			version & TPS65217_CHIPID_REV_MASK);
-- 
1.7.9.5


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

* [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
@ 2012-11-05  9:42   ` AnilKumar Ch
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar Ch @ 2012-11-05  9:42 UTC (permalink / raw)
  To: linux-arm-kernel

From: Colin Foe-Parker <colin.foeparker@logicpd.com>

Set tps65217 PMIC status to OFF if power enable toggle is
supported. Also adds platform data flag, which should be
passed from board init data.

Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
[anilkumar at ti.com: move the additions to tps65217 MFD driver]
Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
---
 .../devicetree/bindings/regulator/tps65217.txt     |    4 ++++
 drivers/mfd/tps65217.c                             |   12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/tps65217.txt b/Documentation/devicetree/bindings/regulator/tps65217.txt
index d316fb8..4f05d20 100644
--- a/Documentation/devicetree/bindings/regulator/tps65217.txt
+++ b/Documentation/devicetree/bindings/regulator/tps65217.txt
@@ -11,6 +11,9 @@ Required properties:
   using the standard binding for regulators found at
   Documentation/devicetree/bindings/regulator/regulator.txt.
 
+Optional properties:
+- ti,pmic-shutdown-controller: Telling the PMIC to shutdown on PWR_EN toggle.
+
   The valid names for regulators are:
   tps65217: dcdc1, dcdc2, dcdc3, ldo1, ldo2, ldo3 and ldo4
 
@@ -20,6 +23,7 @@ Example:
 
 	tps: tps at 24 {
 		compatible = "ti,tps65217";
+		ti,pmic-shutdown-controller;
 
 		regulators {
 			dcdc1_reg: dcdc1 {
diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c
index 3fb32e6..c7f17d8 100644
--- a/drivers/mfd/tps65217.c
+++ b/drivers/mfd/tps65217.c
@@ -160,6 +160,7 @@ static int __devinit tps65217_probe(struct i2c_client *client,
 	unsigned int version;
 	unsigned int chip_id = ids->driver_data;
 	const struct of_device_id *match;
+	bool status_off = false;
 	int ret;
 
 	if (client->dev.of_node) {
@@ -170,6 +171,8 @@ static int __devinit tps65217_probe(struct i2c_client *client,
 			return -EINVAL;
 		}
 		chip_id = (unsigned int)match->data;
+		status_off = of_property_read_bool(client->dev.of_node,
+					"ti,pmic-shutdown-controller");
 	}
 
 	if (!chip_id) {
@@ -207,6 +210,15 @@ static int __devinit tps65217_probe(struct i2c_client *client,
 		return ret;
 	}
 
+	/* Set the PMIC to shutdown on PWR_EN toggle */
+	if (status_off) {
+		ret = tps65217_set_bits(tps, TPS65217_REG_STATUS,
+				TPS65217_STATUS_OFF, TPS65217_STATUS_OFF,
+				TPS65217_PROTECT_NONE);
+		if (ret)
+			dev_warn(tps->dev, "unable to set the status OFF\n");
+	}
+
 	dev_info(tps->dev, "TPS65217 ID %#x version 1.%d\n",
 			(version & TPS65217_CHIPID_CHIP_MASK) >> 4,
 			version & TPS65217_CHIPID_REV_MASK);
-- 
1.7.9.5

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

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
  2012-11-05  9:42 ` AnilKumar Ch
@ 2012-11-05  9:42   ` AnilKumar Ch
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar Ch @ 2012-11-05  9:42 UTC (permalink / raw)
  To: a.zummo, sameo, tony
  Cc: grant.likely, rob.herring, rtc-linux, linux-omap,
	linux-arm-kernel, devicetree-discuss, Colin Foe-Parker,
	AnilKumar Ch

From: Colin Foe-Parker <colin.foeparker@logicpd.com>

Add system power off control to rtc driver which is the in-charge
of controlling the BeagleBone system power. The power_off routine
can be hooked up to "pm_power_off" system call.

System power off sequence:-
* Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
* Enable PMIC_POWER_EN in rtc module
* Set rtc ALARM2 time
* Enable ALARM2 interrupt

Added while (1); after the above steps to make sure that no other
process acquire cpu. Otherwise we might see an unexpected behaviour
because we are shutting down all the power rails of SoC except RTC.

Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
[anilkumar@ti.com: move poweroff additions to rtc driver]
Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
---
 Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
 drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
 2 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
index b47aa41..8d9f4f9 100644
--- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
+++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
@@ -6,6 +6,10 @@ Required properties:
 - interrupts: rtc timer, alarm interrupts in order
 - interrupt-parent: phandle for the interrupt controller
 
+Optional properties:
+- ti,system-power-controller: Telling whether or not rtc is controlling
+  the system power.
+
 Example:
 
 rtc@1c23000 {
@@ -14,4 +18,5 @@ rtc@1c23000 {
 	interrupts = <19
 		      19>;
 	interrupt-parent = <&intc>;
+	ti,system-power-controller;
 };
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 6009714..2d90170 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -72,6 +72,14 @@
 #define OMAP_RTC_KICK0_REG		0x6c
 #define OMAP_RTC_KICK1_REG		0x70
 
+#define OMAP_RTC_ALARM2_SECONDS_REG	0x80
+#define OMAP_RTC_ALARM2_MINUTES_REG	0x84
+#define OMAP_RTC_ALARM2_HOURS_REG	0x88
+#define OMAP_RTC_ALARM2_DAYS_REG	0x8c
+#define OMAP_RTC_ALARM2_MONTHS_REG	0x90
+#define OMAP_RTC_ALARM2_YEARS_REG	0x94
+#define OMAP_RTC_PMIC_REG		0x98
+
 /* OMAP_RTC_CTRL_REG bit fields: */
 #define OMAP_RTC_CTRL_SPLIT		(1<<7)
 #define OMAP_RTC_CTRL_DISABLE		(1<<6)
@@ -93,15 +101,24 @@
 #define OMAP_RTC_STATUS_BUSY            (1<<0)
 
 /* OMAP_RTC_INTERRUPTS_REG bit fields: */
+#define OMAP_RTC_INTERRUPTS_IT_ALARM2   (1<<4)
 #define OMAP_RTC_INTERRUPTS_IT_ALARM    (1<<3)
 #define OMAP_RTC_INTERRUPTS_IT_TIMER    (1<<2)
 
+/* OMAP_RTC_PMIC_REG bit fields: */
+#define OMAP_RTC_PMIC_POWER_EN_EN       (1<<16)
+
 /* OMAP_RTC_KICKER values */
 #define	KICK0_VALUE			0x83e70b13
 #define	KICK1_VALUE			0x95a4f1e0
 
 #define	OMAP_RTC_HAS_KICKER		0x1
 
+#define SHUTDOWN_TIME_SEC		2
+#define SECS_IN_MIN			60
+#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
+#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
+
 static void __iomem	*rtc_base;
 
 #define rtc_read(addr)		readb(rtc_base + (addr))
@@ -290,6 +307,58 @@ static int omap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 	return 0;
 }
 
+/*
+ * rtc_power_off: Set the pmic power off sequence. The RTC generates
+ * pmic_pwr_enable control, which can be used to control an external
+ * PMIC.
+ */
+static void rtc_power_off(void)
+{
+	u32 val;
+	struct rtc_time tm;
+	spinlock_t lock;
+	unsigned long flags;
+
+	spin_lock_init(&lock);
+
+	/* Set PMIC power enable */
+	val = readl(rtc_base + OMAP_RTC_PMIC_REG);
+	writel(val | OMAP_RTC_PMIC_POWER_EN_EN, rtc_base + OMAP_RTC_PMIC_REG);
+
+	/* Wait few seconds instead of rollover */
+	do {
+		omap_rtc_read_time(NULL, &tm);
+		if (WAIT_AFTER <= tm.tm_sec)
+			mdelay(WAIT_TIME_MS);
+	} while (WAIT_AFTER <= tm.tm_sec);
+
+	/* Add shutdown time to the current value */
+	tm.tm_sec += SHUTDOWN_TIME_SEC;
+
+	if (tm2bcd(&tm) < 0)
+		return;
+
+	pr_info("System will go to power_off state in approx. %d secs\n",
+			SHUTDOWN_TIME_SEC);
+
+	/* Set the ALARM2 time */
+	rtc_write(tm.tm_sec, OMAP_RTC_ALARM2_SECONDS_REG);
+	rtc_write(tm.tm_min, OMAP_RTC_ALARM2_MINUTES_REG);
+	rtc_write(tm.tm_hour, OMAP_RTC_ALARM2_HOURS_REG);
+	rtc_write(tm.tm_mday, OMAP_RTC_ALARM2_DAYS_REG);
+	rtc_write(tm.tm_mon, OMAP_RTC_ALARM2_MONTHS_REG);
+	rtc_write(tm.tm_year, OMAP_RTC_ALARM2_YEARS_REG);
+
+	/* Enable alarm2 interrupt */
+	val = readl(rtc_base + OMAP_RTC_INTERRUPTS_REG);
+	writel(val | OMAP_RTC_INTERRUPTS_IT_ALARM2,
+				rtc_base + OMAP_RTC_INTERRUPTS_REG);
+
+	/* Do not allow to execute any other task */
+	spin_lock_irqsave(&lock, flags);
+	while (1);
+}
+
 static struct rtc_class_ops omap_rtc_ops = {
 	.read_time	= omap_rtc_read_time,
 	.set_time	= omap_rtc_set_time,
@@ -327,12 +396,16 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
 	struct resource		*res, *mem;
 	struct rtc_device	*rtc;
 	u8			reg, new_ctrl;
+	bool			pm_off = false;
 	const struct platform_device_id *id_entry;
 	const struct of_device_id *of_id;
 
 	of_id = of_match_device(omap_rtc_of_match, &pdev->dev);
-	if (of_id)
+	if (of_id) {
 		pdev->id_entry = of_id->data;
+		pm_off = of_property_read_bool(pdev->dev.of_node,
+					"ti,system-power-controller");
+	}
 
 	omap_rtc_timer = platform_get_irq(pdev, 0);
 	if (omap_rtc_timer <= 0) {
@@ -385,6 +458,10 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, rtc);
 	dev_set_drvdata(&rtc->dev, mem);
 
+	/* RTC power off */
+	if (pm_off && !pm_power_off)
+		pm_power_off = rtc_power_off;
+
 	/* clear pending irqs, and set 1/second periodic,
 	 * which we'll use instead of update irqs
 	 */
-- 
1.7.9.5


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

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
@ 2012-11-05  9:42   ` AnilKumar Ch
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar Ch @ 2012-11-05  9:42 UTC (permalink / raw)
  To: linux-arm-kernel

From: Colin Foe-Parker <colin.foeparker@logicpd.com>

Add system power off control to rtc driver which is the in-charge
of controlling the BeagleBone system power. The power_off routine
can be hooked up to "pm_power_off" system call.

System power off sequence:-
* Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
* Enable PMIC_POWER_EN in rtc module
* Set rtc ALARM2 time
* Enable ALARM2 interrupt

Added while (1); after the above steps to make sure that no other
process acquire cpu. Otherwise we might see an unexpected behaviour
because we are shutting down all the power rails of SoC except RTC.

Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
[anilkumar at ti.com: move poweroff additions to rtc driver]
Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
---
 Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
 drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
 2 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
index b47aa41..8d9f4f9 100644
--- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
+++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
@@ -6,6 +6,10 @@ Required properties:
 - interrupts: rtc timer, alarm interrupts in order
 - interrupt-parent: phandle for the interrupt controller
 
+Optional properties:
+- ti,system-power-controller: Telling whether or not rtc is controlling
+  the system power.
+
 Example:
 
 rtc at 1c23000 {
@@ -14,4 +18,5 @@ rtc at 1c23000 {
 	interrupts = <19
 		      19>;
 	interrupt-parent = <&intc>;
+	ti,system-power-controller;
 };
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 6009714..2d90170 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -72,6 +72,14 @@
 #define OMAP_RTC_KICK0_REG		0x6c
 #define OMAP_RTC_KICK1_REG		0x70
 
+#define OMAP_RTC_ALARM2_SECONDS_REG	0x80
+#define OMAP_RTC_ALARM2_MINUTES_REG	0x84
+#define OMAP_RTC_ALARM2_HOURS_REG	0x88
+#define OMAP_RTC_ALARM2_DAYS_REG	0x8c
+#define OMAP_RTC_ALARM2_MONTHS_REG	0x90
+#define OMAP_RTC_ALARM2_YEARS_REG	0x94
+#define OMAP_RTC_PMIC_REG		0x98
+
 /* OMAP_RTC_CTRL_REG bit fields: */
 #define OMAP_RTC_CTRL_SPLIT		(1<<7)
 #define OMAP_RTC_CTRL_DISABLE		(1<<6)
@@ -93,15 +101,24 @@
 #define OMAP_RTC_STATUS_BUSY            (1<<0)
 
 /* OMAP_RTC_INTERRUPTS_REG bit fields: */
+#define OMAP_RTC_INTERRUPTS_IT_ALARM2   (1<<4)
 #define OMAP_RTC_INTERRUPTS_IT_ALARM    (1<<3)
 #define OMAP_RTC_INTERRUPTS_IT_TIMER    (1<<2)
 
+/* OMAP_RTC_PMIC_REG bit fields: */
+#define OMAP_RTC_PMIC_POWER_EN_EN       (1<<16)
+
 /* OMAP_RTC_KICKER values */
 #define	KICK0_VALUE			0x83e70b13
 #define	KICK1_VALUE			0x95a4f1e0
 
 #define	OMAP_RTC_HAS_KICKER		0x1
 
+#define SHUTDOWN_TIME_SEC		2
+#define SECS_IN_MIN			60
+#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
+#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
+
 static void __iomem	*rtc_base;
 
 #define rtc_read(addr)		readb(rtc_base + (addr))
@@ -290,6 +307,58 @@ static int omap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 	return 0;
 }
 
+/*
+ * rtc_power_off: Set the pmic power off sequence. The RTC generates
+ * pmic_pwr_enable control, which can be used to control an external
+ * PMIC.
+ */
+static void rtc_power_off(void)
+{
+	u32 val;
+	struct rtc_time tm;
+	spinlock_t lock;
+	unsigned long flags;
+
+	spin_lock_init(&lock);
+
+	/* Set PMIC power enable */
+	val = readl(rtc_base + OMAP_RTC_PMIC_REG);
+	writel(val | OMAP_RTC_PMIC_POWER_EN_EN, rtc_base + OMAP_RTC_PMIC_REG);
+
+	/* Wait few seconds instead of rollover */
+	do {
+		omap_rtc_read_time(NULL, &tm);
+		if (WAIT_AFTER <= tm.tm_sec)
+			mdelay(WAIT_TIME_MS);
+	} while (WAIT_AFTER <= tm.tm_sec);
+
+	/* Add shutdown time to the current value */
+	tm.tm_sec += SHUTDOWN_TIME_SEC;
+
+	if (tm2bcd(&tm) < 0)
+		return;
+
+	pr_info("System will go to power_off state in approx. %d secs\n",
+			SHUTDOWN_TIME_SEC);
+
+	/* Set the ALARM2 time */
+	rtc_write(tm.tm_sec, OMAP_RTC_ALARM2_SECONDS_REG);
+	rtc_write(tm.tm_min, OMAP_RTC_ALARM2_MINUTES_REG);
+	rtc_write(tm.tm_hour, OMAP_RTC_ALARM2_HOURS_REG);
+	rtc_write(tm.tm_mday, OMAP_RTC_ALARM2_DAYS_REG);
+	rtc_write(tm.tm_mon, OMAP_RTC_ALARM2_MONTHS_REG);
+	rtc_write(tm.tm_year, OMAP_RTC_ALARM2_YEARS_REG);
+
+	/* Enable alarm2 interrupt */
+	val = readl(rtc_base + OMAP_RTC_INTERRUPTS_REG);
+	writel(val | OMAP_RTC_INTERRUPTS_IT_ALARM2,
+				rtc_base + OMAP_RTC_INTERRUPTS_REG);
+
+	/* Do not allow to execute any other task */
+	spin_lock_irqsave(&lock, flags);
+	while (1);
+}
+
 static struct rtc_class_ops omap_rtc_ops = {
 	.read_time	= omap_rtc_read_time,
 	.set_time	= omap_rtc_set_time,
@@ -327,12 +396,16 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
 	struct resource		*res, *mem;
 	struct rtc_device	*rtc;
 	u8			reg, new_ctrl;
+	bool			pm_off = false;
 	const struct platform_device_id *id_entry;
 	const struct of_device_id *of_id;
 
 	of_id = of_match_device(omap_rtc_of_match, &pdev->dev);
-	if (of_id)
+	if (of_id) {
 		pdev->id_entry = of_id->data;
+		pm_off = of_property_read_bool(pdev->dev.of_node,
+					"ti,system-power-controller");
+	}
 
 	omap_rtc_timer = platform_get_irq(pdev, 0);
 	if (omap_rtc_timer <= 0) {
@@ -385,6 +458,10 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, rtc);
 	dev_set_drvdata(&rtc->dev, mem);
 
+	/* RTC power off */
+	if (pm_off && !pm_power_off)
+		pm_power_off = rtc_power_off;
+
 	/* clear pending irqs, and set 1/second periodic,
 	 * which we'll use instead of update irqs
 	 */
-- 
1.7.9.5

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

* [PATCH 3/4] ARM: dts: AM33XX: Set pmic-shutdown-controller for BeagleBone
  2012-11-05  9:42 ` AnilKumar Ch
@ 2012-11-05  9:42   ` AnilKumar Ch
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar Ch @ 2012-11-05  9:42 UTC (permalink / raw)
  To: a.zummo, sameo, tony
  Cc: grant.likely, rob.herring, rtc-linux, linux-omap,
	linux-arm-kernel, devicetree-discuss, AnilKumar Ch

Set ti,pmic-shutdown-controller for BeagleBone in am335x-bone.dts
file, this flag is used by the driver to set tps65217 PMIC status
to OFF when PWR_EN toggle.

Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
---
 arch/arm/boot/dts/am335x-bone.dts |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts
index 91eee97..40ea3c7 100644
--- a/arch/arm/boot/dts/am335x-bone.dts
+++ b/arch/arm/boot/dts/am335x-bone.dts
@@ -44,6 +44,8 @@
 /include/ "tps65217.dtsi"
 
 &tps {
+	ti,pmic-shutdown-controller;
+
 	regulators {
 		dcdc1_reg: regulator@0 {
 			regulator-always-on;
-- 
1.7.9.5


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

* [PATCH 3/4] ARM: dts: AM33XX: Set pmic-shutdown-controller for BeagleBone
@ 2012-11-05  9:42   ` AnilKumar Ch
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar Ch @ 2012-11-05  9:42 UTC (permalink / raw)
  To: linux-arm-kernel

Set ti,pmic-shutdown-controller for BeagleBone in am335x-bone.dts
file, this flag is used by the driver to set tps65217 PMIC status
to OFF when PWR_EN toggle.

Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
---
 arch/arm/boot/dts/am335x-bone.dts |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts
index 91eee97..40ea3c7 100644
--- a/arch/arm/boot/dts/am335x-bone.dts
+++ b/arch/arm/boot/dts/am335x-bone.dts
@@ -44,6 +44,8 @@
 /include/ "tps65217.dtsi"
 
 &tps {
+	ti,pmic-shutdown-controller;
+
 	regulators {
 		dcdc1_reg: regulator at 0 {
 			regulator-always-on;
-- 
1.7.9.5

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

* [PATCH 4/4] ARM: dts: AM33XX: Enable system power off control in am335x-bone
  2012-11-05  9:42 ` AnilKumar Ch
@ 2012-11-05  9:42     ` AnilKumar Ch
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar Ch @ 2012-11-05  9:42 UTC (permalink / raw)
  To: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, sameo-VuQAYsv1563Yd54FQh9/CA,
	tony-4v6yS6AI5VpBDgjK7y7TUQ
  Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Enable system power off control for BeagleBone in am335x-bone.dts file
under rtc node. RTC is the incharge of controlling the system power.
This flag is used by the driver to hook up the pm_power_off system call.

Signed-off-by: AnilKumar Ch <anilkumar-l0cyMroinI0@public.gmane.org>
---
 arch/arm/boot/dts/am335x-bone.dts |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts
index 40ea3c7..6f9c48e 100644
--- a/arch/arm/boot/dts/am335x-bone.dts
+++ b/arch/arm/boot/dts/am335x-bone.dts
@@ -38,6 +38,10 @@
 			};
 
 		};
+
+		rtc@44e3e000 {
+			ti,system-power-controller;
+		};
 	};
 };
 
-- 
1.7.9.5

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

* [PATCH 4/4] ARM: dts: AM33XX: Enable system power off control in am335x-bone
@ 2012-11-05  9:42     ` AnilKumar Ch
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar Ch @ 2012-11-05  9:42 UTC (permalink / raw)
  To: linux-arm-kernel

Enable system power off control for BeagleBone in am335x-bone.dts file
under rtc node. RTC is the incharge of controlling the system power.
This flag is used by the driver to hook up the pm_power_off system call.

Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
---
 arch/arm/boot/dts/am335x-bone.dts |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts
index 40ea3c7..6f9c48e 100644
--- a/arch/arm/boot/dts/am335x-bone.dts
+++ b/arch/arm/boot/dts/am335x-bone.dts
@@ -38,6 +38,10 @@
 			};
 
 		};
+
+		rtc at 44e3e000 {
+			ti,system-power-controller;
+		};
 	};
 };
 
-- 
1.7.9.5

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

* Re: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
  2012-11-05  9:42   ` AnilKumar Ch
@ 2012-11-05 16:43       ` Benoit Cousson
  -1 siblings, 0 replies; 58+ messages in thread
From: Benoit Cousson @ 2012-11-05 16:43 UTC (permalink / raw)
  To: AnilKumar Ch, Colin Foe-Parker
  Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, sameo-VuQAYsv1563Yd54FQh9/CA,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi Anil / Colin,

On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> From: Colin Foe-Parker <colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org>
> 
> Add system power off control to rtc driver which is the in-charge
> of controlling the BeagleBone system power. The power_off routine
> can be hooked up to "pm_power_off" system call.
> 
> System power off sequence:-
> * Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
> * Enable PMIC_POWER_EN in rtc module
> * Set rtc ALARM2 time
> * Enable ALARM2 interrupt
> 
> Added while (1); after the above steps to make sure that no other
> process acquire cpu. Otherwise we might see an unexpected behaviour
> because we are shutting down all the power rails of SoC except RTC.
> 
> Signed-off-by: Colin Foe-Parker <colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org>
> [anilkumar-l0cyMroinI0@public.gmane.org: move poweroff additions to rtc driver]
> Signed-off-by: AnilKumar Ch <anilkumar-l0cyMroinI0@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
>  drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
>  2 files changed, 83 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> index b47aa41..8d9f4f9 100644
> --- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> +++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> @@ -6,6 +6,10 @@ Required properties:
>  - interrupts: rtc timer, alarm interrupts in order
>  - interrupt-parent: phandle for the interrupt controller
>  
> +Optional properties:
> +- ti,system-power-controller: Telling whether or not rtc is controlling
> +  the system power.

I don't know how it is connected at board level, but I'm not sure the
binding is the proper one.
It does not look super generic, and I'm wondering if we should not use
instead some regulator binding to reflect the connection of the RTC to a
regulator.

But without the board / soc spec it is hard to tell :-(

Regards,
Benoit


> +
>  Example:
>  
>  rtc@1c23000 {
> @@ -14,4 +18,5 @@ rtc@1c23000 {
>  	interrupts = <19
>  		      19>;
>  	interrupt-parent = <&intc>;
> +	ti,system-power-controller;
>  };
> diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
> index 6009714..2d90170 100644
> --- a/drivers/rtc/rtc-omap.c
> +++ b/drivers/rtc/rtc-omap.c
> @@ -72,6 +72,14 @@
>  #define OMAP_RTC_KICK0_REG		0x6c
>  #define OMAP_RTC_KICK1_REG		0x70
>  
> +#define OMAP_RTC_ALARM2_SECONDS_REG	0x80
> +#define OMAP_RTC_ALARM2_MINUTES_REG	0x84
> +#define OMAP_RTC_ALARM2_HOURS_REG	0x88
> +#define OMAP_RTC_ALARM2_DAYS_REG	0x8c
> +#define OMAP_RTC_ALARM2_MONTHS_REG	0x90
> +#define OMAP_RTC_ALARM2_YEARS_REG	0x94
> +#define OMAP_RTC_PMIC_REG		0x98
> +
>  /* OMAP_RTC_CTRL_REG bit fields: */
>  #define OMAP_RTC_CTRL_SPLIT		(1<<7)
>  #define OMAP_RTC_CTRL_DISABLE		(1<<6)
> @@ -93,15 +101,24 @@
>  #define OMAP_RTC_STATUS_BUSY            (1<<0)
>  
>  /* OMAP_RTC_INTERRUPTS_REG bit fields: */
> +#define OMAP_RTC_INTERRUPTS_IT_ALARM2   (1<<4)
>  #define OMAP_RTC_INTERRUPTS_IT_ALARM    (1<<3)
>  #define OMAP_RTC_INTERRUPTS_IT_TIMER    (1<<2)
>  
> +/* OMAP_RTC_PMIC_REG bit fields: */
> +#define OMAP_RTC_PMIC_POWER_EN_EN       (1<<16)
> +
>  /* OMAP_RTC_KICKER values */
>  #define	KICK0_VALUE			0x83e70b13
>  #define	KICK1_VALUE			0x95a4f1e0
>  
>  #define	OMAP_RTC_HAS_KICKER		0x1
>  
> +#define SHUTDOWN_TIME_SEC		2
> +#define SECS_IN_MIN			60
> +#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
> +#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
> +
>  static void __iomem	*rtc_base;
>  
>  #define rtc_read(addr)		readb(rtc_base + (addr))
> @@ -290,6 +307,58 @@ static int omap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
>  	return 0;
>  }
>  
> +/*
> + * rtc_power_off: Set the pmic power off sequence. The RTC generates
> + * pmic_pwr_enable control, which can be used to control an external
> + * PMIC.
> + */
> +static void rtc_power_off(void)
> +{
> +	u32 val;
> +	struct rtc_time tm;
> +	spinlock_t lock;
> +	unsigned long flags;
> +
> +	spin_lock_init(&lock);
> +
> +	/* Set PMIC power enable */
> +	val = readl(rtc_base + OMAP_RTC_PMIC_REG);
> +	writel(val | OMAP_RTC_PMIC_POWER_EN_EN, rtc_base + OMAP_RTC_PMIC_REG);
> +
> +	/* Wait few seconds instead of rollover */
> +	do {
> +		omap_rtc_read_time(NULL, &tm);
> +		if (WAIT_AFTER <= tm.tm_sec)
> +			mdelay(WAIT_TIME_MS);
> +	} while (WAIT_AFTER <= tm.tm_sec);
> +
> +	/* Add shutdown time to the current value */
> +	tm.tm_sec += SHUTDOWN_TIME_SEC;
> +
> +	if (tm2bcd(&tm) < 0)
> +		return;
> +
> +	pr_info("System will go to power_off state in approx. %d secs\n",
> +			SHUTDOWN_TIME_SEC);
> +
> +	/* Set the ALARM2 time */
> +	rtc_write(tm.tm_sec, OMAP_RTC_ALARM2_SECONDS_REG);
> +	rtc_write(tm.tm_min, OMAP_RTC_ALARM2_MINUTES_REG);
> +	rtc_write(tm.tm_hour, OMAP_RTC_ALARM2_HOURS_REG);
> +	rtc_write(tm.tm_mday, OMAP_RTC_ALARM2_DAYS_REG);
> +	rtc_write(tm.tm_mon, OMAP_RTC_ALARM2_MONTHS_REG);
> +	rtc_write(tm.tm_year, OMAP_RTC_ALARM2_YEARS_REG);
> +
> +	/* Enable alarm2 interrupt */
> +	val = readl(rtc_base + OMAP_RTC_INTERRUPTS_REG);
> +	writel(val | OMAP_RTC_INTERRUPTS_IT_ALARM2,
> +				rtc_base + OMAP_RTC_INTERRUPTS_REG);
> +
> +	/* Do not allow to execute any other task */
> +	spin_lock_irqsave(&lock, flags);
> +	while (1);
> +}
> +
>  static struct rtc_class_ops omap_rtc_ops = {
>  	.read_time	= omap_rtc_read_time,
>  	.set_time	= omap_rtc_set_time,
> @@ -327,12 +396,16 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
>  	struct resource		*res, *mem;
>  	struct rtc_device	*rtc;
>  	u8			reg, new_ctrl;
> +	bool			pm_off = false;
>  	const struct platform_device_id *id_entry;
>  	const struct of_device_id *of_id;
>  
>  	of_id = of_match_device(omap_rtc_of_match, &pdev->dev);
> -	if (of_id)
> +	if (of_id) {
>  		pdev->id_entry = of_id->data;
> +		pm_off = of_property_read_bool(pdev->dev.of_node,
> +					"ti,system-power-controller");
> +	}
>  
>  	omap_rtc_timer = platform_get_irq(pdev, 0);
>  	if (omap_rtc_timer <= 0) {
> @@ -385,6 +458,10 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, rtc);
>  	dev_set_drvdata(&rtc->dev, mem);
>  
> +	/* RTC power off */
> +	if (pm_off && !pm_power_off)
> +		pm_power_off = rtc_power_off;
> +
>  	/* clear pending irqs, and set 1/second periodic,
>  	 * which we'll use instead of update irqs
>  	 */
> 

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

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
@ 2012-11-05 16:43       ` Benoit Cousson
  0 siblings, 0 replies; 58+ messages in thread
From: Benoit Cousson @ 2012-11-05 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Anil / Colin,

On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> From: Colin Foe-Parker <colin.foeparker@logicpd.com>
> 
> Add system power off control to rtc driver which is the in-charge
> of controlling the BeagleBone system power. The power_off routine
> can be hooked up to "pm_power_off" system call.
> 
> System power off sequence:-
> * Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
> * Enable PMIC_POWER_EN in rtc module
> * Set rtc ALARM2 time
> * Enable ALARM2 interrupt
> 
> Added while (1); after the above steps to make sure that no other
> process acquire cpu. Otherwise we might see an unexpected behaviour
> because we are shutting down all the power rails of SoC except RTC.
> 
> Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
> [anilkumar at ti.com: move poweroff additions to rtc driver]
> Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
> ---
>  Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
>  drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
>  2 files changed, 83 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> index b47aa41..8d9f4f9 100644
> --- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> +++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> @@ -6,6 +6,10 @@ Required properties:
>  - interrupts: rtc timer, alarm interrupts in order
>  - interrupt-parent: phandle for the interrupt controller
>  
> +Optional properties:
> +- ti,system-power-controller: Telling whether or not rtc is controlling
> +  the system power.

I don't know how it is connected at board level, but I'm not sure the
binding is the proper one.
It does not look super generic, and I'm wondering if we should not use
instead some regulator binding to reflect the connection of the RTC to a
regulator.

But without the board / soc spec it is hard to tell :-(

Regards,
Benoit


> +
>  Example:
>  
>  rtc at 1c23000 {
> @@ -14,4 +18,5 @@ rtc at 1c23000 {
>  	interrupts = <19
>  		      19>;
>  	interrupt-parent = <&intc>;
> +	ti,system-power-controller;
>  };
> diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
> index 6009714..2d90170 100644
> --- a/drivers/rtc/rtc-omap.c
> +++ b/drivers/rtc/rtc-omap.c
> @@ -72,6 +72,14 @@
>  #define OMAP_RTC_KICK0_REG		0x6c
>  #define OMAP_RTC_KICK1_REG		0x70
>  
> +#define OMAP_RTC_ALARM2_SECONDS_REG	0x80
> +#define OMAP_RTC_ALARM2_MINUTES_REG	0x84
> +#define OMAP_RTC_ALARM2_HOURS_REG	0x88
> +#define OMAP_RTC_ALARM2_DAYS_REG	0x8c
> +#define OMAP_RTC_ALARM2_MONTHS_REG	0x90
> +#define OMAP_RTC_ALARM2_YEARS_REG	0x94
> +#define OMAP_RTC_PMIC_REG		0x98
> +
>  /* OMAP_RTC_CTRL_REG bit fields: */
>  #define OMAP_RTC_CTRL_SPLIT		(1<<7)
>  #define OMAP_RTC_CTRL_DISABLE		(1<<6)
> @@ -93,15 +101,24 @@
>  #define OMAP_RTC_STATUS_BUSY            (1<<0)
>  
>  /* OMAP_RTC_INTERRUPTS_REG bit fields: */
> +#define OMAP_RTC_INTERRUPTS_IT_ALARM2   (1<<4)
>  #define OMAP_RTC_INTERRUPTS_IT_ALARM    (1<<3)
>  #define OMAP_RTC_INTERRUPTS_IT_TIMER    (1<<2)
>  
> +/* OMAP_RTC_PMIC_REG bit fields: */
> +#define OMAP_RTC_PMIC_POWER_EN_EN       (1<<16)
> +
>  /* OMAP_RTC_KICKER values */
>  #define	KICK0_VALUE			0x83e70b13
>  #define	KICK1_VALUE			0x95a4f1e0
>  
>  #define	OMAP_RTC_HAS_KICKER		0x1
>  
> +#define SHUTDOWN_TIME_SEC		2
> +#define SECS_IN_MIN			60
> +#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
> +#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
> +
>  static void __iomem	*rtc_base;
>  
>  #define rtc_read(addr)		readb(rtc_base + (addr))
> @@ -290,6 +307,58 @@ static int omap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
>  	return 0;
>  }
>  
> +/*
> + * rtc_power_off: Set the pmic power off sequence. The RTC generates
> + * pmic_pwr_enable control, which can be used to control an external
> + * PMIC.
> + */
> +static void rtc_power_off(void)
> +{
> +	u32 val;
> +	struct rtc_time tm;
> +	spinlock_t lock;
> +	unsigned long flags;
> +
> +	spin_lock_init(&lock);
> +
> +	/* Set PMIC power enable */
> +	val = readl(rtc_base + OMAP_RTC_PMIC_REG);
> +	writel(val | OMAP_RTC_PMIC_POWER_EN_EN, rtc_base + OMAP_RTC_PMIC_REG);
> +
> +	/* Wait few seconds instead of rollover */
> +	do {
> +		omap_rtc_read_time(NULL, &tm);
> +		if (WAIT_AFTER <= tm.tm_sec)
> +			mdelay(WAIT_TIME_MS);
> +	} while (WAIT_AFTER <= tm.tm_sec);
> +
> +	/* Add shutdown time to the current value */
> +	tm.tm_sec += SHUTDOWN_TIME_SEC;
> +
> +	if (tm2bcd(&tm) < 0)
> +		return;
> +
> +	pr_info("System will go to power_off state in approx. %d secs\n",
> +			SHUTDOWN_TIME_SEC);
> +
> +	/* Set the ALARM2 time */
> +	rtc_write(tm.tm_sec, OMAP_RTC_ALARM2_SECONDS_REG);
> +	rtc_write(tm.tm_min, OMAP_RTC_ALARM2_MINUTES_REG);
> +	rtc_write(tm.tm_hour, OMAP_RTC_ALARM2_HOURS_REG);
> +	rtc_write(tm.tm_mday, OMAP_RTC_ALARM2_DAYS_REG);
> +	rtc_write(tm.tm_mon, OMAP_RTC_ALARM2_MONTHS_REG);
> +	rtc_write(tm.tm_year, OMAP_RTC_ALARM2_YEARS_REG);
> +
> +	/* Enable alarm2 interrupt */
> +	val = readl(rtc_base + OMAP_RTC_INTERRUPTS_REG);
> +	writel(val | OMAP_RTC_INTERRUPTS_IT_ALARM2,
> +				rtc_base + OMAP_RTC_INTERRUPTS_REG);
> +
> +	/* Do not allow to execute any other task */
> +	spin_lock_irqsave(&lock, flags);
> +	while (1);
> +}
> +
>  static struct rtc_class_ops omap_rtc_ops = {
>  	.read_time	= omap_rtc_read_time,
>  	.set_time	= omap_rtc_set_time,
> @@ -327,12 +396,16 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
>  	struct resource		*res, *mem;
>  	struct rtc_device	*rtc;
>  	u8			reg, new_ctrl;
> +	bool			pm_off = false;
>  	const struct platform_device_id *id_entry;
>  	const struct of_device_id *of_id;
>  
>  	of_id = of_match_device(omap_rtc_of_match, &pdev->dev);
> -	if (of_id)
> +	if (of_id) {
>  		pdev->id_entry = of_id->data;
> +		pm_off = of_property_read_bool(pdev->dev.of_node,
> +					"ti,system-power-controller");
> +	}
>  
>  	omap_rtc_timer = platform_get_irq(pdev, 0);
>  	if (omap_rtc_timer <= 0) {
> @@ -385,6 +458,10 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, rtc);
>  	dev_set_drvdata(&rtc->dev, mem);
>  
> +	/* RTC power off */
> +	if (pm_off && !pm_power_off)
> +		pm_power_off = rtc_power_off;
> +
>  	/* clear pending irqs, and set 1/second periodic,
>  	 * which we'll use instead of update irqs
>  	 */
> 

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

* Re: [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
  2012-11-05  9:42   ` AnilKumar Ch
@ 2012-11-05 16:59       ` Benoit Cousson
  -1 siblings, 0 replies; 58+ messages in thread
From: Benoit Cousson @ 2012-11-05 16:59 UTC (permalink / raw)
  To: AnilKumar Ch
  Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, sameo-VuQAYsv1563Yd54FQh9/CA,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, mark Brown,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Colin Foe-Parker,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

+ Mark

On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> From: Colin Foe-Parker <colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org>
> 
> Set tps65217 PMIC status to OFF if power enable toggle is
> supported. Also adds platform data flag, which should be
> passed from board init data.
> 
> Signed-off-by: Colin Foe-Parker <colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org>
> [anilkumar-l0cyMroinI0@public.gmane.org: move the additions to tps65217 MFD driver]
> Signed-off-by: AnilKumar Ch <anilkumar-l0cyMroinI0@public.gmane.org>
> ---
>  .../devicetree/bindings/regulator/tps65217.txt     |    4 ++++
>  drivers/mfd/tps65217.c                             |   12 ++++++++++++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/regulator/tps65217.txt b/Documentation/devicetree/bindings/regulator/tps65217.txt
> index d316fb8..4f05d20 100644
> --- a/Documentation/devicetree/bindings/regulator/tps65217.txt
> +++ b/Documentation/devicetree/bindings/regulator/tps65217.txt
> @@ -11,6 +11,9 @@ Required properties:
>    using the standard binding for regulators found at
>    Documentation/devicetree/bindings/regulator/regulator.txt.
>  
> +Optional properties:
> +- ti,pmic-shutdown-controller: Telling the PMIC to shutdown on PWR_EN toggle.

That sounds like a generic functionality to me. Don't we have some more
generic way to handle that?

If not, that should probably not be a TI only attribute.

It looks like a GPIO like kind of interface at PMIC level.

Regards,
Benoit

> +
>    The valid names for regulators are:
>    tps65217: dcdc1, dcdc2, dcdc3, ldo1, ldo2, ldo3 and ldo4
>  
> @@ -20,6 +23,7 @@ Example:
>  
>  	tps: tps@24 {
>  		compatible = "ti,tps65217";
> +		ti,pmic-shutdown-controller;
>  
>  		regulators {
>  			dcdc1_reg: dcdc1 {
> diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c
> index 3fb32e6..c7f17d8 100644
> --- a/drivers/mfd/tps65217.c
> +++ b/drivers/mfd/tps65217.c
> @@ -160,6 +160,7 @@ static int __devinit tps65217_probe(struct i2c_client *client,
>  	unsigned int version;
>  	unsigned int chip_id = ids->driver_data;
>  	const struct of_device_id *match;
> +	bool status_off = false;
>  	int ret;
>  
>  	if (client->dev.of_node) {
> @@ -170,6 +171,8 @@ static int __devinit tps65217_probe(struct i2c_client *client,
>  			return -EINVAL;
>  		}
>  		chip_id = (unsigned int)match->data;
> +		status_off = of_property_read_bool(client->dev.of_node,
> +					"ti,pmic-shutdown-controller");
>  	}
>  
>  	if (!chip_id) {
> @@ -207,6 +210,15 @@ static int __devinit tps65217_probe(struct i2c_client *client,
>  		return ret;
>  	}
>  
> +	/* Set the PMIC to shutdown on PWR_EN toggle */
> +	if (status_off) {
> +		ret = tps65217_set_bits(tps, TPS65217_REG_STATUS,
> +				TPS65217_STATUS_OFF, TPS65217_STATUS_OFF,
> +				TPS65217_PROTECT_NONE);
> +		if (ret)
> +			dev_warn(tps->dev, "unable to set the status OFF\n");
> +	}
> +
>  	dev_info(tps->dev, "TPS65217 ID %#x version 1.%d\n",
>  			(version & TPS65217_CHIPID_CHIP_MASK) >> 4,
>  			version & TPS65217_CHIPID_REV_MASK);
> 

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

* [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
@ 2012-11-05 16:59       ` Benoit Cousson
  0 siblings, 0 replies; 58+ messages in thread
From: Benoit Cousson @ 2012-11-05 16:59 UTC (permalink / raw)
  To: linux-arm-kernel

+ Mark

On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> From: Colin Foe-Parker <colin.foeparker@logicpd.com>
> 
> Set tps65217 PMIC status to OFF if power enable toggle is
> supported. Also adds platform data flag, which should be
> passed from board init data.
> 
> Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
> [anilkumar at ti.com: move the additions to tps65217 MFD driver]
> Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
> ---
>  .../devicetree/bindings/regulator/tps65217.txt     |    4 ++++
>  drivers/mfd/tps65217.c                             |   12 ++++++++++++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/regulator/tps65217.txt b/Documentation/devicetree/bindings/regulator/tps65217.txt
> index d316fb8..4f05d20 100644
> --- a/Documentation/devicetree/bindings/regulator/tps65217.txt
> +++ b/Documentation/devicetree/bindings/regulator/tps65217.txt
> @@ -11,6 +11,9 @@ Required properties:
>    using the standard binding for regulators found at
>    Documentation/devicetree/bindings/regulator/regulator.txt.
>  
> +Optional properties:
> +- ti,pmic-shutdown-controller: Telling the PMIC to shutdown on PWR_EN toggle.

That sounds like a generic functionality to me. Don't we have some more
generic way to handle that?

If not, that should probably not be a TI only attribute.

It looks like a GPIO like kind of interface at PMIC level.

Regards,
Benoit

> +
>    The valid names for regulators are:
>    tps65217: dcdc1, dcdc2, dcdc3, ldo1, ldo2, ldo3 and ldo4
>  
> @@ -20,6 +23,7 @@ Example:
>  
>  	tps: tps at 24 {
>  		compatible = "ti,tps65217";
> +		ti,pmic-shutdown-controller;
>  
>  		regulators {
>  			dcdc1_reg: dcdc1 {
> diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c
> index 3fb32e6..c7f17d8 100644
> --- a/drivers/mfd/tps65217.c
> +++ b/drivers/mfd/tps65217.c
> @@ -160,6 +160,7 @@ static int __devinit tps65217_probe(struct i2c_client *client,
>  	unsigned int version;
>  	unsigned int chip_id = ids->driver_data;
>  	const struct of_device_id *match;
> +	bool status_off = false;
>  	int ret;
>  
>  	if (client->dev.of_node) {
> @@ -170,6 +171,8 @@ static int __devinit tps65217_probe(struct i2c_client *client,
>  			return -EINVAL;
>  		}
>  		chip_id = (unsigned int)match->data;
> +		status_off = of_property_read_bool(client->dev.of_node,
> +					"ti,pmic-shutdown-controller");
>  	}
>  
>  	if (!chip_id) {
> @@ -207,6 +210,15 @@ static int __devinit tps65217_probe(struct i2c_client *client,
>  		return ret;
>  	}
>  
> +	/* Set the PMIC to shutdown on PWR_EN toggle */
> +	if (status_off) {
> +		ret = tps65217_set_bits(tps, TPS65217_REG_STATUS,
> +				TPS65217_STATUS_OFF, TPS65217_STATUS_OFF,
> +				TPS65217_PROTECT_NONE);
> +		if (ret)
> +			dev_warn(tps->dev, "unable to set the status OFF\n");
> +	}
> +
>  	dev_info(tps->dev, "TPS65217 ID %#x version 1.%d\n",
>  			(version & TPS65217_CHIPID_CHIP_MASK) >> 4,
>  			version & TPS65217_CHIPID_REV_MASK);
> 

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

* RE: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
  2012-11-05 16:43       ` Benoit Cousson
@ 2012-11-05 17:39           ` Colin FoeParker
  -1 siblings, 0 replies; 58+ messages in thread
From: Colin FoeParker @ 2012-11-05 17:39 UTC (permalink / raw)
  To: Benoit Cousson, AnilKumar Ch
  Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, sameo-VuQAYsv1563Yd54FQh9/CA,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r


[-- Attachment #1.1: Type: text/plain, Size: 11439 bytes --]

Hi Benoit,



"I don't know how it is connected at board level, but I'm not sure the binding is the proper one."



Here is a link to the Beaglebone schematic<http://beagleboard.org/static/beaglebone/latest/Docs/Hardware/BONE_SCH.pdf>.  The PMIC_PWR_EN net is the one that you should be interested in following.



In the AM335x, this net is connected to the ALARM2 event in the RTC subsystem.  If the ALARM2 event is triggered, and the PMIC_PWR_EN pin is configured correctly, the pin is driven low.



In the TPS65217 series PMIC, the PWR_EN I/O can be used to put the entire chip into a low power state.  This disables all the power rails in the PMIC with an exception of the rail that powers the RTC power domain.



So when the ALARM2 event occurs, the PWR_EN I/O is pulled low and the entire system into a low power "off" state.



"It does not look super generic, and I'm wondering if we should not use instead some regulator binding to reflect the connection of the RTC to a regulator.



But without the board / soc spec it is hard to tell :-("



This is a good point.  I know that there are other omap SOC RTC's that do not support the ALARM2 implementation.  That being said, I would argue that there is more of a RTC connection with the implementation than a regulator.



Anil will probably have greater insight into the pro's/con's of the implementation.



-Colin





Colin Foe-Parker // Software Engineer II







Logic PD /// engineering design services

5 Clock Tower Place. Suite 400

Maynard, MA 01754

T // 978.243.2045



colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org

www.logicpd.com

/ / / / / / / / / / / / / / / / / / / / / / / / /

This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, distribution, or other use of this message, or the taking of any action based on it, is strictly prohibited.





-----Original Message-----
From: Benoit Cousson [mailto:b-cousson-l0cyMroinI0@public.gmane.org]
Sent: Monday, November 05, 2012 11:43 AM
To: AnilKumar Ch; Colin FoeParker
Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org; sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org; tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org; grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org; rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org; rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org; devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver



Hi Anil / Colin,



On 11/05/2012 10:42 AM, AnilKumar Ch wrote:

> From: Colin Foe-Parker <colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org>

>

> Add system power off control to rtc driver which is the in-charge of

> controlling the BeagleBone system power. The power_off routine can be

> hooked up to "pm_power_off" system call.

>

> System power off sequence:-

> * Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low

> * Enable PMIC_POWER_EN in rtc module

> * Set rtc ALARM2 time

> * Enable ALARM2 interrupt

>

> Added while (1); after the above steps to make sure that no other

> process acquire cpu. Otherwise we might see an unexpected behaviour

> because we are shutting down all the power rails of SoC except RTC.

>

> Signed-off-by: Colin Foe-Parker <colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org<mailto:colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org>>

> [anilkumar-l0cyMroinI0@public.gmane.org: move poweroff additions to rtc driver]

> Signed-off-by: AnilKumar Ch <anilkumar-l0cyMroinI0@public.gmane.org<mailto:anilkumar-l0cyMroinI0@public.gmane.org>>

> ---

>  Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++

>  drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-

>  2 files changed, 83 insertions(+), 1 deletion(-)

>

> diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt

> b/Documentation/devicetree/bindings/rtc/rtc-omap.txt

> index b47aa41..8d9f4f9 100644

> --- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt

> +++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt

> @@ -6,6 +6,10 @@ Required properties:

>  - interrupts: rtc timer, alarm interrupts in order

>  - interrupt-parent: phandle for the interrupt controller

>

> +Optional properties:

> +- ti,system-power-controller: Telling whether or not rtc is

> +controlling

> +  the system power.



I don't know how it is connected at board level, but I'm not sure the binding is the proper one.

It does not look super generic, and I'm wondering if we should not use instead some regulator binding to reflect the connection of the RTC to a regulator.



But without the board / soc spec it is hard to tell :-(



Regards,

Benoit





> +

>  Example:

>

>  rtc@1c23000 {

> @@ -14,4 +18,5 @@ rtc@1c23000 {

>             interrupts = <19

>                                   19>;

>             interrupt-parent = <&intc>;

> +          ti,system-power-controller;

>  };

> diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index

> 6009714..2d90170 100644

> --- a/drivers/rtc/rtc-omap.c

> +++ b/drivers/rtc/rtc-omap.c

> @@ -72,6 +72,14 @@

>  #define OMAP_RTC_KICK0_REG                         0x6c

>  #define OMAP_RTC_KICK1_REG                         0x70

>

> +#define OMAP_RTC_ALARM2_SECONDS_REG            0x80

> +#define OMAP_RTC_ALARM2_MINUTES_REG            0x84

> +#define OMAP_RTC_ALARM2_HOURS_REG 0x88

> +#define OMAP_RTC_ALARM2_DAYS_REG     0x8c

> +#define OMAP_RTC_ALARM2_MONTHS_REG             0x90

> +#define OMAP_RTC_ALARM2_YEARS_REG   0x94

> +#define OMAP_RTC_PMIC_REG                        0x98

> +

>  /* OMAP_RTC_CTRL_REG bit fields: */

>  #define OMAP_RTC_CTRL_SPLIT                         (1<<7)

>  #define OMAP_RTC_CTRL_DISABLE                   (1<<6)

> @@ -93,15 +101,24 @@

>  #define OMAP_RTC_STATUS_BUSY            (1<<0)

>

>  /* OMAP_RTC_INTERRUPTS_REG bit fields: */

> +#define OMAP_RTC_INTERRUPTS_IT_ALARM2   (1<<4)

>  #define OMAP_RTC_INTERRUPTS_IT_ALARM    (1<<3)

>  #define OMAP_RTC_INTERRUPTS_IT_TIMER    (1<<2)

>

> +/* OMAP_RTC_PMIC_REG bit fields: */

> +#define OMAP_RTC_PMIC_POWER_EN_EN       (1<<16)

> +

>  /* OMAP_RTC_KICKER values */

>  #define           KICK0_VALUE                                    0x83e70b13

>  #define           KICK1_VALUE                                    0x95a4f1e0

>

>  #define           OMAP_RTC_HAS_KICKER                            0x1

>

> +#define SHUTDOWN_TIME_SEC                         2

> +#define SECS_IN_MIN                                            60

> +#define WAIT_AFTER                                              (SECS_IN_MIN - SHUTDOWN_TIME_SEC)

> +#define WAIT_TIME_MS                                       (SHUTDOWN_TIME_SEC * 1000)

> +

>  static void __iomem  *rtc_base;

>

>  #define rtc_read(addr)                            readb(rtc_base + (addr))

> @@ -290,6 +307,58 @@ static int omap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)

>             return 0;

>  }

>

> +/*

> + * rtc_power_off: Set the pmic power off sequence. The RTC generates

> + * pmic_pwr_enable control, which can be used to control an external

> + * PMIC.

> + */

> +static void rtc_power_off(void)

> +{

> +          u32 val;

> +          struct rtc_time tm;

> +          spinlock_t lock;

> +          unsigned long flags;

> +

> +          spin_lock_init(&lock);

> +

> +          /* Set PMIC power enable */

> +          val = readl(rtc_base + OMAP_RTC_PMIC_REG);

> +          writel(val | OMAP_RTC_PMIC_POWER_EN_EN, rtc_base +

> +OMAP_RTC_PMIC_REG);

> +

> +          /* Wait few seconds instead of rollover */

> +          do {

> +                          omap_rtc_read_time(NULL, &tm);

> +                          if (WAIT_AFTER <= tm.tm_sec)

> +                                          mdelay(WAIT_TIME_MS);

> +          } while (WAIT_AFTER <= tm.tm_sec);

> +

> +          /* Add shutdown time to the current value */

> +          tm.tm_sec += SHUTDOWN_TIME_SEC;

> +

> +          if (tm2bcd(&tm) < 0)

> +                          return;

> +

> +          pr_info("System will go to power_off state in approx. %d secs\n",

> +                                          SHUTDOWN_TIME_SEC);

> +

> +          /* Set the ALARM2 time */

> +          rtc_write(tm.tm_sec, OMAP_RTC_ALARM2_SECONDS_REG);

> +          rtc_write(tm.tm_min, OMAP_RTC_ALARM2_MINUTES_REG);

> +          rtc_write(tm.tm_hour, OMAP_RTC_ALARM2_HOURS_REG);

> +          rtc_write(tm.tm_mday, OMAP_RTC_ALARM2_DAYS_REG);

> +          rtc_write(tm.tm_mon, OMAP_RTC_ALARM2_MONTHS_REG);

> +          rtc_write(tm.tm_year, OMAP_RTC_ALARM2_YEARS_REG);

> +

> +          /* Enable alarm2 interrupt */

> +          val = readl(rtc_base + OMAP_RTC_INTERRUPTS_REG);

> +          writel(val | OMAP_RTC_INTERRUPTS_IT_ALARM2,

> +                                                          rtc_base + OMAP_RTC_INTERRUPTS_REG);

> +

> +          /* Do not allow to execute any other task */

> +          spin_lock_irqsave(&lock, flags);

> +          while (1);

> +}

> +

>  static struct rtc_class_ops omap_rtc_ops = {

>             .read_time         = omap_rtc_read_time,

>             .set_time            = omap_rtc_set_time,

> @@ -327,12 +396,16 @@ static int __init omap_rtc_probe(struct platform_device *pdev)

>             struct resource                 *res, *mem;

>             struct rtc_device              *rtc;

>             u8                                           reg, new_ctrl;

> +          bool                                       pm_off = false;

>             const struct platform_device_id *id_entry;

>             const struct of_device_id *of_id;

>

>             of_id = of_match_device(omap_rtc_of_match, &pdev->dev);

> -           if (of_id)

> +          if (of_id) {

>                             pdev->id_entry = of_id->data;

> +                          pm_off = of_property_read_bool(pdev->dev.of_node,

> +                                                                          "ti,system-power-controller");

> +          }

>

>             omap_rtc_timer = platform_get_irq(pdev, 0);

>             if (omap_rtc_timer <= 0) {

> @@ -385,6 +458,10 @@ static int __init omap_rtc_probe(struct platform_device *pdev)

>             platform_set_drvdata(pdev, rtc);

>             dev_set_drvdata(&rtc->dev, mem);

>

> +          /* RTC power off */

> +          if (pm_off && !pm_power_off)

> +                          pm_power_off = rtc_power_off;

> +

>             /* clear pending irqs, and set 1/second periodic,

>              * which we'll use instead of update irqs

>              */

>



[-- Attachment #1.2: Type: text/html, Size: 30464 bytes --]

[-- Attachment #2: Type: text/plain, Size: 192 bytes --]

_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

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

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
@ 2012-11-05 17:39           ` Colin FoeParker
  0 siblings, 0 replies; 58+ messages in thread
From: Colin FoeParker @ 2012-11-05 17:39 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Benoit,



"I don't know how it is connected at board level, but I'm not sure the binding is the proper one."



Here is a link to the Beaglebone schematic<http://beagleboard.org/static/beaglebone/latest/Docs/Hardware/BONE_SCH.pdf>.  The PMIC_PWR_EN net is the one that you should be interested in following.



In the AM335x, this net is connected to the ALARM2 event in the RTC subsystem.  If the ALARM2 event is triggered, and the PMIC_PWR_EN pin is configured correctly, the pin is driven low.



In the TPS65217 series PMIC, the PWR_EN I/O can be used to put the entire chip into a low power state.  This disables all the power rails in the PMIC with an exception of the rail that powers the RTC power domain.



So when the ALARM2 event occurs, the PWR_EN I/O is pulled low and the entire system into a low power "off" state.



"It does not look super generic, and I'm wondering if we should not use instead some regulator binding to reflect the connection of the RTC to a regulator.



But without the board / soc spec it is hard to tell :-("



This is a good point.  I know that there are other omap SOC RTC's that do not support the ALARM2 implementation.  That being said, I would argue that there is more of a RTC connection with the implementation than a regulator.



Anil will probably have greater insight into the pro's/con's of the implementation.



-Colin





Colin Foe-Parker // Software Engineer II







Logic PD /// engineering design services

5 Clock Tower Place. Suite 400

Maynard, MA 01754

T // 978.243.2045



colin.foeparker at logicpd.com

www.logicpd.com

/ / / / / / / / / / / / / / / / / / / / / / / / /

This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, distribution, or other use of this message, or the taking of any action based on it, is strictly prohibited.





-----Original Message-----
From: Benoit Cousson [mailto:b-cousson at ti.com]
Sent: Monday, November 05, 2012 11:43 AM
To: AnilKumar Ch; Colin FoeParker
Cc: a.zummo at towertech.it; sameo at linux.intel.com; tony at atomide.com; grant.likely at secretlab.ca; rob.herring at calxeda.com; rtc-linux at googlegroups.com; linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org; devicetree-discuss at lists.ozlabs.org
Subject: Re: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver



Hi Anil / Colin,



On 11/05/2012 10:42 AM, AnilKumar Ch wrote:

> From: Colin Foe-Parker <colin.foeparker@logicpd.com>

>

> Add system power off control to rtc driver which is the in-charge of

> controlling the BeagleBone system power. The power_off routine can be

> hooked up to "pm_power_off" system call.

>

> System power off sequence:-

> * Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low

> * Enable PMIC_POWER_EN in rtc module

> * Set rtc ALARM2 time

> * Enable ALARM2 interrupt

>

> Added while (1); after the above steps to make sure that no other

> process acquire cpu. Otherwise we might see an unexpected behaviour

> because we are shutting down all the power rails of SoC except RTC.

>

> Signed-off-by: Colin Foe-Parker <colin.foeparker at logicpd.com<mailto:colin.foeparker@logicpd.com>>

> [anilkumar at ti.com: move poweroff additions to rtc driver]

> Signed-off-by: AnilKumar Ch <anilkumar at ti.com<mailto:anilkumar@ti.com>>

> ---

>  Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++

>  drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-

>  2 files changed, 83 insertions(+), 1 deletion(-)

>

> diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt

> b/Documentation/devicetree/bindings/rtc/rtc-omap.txt

> index b47aa41..8d9f4f9 100644

> --- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt

> +++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt

> @@ -6,6 +6,10 @@ Required properties:

>  - interrupts: rtc timer, alarm interrupts in order

>  - interrupt-parent: phandle for the interrupt controller

>

> +Optional properties:

> +- ti,system-power-controller: Telling whether or not rtc is

> +controlling

> +  the system power.



I don't know how it is connected at board level, but I'm not sure the binding is the proper one.

It does not look super generic, and I'm wondering if we should not use instead some regulator binding to reflect the connection of the RTC to a regulator.



But without the board / soc spec it is hard to tell :-(



Regards,

Benoit





> +

>  Example:

>

>  rtc at 1c23000 {

> @@ -14,4 +18,5 @@ rtc at 1c23000 {

>             interrupts = <19

>                                   19>;

>             interrupt-parent = <&intc>;

> +          ti,system-power-controller;

>  };

> diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index

> 6009714..2d90170 100644

> --- a/drivers/rtc/rtc-omap.c

> +++ b/drivers/rtc/rtc-omap.c

> @@ -72,6 +72,14 @@

>  #define OMAP_RTC_KICK0_REG                         0x6c

>  #define OMAP_RTC_KICK1_REG                         0x70

>

> +#define OMAP_RTC_ALARM2_SECONDS_REG            0x80

> +#define OMAP_RTC_ALARM2_MINUTES_REG            0x84

> +#define OMAP_RTC_ALARM2_HOURS_REG 0x88

> +#define OMAP_RTC_ALARM2_DAYS_REG     0x8c

> +#define OMAP_RTC_ALARM2_MONTHS_REG             0x90

> +#define OMAP_RTC_ALARM2_YEARS_REG   0x94

> +#define OMAP_RTC_PMIC_REG                        0x98

> +

>  /* OMAP_RTC_CTRL_REG bit fields: */

>  #define OMAP_RTC_CTRL_SPLIT                         (1<<7)

>  #define OMAP_RTC_CTRL_DISABLE                   (1<<6)

> @@ -93,15 +101,24 @@

>  #define OMAP_RTC_STATUS_BUSY            (1<<0)

>

>  /* OMAP_RTC_INTERRUPTS_REG bit fields: */

> +#define OMAP_RTC_INTERRUPTS_IT_ALARM2   (1<<4)

>  #define OMAP_RTC_INTERRUPTS_IT_ALARM    (1<<3)

>  #define OMAP_RTC_INTERRUPTS_IT_TIMER    (1<<2)

>

> +/* OMAP_RTC_PMIC_REG bit fields: */

> +#define OMAP_RTC_PMIC_POWER_EN_EN       (1<<16)

> +

>  /* OMAP_RTC_KICKER values */

>  #define           KICK0_VALUE                                    0x83e70b13

>  #define           KICK1_VALUE                                    0x95a4f1e0

>

>  #define           OMAP_RTC_HAS_KICKER                            0x1

>

> +#define SHUTDOWN_TIME_SEC                         2

> +#define SECS_IN_MIN                                            60

> +#define WAIT_AFTER                                              (SECS_IN_MIN - SHUTDOWN_TIME_SEC)

> +#define WAIT_TIME_MS                                       (SHUTDOWN_TIME_SEC * 1000)

> +

>  static void __iomem  *rtc_base;

>

>  #define rtc_read(addr)                            readb(rtc_base + (addr))

> @@ -290,6 +307,58 @@ static int omap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)

>             return 0;

>  }

>

> +/*

> + * rtc_power_off: Set the pmic power off sequence. The RTC generates

> + * pmic_pwr_enable control, which can be used to control an external

> + * PMIC.

> + */

> +static void rtc_power_off(void)

> +{

> +          u32 val;

> +          struct rtc_time tm;

> +          spinlock_t lock;

> +          unsigned long flags;

> +

> +          spin_lock_init(&lock);

> +

> +          /* Set PMIC power enable */

> +          val = readl(rtc_base + OMAP_RTC_PMIC_REG);

> +          writel(val | OMAP_RTC_PMIC_POWER_EN_EN, rtc_base +

> +OMAP_RTC_PMIC_REG);

> +

> +          /* Wait few seconds instead of rollover */

> +          do {

> +                          omap_rtc_read_time(NULL, &tm);

> +                          if (WAIT_AFTER <= tm.tm_sec)

> +                                          mdelay(WAIT_TIME_MS);

> +          } while (WAIT_AFTER <= tm.tm_sec);

> +

> +          /* Add shutdown time to the current value */

> +          tm.tm_sec += SHUTDOWN_TIME_SEC;

> +

> +          if (tm2bcd(&tm) < 0)

> +                          return;

> +

> +          pr_info("System will go to power_off state in approx. %d secs\n",

> +                                          SHUTDOWN_TIME_SEC);

> +

> +          /* Set the ALARM2 time */

> +          rtc_write(tm.tm_sec, OMAP_RTC_ALARM2_SECONDS_REG);

> +          rtc_write(tm.tm_min, OMAP_RTC_ALARM2_MINUTES_REG);

> +          rtc_write(tm.tm_hour, OMAP_RTC_ALARM2_HOURS_REG);

> +          rtc_write(tm.tm_mday, OMAP_RTC_ALARM2_DAYS_REG);

> +          rtc_write(tm.tm_mon, OMAP_RTC_ALARM2_MONTHS_REG);

> +          rtc_write(tm.tm_year, OMAP_RTC_ALARM2_YEARS_REG);

> +

> +          /* Enable alarm2 interrupt */

> +          val = readl(rtc_base + OMAP_RTC_INTERRUPTS_REG);

> +          writel(val | OMAP_RTC_INTERRUPTS_IT_ALARM2,

> +                                                          rtc_base + OMAP_RTC_INTERRUPTS_REG);

> +

> +          /* Do not allow to execute any other task */

> +          spin_lock_irqsave(&lock, flags);

> +          while (1);

> +}

> +

>  static struct rtc_class_ops omap_rtc_ops = {

>             .read_time         = omap_rtc_read_time,

>             .set_time            = omap_rtc_set_time,

> @@ -327,12 +396,16 @@ static int __init omap_rtc_probe(struct platform_device *pdev)

>             struct resource                 *res, *mem;

>             struct rtc_device              *rtc;

>             u8                                           reg, new_ctrl;

> +          bool                                       pm_off = false;

>             const struct platform_device_id *id_entry;

>             const struct of_device_id *of_id;

>

>             of_id = of_match_device(omap_rtc_of_match, &pdev->dev);

> -           if (of_id)

> +          if (of_id) {

>                             pdev->id_entry = of_id->data;

> +                          pm_off = of_property_read_bool(pdev->dev.of_node,

> +                                                                          "ti,system-power-controller");

> +          }

>

>             omap_rtc_timer = platform_get_irq(pdev, 0);

>             if (omap_rtc_timer <= 0) {

> @@ -385,6 +458,10 @@ static int __init omap_rtc_probe(struct platform_device *pdev)

>             platform_set_drvdata(pdev, rtc);

>             dev_set_drvdata(&rtc->dev, mem);

>

> +          /* RTC power off */

> +          if (pm_off && !pm_power_off)

> +                          pm_power_off = rtc_power_off;

> +

>             /* clear pending irqs, and set 1/second periodic,

>              * which we'll use instead of update irqs

>              */

>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121105/fc8fde6e/attachment-0001.html>

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

* RE: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
  2012-11-05 16:43       ` Benoit Cousson
@ 2012-11-06  5:07         ` AnilKumar, Chimata
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-06  5:07 UTC (permalink / raw)
  To: Cousson, Benoit, Colin Foe-Parker
  Cc: a.zummo, sameo, tony, grant.likely, rob.herring, rtc-linux,
	linux-omap, linux-arm-kernel, devicetree-discuss

On Mon, Nov 05, 2012 at 22:13:25, Cousson, Benoit wrote:
> Hi Anil / Colin,
> 
> On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> > From: Colin Foe-Parker <colin.foeparker@logicpd.com>
> > 
> > Add system power off control to rtc driver which is the in-charge
> > of controlling the BeagleBone system power. The power_off routine
> > can be hooked up to "pm_power_off" system call.
> > 
> > System power off sequence:-
> > * Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
> > * Enable PMIC_POWER_EN in rtc module
> > * Set rtc ALARM2 time
> > * Enable ALARM2 interrupt
> > 
> > Added while (1); after the above steps to make sure that no other
> > process acquire cpu. Otherwise we might see an unexpected behaviour
> > because we are shutting down all the power rails of SoC except RTC.
> > 
> > Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
> > [anilkumar@ti.com: move poweroff additions to rtc driver]
> > Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
> > ---
> >  Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
> >  drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
> >  2 files changed, 83 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > index b47aa41..8d9f4f9 100644
> > --- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > +++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > @@ -6,6 +6,10 @@ Required properties:
> >  - interrupts: rtc timer, alarm interrupts in order
> >  - interrupt-parent: phandle for the interrupt controller
> >  
> > +Optional properties:
> > +- ti,system-power-controller: Telling whether or not rtc is controlling
> > +  the system power.
> 
> I don't know how it is connected at board level, but I'm not sure the
> binding is the proper one.

Hi Benoit,
 ________________________________
|   ______          _______      |
|  |      |        |       |     |
|  |RTC   |        |       |     |
|  |PMIC  |  Line  |       |     |
|  |PWR_EN|=======>|PWR_EN |     |
|  |______|        |_______|     |
|  AM335x SoC       TPS65217     |
|                                |
|________________________________|
          BeagleBone

This is how RTC PMIC_PWR_EN is connected to PWR_EN of TPS65217 PMIC. Only when
RTC pull low in PMIC_PWR_EN then PMIC will go to power off state provided TPS65217
status should be changed to STATUS_OFF.

ALARM2 event should be trigger to configure PMIC_PWR_EN properly then the "Line"
driven low so that PMIC will go to shutdown mode.

Thanks
AnilKumar

> It does not look super generic, and I'm wondering if we should not use
> instead some regulator binding to reflect the connection of the RTC to a
> regulator.
> 
> But without the board / soc spec it is hard to tell :-(
>
> Regards,
> Benoit
> 
> 
> > +
> >  Example:
> >  
> >  rtc@1c23000 {
> > @@ -14,4 +18,5 @@ rtc@1c23000 {
> >  	interrupts = <19
> >  		      19>;
> >  	interrupt-parent = <&intc>;
> > +	ti,system-power-controller;
> >  };
> > diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
> > index 6009714..2d90170 100644
> > --- a/drivers/rtc/rtc-omap.c
> > +++ b/drivers/rtc/rtc-omap.c
> > @@ -72,6 +72,14 @@
> >  #define OMAP_RTC_KICK0_REG		0x6c
> >  #define OMAP_RTC_KICK1_REG		0x70
> >  
> > +#define OMAP_RTC_ALARM2_SECONDS_REG	0x80
> > +#define OMAP_RTC_ALARM2_MINUTES_REG	0x84
> > +#define OMAP_RTC_ALARM2_HOURS_REG	0x88
> > +#define OMAP_RTC_ALARM2_DAYS_REG	0x8c
> > +#define OMAP_RTC_ALARM2_MONTHS_REG	0x90
> > +#define OMAP_RTC_ALARM2_YEARS_REG	0x94
> > +#define OMAP_RTC_PMIC_REG		0x98
> > +
> >  /* OMAP_RTC_CTRL_REG bit fields: */
> >  #define OMAP_RTC_CTRL_SPLIT		(1<<7)
> >  #define OMAP_RTC_CTRL_DISABLE		(1<<6)
> > @@ -93,15 +101,24 @@
> >  #define OMAP_RTC_STATUS_BUSY            (1<<0)
> >  
> >  /* OMAP_RTC_INTERRUPTS_REG bit fields: */
> > +#define OMAP_RTC_INTERRUPTS_IT_ALARM2   (1<<4)
> >  #define OMAP_RTC_INTERRUPTS_IT_ALARM    (1<<3)
> >  #define OMAP_RTC_INTERRUPTS_IT_TIMER    (1<<2)
> >  
> > +/* OMAP_RTC_PMIC_REG bit fields: */
> > +#define OMAP_RTC_PMIC_POWER_EN_EN       (1<<16)
> > +
> >  /* OMAP_RTC_KICKER values */
> >  #define	KICK0_VALUE			0x83e70b13
> >  #define	KICK1_VALUE			0x95a4f1e0
> >  
> >  #define	OMAP_RTC_HAS_KICKER		0x1
> >  
> > +#define SHUTDOWN_TIME_SEC		2
> > +#define SECS_IN_MIN			60
> > +#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
> > +#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
> > +
> >  static void __iomem	*rtc_base;
> >  
> >  #define rtc_read(addr)		readb(rtc_base + (addr))
> > @@ -290,6 +307,58 @@ static int omap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
> >  	return 0;
> >  }
> >  
> > +/*
> > + * rtc_power_off: Set the pmic power off sequence. The RTC generates
> > + * pmic_pwr_enable control, which can be used to control an external
> > + * PMIC.
> > + */
> > +static void rtc_power_off(void)
> > +{
> > +	u32 val;
> > +	struct rtc_time tm;
> > +	spinlock_t lock;
> > +	unsigned long flags;
> > +
> > +	spin_lock_init(&lock);
> > +
> > +	/* Set PMIC power enable */
> > +	val = readl(rtc_base + OMAP_RTC_PMIC_REG);
> > +	writel(val | OMAP_RTC_PMIC_POWER_EN_EN, rtc_base + OMAP_RTC_PMIC_REG);
> > +
> > +	/* Wait few seconds instead of rollover */
> > +	do {
> > +		omap_rtc_read_time(NULL, &tm);
> > +		if (WAIT_AFTER <= tm.tm_sec)
> > +			mdelay(WAIT_TIME_MS);
> > +	} while (WAIT_AFTER <= tm.tm_sec);
> > +
> > +	/* Add shutdown time to the current value */
> > +	tm.tm_sec += SHUTDOWN_TIME_SEC;
> > +
> > +	if (tm2bcd(&tm) < 0)
> > +		return;
> > +
> > +	pr_info("System will go to power_off state in approx. %d secs\n",
> > +			SHUTDOWN_TIME_SEC);
> > +
> > +	/* Set the ALARM2 time */
> > +	rtc_write(tm.tm_sec, OMAP_RTC_ALARM2_SECONDS_REG);
> > +	rtc_write(tm.tm_min, OMAP_RTC_ALARM2_MINUTES_REG);
> > +	rtc_write(tm.tm_hour, OMAP_RTC_ALARM2_HOURS_REG);
> > +	rtc_write(tm.tm_mday, OMAP_RTC_ALARM2_DAYS_REG);
> > +	rtc_write(tm.tm_mon, OMAP_RTC_ALARM2_MONTHS_REG);
> > +	rtc_write(tm.tm_year, OMAP_RTC_ALARM2_YEARS_REG);
> > +
> > +	/* Enable alarm2 interrupt */
> > +	val = readl(rtc_base + OMAP_RTC_INTERRUPTS_REG);
> > +	writel(val | OMAP_RTC_INTERRUPTS_IT_ALARM2,
> > +				rtc_base + OMAP_RTC_INTERRUPTS_REG);
> > +
> > +	/* Do not allow to execute any other task */
> > +	spin_lock_irqsave(&lock, flags);
> > +	while (1);
> > +}
> > +
> >  static struct rtc_class_ops omap_rtc_ops = {
> >  	.read_time	= omap_rtc_read_time,
> >  	.set_time	= omap_rtc_set_time,
> > @@ -327,12 +396,16 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
> >  	struct resource		*res, *mem;
> >  	struct rtc_device	*rtc;
> >  	u8			reg, new_ctrl;
> > +	bool			pm_off = false;
> >  	const struct platform_device_id *id_entry;
> >  	const struct of_device_id *of_id;
> >  
> >  	of_id = of_match_device(omap_rtc_of_match, &pdev->dev);
> > -	if (of_id)
> > +	if (of_id) {
> >  		pdev->id_entry = of_id->data;
> > +		pm_off = of_property_read_bool(pdev->dev.of_node,
> > +					"ti,system-power-controller");
> > +	}
> >  
> >  	omap_rtc_timer = platform_get_irq(pdev, 0);
> >  	if (omap_rtc_timer <= 0) {
> > @@ -385,6 +458,10 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
> >  	platform_set_drvdata(pdev, rtc);
> >  	dev_set_drvdata(&rtc->dev, mem);
> >  
> > +	/* RTC power off */
> > +	if (pm_off && !pm_power_off)
> > +		pm_power_off = rtc_power_off;
> > +
> >  	/* clear pending irqs, and set 1/second periodic,
> >  	 * which we'll use instead of update irqs
> >  	 */
> > 
> 
> 


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

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
@ 2012-11-06  5:07         ` AnilKumar, Chimata
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-06  5:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 05, 2012 at 22:13:25, Cousson, Benoit wrote:
> Hi Anil / Colin,
> 
> On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> > From: Colin Foe-Parker <colin.foeparker@logicpd.com>
> > 
> > Add system power off control to rtc driver which is the in-charge
> > of controlling the BeagleBone system power. The power_off routine
> > can be hooked up to "pm_power_off" system call.
> > 
> > System power off sequence:-
> > * Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
> > * Enable PMIC_POWER_EN in rtc module
> > * Set rtc ALARM2 time
> > * Enable ALARM2 interrupt
> > 
> > Added while (1); after the above steps to make sure that no other
> > process acquire cpu. Otherwise we might see an unexpected behaviour
> > because we are shutting down all the power rails of SoC except RTC.
> > 
> > Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
> > [anilkumar at ti.com: move poweroff additions to rtc driver]
> > Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
> > ---
> >  Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
> >  drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
> >  2 files changed, 83 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > index b47aa41..8d9f4f9 100644
> > --- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > +++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > @@ -6,6 +6,10 @@ Required properties:
> >  - interrupts: rtc timer, alarm interrupts in order
> >  - interrupt-parent: phandle for the interrupt controller
> >  
> > +Optional properties:
> > +- ti,system-power-controller: Telling whether or not rtc is controlling
> > +  the system power.
> 
> I don't know how it is connected at board level, but I'm not sure the
> binding is the proper one.

Hi Benoit,
 ________________________________
|   ______          _______      |
|  |      |        |       |     |
|  |RTC   |        |       |     |
|  |PMIC  |  Line  |       |     |
|  |PWR_EN|=======>|PWR_EN |     |
|  |______|        |_______|     |
|  AM335x SoC       TPS65217     |
|                                |
|________________________________|
          BeagleBone

This is how RTC PMIC_PWR_EN is connected to PWR_EN of TPS65217 PMIC. Only when
RTC pull low in PMIC_PWR_EN then PMIC will go to power off state provided TPS65217
status should be changed to STATUS_OFF.

ALARM2 event should be trigger to configure PMIC_PWR_EN properly then the "Line"
driven low so that PMIC will go to shutdown mode.

Thanks
AnilKumar

> It does not look super generic, and I'm wondering if we should not use
> instead some regulator binding to reflect the connection of the RTC to a
> regulator.
> 
> But without the board / soc spec it is hard to tell :-(
>
> Regards,
> Benoit
> 
> 
> > +
> >  Example:
> >  
> >  rtc at 1c23000 {
> > @@ -14,4 +18,5 @@ rtc at 1c23000 {
> >  	interrupts = <19
> >  		      19>;
> >  	interrupt-parent = <&intc>;
> > +	ti,system-power-controller;
> >  };
> > diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
> > index 6009714..2d90170 100644
> > --- a/drivers/rtc/rtc-omap.c
> > +++ b/drivers/rtc/rtc-omap.c
> > @@ -72,6 +72,14 @@
> >  #define OMAP_RTC_KICK0_REG		0x6c
> >  #define OMAP_RTC_KICK1_REG		0x70
> >  
> > +#define OMAP_RTC_ALARM2_SECONDS_REG	0x80
> > +#define OMAP_RTC_ALARM2_MINUTES_REG	0x84
> > +#define OMAP_RTC_ALARM2_HOURS_REG	0x88
> > +#define OMAP_RTC_ALARM2_DAYS_REG	0x8c
> > +#define OMAP_RTC_ALARM2_MONTHS_REG	0x90
> > +#define OMAP_RTC_ALARM2_YEARS_REG	0x94
> > +#define OMAP_RTC_PMIC_REG		0x98
> > +
> >  /* OMAP_RTC_CTRL_REG bit fields: */
> >  #define OMAP_RTC_CTRL_SPLIT		(1<<7)
> >  #define OMAP_RTC_CTRL_DISABLE		(1<<6)
> > @@ -93,15 +101,24 @@
> >  #define OMAP_RTC_STATUS_BUSY            (1<<0)
> >  
> >  /* OMAP_RTC_INTERRUPTS_REG bit fields: */
> > +#define OMAP_RTC_INTERRUPTS_IT_ALARM2   (1<<4)
> >  #define OMAP_RTC_INTERRUPTS_IT_ALARM    (1<<3)
> >  #define OMAP_RTC_INTERRUPTS_IT_TIMER    (1<<2)
> >  
> > +/* OMAP_RTC_PMIC_REG bit fields: */
> > +#define OMAP_RTC_PMIC_POWER_EN_EN       (1<<16)
> > +
> >  /* OMAP_RTC_KICKER values */
> >  #define	KICK0_VALUE			0x83e70b13
> >  #define	KICK1_VALUE			0x95a4f1e0
> >  
> >  #define	OMAP_RTC_HAS_KICKER		0x1
> >  
> > +#define SHUTDOWN_TIME_SEC		2
> > +#define SECS_IN_MIN			60
> > +#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
> > +#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
> > +
> >  static void __iomem	*rtc_base;
> >  
> >  #define rtc_read(addr)		readb(rtc_base + (addr))
> > @@ -290,6 +307,58 @@ static int omap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
> >  	return 0;
> >  }
> >  
> > +/*
> > + * rtc_power_off: Set the pmic power off sequence. The RTC generates
> > + * pmic_pwr_enable control, which can be used to control an external
> > + * PMIC.
> > + */
> > +static void rtc_power_off(void)
> > +{
> > +	u32 val;
> > +	struct rtc_time tm;
> > +	spinlock_t lock;
> > +	unsigned long flags;
> > +
> > +	spin_lock_init(&lock);
> > +
> > +	/* Set PMIC power enable */
> > +	val = readl(rtc_base + OMAP_RTC_PMIC_REG);
> > +	writel(val | OMAP_RTC_PMIC_POWER_EN_EN, rtc_base + OMAP_RTC_PMIC_REG);
> > +
> > +	/* Wait few seconds instead of rollover */
> > +	do {
> > +		omap_rtc_read_time(NULL, &tm);
> > +		if (WAIT_AFTER <= tm.tm_sec)
> > +			mdelay(WAIT_TIME_MS);
> > +	} while (WAIT_AFTER <= tm.tm_sec);
> > +
> > +	/* Add shutdown time to the current value */
> > +	tm.tm_sec += SHUTDOWN_TIME_SEC;
> > +
> > +	if (tm2bcd(&tm) < 0)
> > +		return;
> > +
> > +	pr_info("System will go to power_off state in approx. %d secs\n",
> > +			SHUTDOWN_TIME_SEC);
> > +
> > +	/* Set the ALARM2 time */
> > +	rtc_write(tm.tm_sec, OMAP_RTC_ALARM2_SECONDS_REG);
> > +	rtc_write(tm.tm_min, OMAP_RTC_ALARM2_MINUTES_REG);
> > +	rtc_write(tm.tm_hour, OMAP_RTC_ALARM2_HOURS_REG);
> > +	rtc_write(tm.tm_mday, OMAP_RTC_ALARM2_DAYS_REG);
> > +	rtc_write(tm.tm_mon, OMAP_RTC_ALARM2_MONTHS_REG);
> > +	rtc_write(tm.tm_year, OMAP_RTC_ALARM2_YEARS_REG);
> > +
> > +	/* Enable alarm2 interrupt */
> > +	val = readl(rtc_base + OMAP_RTC_INTERRUPTS_REG);
> > +	writel(val | OMAP_RTC_INTERRUPTS_IT_ALARM2,
> > +				rtc_base + OMAP_RTC_INTERRUPTS_REG);
> > +
> > +	/* Do not allow to execute any other task */
> > +	spin_lock_irqsave(&lock, flags);
> > +	while (1);
> > +}
> > +
> >  static struct rtc_class_ops omap_rtc_ops = {
> >  	.read_time	= omap_rtc_read_time,
> >  	.set_time	= omap_rtc_set_time,
> > @@ -327,12 +396,16 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
> >  	struct resource		*res, *mem;
> >  	struct rtc_device	*rtc;
> >  	u8			reg, new_ctrl;
> > +	bool			pm_off = false;
> >  	const struct platform_device_id *id_entry;
> >  	const struct of_device_id *of_id;
> >  
> >  	of_id = of_match_device(omap_rtc_of_match, &pdev->dev);
> > -	if (of_id)
> > +	if (of_id) {
> >  		pdev->id_entry = of_id->data;
> > +		pm_off = of_property_read_bool(pdev->dev.of_node,
> > +					"ti,system-power-controller");
> > +	}
> >  
> >  	omap_rtc_timer = platform_get_irq(pdev, 0);
> >  	if (omap_rtc_timer <= 0) {
> > @@ -385,6 +458,10 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
> >  	platform_set_drvdata(pdev, rtc);
> >  	dev_set_drvdata(&rtc->dev, mem);
> >  
> > +	/* RTC power off */
> > +	if (pm_off && !pm_power_off)
> > +		pm_power_off = rtc_power_off;
> > +
> >  	/* clear pending irqs, and set 1/second periodic,
> >  	 * which we'll use instead of update irqs
> >  	 */
> > 
> 
> 

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

* RE: [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
  2012-11-05 16:59       ` Benoit Cousson
@ 2012-11-06  5:13           ` AnilKumar, Chimata
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-06  5:13 UTC (permalink / raw)
  To: Cousson, Benoit
  Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, sameo-VuQAYsv1563Yd54FQh9/CA,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, mark Brown,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Colin Foe-Parker,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Mon, Nov 05, 2012 at 22:29:36, Cousson, Benoit wrote:
> + Mark
> 
> On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> > From: Colin Foe-Parker <colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org>
> > 
> > Set tps65217 PMIC status to OFF if power enable toggle is
> > supported. Also adds platform data flag, which should be
> > passed from board init data.
> > 
> > Signed-off-by: Colin Foe-Parker <colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org>
> > [anilkumar-l0cyMroinI0@public.gmane.org: move the additions to tps65217 MFD driver]
> > Signed-off-by: AnilKumar Ch <anilkumar-l0cyMroinI0@public.gmane.org>
> > ---
> >  .../devicetree/bindings/regulator/tps65217.txt     |    4 ++++
> >  drivers/mfd/tps65217.c                             |   12 ++++++++++++
> >  2 files changed, 16 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/regulator/tps65217.txt b/Documentation/devicetree/bindings/regulator/tps65217.txt
> > index d316fb8..4f05d20 100644
> > --- a/Documentation/devicetree/bindings/regulator/tps65217.txt
> > +++ b/Documentation/devicetree/bindings/regulator/tps65217.txt
> > @@ -11,6 +11,9 @@ Required properties:
> >    using the standard binding for regulators found at
> >    Documentation/devicetree/bindings/regulator/regulator.txt.
> >  
> > +Optional properties:
> > +- ti,pmic-shutdown-controller: Telling the PMIC to shutdown on PWR_EN toggle.
> 
> That sounds like a generic functionality to me. Don't we have some more
> generic way to handle that?

But STATUS_OFF should be set only if Board supports it, otherwise
this change doesn't make sense.

> 
> If not, that should probably not be a TI only attribute.
> 
> It looks like a GPIO like kind of interface at PMIC level.

I agree this should be a generic parameter, but in some regulators this STATUS OFF
control might not be available. This is in my mind while name this parameter.

Thanks
AnilKumar

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

* [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
@ 2012-11-06  5:13           ` AnilKumar, Chimata
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-06  5:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 05, 2012 at 22:29:36, Cousson, Benoit wrote:
> + Mark
> 
> On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> > From: Colin Foe-Parker <colin.foeparker@logicpd.com>
> > 
> > Set tps65217 PMIC status to OFF if power enable toggle is
> > supported. Also adds platform data flag, which should be
> > passed from board init data.
> > 
> > Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
> > [anilkumar at ti.com: move the additions to tps65217 MFD driver]
> > Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
> > ---
> >  .../devicetree/bindings/regulator/tps65217.txt     |    4 ++++
> >  drivers/mfd/tps65217.c                             |   12 ++++++++++++
> >  2 files changed, 16 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/regulator/tps65217.txt b/Documentation/devicetree/bindings/regulator/tps65217.txt
> > index d316fb8..4f05d20 100644
> > --- a/Documentation/devicetree/bindings/regulator/tps65217.txt
> > +++ b/Documentation/devicetree/bindings/regulator/tps65217.txt
> > @@ -11,6 +11,9 @@ Required properties:
> >    using the standard binding for regulators found at
> >    Documentation/devicetree/bindings/regulator/regulator.txt.
> >  
> > +Optional properties:
> > +- ti,pmic-shutdown-controller: Telling the PMIC to shutdown on PWR_EN toggle.
> 
> That sounds like a generic functionality to me. Don't we have some more
> generic way to handle that?

But STATUS_OFF should be set only if Board supports it, otherwise
this change doesn't make sense.

> 
> If not, that should probably not be a TI only attribute.
> 
> It looks like a GPIO like kind of interface at PMIC level.

I agree this should be a generic parameter, but in some regulators this STATUS OFF
control might not be available. This is in my mind while name this parameter.

Thanks
AnilKumar

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

* RE: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
  2012-11-05  9:42   ` AnilKumar Ch
@ 2012-11-06  5:45     ` Bedia, Vaibhav
  -1 siblings, 0 replies; 58+ messages in thread
From: Bedia, Vaibhav @ 2012-11-06  5:45 UTC (permalink / raw)
  To: AnilKumar, Chimata, a.zummo, sameo, tony
  Cc: Colin Foe-Parker, rtc-linux, devicetree-discuss, rob.herring,
	grant.likely, linux-omap, linux-arm-kernel

On Mon, Nov 05, 2012 at 15:12:27, AnilKumar, Chimata wrote:
[...]
>  
> +#define SHUTDOWN_TIME_SEC		2
> +#define SECS_IN_MIN			60
> +#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
> +#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
> +
>  static void __iomem	*rtc_base;
>  
[...]
> +
> +	/* Wait few seconds instead of rollover */
> +	do {
> +		omap_rtc_read_time(NULL, &tm);
> +		if (WAIT_AFTER <= tm.tm_sec)
> +			mdelay(WAIT_TIME_MS);
> +	} while (WAIT_AFTER <= tm.tm_sec);

This hardcoded wait for rollover doesn't look good. I see some
helper functions in rtc-lib.c which probably could be used for
converting the current time to elapsed seconds, add the delay and
then convert it back to the time to be programmed in RTC without
worrying about rollover. Why not use that?

> +
> +	/* Add shutdown time to the current value */
> +	tm.tm_sec += SHUTDOWN_TIME_SEC;
> +
> +	if (tm2bcd(&tm) < 0)
> +		return;
> +
> +	pr_info("System will go to power_off state in approx. %d secs\n",
> +			SHUTDOWN_TIME_SEC);
> +
> +	/* Set the ALARM2 time */
> +	rtc_write(tm.tm_sec, OMAP_RTC_ALARM2_SECONDS_REG);
> +	rtc_write(tm.tm_min, OMAP_RTC_ALARM2_MINUTES_REG);
> +	rtc_write(tm.tm_hour, OMAP_RTC_ALARM2_HOURS_REG);
> +	rtc_write(tm.tm_mday, OMAP_RTC_ALARM2_DAYS_REG);
> +	rtc_write(tm.tm_mon, OMAP_RTC_ALARM2_MONTHS_REG);
> +	rtc_write(tm.tm_year, OMAP_RTC_ALARM2_YEARS_REG);
> +
> +	/* Enable alarm2 interrupt */
> +	val = readl(rtc_base + OMAP_RTC_INTERRUPTS_REG);
> +	writel(val | OMAP_RTC_INTERRUPTS_IT_ALARM2,
> +				rtc_base + OMAP_RTC_INTERRUPTS_REG);
> +

These registers are not present in older versions of the IP so how
does that get handled?

You also need to describe the connection between the ALARM2 and the
power off logic in detail.

Regards,
Vaibhav

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

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
@ 2012-11-06  5:45     ` Bedia, Vaibhav
  0 siblings, 0 replies; 58+ messages in thread
From: Bedia, Vaibhav @ 2012-11-06  5:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 05, 2012 at 15:12:27, AnilKumar, Chimata wrote:
[...]
>  
> +#define SHUTDOWN_TIME_SEC		2
> +#define SECS_IN_MIN			60
> +#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
> +#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
> +
>  static void __iomem	*rtc_base;
>  
[...]
> +
> +	/* Wait few seconds instead of rollover */
> +	do {
> +		omap_rtc_read_time(NULL, &tm);
> +		if (WAIT_AFTER <= tm.tm_sec)
> +			mdelay(WAIT_TIME_MS);
> +	} while (WAIT_AFTER <= tm.tm_sec);

This hardcoded wait for rollover doesn't look good. I see some
helper functions in rtc-lib.c which probably could be used for
converting the current time to elapsed seconds, add the delay and
then convert it back to the time to be programmed in RTC without
worrying about rollover. Why not use that?

> +
> +	/* Add shutdown time to the current value */
> +	tm.tm_sec += SHUTDOWN_TIME_SEC;
> +
> +	if (tm2bcd(&tm) < 0)
> +		return;
> +
> +	pr_info("System will go to power_off state in approx. %d secs\n",
> +			SHUTDOWN_TIME_SEC);
> +
> +	/* Set the ALARM2 time */
> +	rtc_write(tm.tm_sec, OMAP_RTC_ALARM2_SECONDS_REG);
> +	rtc_write(tm.tm_min, OMAP_RTC_ALARM2_MINUTES_REG);
> +	rtc_write(tm.tm_hour, OMAP_RTC_ALARM2_HOURS_REG);
> +	rtc_write(tm.tm_mday, OMAP_RTC_ALARM2_DAYS_REG);
> +	rtc_write(tm.tm_mon, OMAP_RTC_ALARM2_MONTHS_REG);
> +	rtc_write(tm.tm_year, OMAP_RTC_ALARM2_YEARS_REG);
> +
> +	/* Enable alarm2 interrupt */
> +	val = readl(rtc_base + OMAP_RTC_INTERRUPTS_REG);
> +	writel(val | OMAP_RTC_INTERRUPTS_IT_ALARM2,
> +				rtc_base + OMAP_RTC_INTERRUPTS_REG);
> +

These registers are not present in older versions of the IP so how
does that get handled?

You also need to describe the connection between the ALARM2 and the
power off logic in detail.

Regards,
Vaibhav

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

* Re: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
  2012-11-06  5:07         ` AnilKumar, Chimata
@ 2012-11-06 16:56           ` Benoit Cousson
  -1 siblings, 0 replies; 58+ messages in thread
From: Benoit Cousson @ 2012-11-06 16:56 UTC (permalink / raw)
  To: AnilKumar, Chimata
  Cc: Colin Foe-Parker, a.zummo, sameo, tony, grant.likely,
	rob.herring, rtc-linux, linux-omap, linux-arm-kernel,
	devicetree-discuss

Hi Anil,

On 11/06/2012 06:07 AM, AnilKumar, Chimata wrote:
> On Mon, Nov 05, 2012 at 22:13:25, Cousson, Benoit wrote:
>> Hi Anil / Colin,
>>
>> On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
>>> From: Colin Foe-Parker <colin.foeparker@logicpd.com>
>>>
>>> Add system power off control to rtc driver which is the in-charge
>>> of controlling the BeagleBone system power. The power_off routine
>>> can be hooked up to "pm_power_off" system call.
>>>
>>> System power off sequence:-
>>> * Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
>>> * Enable PMIC_POWER_EN in rtc module
>>> * Set rtc ALARM2 time
>>> * Enable ALARM2 interrupt
>>>
>>> Added while (1); after the above steps to make sure that no other
>>> process acquire cpu. Otherwise we might see an unexpected behaviour
>>> because we are shutting down all the power rails of SoC except RTC.
>>>
>>> Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
>>> [anilkumar@ti.com: move poweroff additions to rtc driver]
>>> Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
>>> ---
>>>  Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
>>>  drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
>>>  2 files changed, 83 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
>>> index b47aa41..8d9f4f9 100644
>>> --- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
>>> +++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
>>> @@ -6,6 +6,10 @@ Required properties:
>>>  - interrupts: rtc timer, alarm interrupts in order
>>>  - interrupt-parent: phandle for the interrupt controller
>>>  
>>> +Optional properties:
>>> +- ti,system-power-controller: Telling whether or not rtc is controlling
>>> +  the system power.
>>
>> I don't know how it is connected at board level, but I'm not sure the
>> binding is the proper one.
> 
> Hi Benoit,
>  ________________________________
> |   ______          _______      |
> |  |      |        |       |     |
> |  |RTC   |        |       |     |
> |  |PMIC  |  Line  |       |     |
> |  |PWR_EN|=======>|PWR_EN |     |
> |  |______|        |_______|     |
> |  AM335x SoC       TPS65217     |
> |                                |
> |________________________________|
>           BeagleBone
> 
> This is how RTC PMIC_PWR_EN is connected to PWR_EN of TPS65217 PMIC. Only when
> RTC pull low in PMIC_PWR_EN then PMIC will go to power off state provided TPS65217
> status should be changed to STATUS_OFF.
> 
> ALARM2 event should be trigger to configure PMIC_PWR_EN properly then the "Line"
> driven low so that PMIC will go to shutdown mode.

Thanks for the nice diagram :-)

I'm wondering if we cannot abuse the gpio binding to describe that
connection instead of creating two custom attributes (PMIC + RTC).

Ideally we should do that without having to change the RTC to use the
gpiolib at all.


rtc: rtc@44e3e000 {
	compatible = "ti,da830-rtc";
	reg = <0x44e3e000 0x1000>;
	interrupts = <75, 76>;
	ti,hwmods = "rtc";

	/* expose the PWR_EN functionality of this RTC*/
	gpio-controller;
	#gpio-cells = <0>; /* assuming we can use 0 ??? */
};

...

tps: tps@24 {
 	compatible = "ti,tps65217";
	/*
         * Enable the power enable feature from
         * the input line if that attribute is there.
         */
	gpio-power-en = <&rtc>; /* PWR_EN */

	...
}	

Any thought?

Regards,
Benoit




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

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
@ 2012-11-06 16:56           ` Benoit Cousson
  0 siblings, 0 replies; 58+ messages in thread
From: Benoit Cousson @ 2012-11-06 16:56 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Anil,

On 11/06/2012 06:07 AM, AnilKumar, Chimata wrote:
> On Mon, Nov 05, 2012 at 22:13:25, Cousson, Benoit wrote:
>> Hi Anil / Colin,
>>
>> On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
>>> From: Colin Foe-Parker <colin.foeparker@logicpd.com>
>>>
>>> Add system power off control to rtc driver which is the in-charge
>>> of controlling the BeagleBone system power. The power_off routine
>>> can be hooked up to "pm_power_off" system call.
>>>
>>> System power off sequence:-
>>> * Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
>>> * Enable PMIC_POWER_EN in rtc module
>>> * Set rtc ALARM2 time
>>> * Enable ALARM2 interrupt
>>>
>>> Added while (1); after the above steps to make sure that no other
>>> process acquire cpu. Otherwise we might see an unexpected behaviour
>>> because we are shutting down all the power rails of SoC except RTC.
>>>
>>> Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
>>> [anilkumar at ti.com: move poweroff additions to rtc driver]
>>> Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
>>> ---
>>>  Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
>>>  drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
>>>  2 files changed, 83 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
>>> index b47aa41..8d9f4f9 100644
>>> --- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
>>> +++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
>>> @@ -6,6 +6,10 @@ Required properties:
>>>  - interrupts: rtc timer, alarm interrupts in order
>>>  - interrupt-parent: phandle for the interrupt controller
>>>  
>>> +Optional properties:
>>> +- ti,system-power-controller: Telling whether or not rtc is controlling
>>> +  the system power.
>>
>> I don't know how it is connected at board level, but I'm not sure the
>> binding is the proper one.
> 
> Hi Benoit,
>  ________________________________
> |   ______          _______      |
> |  |      |        |       |     |
> |  |RTC   |        |       |     |
> |  |PMIC  |  Line  |       |     |
> |  |PWR_EN|=======>|PWR_EN |     |
> |  |______|        |_______|     |
> |  AM335x SoC       TPS65217     |
> |                                |
> |________________________________|
>           BeagleBone
> 
> This is how RTC PMIC_PWR_EN is connected to PWR_EN of TPS65217 PMIC. Only when
> RTC pull low in PMIC_PWR_EN then PMIC will go to power off state provided TPS65217
> status should be changed to STATUS_OFF.
> 
> ALARM2 event should be trigger to configure PMIC_PWR_EN properly then the "Line"
> driven low so that PMIC will go to shutdown mode.

Thanks for the nice diagram :-)

I'm wondering if we cannot abuse the gpio binding to describe that
connection instead of creating two custom attributes (PMIC + RTC).

Ideally we should do that without having to change the RTC to use the
gpiolib at all.


rtc: rtc at 44e3e000 {
	compatible = "ti,da830-rtc";
	reg = <0x44e3e000 0x1000>;
	interrupts = <75, 76>;
	ti,hwmods = "rtc";

	/* expose the PWR_EN functionality of this RTC*/
	gpio-controller;
	#gpio-cells = <0>; /* assuming we can use 0 ??? */
};

...

tps: tps at 24 {
 	compatible = "ti,tps65217";
	/*
         * Enable the power enable feature from
         * the input line if that attribute is there.
         */
	gpio-power-en = <&rtc>; /* PWR_EN */

	...
}	

Any thought?

Regards,
Benoit

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

* RE: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
  2012-11-06 16:56           ` Benoit Cousson
@ 2012-11-12  9:47               ` AnilKumar, Chimata
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-12  9:47 UTC (permalink / raw)
  To: Cousson, Benoit
  Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, sameo-VuQAYsv1563Yd54FQh9/CA,
	Colin Foe-Parker, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Tue, Nov 06, 2012 at 22:26:54, Cousson, Benoit wrote:
> Hi Anil,
> 
> On 11/06/2012 06:07 AM, AnilKumar, Chimata wrote:
> > On Mon, Nov 05, 2012 at 22:13:25, Cousson, Benoit wrote:
> >> Hi Anil / Colin,
> >>
> >> On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> >>> From: Colin Foe-Parker <colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org>
> >>>
> >>> Add system power off control to rtc driver which is the in-charge
> >>> of controlling the BeagleBone system power. The power_off routine
> >>> can be hooked up to "pm_power_off" system call.
> >>>
> >>> System power off sequence:-
> >>> * Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
> >>> * Enable PMIC_POWER_EN in rtc module
> >>> * Set rtc ALARM2 time
> >>> * Enable ALARM2 interrupt
> >>>
> >>> Added while (1); after the above steps to make sure that no other
> >>> process acquire cpu. Otherwise we might see an unexpected behaviour
> >>> because we are shutting down all the power rails of SoC except RTC.
> >>>
> >>> Signed-off-by: Colin Foe-Parker <colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org>
> >>> [anilkumar-l0cyMroinI0@public.gmane.org: move poweroff additions to rtc driver]
> >>> Signed-off-by: AnilKumar Ch <anilkumar-l0cyMroinI0@public.gmane.org>
> >>> ---
> >>>  Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
> >>>  drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
> >>>  2 files changed, 83 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> >>> index b47aa41..8d9f4f9 100644
> >>> --- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> >>> +++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> >>> @@ -6,6 +6,10 @@ Required properties:
> >>>  - interrupts: rtc timer, alarm interrupts in order
> >>>  - interrupt-parent: phandle for the interrupt controller
> >>>  
> >>> +Optional properties:
> >>> +- ti,system-power-controller: Telling whether or not rtc is controlling
> >>> +  the system power.
> >>
> >> I don't know how it is connected at board level, but I'm not sure the
> >> binding is the proper one.
> > 
> > Hi Benoit,
> >  ________________________________
> > |   ______          _______      |
> > |  |      |        |       |     |
> > |  |RTC   |        |       |     |
> > |  |PMIC  |  Line  |       |     |
> > |  |PWR_EN|=======>|PWR_EN |     |
> > |  |______|        |_______|     |
> > |  AM335x SoC       TPS65217     |
> > |                                |
> > |________________________________|
> >           BeagleBone
> > 
> > This is how RTC PMIC_PWR_EN is connected to PWR_EN of TPS65217 PMIC. Only when
> > RTC pull low in PMIC_PWR_EN then PMIC will go to power off state provided TPS65217
> > status should be changed to STATUS_OFF.
> > 
> > ALARM2 event should be trigger to configure PMIC_PWR_EN properly then the "Line"
> > driven low so that PMIC will go to shutdown mode.
> 
> Thanks for the nice diagram :-)

I missed this mail thread so delayed in response

> 
> I'm wondering if we cannot abuse the gpio binding to describe that
> connection instead of creating two custom attributes (PMIC + RTC).
> 
> Ideally we should do that without having to change the RTC to use the
> gpiolib at all.
> 
> 
> rtc: rtc@44e3e000 {
> 	compatible = "ti,da830-rtc";
> 	reg = <0x44e3e000 0x1000>;
> 	interrupts = <75, 76>;
> 	ti,hwmods = "rtc";
> 
> 	/* expose the PWR_EN functionality of this RTC*/
> 	gpio-controller;
> 	#gpio-cells = <0>; /* assuming we can use 0 ??? */
> };
> 
> ...
> 
> tps: tps@24 {
>  	compatible = "ti,tps65217";
> 	/*
>          * Enable the power enable feature from
>          * the input line if that attribute is there.
>          */
> 	gpio-power-en = <&rtc>; /* PWR_EN */
> 
> 	...
> }	
> 
> Any thought?

No, these two are independent controllers. PMIC can go to power
off mode if we pull PWR_EN to low. We can pull down that line
by any means like PRCM or GPIO or some other. So these two flags
should be independent from each other.

Thanks
AnilKumar

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

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
@ 2012-11-12  9:47               ` AnilKumar, Chimata
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-12  9:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Nov 06, 2012 at 22:26:54, Cousson, Benoit wrote:
> Hi Anil,
> 
> On 11/06/2012 06:07 AM, AnilKumar, Chimata wrote:
> > On Mon, Nov 05, 2012 at 22:13:25, Cousson, Benoit wrote:
> >> Hi Anil / Colin,
> >>
> >> On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> >>> From: Colin Foe-Parker <colin.foeparker@logicpd.com>
> >>>
> >>> Add system power off control to rtc driver which is the in-charge
> >>> of controlling the BeagleBone system power. The power_off routine
> >>> can be hooked up to "pm_power_off" system call.
> >>>
> >>> System power off sequence:-
> >>> * Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
> >>> * Enable PMIC_POWER_EN in rtc module
> >>> * Set rtc ALARM2 time
> >>> * Enable ALARM2 interrupt
> >>>
> >>> Added while (1); after the above steps to make sure that no other
> >>> process acquire cpu. Otherwise we might see an unexpected behaviour
> >>> because we are shutting down all the power rails of SoC except RTC.
> >>>
> >>> Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
> >>> [anilkumar at ti.com: move poweroff additions to rtc driver]
> >>> Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
> >>> ---
> >>>  Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
> >>>  drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
> >>>  2 files changed, 83 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> >>> index b47aa41..8d9f4f9 100644
> >>> --- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> >>> +++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> >>> @@ -6,6 +6,10 @@ Required properties:
> >>>  - interrupts: rtc timer, alarm interrupts in order
> >>>  - interrupt-parent: phandle for the interrupt controller
> >>>  
> >>> +Optional properties:
> >>> +- ti,system-power-controller: Telling whether or not rtc is controlling
> >>> +  the system power.
> >>
> >> I don't know how it is connected at board level, but I'm not sure the
> >> binding is the proper one.
> > 
> > Hi Benoit,
> >  ________________________________
> > |   ______          _______      |
> > |  |      |        |       |     |
> > |  |RTC   |        |       |     |
> > |  |PMIC  |  Line  |       |     |
> > |  |PWR_EN|=======>|PWR_EN |     |
> > |  |______|        |_______|     |
> > |  AM335x SoC       TPS65217     |
> > |                                |
> > |________________________________|
> >           BeagleBone
> > 
> > This is how RTC PMIC_PWR_EN is connected to PWR_EN of TPS65217 PMIC. Only when
> > RTC pull low in PMIC_PWR_EN then PMIC will go to power off state provided TPS65217
> > status should be changed to STATUS_OFF.
> > 
> > ALARM2 event should be trigger to configure PMIC_PWR_EN properly then the "Line"
> > driven low so that PMIC will go to shutdown mode.
> 
> Thanks for the nice diagram :-)

I missed this mail thread so delayed in response

> 
> I'm wondering if we cannot abuse the gpio binding to describe that
> connection instead of creating two custom attributes (PMIC + RTC).
> 
> Ideally we should do that without having to change the RTC to use the
> gpiolib at all.
> 
> 
> rtc: rtc at 44e3e000 {
> 	compatible = "ti,da830-rtc";
> 	reg = <0x44e3e000 0x1000>;
> 	interrupts = <75, 76>;
> 	ti,hwmods = "rtc";
> 
> 	/* expose the PWR_EN functionality of this RTC*/
> 	gpio-controller;
> 	#gpio-cells = <0>; /* assuming we can use 0 ??? */
> };
> 
> ...
> 
> tps: tps at 24 {
>  	compatible = "ti,tps65217";
> 	/*
>          * Enable the power enable feature from
>          * the input line if that attribute is there.
>          */
> 	gpio-power-en = <&rtc>; /* PWR_EN */
> 
> 	...
> }	
> 
> Any thought?

No, these two are independent controllers. PMIC can go to power
off mode if we pull PWR_EN to low. We can pull down that line
by any means like PRCM or GPIO or some other. So these two flags
should be independent from each other.

Thanks
AnilKumar

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

* RE: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
  2012-11-06  5:45     ` Bedia, Vaibhav
@ 2012-11-12  9:47         ` AnilKumar, Chimata
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-12  9:47 UTC (permalink / raw)
  To: Bedia, Vaibhav, a.zummo-BfzFCNDTiLLj+vYz1yj4TQ,
	sameo-VuQAYsv1563Yd54FQh9/CA, tony-4v6yS6AI5VpBDgjK7y7TUQ
  Cc: Colin Foe-Parker, rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Tue, Nov 06, 2012 at 11:15:34, Bedia, Vaibhav wrote:
> On Mon, Nov 05, 2012 at 15:12:27, AnilKumar, Chimata wrote:
> [...]
> >  
> > +#define SHUTDOWN_TIME_SEC		2
> > +#define SECS_IN_MIN			60
> > +#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
> > +#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
> > +
> >  static void __iomem	*rtc_base;
> >  
> [...]
> > +
> > +	/* Wait few seconds instead of rollover */
> > +	do {
> > +		omap_rtc_read_time(NULL, &tm);
> > +		if (WAIT_AFTER <= tm.tm_sec)
> > +			mdelay(WAIT_TIME_MS);
> > +	} while (WAIT_AFTER <= tm.tm_sec);
> 
> This hardcoded wait for rollover doesn't look good. I see some
> helper functions in rtc-lib.c which probably could be used for
> converting the current time to elapsed seconds, add the delay and
> then convert it back to the time to be programmed in RTC without
> worrying about rollover. Why not use that?

I am not aware of those APIs, can you point some?

> 
> > +
> > +	/* Add shutdown time to the current value */
> > +	tm.tm_sec += SHUTDOWN_TIME_SEC;
> > +
> > +	if (tm2bcd(&tm) < 0)
> > +		return;
> > +
> > +	pr_info("System will go to power_off state in approx. %d secs\n",
> > +			SHUTDOWN_TIME_SEC);
> > +
> > +	/* Set the ALARM2 time */
> > +	rtc_write(tm.tm_sec, OMAP_RTC_ALARM2_SECONDS_REG);
> > +	rtc_write(tm.tm_min, OMAP_RTC_ALARM2_MINUTES_REG);
> > +	rtc_write(tm.tm_hour, OMAP_RTC_ALARM2_HOURS_REG);
> > +	rtc_write(tm.tm_mday, OMAP_RTC_ALARM2_DAYS_REG);
> > +	rtc_write(tm.tm_mon, OMAP_RTC_ALARM2_MONTHS_REG);
> > +	rtc_write(tm.tm_year, OMAP_RTC_ALARM2_YEARS_REG);
> > +
> > +	/* Enable alarm2 interrupt */
> > +	val = readl(rtc_base + OMAP_RTC_INTERRUPTS_REG);
> > +	writel(val | OMAP_RTC_INTERRUPTS_IT_ALARM2,
> > +				rtc_base + OMAP_RTC_INTERRUPTS_REG);
> > +
> 
> These registers are not present in older versions of the IP so how
> does that get handled?

I think, earlier this feature is not supported/not used.

> 
> You also need to describe the connection between the ALARM2 and the
> power off logic in detail.

Sure, I will add.

Thanks
AnilKumar

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

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
@ 2012-11-12  9:47         ` AnilKumar, Chimata
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-12  9:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Nov 06, 2012 at 11:15:34, Bedia, Vaibhav wrote:
> On Mon, Nov 05, 2012 at 15:12:27, AnilKumar, Chimata wrote:
> [...]
> >  
> > +#define SHUTDOWN_TIME_SEC		2
> > +#define SECS_IN_MIN			60
> > +#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
> > +#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
> > +
> >  static void __iomem	*rtc_base;
> >  
> [...]
> > +
> > +	/* Wait few seconds instead of rollover */
> > +	do {
> > +		omap_rtc_read_time(NULL, &tm);
> > +		if (WAIT_AFTER <= tm.tm_sec)
> > +			mdelay(WAIT_TIME_MS);
> > +	} while (WAIT_AFTER <= tm.tm_sec);
> 
> This hardcoded wait for rollover doesn't look good. I see some
> helper functions in rtc-lib.c which probably could be used for
> converting the current time to elapsed seconds, add the delay and
> then convert it back to the time to be programmed in RTC without
> worrying about rollover. Why not use that?

I am not aware of those APIs, can you point some?

> 
> > +
> > +	/* Add shutdown time to the current value */
> > +	tm.tm_sec += SHUTDOWN_TIME_SEC;
> > +
> > +	if (tm2bcd(&tm) < 0)
> > +		return;
> > +
> > +	pr_info("System will go to power_off state in approx. %d secs\n",
> > +			SHUTDOWN_TIME_SEC);
> > +
> > +	/* Set the ALARM2 time */
> > +	rtc_write(tm.tm_sec, OMAP_RTC_ALARM2_SECONDS_REG);
> > +	rtc_write(tm.tm_min, OMAP_RTC_ALARM2_MINUTES_REG);
> > +	rtc_write(tm.tm_hour, OMAP_RTC_ALARM2_HOURS_REG);
> > +	rtc_write(tm.tm_mday, OMAP_RTC_ALARM2_DAYS_REG);
> > +	rtc_write(tm.tm_mon, OMAP_RTC_ALARM2_MONTHS_REG);
> > +	rtc_write(tm.tm_year, OMAP_RTC_ALARM2_YEARS_REG);
> > +
> > +	/* Enable alarm2 interrupt */
> > +	val = readl(rtc_base + OMAP_RTC_INTERRUPTS_REG);
> > +	writel(val | OMAP_RTC_INTERRUPTS_IT_ALARM2,
> > +				rtc_base + OMAP_RTC_INTERRUPTS_REG);
> > +
> 
> These registers are not present in older versions of the IP so how
> does that get handled?

I think, earlier this feature is not supported/not used.

> 
> You also need to describe the connection between the ALARM2 and the
> power off logic in detail.

Sure, I will add.

Thanks
AnilKumar

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

* Re: [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
  2012-11-05 16:59       ` Benoit Cousson
@ 2012-11-14  2:23         ` Mark Brown
  -1 siblings, 0 replies; 58+ messages in thread
From: Mark Brown @ 2012-11-14  2:23 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: AnilKumar Ch, a.zummo, sameo, tony, grant.likely, rob.herring,
	rtc-linux, linux-omap, linux-arm-kernel, devicetree-discuss,
	Colin Foe-Parker

[-- Attachment #1: Type: text/plain, Size: 542 bytes --]

On Mon, Nov 05, 2012 at 05:59:36PM +0100, Benoit Cousson wrote:
> On 11/05/2012 10:42 AM, AnilKumar Ch wrote:

> > +Optional properties:
> > +- ti,pmic-shutdown-controller: Telling the PMIC to shutdown on PWR_EN toggle.

> That sounds like a generic functionality to me. Don't we have some more
> generic way to handle that?

> If not, that should probably not be a TI only attribute.

It's pretty unusual to have this configurable as a single thing rather
than as part of flexible power sequencing or something that's just fixed
in silicon.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
@ 2012-11-14  2:23         ` Mark Brown
  0 siblings, 0 replies; 58+ messages in thread
From: Mark Brown @ 2012-11-14  2:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 05, 2012 at 05:59:36PM +0100, Benoit Cousson wrote:
> On 11/05/2012 10:42 AM, AnilKumar Ch wrote:

> > +Optional properties:
> > +- ti,pmic-shutdown-controller: Telling the PMIC to shutdown on PWR_EN toggle.

> That sounds like a generic functionality to me. Don't we have some more
> generic way to handle that?

> If not, that should probably not be a TI only attribute.

It's pretty unusual to have this configurable as a single thing rather
than as part of flexible power sequencing or something that's just fixed
in silicon.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121114/dbbb5772/attachment.sig>

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

* RE: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
  2012-11-06 16:56           ` Benoit Cousson
@ 2012-11-14  5:01             ` AnilKumar, Chimata
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-14  5:01 UTC (permalink / raw)
  To: AnilKumar, Chimata, Cousson, Benoit
  Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, sameo-VuQAYsv1563Yd54FQh9/CA,
	Colin Foe-Parker, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	Mark Brown, rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

+Mark

On Mon, Nov 12, 2012 at 15:17:13, AnilKumar, Chimata wrote:
> On Tue, Nov 06, 2012 at 22:26:54, Cousson, Benoit wrote:
> > Hi Anil,
> > 
> > On 11/06/2012 06:07 AM, AnilKumar, Chimata wrote:
> > > On Mon, Nov 05, 2012 at 22:13:25, Cousson, Benoit wrote:
> > >> Hi Anil / Colin,
> > >>
> > >> On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> > >>> From: Colin Foe-Parker <colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org>
> > >>>
> > >>> Add system power off control to rtc driver which is the in-charge
> > >>> of controlling the BeagleBone system power. The power_off routine
> > >>> can be hooked up to "pm_power_off" system call.
> > >>>
> > >>> System power off sequence:-
> > >>> * Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
> > >>> * Enable PMIC_POWER_EN in rtc module
> > >>> * Set rtc ALARM2 time
> > >>> * Enable ALARM2 interrupt
> > >>>
> > >>> Added while (1); after the above steps to make sure that no other
> > >>> process acquire cpu. Otherwise we might see an unexpected behaviour
> > >>> because we are shutting down all the power rails of SoC except RTC.
> > >>>
> > >>> Signed-off-by: Colin Foe-Parker <colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org>
> > >>> [anilkumar-l0cyMroinI0@public.gmane.org: move poweroff additions to rtc driver]
> > >>> Signed-off-by: AnilKumar Ch <anilkumar-l0cyMroinI0@public.gmane.org>
> > >>> ---
> > >>>  Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
> > >>>  drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
> > >>>  2 files changed, 83 insertions(+), 1 deletion(-)
> > >>>
> > >>> diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > >>> index b47aa41..8d9f4f9 100644
> > >>> --- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > >>> +++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > >>> @@ -6,6 +6,10 @@ Required properties:
> > >>>  - interrupts: rtc timer, alarm interrupts in order
> > >>>  - interrupt-parent: phandle for the interrupt controller
> > >>>  
> > >>> +Optional properties:
> > >>> +- ti,system-power-controller: Telling whether or not rtc is controlling
> > >>> +  the system power.
> > >>
> > >> I don't know how it is connected at board level, but I'm not sure the
> > >> binding is the proper one.
> > > 
> > > Hi Benoit,
> > >  ________________________________
> > > |   ______          _______      |
> > > |  |      |        |       |     |
> > > |  |RTC   |        |       |     |
> > > |  |PMIC  |  Line  |       |     |
> > > |  |PWR_EN|=======>|PWR_EN |     |
> > > |  |______|        |_______|     |
> > > |  AM335x SoC       TPS65217     |
> > > |                                |
> > > |________________________________|
> > >           BeagleBone
> > > 
> > > This is how RTC PMIC_PWR_EN is connected to PWR_EN of TPS65217 PMIC. Only when
> > > RTC pull low in PMIC_PWR_EN then PMIC will go to power off state provided TPS65217
> > > status should be changed to STATUS_OFF.
> > > 
> > > ALARM2 event should be trigger to configure PMIC_PWR_EN properly then the "Line"
> > > driven low so that PMIC will go to shutdown mode.
> > 
> > Thanks for the nice diagram :-)
> 
> I missed this mail thread so delayed in response
> 
> > 
> > I'm wondering if we cannot abuse the gpio binding to describe that
> > connection instead of creating two custom attributes (PMIC + RTC).
> > 
> > Ideally we should do that without having to change the RTC to use the
> > gpiolib at all.
> > 
> > 
> > rtc: rtc@44e3e000 {
> > 	compatible = "ti,da830-rtc";
> > 	reg = <0x44e3e000 0x1000>;
> > 	interrupts = <75, 76>;
> > 	ti,hwmods = "rtc";
> > 
> > 	/* expose the PWR_EN functionality of this RTC*/
> > 	gpio-controller;
> > 	#gpio-cells = <0>; /* assuming we can use 0 ??? */
> > };
> > 
> > ...
> > 
> > tps: tps@24 {
> >  	compatible = "ti,tps65217";
> > 	/*
> >          * Enable the power enable feature from
> >          * the input line if that attribute is there.
> >          */
> > 	gpio-power-en = <&rtc>; /* PWR_EN */
> > 
> > 	...
> > }	
> > 
> > Any thought?
> 
> No, these two are independent controllers. PMIC can go to power
> off mode if we pull PWR_EN to low. We can pull down that line
> by any means like PRCM or GPIO or some other. So these two flags
> should be independent from each other.
> 
> Thanks
> AnilKumar
> 

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

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
@ 2012-11-14  5:01             ` AnilKumar, Chimata
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-14  5:01 UTC (permalink / raw)
  To: linux-arm-kernel

+Mark

On Mon, Nov 12, 2012 at 15:17:13, AnilKumar, Chimata wrote:
> On Tue, Nov 06, 2012 at 22:26:54, Cousson, Benoit wrote:
> > Hi Anil,
> > 
> > On 11/06/2012 06:07 AM, AnilKumar, Chimata wrote:
> > > On Mon, Nov 05, 2012 at 22:13:25, Cousson, Benoit wrote:
> > >> Hi Anil / Colin,
> > >>
> > >> On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> > >>> From: Colin Foe-Parker <colin.foeparker@logicpd.com>
> > >>>
> > >>> Add system power off control to rtc driver which is the in-charge
> > >>> of controlling the BeagleBone system power. The power_off routine
> > >>> can be hooked up to "pm_power_off" system call.
> > >>>
> > >>> System power off sequence:-
> > >>> * Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
> > >>> * Enable PMIC_POWER_EN in rtc module
> > >>> * Set rtc ALARM2 time
> > >>> * Enable ALARM2 interrupt
> > >>>
> > >>> Added while (1); after the above steps to make sure that no other
> > >>> process acquire cpu. Otherwise we might see an unexpected behaviour
> > >>> because we are shutting down all the power rails of SoC except RTC.
> > >>>
> > >>> Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
> > >>> [anilkumar at ti.com: move poweroff additions to rtc driver]
> > >>> Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
> > >>> ---
> > >>>  Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
> > >>>  drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
> > >>>  2 files changed, 83 insertions(+), 1 deletion(-)
> > >>>
> > >>> diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > >>> index b47aa41..8d9f4f9 100644
> > >>> --- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > >>> +++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > >>> @@ -6,6 +6,10 @@ Required properties:
> > >>>  - interrupts: rtc timer, alarm interrupts in order
> > >>>  - interrupt-parent: phandle for the interrupt controller
> > >>>  
> > >>> +Optional properties:
> > >>> +- ti,system-power-controller: Telling whether or not rtc is controlling
> > >>> +  the system power.
> > >>
> > >> I don't know how it is connected at board level, but I'm not sure the
> > >> binding is the proper one.
> > > 
> > > Hi Benoit,
> > >  ________________________________
> > > |   ______          _______      |
> > > |  |      |        |       |     |
> > > |  |RTC   |        |       |     |
> > > |  |PMIC  |  Line  |       |     |
> > > |  |PWR_EN|=======>|PWR_EN |     |
> > > |  |______|        |_______|     |
> > > |  AM335x SoC       TPS65217     |
> > > |                                |
> > > |________________________________|
> > >           BeagleBone
> > > 
> > > This is how RTC PMIC_PWR_EN is connected to PWR_EN of TPS65217 PMIC. Only when
> > > RTC pull low in PMIC_PWR_EN then PMIC will go to power off state provided TPS65217
> > > status should be changed to STATUS_OFF.
> > > 
> > > ALARM2 event should be trigger to configure PMIC_PWR_EN properly then the "Line"
> > > driven low so that PMIC will go to shutdown mode.
> > 
> > Thanks for the nice diagram :-)
> 
> I missed this mail thread so delayed in response
> 
> > 
> > I'm wondering if we cannot abuse the gpio binding to describe that
> > connection instead of creating two custom attributes (PMIC + RTC).
> > 
> > Ideally we should do that without having to change the RTC to use the
> > gpiolib at all.
> > 
> > 
> > rtc: rtc at 44e3e000 {
> > 	compatible = "ti,da830-rtc";
> > 	reg = <0x44e3e000 0x1000>;
> > 	interrupts = <75, 76>;
> > 	ti,hwmods = "rtc";
> > 
> > 	/* expose the PWR_EN functionality of this RTC*/
> > 	gpio-controller;
> > 	#gpio-cells = <0>; /* assuming we can use 0 ??? */
> > };
> > 
> > ...
> > 
> > tps: tps at 24 {
> >  	compatible = "ti,tps65217";
> > 	/*
> >          * Enable the power enable feature from
> >          * the input line if that attribute is there.
> >          */
> > 	gpio-power-en = <&rtc>; /* PWR_EN */
> > 
> > 	...
> > }	
> > 
> > Any thought?
> 
> No, these two are independent controllers. PMIC can go to power
> off mode if we pull PWR_EN to low. We can pull down that line
> by any means like PRCM or GPIO or some other. So these two flags
> should be independent from each other.
> 
> Thanks
> AnilKumar
> 

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

* RE: [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
  2012-11-14  2:23         ` Mark Brown
@ 2012-11-14  5:10             ` AnilKumar, Chimata
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-14  5:10 UTC (permalink / raw)
  To: Mark Brown, Cousson, Benoit
  Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, sameo-VuQAYsv1563Yd54FQh9/CA,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Colin Foe-Parker,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Wed, Nov 14, 2012 at 07:53:42, Mark Brown wrote:
> On Mon, Nov 05, 2012 at 05:59:36PM +0100, Benoit Cousson wrote:
> > On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> 
> > > +Optional properties:
> > > +- ti,pmic-shutdown-controller: Telling the PMIC to shutdown on PWR_EN toggle.
> 
> > That sounds like a generic functionality to me. Don't we have some more
> > generic way to handle that?
> 
> > If not, that should probably not be a TI only attribute.
> 
> It's pretty unusual to have this configurable as a single thing rather
> than as part of flexible power sequencing or something that's just fixed
> in silicon.
> 

"[PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver" thread
have the details of how PMIC is connected to RTC module of SoC.

As part of the power_off sequence we have
1. To write STATUS_OFF in TPS65217 PMIC. If we do so then PMIC will
go to shutdown if PWR_EN is pulled-down. (This patch doing this)
2. To pull down the PWR_EN signal we have to set PMIC_PWR_EN in RTC
module and trigger ALARM2 event. (This piece of code in 2/4 patch).

Thanks
AnilKumar

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

* [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
@ 2012-11-14  5:10             ` AnilKumar, Chimata
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-14  5:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 14, 2012 at 07:53:42, Mark Brown wrote:
> On Mon, Nov 05, 2012 at 05:59:36PM +0100, Benoit Cousson wrote:
> > On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> 
> > > +Optional properties:
> > > +- ti,pmic-shutdown-controller: Telling the PMIC to shutdown on PWR_EN toggle.
> 
> > That sounds like a generic functionality to me. Don't we have some more
> > generic way to handle that?
> 
> > If not, that should probably not be a TI only attribute.
> 
> It's pretty unusual to have this configurable as a single thing rather
> than as part of flexible power sequencing or something that's just fixed
> in silicon.
> 

"[PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver" thread
have the details of how PMIC is connected to RTC module of SoC.

As part of the power_off sequence we have
1. To write STATUS_OFF in TPS65217 PMIC. If we do so then PMIC will
go to shutdown if PWR_EN is pulled-down. (This patch doing this)
2. To pull down the PWR_EN signal we have to set PMIC_PWR_EN in RTC
module and trigger ALARM2 event. (This piece of code in 2/4 patch).

Thanks
AnilKumar

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

* Re: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
  2012-11-14  5:01             ` AnilKumar, Chimata
@ 2012-11-14  5:21               ` Mark Brown
  -1 siblings, 0 replies; 58+ messages in thread
From: Mark Brown @ 2012-11-14  5:21 UTC (permalink / raw)
  To: AnilKumar, Chimata
  Cc: Cousson, Benoit, Colin Foe-Parker, a.zummo, sameo, tony,
	grant.likely, rob.herring, rtc-linux, linux-omap,
	linux-arm-kernel, devicetree-discuss

[-- Attachment #1: Type: text/plain, Size: 163 bytes --]

On Wed, Nov 14, 2012 at 05:01:45AM +0000, AnilKumar, Chimata wrote:
> +Mark

...without any words as to why I'm being added or what the content in
the message is?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
@ 2012-11-14  5:21               ` Mark Brown
  0 siblings, 0 replies; 58+ messages in thread
From: Mark Brown @ 2012-11-14  5:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 14, 2012 at 05:01:45AM +0000, AnilKumar, Chimata wrote:
> +Mark

...without any words as to why I'm being added or what the content in
the message is?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121114/770b6120/attachment.sig>

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

* RE: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
  2012-11-06 16:56           ` Benoit Cousson
@ 2012-11-14  5:50             ` AnilKumar, Chimata
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-14  5:50 UTC (permalink / raw)
  To: AnilKumar, Chimata, Cousson, Benoit
  Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, sameo-VuQAYsv1563Yd54FQh9/CA,
	Colin Foe-Parker, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	Mark Brown, rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Wed, Nov 14, 2012 at 10:31:42, AnilKumar, Chimata wrote:
> +Mark
> 
> On Mon, Nov 12, 2012 at 15:17:13, AnilKumar, Chimata wrote:
> > On Tue, Nov 06, 2012 at 22:26:54, Cousson, Benoit wrote:
> > > Hi Anil,
> > > 
> > > On 11/06/2012 06:07 AM, AnilKumar, Chimata wrote:
> > > > On Mon, Nov 05, 2012 at 22:13:25, Cousson, Benoit wrote:
> > > >> Hi Anil / Colin,
> > > >>
> > > >> On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> > > >>> From: Colin Foe-Parker <colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org>
> > > >>>
> > > >>> Add system power off control to rtc driver which is the in-charge
> > > >>> of controlling the BeagleBone system power. The power_off routine
> > > >>> can be hooked up to "pm_power_off" system call.
> > > >>>
> > > >>> System power off sequence:-
> > > >>> * Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
> > > >>> * Enable PMIC_POWER_EN in rtc module
> > > >>> * Set rtc ALARM2 time
> > > >>> * Enable ALARM2 interrupt
> > > >>>
> > > >>> Added while (1); after the above steps to make sure that no other
> > > >>> process acquire cpu. Otherwise we might see an unexpected behaviour
> > > >>> because we are shutting down all the power rails of SoC except RTC.
> > > >>>
> > > >>> Signed-off-by: Colin Foe-Parker <colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org>
> > > >>> [anilkumar-l0cyMroinI0@public.gmane.org: move poweroff additions to rtc driver]
> > > >>> Signed-off-by: AnilKumar Ch <anilkumar-l0cyMroinI0@public.gmane.org>
> > > >>> ---
> > > >>>  Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
> > > >>>  drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
> > > >>>  2 files changed, 83 insertions(+), 1 deletion(-)
> > > >>>
> > > >>> diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > > >>> index b47aa41..8d9f4f9 100644
> > > >>> --- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > > >>> +++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > > >>> @@ -6,6 +6,10 @@ Required properties:
> > > >>>  - interrupts: rtc timer, alarm interrupts in order
> > > >>>  - interrupt-parent: phandle for the interrupt controller
> > > >>>  
> > > >>> +Optional properties:
> > > >>> +- ti,system-power-controller: Telling whether or not rtc is controlling
> > > >>> +  the system power.
> > > >>
> > > >> I don't know how it is connected at board level, but I'm not sure the
> > > >> binding is the proper one.
> > > > 
> > > > Hi Benoit,
> > > >  ________________________________
> > > > |   ______          _______      |
> > > > |  |      |        |       |     |
> > > > |  |RTC   |        |       |     |
> > > > |  |PMIC  |  Line  |       |     |
> > > > |  |PWR_EN|=======>|PWR_EN |     |
> > > > |  |______|        |_______|     |
> > > > |  AM335x SoC       TPS65217     |
> > > > |                                |
> > > > |________________________________|
> > > >           BeagleBone
> > > > 
> > > > This is how RTC PMIC_PWR_EN is connected to PWR_EN of TPS65217 PMIC. Only when
> > > > RTC pull low in PMIC_PWR_EN then PMIC will go to power off state provided TPS65217
> > > > status should be changed to STATUS_OFF.
> > > > 
> > > > ALARM2 event should be trigger to configure PMIC_PWR_EN properly then the "Line"
> > > > driven low so that PMIC will go to shutdown mode.

Mark,

Details regarding how PMIC PWR_EN is connected to RTC module

Thanks
AnilKumar

> > > 
> > > Thanks for the nice diagram :-)
> > 
> > I missed this mail thread so delayed in response
> > 
> > > 
> > > I'm wondering if we cannot abuse the gpio binding to describe that
> > > connection instead of creating two custom attributes (PMIC + RTC).
> > > 
> > > Ideally we should do that without having to change the RTC to use the
> > > gpiolib at all.
> > > 
> > > 
> > > rtc: rtc@44e3e000 {
> > > 	compatible = "ti,da830-rtc";
> > > 	reg = <0x44e3e000 0x1000>;
> > > 	interrupts = <75, 76>;
> > > 	ti,hwmods = "rtc";
> > > 
> > > 	/* expose the PWR_EN functionality of this RTC*/
> > > 	gpio-controller;
> > > 	#gpio-cells = <0>; /* assuming we can use 0 ??? */
> > > };
> > > 
> > > ...
> > > 
> > > tps: tps@24 {
> > >  	compatible = "ti,tps65217";
> > > 	/*
> > >          * Enable the power enable feature from
> > >          * the input line if that attribute is there.
> > >          */
> > > 	gpio-power-en = <&rtc>; /* PWR_EN */
> > > 
> > > 	...
> > > }	
> > > 
> > > Any thought?
> > 
> > No, these two are independent controllers. PMIC can go to power
> > off mode if we pull PWR_EN to low. We can pull down that line
> > by any means like PRCM or GPIO or some other. So these two flags
> > should be independent from each other.
> > 
> > Thanks
> > AnilKumar
> > 
> 
> 

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

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
@ 2012-11-14  5:50             ` AnilKumar, Chimata
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-14  5:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 14, 2012 at 10:31:42, AnilKumar, Chimata wrote:
> +Mark
> 
> On Mon, Nov 12, 2012 at 15:17:13, AnilKumar, Chimata wrote:
> > On Tue, Nov 06, 2012 at 22:26:54, Cousson, Benoit wrote:
> > > Hi Anil,
> > > 
> > > On 11/06/2012 06:07 AM, AnilKumar, Chimata wrote:
> > > > On Mon, Nov 05, 2012 at 22:13:25, Cousson, Benoit wrote:
> > > >> Hi Anil / Colin,
> > > >>
> > > >> On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> > > >>> From: Colin Foe-Parker <colin.foeparker@logicpd.com>
> > > >>>
> > > >>> Add system power off control to rtc driver which is the in-charge
> > > >>> of controlling the BeagleBone system power. The power_off routine
> > > >>> can be hooked up to "pm_power_off" system call.
> > > >>>
> > > >>> System power off sequence:-
> > > >>> * Set PMIC STATUS_OFF when PMIC_POWER_EN is pulled low
> > > >>> * Enable PMIC_POWER_EN in rtc module
> > > >>> * Set rtc ALARM2 time
> > > >>> * Enable ALARM2 interrupt
> > > >>>
> > > >>> Added while (1); after the above steps to make sure that no other
> > > >>> process acquire cpu. Otherwise we might see an unexpected behaviour
> > > >>> because we are shutting down all the power rails of SoC except RTC.
> > > >>>
> > > >>> Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
> > > >>> [anilkumar at ti.com: move poweroff additions to rtc driver]
> > > >>> Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
> > > >>> ---
> > > >>>  Documentation/devicetree/bindings/rtc/rtc-omap.txt |    5 ++
> > > >>>  drivers/rtc/rtc-omap.c                             |   79 +++++++++++++++++++-
> > > >>>  2 files changed, 83 insertions(+), 1 deletion(-)
> > > >>>
> > > >>> diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > > >>> index b47aa41..8d9f4f9 100644
> > > >>> --- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > > >>> +++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
> > > >>> @@ -6,6 +6,10 @@ Required properties:
> > > >>>  - interrupts: rtc timer, alarm interrupts in order
> > > >>>  - interrupt-parent: phandle for the interrupt controller
> > > >>>  
> > > >>> +Optional properties:
> > > >>> +- ti,system-power-controller: Telling whether or not rtc is controlling
> > > >>> +  the system power.
> > > >>
> > > >> I don't know how it is connected at board level, but I'm not sure the
> > > >> binding is the proper one.
> > > > 
> > > > Hi Benoit,
> > > >  ________________________________
> > > > |   ______          _______      |
> > > > |  |      |        |       |     |
> > > > |  |RTC   |        |       |     |
> > > > |  |PMIC  |  Line  |       |     |
> > > > |  |PWR_EN|=======>|PWR_EN |     |
> > > > |  |______|        |_______|     |
> > > > |  AM335x SoC       TPS65217     |
> > > > |                                |
> > > > |________________________________|
> > > >           BeagleBone
> > > > 
> > > > This is how RTC PMIC_PWR_EN is connected to PWR_EN of TPS65217 PMIC. Only when
> > > > RTC pull low in PMIC_PWR_EN then PMIC will go to power off state provided TPS65217
> > > > status should be changed to STATUS_OFF.
> > > > 
> > > > ALARM2 event should be trigger to configure PMIC_PWR_EN properly then the "Line"
> > > > driven low so that PMIC will go to shutdown mode.

Mark,

Details regarding how PMIC PWR_EN is connected to RTC module

Thanks
AnilKumar

> > > 
> > > Thanks for the nice diagram :-)
> > 
> > I missed this mail thread so delayed in response
> > 
> > > 
> > > I'm wondering if we cannot abuse the gpio binding to describe that
> > > connection instead of creating two custom attributes (PMIC + RTC).
> > > 
> > > Ideally we should do that without having to change the RTC to use the
> > > gpiolib at all.
> > > 
> > > 
> > > rtc: rtc at 44e3e000 {
> > > 	compatible = "ti,da830-rtc";
> > > 	reg = <0x44e3e000 0x1000>;
> > > 	interrupts = <75, 76>;
> > > 	ti,hwmods = "rtc";
> > > 
> > > 	/* expose the PWR_EN functionality of this RTC*/
> > > 	gpio-controller;
> > > 	#gpio-cells = <0>; /* assuming we can use 0 ??? */
> > > };
> > > 
> > > ...
> > > 
> > > tps: tps at 24 {
> > >  	compatible = "ti,tps65217";
> > > 	/*
> > >          * Enable the power enable feature from
> > >          * the input line if that attribute is there.
> > >          */
> > > 	gpio-power-en = <&rtc>; /* PWR_EN */
> > > 
> > > 	...
> > > }	
> > > 
> > > Any thought?
> > 
> > No, these two are independent controllers. PMIC can go to power
> > off mode if we pull PWR_EN to low. We can pull down that line
> > by any means like PRCM or GPIO or some other. So these two flags
> > should be independent from each other.
> > 
> > Thanks
> > AnilKumar
> > 
> 
> 

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

* Re: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
  2012-11-14  5:50             ` AnilKumar, Chimata
@ 2012-11-14  6:00               ` Mark Brown
  -1 siblings, 0 replies; 58+ messages in thread
From: Mark Brown @ 2012-11-14  6:00 UTC (permalink / raw)
  To: AnilKumar, Chimata
  Cc: Cousson, Benoit, Colin Foe-Parker, a.zummo, sameo, tony,
	grant.likely, rob.herring, rtc-linux, linux-omap,
	linux-arm-kernel, devicetree-discuss

[-- Attachment #1: Type: text/plain, Size: 308 bytes --]

On Wed, Nov 14, 2012 at 05:50:46AM +0000, AnilKumar, Chimata wrote:
> On Wed, Nov 14, 2012 at 10:31:42, AnilKumar, Chimata wrote:

*Please* cut out irrelevant context from your mails.

> Details regarding how PMIC PWR_EN is connected to RTC module

OK...  but what am I expected to do with this information?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
@ 2012-11-14  6:00               ` Mark Brown
  0 siblings, 0 replies; 58+ messages in thread
From: Mark Brown @ 2012-11-14  6:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 14, 2012 at 05:50:46AM +0000, AnilKumar, Chimata wrote:
> On Wed, Nov 14, 2012 at 10:31:42, AnilKumar, Chimata wrote:

*Please* cut out irrelevant context from your mails.

> Details regarding how PMIC PWR_EN is connected to RTC module

OK...  but what am I expected to do with this information?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121114/8a755791/attachment.sig>

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

* RE: [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
  2012-11-14  2:23         ` Mark Brown
@ 2012-11-14  6:11           ` AnilKumar, Chimata
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-14  6:11 UTC (permalink / raw)
  To: AnilKumar, Chimata, Mark Brown, Cousson, Benoit
  Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, sameo-VuQAYsv1563Yd54FQh9/CA,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Colin Foe-Parker,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Wed, Nov 14, 2012 at 10:40:18, AnilKumar, Chimata wrote:
> On Wed, Nov 14, 2012 at 07:53:42, Mark Brown wrote:
> > On Mon, Nov 05, 2012 at 05:59:36PM +0100, Benoit Cousson wrote:
> > > On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> > 
> > > > +Optional properties:
> > > > +- ti,pmic-shutdown-controller: Telling the PMIC to shutdown on PWR_EN toggle.
> > 
> > > That sounds like a generic functionality to me. Don't we have some more
> > > generic way to handle that?
> > 
> > > If not, that should probably not be a TI only attribute.
> > 
> > It's pretty unusual to have this configurable as a single thing rather
> > than as part of flexible power sequencing or something that's just fixed
> > in silicon.
> >

Mark,

>From these two threads we can infer that this is handled in power_off
sequence only. And this is feature of PMIC to go to shutdown mode nothing
to be fixed in silicon. PWR_EN line can be connected to any of these like
PRCM control or GPIO or some other instead of RTC(in this case).

Thanks
AnilKumar
 
> 
> "[PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver" thread
> have the details of how PMIC is connected to RTC module of SoC.
> 
> As part of the power_off sequence we have
> 1. To write STATUS_OFF in TPS65217 PMIC. If we do so then PMIC will
> go to shutdown if PWR_EN is pulled-down. (This patch doing this)
> 2. To pull down the PWR_EN signal we have to set PMIC_PWR_EN in RTC
> module and trigger ALARM2 event. (This piece of code in 2/4 patch).
> 
> Thanks
> AnilKumar
> 

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

* [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
@ 2012-11-14  6:11           ` AnilKumar, Chimata
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-14  6:11 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 14, 2012 at 10:40:18, AnilKumar, Chimata wrote:
> On Wed, Nov 14, 2012 at 07:53:42, Mark Brown wrote:
> > On Mon, Nov 05, 2012 at 05:59:36PM +0100, Benoit Cousson wrote:
> > > On 11/05/2012 10:42 AM, AnilKumar Ch wrote:
> > 
> > > > +Optional properties:
> > > > +- ti,pmic-shutdown-controller: Telling the PMIC to shutdown on PWR_EN toggle.
> > 
> > > That sounds like a generic functionality to me. Don't we have some more
> > > generic way to handle that?
> > 
> > > If not, that should probably not be a TI only attribute.
> > 
> > It's pretty unusual to have this configurable as a single thing rather
> > than as part of flexible power sequencing or something that's just fixed
> > in silicon.
> >

Mark,

>From these two threads we can infer that this is handled in power_off
sequence only. And this is feature of PMIC to go to shutdown mode nothing
to be fixed in silicon. PWR_EN line can be connected to any of these like
PRCM control or GPIO or some other instead of RTC(in this case).

Thanks
AnilKumar
 
> 
> "[PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver" thread
> have the details of how PMIC is connected to RTC module of SoC.
> 
> As part of the power_off sequence we have
> 1. To write STATUS_OFF in TPS65217 PMIC. If we do so then PMIC will
> go to shutdown if PWR_EN is pulled-down. (This patch doing this)
> 2. To pull down the PWR_EN signal we have to set PMIC_PWR_EN in RTC
> module and trigger ALARM2 event. (This piece of code in 2/4 patch).
> 
> Thanks
> AnilKumar
> 

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

* Re: [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
  2012-11-14  6:11           ` AnilKumar, Chimata
@ 2012-11-14  6:21             ` Mark Brown
  -1 siblings, 0 replies; 58+ messages in thread
From: Mark Brown @ 2012-11-14  6:21 UTC (permalink / raw)
  To: AnilKumar, Chimata
  Cc: Cousson, Benoit, a.zummo, sameo, tony, grant.likely, rob.herring,
	rtc-linux, linux-omap, linux-arm-kernel, devicetree-discuss,
	Colin Foe-Parker

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

On Wed, Nov 14, 2012 at 06:11:45AM +0000, AnilKumar, Chimata wrote:

> From these two threads we can infer that this is handled in power_off
> sequence only. And this is feature of PMIC to go to shutdown mode nothing
> to be fixed in silicon. PWR_EN line can be connected to any of these like
> PRCM control or GPIO or some other instead of RTC(in this case).

OK, but why are you telling me this?  What are you looking for me to do
with this information?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
@ 2012-11-14  6:21             ` Mark Brown
  0 siblings, 0 replies; 58+ messages in thread
From: Mark Brown @ 2012-11-14  6:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 14, 2012 at 06:11:45AM +0000, AnilKumar, Chimata wrote:

> From these two threads we can infer that this is handled in power_off
> sequence only. And this is feature of PMIC to go to shutdown mode nothing
> to be fixed in silicon. PWR_EN line can be connected to any of these like
> PRCM control or GPIO or some other instead of RTC(in this case).

OK, but why are you telling me this?  What are you looking for me to do
with this information?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121114/3d0017b1/attachment-0001.sig>

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

* RE: [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
  2012-11-14  6:21             ` Mark Brown
@ 2012-11-14  6:49                 ` AnilKumar, Chimata
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-14  6:49 UTC (permalink / raw)
  To: Mark Brown
  Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Colin Foe-Parker,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	sameo-VuQAYsv1563Yd54FQh9/CA

On Wed, Nov 14, 2012 at 11:51:19, Mark Brown wrote:
> On Wed, Nov 14, 2012 at 06:11:45AM +0000, AnilKumar, Chimata wrote:
> 
> > From these two threads we can infer that this is handled in power_off
> > sequence only. And this is feature of PMIC to go to shutdown mode nothing
> > to be fixed in silicon. PWR_EN line can be connected to any of these like
> > PRCM control or GPIO or some other instead of RTC(in this case).
> 
> OK, but why are you telling me this?  What are you looking for me to do
> with this information?
> 

Mark,

Earlier you have a comment on this thread, I am adding my comments
on top of it. Sorry if I am in wrong direction.

Thanks
AnilKumar

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

* [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
@ 2012-11-14  6:49                 ` AnilKumar, Chimata
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-14  6:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 14, 2012 at 11:51:19, Mark Brown wrote:
> On Wed, Nov 14, 2012 at 06:11:45AM +0000, AnilKumar, Chimata wrote:
> 
> > From these two threads we can infer that this is handled in power_off
> > sequence only. And this is feature of PMIC to go to shutdown mode nothing
> > to be fixed in silicon. PWR_EN line can be connected to any of these like
> > PRCM control or GPIO or some other instead of RTC(in this case).
> 
> OK, but why are you telling me this?  What are you looking for me to do
> with this information?
> 

Mark,

Earlier you have a comment on this thread, I am adding my comments
on top of it. Sorry if I am in wrong direction.

Thanks
AnilKumar

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

* Re: [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
  2012-11-14  6:49                 ` AnilKumar, Chimata
@ 2012-11-14  7:00                   ` Mark Brown
  -1 siblings, 0 replies; 58+ messages in thread
From: Mark Brown @ 2012-11-14  7:00 UTC (permalink / raw)
  To: AnilKumar, Chimata
  Cc: Cousson, Benoit, a.zummo, sameo, tony, grant.likely, rob.herring,
	rtc-linux, linux-omap, linux-arm-kernel, devicetree-discuss,
	Colin Foe-Parker

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

On Wed, Nov 14, 2012 at 06:49:58AM +0000, AnilKumar, Chimata wrote:

> Earlier you have a comment on this thread, I am adding my comments
> on top of it. Sorry if I am in wrong direction.

Ah, I see.  I was just commenting because Benoit was asking if this
should be supported with a standard framework feature - I'm not
convinced that it should right now as there's not any clear patterns in
hardware behaviour.  I've no specific interest in this system.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
@ 2012-11-14  7:00                   ` Mark Brown
  0 siblings, 0 replies; 58+ messages in thread
From: Mark Brown @ 2012-11-14  7:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 14, 2012 at 06:49:58AM +0000, AnilKumar, Chimata wrote:

> Earlier you have a comment on this thread, I am adding my comments
> on top of it. Sorry if I am in wrong direction.

Ah, I see.  I was just commenting because Benoit was asking if this
should be supported with a standard framework feature - I'm not
convinced that it should right now as there's not any clear patterns in
hardware behaviour.  I've no specific interest in this system.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121114/82583125/attachment.sig>

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

* Re: [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
  2012-11-14  7:00                   ` Mark Brown
@ 2012-11-14 10:08                       ` Benoit Cousson
  -1 siblings, 0 replies; 58+ messages in thread
From: Benoit Cousson @ 2012-11-14 10:08 UTC (permalink / raw)
  To: Mark Brown
  Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, sameo-VuQAYsv1563Yd54FQh9/CA,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Colin Foe-Parker,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi Mark,

On 11/14/2012 08:00 AM, Mark Brown wrote:
> On Wed, Nov 14, 2012 at 06:49:58AM +0000, AnilKumar, Chimata wrote:
> 
>> Earlier you have a comment on this thread, I am adding my comments
>> on top of it. Sorry if I am in wrong direction.
> 
> Ah, I see.  I was just commenting because Benoit was asking if this
> should be supported with a standard framework feature - I'm not
> convinced that it should right now as there's not any clear patterns in
> hardware behaviour.  I've no specific interest in this system.

I was wondering that, because exposing a pin to control the whole PMIC
low power mode seems to be something that should be generic enough to be
handled by the regulator framework.

In the current situation we do have a pwr_en pin that can be controlled
by a GPIO or whatever signal from the SoC.
That's very similar, at PMIC level, to the fixedregulator that allow a
GPIO binding to enable it.

Don't you think that should deserve a support in the fmwk?

Regards,
Benoit

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

* [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
@ 2012-11-14 10:08                       ` Benoit Cousson
  0 siblings, 0 replies; 58+ messages in thread
From: Benoit Cousson @ 2012-11-14 10:08 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Mark,

On 11/14/2012 08:00 AM, Mark Brown wrote:
> On Wed, Nov 14, 2012 at 06:49:58AM +0000, AnilKumar, Chimata wrote:
> 
>> Earlier you have a comment on this thread, I am adding my comments
>> on top of it. Sorry if I am in wrong direction.
> 
> Ah, I see.  I was just commenting because Benoit was asking if this
> should be supported with a standard framework feature - I'm not
> convinced that it should right now as there's not any clear patterns in
> hardware behaviour.  I've no specific interest in this system.

I was wondering that, because exposing a pin to control the whole PMIC
low power mode seems to be something that should be generic enough to be
handled by the regulator framework.

In the current situation we do have a pwr_en pin that can be controlled
by a GPIO or whatever signal from the SoC.
That's very similar, at PMIC level, to the fixedregulator that allow a
GPIO binding to enable it.

Don't you think that should deserve a support in the fmwk?

Regards,
Benoit

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

* Re: [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
  2012-11-14 10:08                       ` Benoit Cousson
@ 2012-11-14 10:24                         ` Mark Brown
  -1 siblings, 0 replies; 58+ messages in thread
From: Mark Brown @ 2012-11-14 10:24 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: AnilKumar, Chimata, a.zummo, sameo, tony, grant.likely,
	rob.herring, rtc-linux, linux-omap, linux-arm-kernel,
	devicetree-discuss, Colin Foe-Parker

[-- Attachment #1: Type: text/plain, Size: 997 bytes --]

On Wed, Nov 14, 2012 at 11:08:49AM +0100, Benoit Cousson wrote:

> I was wondering that, because exposing a pin to control the whole PMIC
> low power mode seems to be something that should be generic enough to be
> handled by the regulator framework.

Having something that's controlled by software is really not at all
generic - suspending a PMIC from a GPIO is generally tied in very
closely with the CPU power sequencing which means it's typically some
combination of very hard coded things that we can't control or part of
much wider control of sequencing.

> In the current situation we do have a pwr_en pin that can be controlled
> by a GPIO or whatever signal from the SoC.
> That's very similar, at PMIC level, to the fixedregulator that allow a
> GPIO binding to enable it.

> Don't you think that should deserve a support in the fmwk?

I'm not seeing a coherent description of a feature here - what exactly
are you proposing that we do?  When and how would this GPIO be set for
example?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
@ 2012-11-14 10:24                         ` Mark Brown
  0 siblings, 0 replies; 58+ messages in thread
From: Mark Brown @ 2012-11-14 10:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 14, 2012 at 11:08:49AM +0100, Benoit Cousson wrote:

> I was wondering that, because exposing a pin to control the whole PMIC
> low power mode seems to be something that should be generic enough to be
> handled by the regulator framework.

Having something that's controlled by software is really not at all
generic - suspending a PMIC from a GPIO is generally tied in very
closely with the CPU power sequencing which means it's typically some
combination of very hard coded things that we can't control or part of
much wider control of sequencing.

> In the current situation we do have a pwr_en pin that can be controlled
> by a GPIO or whatever signal from the SoC.
> That's very similar, at PMIC level, to the fixedregulator that allow a
> GPIO binding to enable it.

> Don't you think that should deserve a support in the fmwk?

I'm not seeing a coherent description of a feature here - what exactly
are you proposing that we do?  When and how would this GPIO be set for
example?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121114/c909c844/attachment.sig>

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

* RE: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
  2012-11-06  5:45     ` Bedia, Vaibhav
@ 2012-11-16  6:13       ` AnilKumar, Chimata
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-16  6:13 UTC (permalink / raw)
  To: AnilKumar, Chimata, Bedia, Vaibhav,
	a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, sameo-VuQAYsv1563Yd54FQh9/CA,
	tony-4v6yS6AI5VpBDgjK7y7TUQ
  Cc: Colin Foe-Parker, rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Mon, Nov 12, 2012 at 15:17:48, AnilKumar, Chimata wrote:
> On Tue, Nov 06, 2012 at 11:15:34, Bedia, Vaibhav wrote:
> > On Mon, Nov 05, 2012 at 15:12:27, AnilKumar, Chimata wrote:
> > [...]
> > >  
> > > +#define SHUTDOWN_TIME_SEC		2
> > > +#define SECS_IN_MIN			60
> > > +#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
> > > +#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
> > > +
> > >  static void __iomem	*rtc_base;
> > >  
> > [...]
> > > +
> > > +	/* Wait few seconds instead of rollover */
> > > +	do {
> > > +		omap_rtc_read_time(NULL, &tm);
> > > +		if (WAIT_AFTER <= tm.tm_sec)
> > > +			mdelay(WAIT_TIME_MS);
> > > +	} while (WAIT_AFTER <= tm.tm_sec);
> > 
> > This hardcoded wait for rollover doesn't look good. I see some
> > helper functions in rtc-lib.c which probably could be used for
> > converting the current time to elapsed seconds, add the delay and
> > then convert it back to the time to be programmed in RTC without
> > worrying about rollover. Why not use that?
> 
> I am not aware of those APIs, can you point some?

I have gone through rtc-lib.c, these are the API's I am seeing
in the library

1. rtc_time_to_tm: Convert seconds since 01-01-1970 00:00:00 to
Gregorian date
2. rtc_tm_to_time: Convert Gregorian date to seconds since
01-01-1970 00:00:00

Steps I followed:-
================
1: unsigned long time;
2: omap_rtc_read_time(NULL, &tm);
3: rtc_tm_to_time(tm, &time);
4: pr_info("Time 1 %lu\n", time);
5: time += 2; /* (2sec) */
6: rtc_time_to_tm(time, tm);
7: rtc_tm_to_time(tm, &time); /* Only for printing time value */
8: pr_info("Time 2 %lu\n", time); 

With the above steps I am seeing completely two different time
values at step4 and step8

Thanks
AnilKumar

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

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
@ 2012-11-16  6:13       ` AnilKumar, Chimata
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-16  6:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 12, 2012 at 15:17:48, AnilKumar, Chimata wrote:
> On Tue, Nov 06, 2012 at 11:15:34, Bedia, Vaibhav wrote:
> > On Mon, Nov 05, 2012 at 15:12:27, AnilKumar, Chimata wrote:
> > [...]
> > >  
> > > +#define SHUTDOWN_TIME_SEC		2
> > > +#define SECS_IN_MIN			60
> > > +#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
> > > +#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
> > > +
> > >  static void __iomem	*rtc_base;
> > >  
> > [...]
> > > +
> > > +	/* Wait few seconds instead of rollover */
> > > +	do {
> > > +		omap_rtc_read_time(NULL, &tm);
> > > +		if (WAIT_AFTER <= tm.tm_sec)
> > > +			mdelay(WAIT_TIME_MS);
> > > +	} while (WAIT_AFTER <= tm.tm_sec);
> > 
> > This hardcoded wait for rollover doesn't look good. I see some
> > helper functions in rtc-lib.c which probably could be used for
> > converting the current time to elapsed seconds, add the delay and
> > then convert it back to the time to be programmed in RTC without
> > worrying about rollover. Why not use that?
> 
> I am not aware of those APIs, can you point some?

I have gone through rtc-lib.c, these are the API's I am seeing
in the library

1. rtc_time_to_tm: Convert seconds since 01-01-1970 00:00:00 to
Gregorian date
2. rtc_tm_to_time: Convert Gregorian date to seconds since
01-01-1970 00:00:00

Steps I followed:-
================
1: unsigned long time;
2: omap_rtc_read_time(NULL, &tm);
3: rtc_tm_to_time(tm, &time);
4: pr_info("Time 1 %lu\n", time);
5: time += 2; /* (2sec) */
6: rtc_time_to_tm(time, tm);
7: rtc_tm_to_time(tm, &time); /* Only for printing time value */
8: pr_info("Time 2 %lu\n", time); 

With the above steps I am seeing completely two different time
values at step4 and step8

Thanks
AnilKumar

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

* RE: [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
  2012-11-14 10:24                         ` Mark Brown
@ 2012-11-16  6:16                             ` AnilKumar, Chimata
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-16  6:16 UTC (permalink / raw)
  To: Mark Brown, Cousson, Benoit
  Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, sameo-VuQAYsv1563Yd54FQh9/CA,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Colin Foe-Parker,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Wed, Nov 14, 2012 at 15:54:53, Mark Brown wrote:
> On Wed, Nov 14, 2012 at 11:08:49AM +0100, Benoit Cousson wrote:
> 
> > I was wondering that, because exposing a pin to control the whole PMIC
> > low power mode seems to be something that should be generic enough to be
> > handled by the regulator framework.
> 
> Having something that's controlled by software is really not at all
> generic - suspending a PMIC from a GPIO is generally tied in very
> closely with the CPU power sequencing which means it's typically some
> combination of very hard coded things that we can't control or part of
> much wider control of sequencing.
> 
> > In the current situation we do have a pwr_en pin that can be controlled
> > by a GPIO or whatever signal from the SoC.
> > That's very similar, at PMIC level, to the fixedregulator that allow a
> > GPIO binding to enable it.
> 
> > Don't you think that should deserve a support in the fmwk?
> 
> I'm not seeing a coherent description of a feature here - what exactly
> are you proposing that we do?  When and how would this GPIO be set for
> example?

It would be better if these patches are going in like this till the
framework exists. We can change/move this portion once the framework
is defined for this kind.

Thanks
AnilKumar

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

* [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle
@ 2012-11-16  6:16                             ` AnilKumar, Chimata
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-16  6:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 14, 2012 at 15:54:53, Mark Brown wrote:
> On Wed, Nov 14, 2012 at 11:08:49AM +0100, Benoit Cousson wrote:
> 
> > I was wondering that, because exposing a pin to control the whole PMIC
> > low power mode seems to be something that should be generic enough to be
> > handled by the regulator framework.
> 
> Having something that's controlled by software is really not at all
> generic - suspending a PMIC from a GPIO is generally tied in very
> closely with the CPU power sequencing which means it's typically some
> combination of very hard coded things that we can't control or part of
> much wider control of sequencing.
> 
> > In the current situation we do have a pwr_en pin that can be controlled
> > by a GPIO or whatever signal from the SoC.
> > That's very similar, at PMIC level, to the fixedregulator that allow a
> > GPIO binding to enable it.
> 
> > Don't you think that should deserve a support in the fmwk?
> 
> I'm not seeing a coherent description of a feature here - what exactly
> are you proposing that we do?  When and how would this GPIO be set for
> example?

It would be better if these patches are going in like this till the
framework exists. We can change/move this portion once the framework
is defined for this kind.

Thanks
AnilKumar

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

* RE: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
  2012-11-06  5:45     ` Bedia, Vaibhav
@ 2012-11-16 10:47       ` AnilKumar, Chimata
  -1 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-16 10:47 UTC (permalink / raw)
  To: AnilKumar, Chimata, Bedia, Vaibhav,
	a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, sameo-VuQAYsv1563Yd54FQh9/CA,
	tony-4v6yS6AI5VpBDgjK7y7TUQ
  Cc: Colin Foe-Parker, rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Fri, Nov 16, 2012 at 11:43:36, AnilKumar, Chimata wrote:
> On Mon, Nov 12, 2012 at 15:17:48, AnilKumar, Chimata wrote:
> > On Tue, Nov 06, 2012 at 11:15:34, Bedia, Vaibhav wrote:
> > > On Mon, Nov 05, 2012 at 15:12:27, AnilKumar, Chimata wrote:
> > > [...]
> > > >  
> > > > +#define SHUTDOWN_TIME_SEC		2
> > > > +#define SECS_IN_MIN			60
> > > > +#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
> > > > +#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
> > > > +
> > > >  static void __iomem	*rtc_base;
> > > >  
> > > [...]
> > > > +
> > > > +	/* Wait few seconds instead of rollover */
> > > > +	do {
> > > > +		omap_rtc_read_time(NULL, &tm);
> > > > +		if (WAIT_AFTER <= tm.tm_sec)
> > > > +			mdelay(WAIT_TIME_MS);
> > > > +	} while (WAIT_AFTER <= tm.tm_sec);
> > > 
> > > This hardcoded wait for rollover doesn't look good. I see some
> > > helper functions in rtc-lib.c which probably could be used for
> > > converting the current time to elapsed seconds, add the delay and
> > > then convert it back to the time to be programmed in RTC without
> > > worrying about rollover. Why not use that?
> > 
> > I am not aware of those APIs, can you point some?
> 
> I have gone through rtc-lib.c, these are the API's I am seeing
> in the library
> 
> 1. rtc_time_to_tm: Convert seconds since 01-01-1970 00:00:00 to
> Gregorian date
> 2. rtc_tm_to_time: Convert Gregorian date to seconds since
> 01-01-1970 00:00:00
> 
> Steps I followed:-
> ================
> 1: unsigned long time;
> 2: omap_rtc_read_time(NULL, &tm);
> 3: rtc_tm_to_time(tm, &time);
> 4: pr_info("Time 1 %lu\n", time);
> 5: time += 2; /* (2sec) */
> 6: rtc_time_to_tm(time, tm);
> 7: rtc_tm_to_time(tm, &time); /* Only for printing time value */
> 8: pr_info("Time 2 %lu\n", time); 
> 
> With the above steps I am seeing completely two different time
> values at step4 and step8
> 

Nevermind it working now.

Thanks
AnilKumar

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

* [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
@ 2012-11-16 10:47       ` AnilKumar, Chimata
  0 siblings, 0 replies; 58+ messages in thread
From: AnilKumar, Chimata @ 2012-11-16 10:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Nov 16, 2012 at 11:43:36, AnilKumar, Chimata wrote:
> On Mon, Nov 12, 2012 at 15:17:48, AnilKumar, Chimata wrote:
> > On Tue, Nov 06, 2012 at 11:15:34, Bedia, Vaibhav wrote:
> > > On Mon, Nov 05, 2012 at 15:12:27, AnilKumar, Chimata wrote:
> > > [...]
> > > >  
> > > > +#define SHUTDOWN_TIME_SEC		2
> > > > +#define SECS_IN_MIN			60
> > > > +#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
> > > > +#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
> > > > +
> > > >  static void __iomem	*rtc_base;
> > > >  
> > > [...]
> > > > +
> > > > +	/* Wait few seconds instead of rollover */
> > > > +	do {
> > > > +		omap_rtc_read_time(NULL, &tm);
> > > > +		if (WAIT_AFTER <= tm.tm_sec)
> > > > +			mdelay(WAIT_TIME_MS);
> > > > +	} while (WAIT_AFTER <= tm.tm_sec);
> > > 
> > > This hardcoded wait for rollover doesn't look good. I see some
> > > helper functions in rtc-lib.c which probably could be used for
> > > converting the current time to elapsed seconds, add the delay and
> > > then convert it back to the time to be programmed in RTC without
> > > worrying about rollover. Why not use that?
> > 
> > I am not aware of those APIs, can you point some?
> 
> I have gone through rtc-lib.c, these are the API's I am seeing
> in the library
> 
> 1. rtc_time_to_tm: Convert seconds since 01-01-1970 00:00:00 to
> Gregorian date
> 2. rtc_tm_to_time: Convert Gregorian date to seconds since
> 01-01-1970 00:00:00
> 
> Steps I followed:-
> ================
> 1: unsigned long time;
> 2: omap_rtc_read_time(NULL, &tm);
> 3: rtc_tm_to_time(tm, &time);
> 4: pr_info("Time 1 %lu\n", time);
> 5: time += 2; /* (2sec) */
> 6: rtc_time_to_tm(time, tm);
> 7: rtc_tm_to_time(tm, &time); /* Only for printing time value */
> 8: pr_info("Time 2 %lu\n", time); 
> 
> With the above steps I am seeing completely two different time
> values at step4 and step8
> 

Nevermind it working now.

Thanks
AnilKumar

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

end of thread, other threads:[~2012-11-16 10:47 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-05  9:42 [PATCH 0/4] pm: Add power off control AnilKumar Ch
2012-11-05  9:42 ` AnilKumar Ch
2012-11-05  9:42 ` [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle AnilKumar Ch
2012-11-05  9:42   ` AnilKumar Ch
     [not found]   ` <1352108549-9341-2-git-send-email-anilkumar-l0cyMroinI0@public.gmane.org>
2012-11-05 16:59     ` Benoit Cousson
2012-11-05 16:59       ` Benoit Cousson
     [not found]       ` <5097F078.50701-l0cyMroinI0@public.gmane.org>
2012-11-06  5:13         ` AnilKumar, Chimata
2012-11-06  5:13           ` AnilKumar, Chimata
2012-11-14  2:23       ` Mark Brown
2012-11-14  2:23         ` Mark Brown
     [not found]         ` <20121114022341.GM4415-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-11-14  5:10           ` AnilKumar, Chimata
2012-11-14  5:10             ` AnilKumar, Chimata
2012-11-14  6:11         ` AnilKumar, Chimata
2012-11-14  6:11           ` AnilKumar, Chimata
2012-11-14  6:21           ` Mark Brown
2012-11-14  6:21             ` Mark Brown
     [not found]             ` <20121114062117.GC7407-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-11-14  6:49               ` AnilKumar, Chimata
2012-11-14  6:49                 ` AnilKumar, Chimata
2012-11-14  7:00                 ` Mark Brown
2012-11-14  7:00                   ` Mark Brown
     [not found]                   ` <20121114070046.GE7407-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-11-14 10:08                     ` Benoit Cousson
2012-11-14 10:08                       ` Benoit Cousson
2012-11-14 10:24                       ` Mark Brown
2012-11-14 10:24                         ` Mark Brown
     [not found]                         ` <20121114102452.GI7407-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-11-16  6:16                           ` AnilKumar, Chimata
2012-11-16  6:16                             ` AnilKumar, Chimata
2012-11-05  9:42 ` [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver AnilKumar Ch
2012-11-05  9:42   ` AnilKumar Ch
     [not found]   ` <1352108549-9341-3-git-send-email-anilkumar-l0cyMroinI0@public.gmane.org>
2012-11-05 16:43     ` Benoit Cousson
2012-11-05 16:43       ` Benoit Cousson
     [not found]       ` <5097ECAD.9010101-l0cyMroinI0@public.gmane.org>
2012-11-05 17:39         ` Colin FoeParker
2012-11-05 17:39           ` Colin FoeParker
2012-11-06  5:07       ` AnilKumar, Chimata
2012-11-06  5:07         ` AnilKumar, Chimata
2012-11-06 16:56         ` Benoit Cousson
2012-11-06 16:56           ` Benoit Cousson
     [not found]           ` <50994156.4080305-l0cyMroinI0@public.gmane.org>
2012-11-12  9:47             ` AnilKumar, Chimata
2012-11-12  9:47               ` AnilKumar, Chimata
2012-11-14  5:01           ` AnilKumar, Chimata
2012-11-14  5:01             ` AnilKumar, Chimata
2012-11-14  5:21             ` Mark Brown
2012-11-14  5:21               ` Mark Brown
2012-11-14  5:50           ` AnilKumar, Chimata
2012-11-14  5:50             ` AnilKumar, Chimata
2012-11-14  6:00             ` Mark Brown
2012-11-14  6:00               ` Mark Brown
2012-11-06  5:45   ` Bedia, Vaibhav
2012-11-06  5:45     ` Bedia, Vaibhav
     [not found]     ` <B5906170F1614E41A8A28DE3B8D121433EC04226-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-11-12  9:47       ` AnilKumar, Chimata
2012-11-12  9:47         ` AnilKumar, Chimata
2012-11-16  6:13     ` AnilKumar, Chimata
2012-11-16  6:13       ` AnilKumar, Chimata
2012-11-16 10:47     ` AnilKumar, Chimata
2012-11-16 10:47       ` AnilKumar, Chimata
2012-11-05  9:42 ` [PATCH 3/4] ARM: dts: AM33XX: Set pmic-shutdown-controller for BeagleBone AnilKumar Ch
2012-11-05  9:42   ` AnilKumar Ch
     [not found] ` <1352108549-9341-1-git-send-email-anilkumar-l0cyMroinI0@public.gmane.org>
2012-11-05  9:42   ` [PATCH 4/4] ARM: dts: AM33XX: Enable system power off control in am335x-bone AnilKumar Ch
2012-11-05  9:42     ` AnilKumar Ch

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.