All of lore.kernel.org
 help / color / mirror / Atom feed
* [rtc-linux] [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-19 17:04 ` Frank.Li
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni
  Cc: linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree, Frank Li

From: Frank Li <Frank.Li@freescale.com>

Change from v1 to v2
 - Change simple-bus to simple-mfd
 - RTC remove lock.
 - RTC remove comments "These register offsets are relative to LP (Low Power) range"
 - power off, remove extra space

SNVS is MPF module.
include rtc, power off, ON/OFF power key

  arm: imx: power-off: change to syscon to access register
  rtc: arm: imx: snvs: change use syscon to access register
Above two patch change existed power-off and rtc use syscon

  Document: dt: fsl: snvs: change support syscon
  arm: dts: imx: update snvs to use syscon access register
Update dt file and document

  input: keyboard: imx: add snvs power key driver
  document: devicetree: input: imx: i.mx snvs power device tree bindings
  arm: dts: imx6sx: enable snvs power key
Added on/off key driver

Frank Li (6):
  arm: imx: power-off: change to syscon to access register
  rtc: arm: imx: snvs: change use syscon to access register
  Document: dt: fsl: snvs: change support syscon
  arm: dts: imx: update snvs to use syscon access register
  document: devicetree: input: imx: i.mx snvs power device tree bindings
  arm: dts: imx6sx: enable snvs power key

Robin Gong (1):
  input: keyboard: imx: add snvs power key driver

 .../devicetree/bindings/crypto/fsl-sec4.txt        |  93 +++++++--
 .../devicetree/bindings/input/snvs-pwrkey.txt      |   1 +
 .../bindings/power_supply/imx-snvs-poweroff.txt    |  24 +--
 arch/arm/boot/dts/imx6qdl.dtsi                     |  12 +-
 arch/arm/boot/dts/imx6sl.dtsi                      |  12 +-
 arch/arm/boot/dts/imx6sx.dtsi                      |  19 +-
 arch/arm/boot/dts/vfxxx.dtsi                       |   9 +-
 drivers/input/keyboard/Kconfig                     |  11 +
 drivers/input/keyboard/Makefile                    |   1 +
 drivers/input/keyboard/snvs_pwrkey.c               | 232 +++++++++++++++++++++
 drivers/power/reset/imx-snvs-poweroff.c            |  21 +-
 drivers/rtc/rtc-snvs.c                             | 128 +++++-------
 12 files changed, 417 insertions(+), 146 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/snvs-pwrkey.txt
 create mode 100644 drivers/input/keyboard/snvs_pwrkey.c

-- 
1.9.1

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-19 17:04 ` Frank.Li
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni
  Cc: devicetree, Frank Li, rtc-linux, linux-pm, linux-input, linux-arm-kernel

From: Frank Li <Frank.Li@freescale.com>

Change from v1 to v2
 - Change simple-bus to simple-mfd
 - RTC remove lock.
 - RTC remove comments "These register offsets are relative to LP (Low Power) range"
 - power off, remove extra space

SNVS is MPF module.
include rtc, power off, ON/OFF power key

  arm: imx: power-off: change to syscon to access register
  rtc: arm: imx: snvs: change use syscon to access register
Above two patch change existed power-off and rtc use syscon

  Document: dt: fsl: snvs: change support syscon
  arm: dts: imx: update snvs to use syscon access register
Update dt file and document

  input: keyboard: imx: add snvs power key driver
  document: devicetree: input: imx: i.mx snvs power device tree bindings
  arm: dts: imx6sx: enable snvs power key
Added on/off key driver

Frank Li (6):
  arm: imx: power-off: change to syscon to access register
  rtc: arm: imx: snvs: change use syscon to access register
  Document: dt: fsl: snvs: change support syscon
  arm: dts: imx: update snvs to use syscon access register
  document: devicetree: input: imx: i.mx snvs power device tree bindings
  arm: dts: imx6sx: enable snvs power key

Robin Gong (1):
  input: keyboard: imx: add snvs power key driver

 .../devicetree/bindings/crypto/fsl-sec4.txt        |  93 +++++++--
 .../devicetree/bindings/input/snvs-pwrkey.txt      |   1 +
 .../bindings/power_supply/imx-snvs-poweroff.txt    |  24 +--
 arch/arm/boot/dts/imx6qdl.dtsi                     |  12 +-
 arch/arm/boot/dts/imx6sl.dtsi                      |  12 +-
 arch/arm/boot/dts/imx6sx.dtsi                      |  19 +-
 arch/arm/boot/dts/vfxxx.dtsi                       |   9 +-
 drivers/input/keyboard/Kconfig                     |  11 +
 drivers/input/keyboard/Makefile                    |   1 +
 drivers/input/keyboard/snvs_pwrkey.c               | 232 +++++++++++++++++++++
 drivers/power/reset/imx-snvs-poweroff.c            |  21 +-
 drivers/rtc/rtc-snvs.c                             | 128 +++++-------
 12 files changed, 417 insertions(+), 146 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/snvs-pwrkey.txt
 create mode 100644 drivers/input/keyboard/snvs_pwrkey.c

-- 
1.9.1

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

* [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-19 17:04 ` Frank.Li
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li at freescale.com @ 2015-05-19 17:04 UTC (permalink / raw)
  To: linux-arm-kernel

From: Frank Li <Frank.Li@freescale.com>

Change from v1 to v2
 - Change simple-bus to simple-mfd
 - RTC remove lock.
 - RTC remove comments "These register offsets are relative to LP (Low Power) range"
 - power off, remove extra space

SNVS is MPF module.
include rtc, power off, ON/OFF power key

  arm: imx: power-off: change to syscon to access register
  rtc: arm: imx: snvs: change use syscon to access register
Above two patch change existed power-off and rtc use syscon

  Document: dt: fsl: snvs: change support syscon
  arm: dts: imx: update snvs to use syscon access register
Update dt file and document

  input: keyboard: imx: add snvs power key driver
  document: devicetree: input: imx: i.mx snvs power device tree bindings
  arm: dts: imx6sx: enable snvs power key
Added on/off key driver

Frank Li (6):
  arm: imx: power-off: change to syscon to access register
  rtc: arm: imx: snvs: change use syscon to access register
  Document: dt: fsl: snvs: change support syscon
  arm: dts: imx: update snvs to use syscon access register
  document: devicetree: input: imx: i.mx snvs power device tree bindings
  arm: dts: imx6sx: enable snvs power key

Robin Gong (1):
  input: keyboard: imx: add snvs power key driver

 .../devicetree/bindings/crypto/fsl-sec4.txt        |  93 +++++++--
 .../devicetree/bindings/input/snvs-pwrkey.txt      |   1 +
 .../bindings/power_supply/imx-snvs-poweroff.txt    |  24 +--
 arch/arm/boot/dts/imx6qdl.dtsi                     |  12 +-
 arch/arm/boot/dts/imx6sl.dtsi                      |  12 +-
 arch/arm/boot/dts/imx6sx.dtsi                      |  19 +-
 arch/arm/boot/dts/vfxxx.dtsi                       |   9 +-
 drivers/input/keyboard/Kconfig                     |  11 +
 drivers/input/keyboard/Makefile                    |   1 +
 drivers/input/keyboard/snvs_pwrkey.c               | 232 +++++++++++++++++++++
 drivers/power/reset/imx-snvs-poweroff.c            |  21 +-
 drivers/rtc/rtc-snvs.c                             | 128 +++++-------
 12 files changed, 417 insertions(+), 146 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/snvs-pwrkey.txt
 create mode 100644 drivers/input/keyboard/snvs_pwrkey.c

-- 
1.9.1

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

* [rtc-linux] [PATCH v2 1/7] arm: imx: power-off: change to syscon to access register
  2015-05-19 17:04 ` Frank.Li
  (?)
@ 2015-05-19 17:04   ` Frank.Li
  -1 siblings, 0 replies; 63+ messages in thread
From: Frank.Li @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni
  Cc: linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree, Frank Li

From: Frank Li <Frank.Li@freescale.com>

snvs is MFP device, which included rtc, ON/OFF key, power off

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 drivers/power/reset/imx-snvs-poweroff.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/power/reset/imx-snvs-poweroff.c b/drivers/power/reset/imx-snvs-poweroff.c
index ad6ce50..aab8588 100644
--- a/drivers/power/reset/imx-snvs-poweroff.c
+++ b/drivers/power/reset/imx-snvs-poweroff.c
@@ -22,21 +22,30 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
 
-static void __iomem *snvs_base;
+static struct regmap *snvs;
+
+#define SNVS_LPCR 0x38
 
 static void do_imx_poweroff(void)
 {
-	u32 value = readl(snvs_base);
-
 	/* set TOP and DP_EN bit */
-	writel(value | 0x60, snvs_base);
+	regmap_update_bits(snvs, SNVS_LPCR, 0x60, 0x60);
 }
 
 static int imx_poweroff_probe(struct platform_device *pdev)
 {
-	snvs_base = of_iomap(pdev->dev.of_node, 0);
-	if (!snvs_base) {
+	struct device_node *nd;
+
+	nd = of_get_parent(pdev->dev.of_node);
+	if (!nd)
+		return -ENODEV;
+	snvs = syscon_node_to_regmap(nd);
+	of_node_put(nd);
+
+	if (!snvs) {
 		dev_err(&pdev->dev, "failed to get memory\n");
 		return -ENODEV;
 	}
-- 
1.9.1

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH v2 1/7] arm: imx: power-off: change to syscon to access register
@ 2015-05-19 17:04   ` Frank.Li
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni
  Cc: linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree, Frank Li

From: Frank Li <Frank.Li@freescale.com>

snvs is MFP device, which included rtc, ON/OFF key, power off

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 drivers/power/reset/imx-snvs-poweroff.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/power/reset/imx-snvs-poweroff.c b/drivers/power/reset/imx-snvs-poweroff.c
index ad6ce50..aab8588 100644
--- a/drivers/power/reset/imx-snvs-poweroff.c
+++ b/drivers/power/reset/imx-snvs-poweroff.c
@@ -22,21 +22,30 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
 
-static void __iomem *snvs_base;
+static struct regmap *snvs;
+
+#define SNVS_LPCR 0x38
 
 static void do_imx_poweroff(void)
 {
-	u32 value = readl(snvs_base);
-
 	/* set TOP and DP_EN bit */
-	writel(value | 0x60, snvs_base);
+	regmap_update_bits(snvs, SNVS_LPCR, 0x60, 0x60);
 }
 
 static int imx_poweroff_probe(struct platform_device *pdev)
 {
-	snvs_base = of_iomap(pdev->dev.of_node, 0);
-	if (!snvs_base) {
+	struct device_node *nd;
+
+	nd = of_get_parent(pdev->dev.of_node);
+	if (!nd)
+		return -ENODEV;
+	snvs = syscon_node_to_regmap(nd);
+	of_node_put(nd);
+
+	if (!snvs) {
 		dev_err(&pdev->dev, "failed to get memory\n");
 		return -ENODEV;
 	}
-- 
1.9.1


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

* [PATCH v2 1/7] arm: imx: power-off: change to syscon to access register
@ 2015-05-19 17:04   ` Frank.Li
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li at freescale.com @ 2015-05-19 17:04 UTC (permalink / raw)
  To: linux-arm-kernel

From: Frank Li <Frank.Li@freescale.com>

snvs is MFP device, which included rtc, ON/OFF key, power off

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 drivers/power/reset/imx-snvs-poweroff.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/power/reset/imx-snvs-poweroff.c b/drivers/power/reset/imx-snvs-poweroff.c
index ad6ce50..aab8588 100644
--- a/drivers/power/reset/imx-snvs-poweroff.c
+++ b/drivers/power/reset/imx-snvs-poweroff.c
@@ -22,21 +22,30 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
 
-static void __iomem *snvs_base;
+static struct regmap *snvs;
+
+#define SNVS_LPCR 0x38
 
 static void do_imx_poweroff(void)
 {
-	u32 value = readl(snvs_base);
-
 	/* set TOP and DP_EN bit */
-	writel(value | 0x60, snvs_base);
+	regmap_update_bits(snvs, SNVS_LPCR, 0x60, 0x60);
 }
 
 static int imx_poweroff_probe(struct platform_device *pdev)
 {
-	snvs_base = of_iomap(pdev->dev.of_node, 0);
-	if (!snvs_base) {
+	struct device_node *nd;
+
+	nd = of_get_parent(pdev->dev.of_node);
+	if (!nd)
+		return -ENODEV;
+	snvs = syscon_node_to_regmap(nd);
+	of_node_put(nd);
+
+	if (!snvs) {
 		dev_err(&pdev->dev, "failed to get memory\n");
 		return -ENODEV;
 	}
-- 
1.9.1

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

* [rtc-linux] [PATCH v2 2/7] rtc: arm: imx: snvs: change use syscon to access register
@ 2015-05-19 17:04   ` Frank.Li-KZfg59tc24xl57MIdRCFDg
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni
  Cc: linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree, Frank Li

From: Frank Li <Frank.Li@freescale.com>

snvs included rtc, on/off key, power-off module
change to syscon to access register

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 drivers/rtc/rtc-snvs.c | 128 +++++++++++++++++++++----------------------------
 1 file changed, 54 insertions(+), 74 deletions(-)

diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c
index 0479e80..6eaebf1 100644
--- a/drivers/rtc/rtc-snvs.c
+++ b/drivers/rtc/rtc-snvs.c
@@ -18,14 +18,15 @@
 #include <linux/platform_device.h>
 #include <linux/rtc.h>
 #include <linux/clk.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
 
-/* These register offsets are relative to LP (Low Power) range */
-#define SNVS_LPCR		0x04
-#define SNVS_LPSR		0x18
-#define SNVS_LPSRTCMR		0x1c
-#define SNVS_LPSRTCLR		0x20
-#define SNVS_LPTAR		0x24
-#define SNVS_LPPGDR		0x30
+#define SNVS_LPCR		0x38
+#define SNVS_LPSR		0x4c
+#define SNVS_LPSRTCMR		0x50
+#define SNVS_LPSRTCLR		0x54
+#define SNVS_LPTAR		0x58
+#define SNVS_LPPGDR		0x64
 
 #define SNVS_LPCR_SRTC_ENV	(1 << 0)
 #define SNVS_LPCR_LPTA_EN	(1 << 1)
@@ -37,31 +38,34 @@
 
 struct snvs_rtc_data {
 	struct rtc_device *rtc;
-	void __iomem *ioaddr;
+	struct regmap *snvs;
 	int irq;
-	spinlock_t lock;
 	struct clk *clk;
 };
 
-static u32 rtc_read_lp_counter(void __iomem *ioaddr)
+static u32 rtc_read_lp_counter(struct regmap *snvs)
 {
 	u64 read1, read2;
-
+	u32 val;
 	do {
-		read1 = readl(ioaddr + SNVS_LPSRTCMR);
+		regmap_read(snvs, SNVS_LPSRTCMR, &val);
+		read1 = val;
 		read1 <<= 32;
-		read1 |= readl(ioaddr + SNVS_LPSRTCLR);
+		regmap_read(snvs, SNVS_LPSRTCLR, &val);
+		read1 |= val;
 
-		read2 = readl(ioaddr + SNVS_LPSRTCMR);
+		regmap_read(snvs, SNVS_LPSRTCMR, &val);
+		read2 = val;
 		read2 <<= 32;
-		read2 |= readl(ioaddr + SNVS_LPSRTCLR);
+		regmap_read(snvs, SNVS_LPSRTCLR, &val);
+		read2 |= val;
 	} while (read1 != read2);
 
 	/* Convert 47-bit counter to 32-bit raw second count */
 	return (u32) (read1 >> CNTR_TO_SECS_SH);
 }
 
-static void rtc_write_sync_lp(void __iomem *ioaddr)
+static void rtc_write_sync_lp(struct regmap *snvs)
 {
 	u32 count1, count2, count3;
 	int i;
@@ -69,15 +73,15 @@ static void rtc_write_sync_lp(void __iomem *ioaddr)
 	/* Wait for 3 CKIL cycles */
 	for (i = 0; i < 3; i++) {
 		do {
-			count1 = readl(ioaddr + SNVS_LPSRTCLR);
-			count2 = readl(ioaddr + SNVS_LPSRTCLR);
+			regmap_read(snvs, SNVS_LPSRTCLR, &count1);
+			regmap_read(snvs, SNVS_LPSRTCLR, &count2);
 		} while (count1 != count2);
 
 		/* Now wait until counter value changes */
 		do {
 			do {
-				count2 = readl(ioaddr + SNVS_LPSRTCLR);
-				count3 = readl(ioaddr + SNVS_LPSRTCLR);
+				regmap_read(snvs, SNVS_LPSRTCLR, &count2);
+				regmap_read(snvs, SNVS_LPSRTCLR, &count3);
 			} while (count2 != count3);
 		} while (count3 == count1);
 	}
@@ -85,23 +89,14 @@ static void rtc_write_sync_lp(void __iomem *ioaddr)
 
 static int snvs_rtc_enable(struct snvs_rtc_data *data, bool enable)
 {
-	unsigned long flags;
 	int timeout = 1000;
 	u32 lpcr;
 
-	spin_lock_irqsave(&data->lock, flags);
-
-	lpcr = readl(data->ioaddr + SNVS_LPCR);
-	if (enable)
-		lpcr |= SNVS_LPCR_SRTC_ENV;
-	else
-		lpcr &= ~SNVS_LPCR_SRTC_ENV;
-	writel(lpcr, data->ioaddr + SNVS_LPCR);
-
-	spin_unlock_irqrestore(&data->lock, flags);
+	regmap_update_bits(data->snvs, SNVS_LPCR, SNVS_LPCR_SRTC_ENV,
+			   enable ? SNVS_LPCR_SRTC_ENV : 0);
 
 	while (--timeout) {
-		lpcr = readl(data->ioaddr + SNVS_LPCR);
+		regmap_read(data->snvs, SNVS_LPCR, &lpcr);
 
 		if (enable) {
 			if (lpcr & SNVS_LPCR_SRTC_ENV)
@@ -121,7 +116,7 @@ static int snvs_rtc_enable(struct snvs_rtc_data *data, bool enable)
 static int snvs_rtc_read_time(struct device *dev, struct rtc_time *tm)
 {
 	struct snvs_rtc_data *data = dev_get_drvdata(dev);
-	unsigned long time = rtc_read_lp_counter(data->ioaddr);
+	unsigned long time = rtc_read_lp_counter(data->snvs);
 
 	rtc_time_to_tm(time, tm);
 
@@ -139,8 +134,8 @@ static int snvs_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	snvs_rtc_enable(data, false);
 
 	/* Write 32-bit time to 47-bit timer, leaving 15 LSBs blank */
-	writel(time << CNTR_TO_SECS_SH, data->ioaddr + SNVS_LPSRTCLR);
-	writel(time >> (32 - CNTR_TO_SECS_SH), data->ioaddr + SNVS_LPSRTCMR);
+	regmap_write(data->snvs, SNVS_LPSRTCLR, time << CNTR_TO_SECS_SH);
+	regmap_write(data->snvs, SNVS_LPSRTCMR, time >> (32 - CNTR_TO_SECS_SH));
 
 	/* Enable RTC again */
 	snvs_rtc_enable(data, true);
@@ -153,10 +148,10 @@ static int snvs_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 	struct snvs_rtc_data *data = dev_get_drvdata(dev);
 	u32 lptar, lpsr;
 
-	lptar = readl(data->ioaddr + SNVS_LPTAR);
+	regmap_read(data->snvs, SNVS_LPTAR, &lptar);
 	rtc_time_to_tm(lptar, &alrm->time);
 
-	lpsr = readl(data->ioaddr + SNVS_LPSR);
+	regmap_read(data->snvs, SNVS_LPSR, &lpsr);
 	alrm->pending = (lpsr & SNVS_LPSR_LPTA) ? 1 : 0;
 
 	return 0;
@@ -165,21 +160,11 @@ static int snvs_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 static int snvs_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
 {
 	struct snvs_rtc_data *data = dev_get_drvdata(dev);
-	u32 lpcr;
-	unsigned long flags;
 
-	spin_lock_irqsave(&data->lock, flags);
+	regmap_update_bits(data->snvs, SNVS_LPCR, (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN),
+			   enable ? (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN) : 0);
 
-	lpcr = readl(data->ioaddr + SNVS_LPCR);
-	if (enable)
-		lpcr |= (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN);
-	else
-		lpcr &= ~(SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN);
-	writel(lpcr, data->ioaddr + SNVS_LPCR);
-
-	spin_unlock_irqrestore(&data->lock, flags);
-
-	rtc_write_sync_lp(data->ioaddr);
+	rtc_write_sync_lp(data->snvs);
 
 	return 0;
 }
@@ -189,24 +174,14 @@ static int snvs_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 	struct snvs_rtc_data *data = dev_get_drvdata(dev);
 	struct rtc_time *alrm_tm = &alrm->time;
 	unsigned long time;
-	unsigned long flags;
-	u32 lpcr;
 
 	rtc_tm_to_time(alrm_tm, &time);
 
-	spin_lock_irqsave(&data->lock, flags);
-
-	/* Have to clear LPTA_EN before programming new alarm time in LPTAR */
-	lpcr = readl(data->ioaddr + SNVS_LPCR);
-	lpcr &= ~SNVS_LPCR_LPTA_EN;
-	writel(lpcr, data->ioaddr + SNVS_LPCR);
-
-	spin_unlock_irqrestore(&data->lock, flags);
-
-	writel(time, data->ioaddr + SNVS_LPTAR);
+	regmap_update_bits(data->snvs, SNVS_LPCR, SNVS_LPCR_LPTA_EN, 0);
+	regmap_write(data->snvs, SNVS_LPTAR, time);
 
 	/* Clear alarm interrupt status bit */
-	writel(SNVS_LPSR_LPTA, data->ioaddr + SNVS_LPSR);
+	regmap_write(data->snvs, SNVS_LPSR, SNVS_LPSR_LPTA);
 
 	return snvs_rtc_alarm_irq_enable(dev, alrm->enabled);
 }
@@ -226,7 +201,7 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
 	u32 lpsr;
 	u32 events = 0;
 
-	lpsr = readl(data->ioaddr + SNVS_LPSR);
+	regmap_read(data->snvs, SNVS_LPSR, &lpsr);
 
 	if (lpsr & SNVS_LPSR_LPTA) {
 		events |= (RTC_AF | RTC_IRQF);
@@ -238,7 +213,7 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
 	}
 
 	/* clear interrupt status */
-	writel(lpsr, data->ioaddr + SNVS_LPSR);
+	regmap_write(data->snvs, SNVS_LPSR, lpsr);
 
 	return events ? IRQ_HANDLED : IRQ_NONE;
 }
@@ -246,17 +221,24 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
 static int snvs_rtc_probe(struct platform_device *pdev)
 {
 	struct snvs_rtc_data *data;
-	struct resource *res;
 	int ret;
+	struct device_node *snvs_np;
 
 	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	data->ioaddr = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(data->ioaddr))
-		return PTR_ERR(data->ioaddr);
+	snvs_np = of_get_parent(pdev->dev.of_node);
+	if (!snvs_np)
+		return -ENODEV;
+
+	data->snvs = syscon_node_to_regmap(snvs_np);
+	of_node_put(snvs_np);
+
+	if (!data->snvs) {
+		pr_err("Can't snvs syscon\n");
+		return -ENODEV;
+	}
 
 	data->irq = platform_get_irq(pdev, 0);
 	if (data->irq < 0)
@@ -276,13 +258,11 @@ static int snvs_rtc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, data);
 
-	spin_lock_init(&data->lock);
-
 	/* Initialize glitch detect */
-	writel(SNVS_LPPGDR_INIT, data->ioaddr + SNVS_LPPGDR);
+	regmap_write(data->snvs, SNVS_LPPGDR, SNVS_LPPGDR_INIT);
 
 	/* Clear interrupt status */
-	writel(0xffffffff, data->ioaddr + SNVS_LPSR);
+	regmap_write(data->snvs, SNVS_LPSR, 0xffffffff);
 
 	/* Enable RTC */
 	snvs_rtc_enable(data, true);
-- 
1.9.1

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH v2 2/7] rtc: arm: imx: snvs: change use syscon to access register
@ 2015-05-19 17:04   ` Frank.Li-KZfg59tc24xl57MIdRCFDg
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li-KZfg59tc24xl57MIdRCFDg @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa-Re5JQEeQqe8AvxtiuMwx3w, shawn.guo-QSEj5FYQhm4dnm+yROfE0A,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, a.zummo-BfzFCNDTiLLj+vYz1yj4TQ,
	p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-pm-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Frank Li

From: Frank Li <Frank.Li-KZfg59tc24xl57MIdRCFDg@public.gmane.org>

snvs included rtc, on/off key, power-off module
change to syscon to access register

Signed-off-by: Frank Li <Frank.Li-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
---
 drivers/rtc/rtc-snvs.c | 128 +++++++++++++++++++++----------------------------
 1 file changed, 54 insertions(+), 74 deletions(-)

diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c
index 0479e80..6eaebf1 100644
--- a/drivers/rtc/rtc-snvs.c
+++ b/drivers/rtc/rtc-snvs.c
@@ -18,14 +18,15 @@
 #include <linux/platform_device.h>
 #include <linux/rtc.h>
 #include <linux/clk.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
 
-/* These register offsets are relative to LP (Low Power) range */
-#define SNVS_LPCR		0x04
-#define SNVS_LPSR		0x18
-#define SNVS_LPSRTCMR		0x1c
-#define SNVS_LPSRTCLR		0x20
-#define SNVS_LPTAR		0x24
-#define SNVS_LPPGDR		0x30
+#define SNVS_LPCR		0x38
+#define SNVS_LPSR		0x4c
+#define SNVS_LPSRTCMR		0x50
+#define SNVS_LPSRTCLR		0x54
+#define SNVS_LPTAR		0x58
+#define SNVS_LPPGDR		0x64
 
 #define SNVS_LPCR_SRTC_ENV	(1 << 0)
 #define SNVS_LPCR_LPTA_EN	(1 << 1)
@@ -37,31 +38,34 @@
 
 struct snvs_rtc_data {
 	struct rtc_device *rtc;
-	void __iomem *ioaddr;
+	struct regmap *snvs;
 	int irq;
-	spinlock_t lock;
 	struct clk *clk;
 };
 
-static u32 rtc_read_lp_counter(void __iomem *ioaddr)
+static u32 rtc_read_lp_counter(struct regmap *snvs)
 {
 	u64 read1, read2;
-
+	u32 val;
 	do {
-		read1 = readl(ioaddr + SNVS_LPSRTCMR);
+		regmap_read(snvs, SNVS_LPSRTCMR, &val);
+		read1 = val;
 		read1 <<= 32;
-		read1 |= readl(ioaddr + SNVS_LPSRTCLR);
+		regmap_read(snvs, SNVS_LPSRTCLR, &val);
+		read1 |= val;
 
-		read2 = readl(ioaddr + SNVS_LPSRTCMR);
+		regmap_read(snvs, SNVS_LPSRTCMR, &val);
+		read2 = val;
 		read2 <<= 32;
-		read2 |= readl(ioaddr + SNVS_LPSRTCLR);
+		regmap_read(snvs, SNVS_LPSRTCLR, &val);
+		read2 |= val;
 	} while (read1 != read2);
 
 	/* Convert 47-bit counter to 32-bit raw second count */
 	return (u32) (read1 >> CNTR_TO_SECS_SH);
 }
 
-static void rtc_write_sync_lp(void __iomem *ioaddr)
+static void rtc_write_sync_lp(struct regmap *snvs)
 {
 	u32 count1, count2, count3;
 	int i;
@@ -69,15 +73,15 @@ static void rtc_write_sync_lp(void __iomem *ioaddr)
 	/* Wait for 3 CKIL cycles */
 	for (i = 0; i < 3; i++) {
 		do {
-			count1 = readl(ioaddr + SNVS_LPSRTCLR);
-			count2 = readl(ioaddr + SNVS_LPSRTCLR);
+			regmap_read(snvs, SNVS_LPSRTCLR, &count1);
+			regmap_read(snvs, SNVS_LPSRTCLR, &count2);
 		} while (count1 != count2);
 
 		/* Now wait until counter value changes */
 		do {
 			do {
-				count2 = readl(ioaddr + SNVS_LPSRTCLR);
-				count3 = readl(ioaddr + SNVS_LPSRTCLR);
+				regmap_read(snvs, SNVS_LPSRTCLR, &count2);
+				regmap_read(snvs, SNVS_LPSRTCLR, &count3);
 			} while (count2 != count3);
 		} while (count3 == count1);
 	}
@@ -85,23 +89,14 @@ static void rtc_write_sync_lp(void __iomem *ioaddr)
 
 static int snvs_rtc_enable(struct snvs_rtc_data *data, bool enable)
 {
-	unsigned long flags;
 	int timeout = 1000;
 	u32 lpcr;
 
-	spin_lock_irqsave(&data->lock, flags);
-
-	lpcr = readl(data->ioaddr + SNVS_LPCR);
-	if (enable)
-		lpcr |= SNVS_LPCR_SRTC_ENV;
-	else
-		lpcr &= ~SNVS_LPCR_SRTC_ENV;
-	writel(lpcr, data->ioaddr + SNVS_LPCR);
-
-	spin_unlock_irqrestore(&data->lock, flags);
+	regmap_update_bits(data->snvs, SNVS_LPCR, SNVS_LPCR_SRTC_ENV,
+			   enable ? SNVS_LPCR_SRTC_ENV : 0);
 
 	while (--timeout) {
-		lpcr = readl(data->ioaddr + SNVS_LPCR);
+		regmap_read(data->snvs, SNVS_LPCR, &lpcr);
 
 		if (enable) {
 			if (lpcr & SNVS_LPCR_SRTC_ENV)
@@ -121,7 +116,7 @@ static int snvs_rtc_enable(struct snvs_rtc_data *data, bool enable)
 static int snvs_rtc_read_time(struct device *dev, struct rtc_time *tm)
 {
 	struct snvs_rtc_data *data = dev_get_drvdata(dev);
-	unsigned long time = rtc_read_lp_counter(data->ioaddr);
+	unsigned long time = rtc_read_lp_counter(data->snvs);
 
 	rtc_time_to_tm(time, tm);
 
@@ -139,8 +134,8 @@ static int snvs_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	snvs_rtc_enable(data, false);
 
 	/* Write 32-bit time to 47-bit timer, leaving 15 LSBs blank */
-	writel(time << CNTR_TO_SECS_SH, data->ioaddr + SNVS_LPSRTCLR);
-	writel(time >> (32 - CNTR_TO_SECS_SH), data->ioaddr + SNVS_LPSRTCMR);
+	regmap_write(data->snvs, SNVS_LPSRTCLR, time << CNTR_TO_SECS_SH);
+	regmap_write(data->snvs, SNVS_LPSRTCMR, time >> (32 - CNTR_TO_SECS_SH));
 
 	/* Enable RTC again */
 	snvs_rtc_enable(data, true);
@@ -153,10 +148,10 @@ static int snvs_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 	struct snvs_rtc_data *data = dev_get_drvdata(dev);
 	u32 lptar, lpsr;
 
-	lptar = readl(data->ioaddr + SNVS_LPTAR);
+	regmap_read(data->snvs, SNVS_LPTAR, &lptar);
 	rtc_time_to_tm(lptar, &alrm->time);
 
-	lpsr = readl(data->ioaddr + SNVS_LPSR);
+	regmap_read(data->snvs, SNVS_LPSR, &lpsr);
 	alrm->pending = (lpsr & SNVS_LPSR_LPTA) ? 1 : 0;
 
 	return 0;
@@ -165,21 +160,11 @@ static int snvs_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 static int snvs_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
 {
 	struct snvs_rtc_data *data = dev_get_drvdata(dev);
-	u32 lpcr;
-	unsigned long flags;
 
-	spin_lock_irqsave(&data->lock, flags);
+	regmap_update_bits(data->snvs, SNVS_LPCR, (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN),
+			   enable ? (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN) : 0);
 
-	lpcr = readl(data->ioaddr + SNVS_LPCR);
-	if (enable)
-		lpcr |= (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN);
-	else
-		lpcr &= ~(SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN);
-	writel(lpcr, data->ioaddr + SNVS_LPCR);
-
-	spin_unlock_irqrestore(&data->lock, flags);
-
-	rtc_write_sync_lp(data->ioaddr);
+	rtc_write_sync_lp(data->snvs);
 
 	return 0;
 }
@@ -189,24 +174,14 @@ static int snvs_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 	struct snvs_rtc_data *data = dev_get_drvdata(dev);
 	struct rtc_time *alrm_tm = &alrm->time;
 	unsigned long time;
-	unsigned long flags;
-	u32 lpcr;
 
 	rtc_tm_to_time(alrm_tm, &time);
 
-	spin_lock_irqsave(&data->lock, flags);
-
-	/* Have to clear LPTA_EN before programming new alarm time in LPTAR */
-	lpcr = readl(data->ioaddr + SNVS_LPCR);
-	lpcr &= ~SNVS_LPCR_LPTA_EN;
-	writel(lpcr, data->ioaddr + SNVS_LPCR);
-
-	spin_unlock_irqrestore(&data->lock, flags);
-
-	writel(time, data->ioaddr + SNVS_LPTAR);
+	regmap_update_bits(data->snvs, SNVS_LPCR, SNVS_LPCR_LPTA_EN, 0);
+	regmap_write(data->snvs, SNVS_LPTAR, time);
 
 	/* Clear alarm interrupt status bit */
-	writel(SNVS_LPSR_LPTA, data->ioaddr + SNVS_LPSR);
+	regmap_write(data->snvs, SNVS_LPSR, SNVS_LPSR_LPTA);
 
 	return snvs_rtc_alarm_irq_enable(dev, alrm->enabled);
 }
@@ -226,7 +201,7 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
 	u32 lpsr;
 	u32 events = 0;
 
-	lpsr = readl(data->ioaddr + SNVS_LPSR);
+	regmap_read(data->snvs, SNVS_LPSR, &lpsr);
 
 	if (lpsr & SNVS_LPSR_LPTA) {
 		events |= (RTC_AF | RTC_IRQF);
@@ -238,7 +213,7 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
 	}
 
 	/* clear interrupt status */
-	writel(lpsr, data->ioaddr + SNVS_LPSR);
+	regmap_write(data->snvs, SNVS_LPSR, lpsr);
 
 	return events ? IRQ_HANDLED : IRQ_NONE;
 }
@@ -246,17 +221,24 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
 static int snvs_rtc_probe(struct platform_device *pdev)
 {
 	struct snvs_rtc_data *data;
-	struct resource *res;
 	int ret;
+	struct device_node *snvs_np;
 
 	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	data->ioaddr = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(data->ioaddr))
-		return PTR_ERR(data->ioaddr);
+	snvs_np = of_get_parent(pdev->dev.of_node);
+	if (!snvs_np)
+		return -ENODEV;
+
+	data->snvs = syscon_node_to_regmap(snvs_np);
+	of_node_put(snvs_np);
+
+	if (!data->snvs) {
+		pr_err("Can't snvs syscon\n");
+		return -ENODEV;
+	}
 
 	data->irq = platform_get_irq(pdev, 0);
 	if (data->irq < 0)
@@ -276,13 +258,11 @@ static int snvs_rtc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, data);
 
-	spin_lock_init(&data->lock);
-
 	/* Initialize glitch detect */
-	writel(SNVS_LPPGDR_INIT, data->ioaddr + SNVS_LPPGDR);
+	regmap_write(data->snvs, SNVS_LPPGDR, SNVS_LPPGDR_INIT);
 
 	/* Clear interrupt status */
-	writel(0xffffffff, data->ioaddr + SNVS_LPSR);
+	regmap_write(data->snvs, SNVS_LPSR, 0xffffffff);
 
 	/* Enable RTC */
 	snvs_rtc_enable(data, true);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 2/7] rtc: arm: imx: snvs: change use syscon to access register
@ 2015-05-19 17:04   ` Frank.Li-KZfg59tc24xl57MIdRCFDg
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li at freescale.com @ 2015-05-19 17:04 UTC (permalink / raw)
  To: linux-arm-kernel

From: Frank Li <Frank.Li@freescale.com>

snvs included rtc, on/off key, power-off module
change to syscon to access register

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 drivers/rtc/rtc-snvs.c | 128 +++++++++++++++++++++----------------------------
 1 file changed, 54 insertions(+), 74 deletions(-)

diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c
index 0479e80..6eaebf1 100644
--- a/drivers/rtc/rtc-snvs.c
+++ b/drivers/rtc/rtc-snvs.c
@@ -18,14 +18,15 @@
 #include <linux/platform_device.h>
 #include <linux/rtc.h>
 #include <linux/clk.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
 
-/* These register offsets are relative to LP (Low Power) range */
-#define SNVS_LPCR		0x04
-#define SNVS_LPSR		0x18
-#define SNVS_LPSRTCMR		0x1c
-#define SNVS_LPSRTCLR		0x20
-#define SNVS_LPTAR		0x24
-#define SNVS_LPPGDR		0x30
+#define SNVS_LPCR		0x38
+#define SNVS_LPSR		0x4c
+#define SNVS_LPSRTCMR		0x50
+#define SNVS_LPSRTCLR		0x54
+#define SNVS_LPTAR		0x58
+#define SNVS_LPPGDR		0x64
 
 #define SNVS_LPCR_SRTC_ENV	(1 << 0)
 #define SNVS_LPCR_LPTA_EN	(1 << 1)
@@ -37,31 +38,34 @@
 
 struct snvs_rtc_data {
 	struct rtc_device *rtc;
-	void __iomem *ioaddr;
+	struct regmap *snvs;
 	int irq;
-	spinlock_t lock;
 	struct clk *clk;
 };
 
-static u32 rtc_read_lp_counter(void __iomem *ioaddr)
+static u32 rtc_read_lp_counter(struct regmap *snvs)
 {
 	u64 read1, read2;
-
+	u32 val;
 	do {
-		read1 = readl(ioaddr + SNVS_LPSRTCMR);
+		regmap_read(snvs, SNVS_LPSRTCMR, &val);
+		read1 = val;
 		read1 <<= 32;
-		read1 |= readl(ioaddr + SNVS_LPSRTCLR);
+		regmap_read(snvs, SNVS_LPSRTCLR, &val);
+		read1 |= val;
 
-		read2 = readl(ioaddr + SNVS_LPSRTCMR);
+		regmap_read(snvs, SNVS_LPSRTCMR, &val);
+		read2 = val;
 		read2 <<= 32;
-		read2 |= readl(ioaddr + SNVS_LPSRTCLR);
+		regmap_read(snvs, SNVS_LPSRTCLR, &val);
+		read2 |= val;
 	} while (read1 != read2);
 
 	/* Convert 47-bit counter to 32-bit raw second count */
 	return (u32) (read1 >> CNTR_TO_SECS_SH);
 }
 
-static void rtc_write_sync_lp(void __iomem *ioaddr)
+static void rtc_write_sync_lp(struct regmap *snvs)
 {
 	u32 count1, count2, count3;
 	int i;
@@ -69,15 +73,15 @@ static void rtc_write_sync_lp(void __iomem *ioaddr)
 	/* Wait for 3 CKIL cycles */
 	for (i = 0; i < 3; i++) {
 		do {
-			count1 = readl(ioaddr + SNVS_LPSRTCLR);
-			count2 = readl(ioaddr + SNVS_LPSRTCLR);
+			regmap_read(snvs, SNVS_LPSRTCLR, &count1);
+			regmap_read(snvs, SNVS_LPSRTCLR, &count2);
 		} while (count1 != count2);
 
 		/* Now wait until counter value changes */
 		do {
 			do {
-				count2 = readl(ioaddr + SNVS_LPSRTCLR);
-				count3 = readl(ioaddr + SNVS_LPSRTCLR);
+				regmap_read(snvs, SNVS_LPSRTCLR, &count2);
+				regmap_read(snvs, SNVS_LPSRTCLR, &count3);
 			} while (count2 != count3);
 		} while (count3 == count1);
 	}
@@ -85,23 +89,14 @@ static void rtc_write_sync_lp(void __iomem *ioaddr)
 
 static int snvs_rtc_enable(struct snvs_rtc_data *data, bool enable)
 {
-	unsigned long flags;
 	int timeout = 1000;
 	u32 lpcr;
 
-	spin_lock_irqsave(&data->lock, flags);
-
-	lpcr = readl(data->ioaddr + SNVS_LPCR);
-	if (enable)
-		lpcr |= SNVS_LPCR_SRTC_ENV;
-	else
-		lpcr &= ~SNVS_LPCR_SRTC_ENV;
-	writel(lpcr, data->ioaddr + SNVS_LPCR);
-
-	spin_unlock_irqrestore(&data->lock, flags);
+	regmap_update_bits(data->snvs, SNVS_LPCR, SNVS_LPCR_SRTC_ENV,
+			   enable ? SNVS_LPCR_SRTC_ENV : 0);
 
 	while (--timeout) {
-		lpcr = readl(data->ioaddr + SNVS_LPCR);
+		regmap_read(data->snvs, SNVS_LPCR, &lpcr);
 
 		if (enable) {
 			if (lpcr & SNVS_LPCR_SRTC_ENV)
@@ -121,7 +116,7 @@ static int snvs_rtc_enable(struct snvs_rtc_data *data, bool enable)
 static int snvs_rtc_read_time(struct device *dev, struct rtc_time *tm)
 {
 	struct snvs_rtc_data *data = dev_get_drvdata(dev);
-	unsigned long time = rtc_read_lp_counter(data->ioaddr);
+	unsigned long time = rtc_read_lp_counter(data->snvs);
 
 	rtc_time_to_tm(time, tm);
 
@@ -139,8 +134,8 @@ static int snvs_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	snvs_rtc_enable(data, false);
 
 	/* Write 32-bit time to 47-bit timer, leaving 15 LSBs blank */
-	writel(time << CNTR_TO_SECS_SH, data->ioaddr + SNVS_LPSRTCLR);
-	writel(time >> (32 - CNTR_TO_SECS_SH), data->ioaddr + SNVS_LPSRTCMR);
+	regmap_write(data->snvs, SNVS_LPSRTCLR, time << CNTR_TO_SECS_SH);
+	regmap_write(data->snvs, SNVS_LPSRTCMR, time >> (32 - CNTR_TO_SECS_SH));
 
 	/* Enable RTC again */
 	snvs_rtc_enable(data, true);
@@ -153,10 +148,10 @@ static int snvs_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 	struct snvs_rtc_data *data = dev_get_drvdata(dev);
 	u32 lptar, lpsr;
 
-	lptar = readl(data->ioaddr + SNVS_LPTAR);
+	regmap_read(data->snvs, SNVS_LPTAR, &lptar);
 	rtc_time_to_tm(lptar, &alrm->time);
 
-	lpsr = readl(data->ioaddr + SNVS_LPSR);
+	regmap_read(data->snvs, SNVS_LPSR, &lpsr);
 	alrm->pending = (lpsr & SNVS_LPSR_LPTA) ? 1 : 0;
 
 	return 0;
@@ -165,21 +160,11 @@ static int snvs_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 static int snvs_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
 {
 	struct snvs_rtc_data *data = dev_get_drvdata(dev);
-	u32 lpcr;
-	unsigned long flags;
 
-	spin_lock_irqsave(&data->lock, flags);
+	regmap_update_bits(data->snvs, SNVS_LPCR, (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN),
+			   enable ? (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN) : 0);
 
-	lpcr = readl(data->ioaddr + SNVS_LPCR);
-	if (enable)
-		lpcr |= (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN);
-	else
-		lpcr &= ~(SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN);
-	writel(lpcr, data->ioaddr + SNVS_LPCR);
-
-	spin_unlock_irqrestore(&data->lock, flags);
-
-	rtc_write_sync_lp(data->ioaddr);
+	rtc_write_sync_lp(data->snvs);
 
 	return 0;
 }
@@ -189,24 +174,14 @@ static int snvs_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 	struct snvs_rtc_data *data = dev_get_drvdata(dev);
 	struct rtc_time *alrm_tm = &alrm->time;
 	unsigned long time;
-	unsigned long flags;
-	u32 lpcr;
 
 	rtc_tm_to_time(alrm_tm, &time);
 
-	spin_lock_irqsave(&data->lock, flags);
-
-	/* Have to clear LPTA_EN before programming new alarm time in LPTAR */
-	lpcr = readl(data->ioaddr + SNVS_LPCR);
-	lpcr &= ~SNVS_LPCR_LPTA_EN;
-	writel(lpcr, data->ioaddr + SNVS_LPCR);
-
-	spin_unlock_irqrestore(&data->lock, flags);
-
-	writel(time, data->ioaddr + SNVS_LPTAR);
+	regmap_update_bits(data->snvs, SNVS_LPCR, SNVS_LPCR_LPTA_EN, 0);
+	regmap_write(data->snvs, SNVS_LPTAR, time);
 
 	/* Clear alarm interrupt status bit */
-	writel(SNVS_LPSR_LPTA, data->ioaddr + SNVS_LPSR);
+	regmap_write(data->snvs, SNVS_LPSR, SNVS_LPSR_LPTA);
 
 	return snvs_rtc_alarm_irq_enable(dev, alrm->enabled);
 }
@@ -226,7 +201,7 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
 	u32 lpsr;
 	u32 events = 0;
 
-	lpsr = readl(data->ioaddr + SNVS_LPSR);
+	regmap_read(data->snvs, SNVS_LPSR, &lpsr);
 
 	if (lpsr & SNVS_LPSR_LPTA) {
 		events |= (RTC_AF | RTC_IRQF);
@@ -238,7 +213,7 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
 	}
 
 	/* clear interrupt status */
-	writel(lpsr, data->ioaddr + SNVS_LPSR);
+	regmap_write(data->snvs, SNVS_LPSR, lpsr);
 
 	return events ? IRQ_HANDLED : IRQ_NONE;
 }
@@ -246,17 +221,24 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
 static int snvs_rtc_probe(struct platform_device *pdev)
 {
 	struct snvs_rtc_data *data;
-	struct resource *res;
 	int ret;
+	struct device_node *snvs_np;
 
 	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	data->ioaddr = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(data->ioaddr))
-		return PTR_ERR(data->ioaddr);
+	snvs_np = of_get_parent(pdev->dev.of_node);
+	if (!snvs_np)
+		return -ENODEV;
+
+	data->snvs = syscon_node_to_regmap(snvs_np);
+	of_node_put(snvs_np);
+
+	if (!data->snvs) {
+		pr_err("Can't snvs syscon\n");
+		return -ENODEV;
+	}
 
 	data->irq = platform_get_irq(pdev, 0);
 	if (data->irq < 0)
@@ -276,13 +258,11 @@ static int snvs_rtc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, data);
 
-	spin_lock_init(&data->lock);
-
 	/* Initialize glitch detect */
-	writel(SNVS_LPPGDR_INIT, data->ioaddr + SNVS_LPPGDR);
+	regmap_write(data->snvs, SNVS_LPPGDR, SNVS_LPPGDR_INIT);
 
 	/* Clear interrupt status */
-	writel(0xffffffff, data->ioaddr + SNVS_LPSR);
+	regmap_write(data->snvs, SNVS_LPSR, 0xffffffff);
 
 	/* Enable RTC */
 	snvs_rtc_enable(data, true);
-- 
1.9.1

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

* [rtc-linux] [PATCH v2 3/7] Document: dt: fsl: snvs: change support syscon
  2015-05-19 17:04 ` Frank.Li
  (?)
@ 2015-05-19 17:04   ` Frank.Li
  -1 siblings, 0 replies; 63+ messages in thread
From: Frank.Li @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni
  Cc: linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree, Frank Li

From: Frank Li <Frank.Li@freescale.com>

snvs actually is multi fucntion driver.
Change to use syscon to access register.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 .../devicetree/bindings/crypto/fsl-sec4.txt        | 51 ++++++++++++++++------
 .../bindings/power_supply/imx-snvs-poweroff.txt    | 24 +---------
 2 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
index e402277..ca04206 100644
--- a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
+++ b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
@@ -288,12 +288,13 @@ Secure Non-Volatile Storage (SNVS) Node
     Node defines address range and the associated
     interrupt for the SNVS function.  This function
     monitors security state information & reports
-    security violations.
+    security violations. This also included rtc,
+    system power off and ON/OFF key.
 
   - compatible
       Usage: required
       Value type: <string>
-      Definition: Must include "fsl,sec-v4.0-mon".
+      Definition: Must include "fsl,sec-v4.0-mon" and "syscon".
 
   - reg
       Usage: required
@@ -324,7 +325,7 @@ Secure Non-Volatile Storage (SNVS) Node
            the child address, parent address, & length.
 
    - interrupts
-      Usage: required
+      Usage: optional
       Value type: <prop_encoded-array>
       Definition:  Specifies the interrupts generated by this
            device.  The value of the interrupts property
@@ -341,7 +342,7 @@ Secure Non-Volatile Storage (SNVS) Node
 
 EXAMPLE
 	sec_mon@314000 {
-		compatible = "fsl,sec-v4.0-mon";
+		compatible = "fsl,sec-v4.0-mon", "syscon";
 		reg = <0x314000 0x1000>;
 		ranges = <0 0x314000 0x1000>;
 		interrupt-parent = <&mpic>;
@@ -358,19 +359,41 @@ Secure Non-Volatile Storage (SNVS) Low Power (LP) RTC Node
       Value type: <string>
       Definition: Must include "fsl,sec-v4.0-mon-rtc-lp".
 
-  - reg
+  - interrupts
       Usage: required
-      Value type: <prop-encoded-array>
-      Definition: A standard property.  Specifies the physical
-          address and length of the SNVS LP configuration registers.
+      Value type: <prop_encoded-array>
+      Definition: Specifies the interrupts generated by this
+	   device.  The value of the interrupts property
+	   consists of one interrupt specifier. The format
+	   of the specifier is defined by the binding document
+	   describing the node's interrupt parent.
 
 EXAMPLE
-	sec_mon_rtc_lp@314000 {
+	sec_mon_rtc_lp@1 {
 		compatible = "fsl,sec-v4.0-mon-rtc-lp";
-		reg = <0x34 0x58>;
+		interrupts = <93 2>;
 	};
 
 =====================================================================
+System power off Driver
+
+  A SNVS child node that define system power off
+  SNVS_LPCR in SNVS module can power off the whole system by pull
+  PMIC_ON_REQ low if PMIC_ON_REQ is connected with external PMIC.
+  If you don't want to use PMIC_ON_REQ as power on/off control,
+  please set status='disabled' to disable this driver.
+
+  - compatible
+      Usage: regquied
+      Value type: <string>
+      Definition: Must include "fsl,sec-v4.0-poweroff"
+
+EXAMPLE
+	snvs_poweroff: snvs-poweroff {
+		compatible = "fsl,sec-v4.0-poweroff";
+};
+
+=====================================================================
 FULL EXAMPLE
 
 	crypto: crypto@300000 {
@@ -443,13 +466,15 @@ FULL EXAMPLE
 		compatible = "fsl,sec-v4.0-mon";
 		reg = <0x314000 0x1000>;
 		ranges = <0 0x314000 0x1000>;
-		interrupt-parent = <&mpic>;
-		interrupts = <93 2>;
 
 		sec_mon_rtc_lp@34 {
 			compatible = "fsl,sec-v4.0-mon-rtc-lp";
-			reg = <0x34 0x58>;
+			interrupts = <93 2>;
 		};
+
+		snvs_poweroff: snvs-poweroff@38 {
+                        compatible = "fsl,sec-v4.0-poweroff";
+                };
 	};
 
 =====================================================================
diff --git a/Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt b/Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt
index dc7c9ba..70c1425 100644
--- a/Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt
+++ b/Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt
@@ -1,23 +1 @@
-i.mx6 Poweroff Driver
-
-SNVS_LPCR in SNVS module can power off the whole system by pull
-PMIC_ON_REQ low if PMIC_ON_REQ is connected with external PMIC.
-If you don't want to use PMIC_ON_REQ as power on/off control,
-please set status='disabled' to disable this driver.
-
-Required Properties:
--compatible: "fsl,sec-v4.0-poweroff"
--reg: Specifies the physical address of the SNVS_LPCR register
-
-Example:
-	snvs@020cc000 {
-		compatible = "fsl,sec-v4.0-mon", "simple-bus";
-		#address-cells = <1>;
-		#size-cells = <1>;
-		ranges = <0 0x020cc000 0x4000>;
-		.....
-		snvs_poweroff: snvs-poweroff@38 {
-			compatible = "fsl,sec-v4.0-poweroff";
-			reg = <0x38 0x4>;
-		};
-	}
+See Documentation/devicetree/bindings/crypto/fsl-sec4.txt
-- 
1.9.1

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH v2 3/7] Document: dt: fsl: snvs: change support syscon
@ 2015-05-19 17:04   ` Frank.Li
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni
  Cc: linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree, Frank Li

From: Frank Li <Frank.Li@freescale.com>

snvs actually is multi fucntion driver.
Change to use syscon to access register.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 .../devicetree/bindings/crypto/fsl-sec4.txt        | 51 ++++++++++++++++------
 .../bindings/power_supply/imx-snvs-poweroff.txt    | 24 +---------
 2 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
index e402277..ca04206 100644
--- a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
+++ b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
@@ -288,12 +288,13 @@ Secure Non-Volatile Storage (SNVS) Node
     Node defines address range and the associated
     interrupt for the SNVS function.  This function
     monitors security state information & reports
-    security violations.
+    security violations. This also included rtc,
+    system power off and ON/OFF key.
 
   - compatible
       Usage: required
       Value type: <string>
-      Definition: Must include "fsl,sec-v4.0-mon".
+      Definition: Must include "fsl,sec-v4.0-mon" and "syscon".
 
   - reg
       Usage: required
@@ -324,7 +325,7 @@ Secure Non-Volatile Storage (SNVS) Node
            the child address, parent address, & length.
 
    - interrupts
-      Usage: required
+      Usage: optional
       Value type: <prop_encoded-array>
       Definition:  Specifies the interrupts generated by this
            device.  The value of the interrupts property
@@ -341,7 +342,7 @@ Secure Non-Volatile Storage (SNVS) Node
 
 EXAMPLE
 	sec_mon@314000 {
-		compatible = "fsl,sec-v4.0-mon";
+		compatible = "fsl,sec-v4.0-mon", "syscon";
 		reg = <0x314000 0x1000>;
 		ranges = <0 0x314000 0x1000>;
 		interrupt-parent = <&mpic>;
@@ -358,19 +359,41 @@ Secure Non-Volatile Storage (SNVS) Low Power (LP) RTC Node
       Value type: <string>
       Definition: Must include "fsl,sec-v4.0-mon-rtc-lp".
 
-  - reg
+  - interrupts
       Usage: required
-      Value type: <prop-encoded-array>
-      Definition: A standard property.  Specifies the physical
-          address and length of the SNVS LP configuration registers.
+      Value type: <prop_encoded-array>
+      Definition: Specifies the interrupts generated by this
+	   device.  The value of the interrupts property
+	   consists of one interrupt specifier. The format
+	   of the specifier is defined by the binding document
+	   describing the node's interrupt parent.
 
 EXAMPLE
-	sec_mon_rtc_lp@314000 {
+	sec_mon_rtc_lp@1 {
 		compatible = "fsl,sec-v4.0-mon-rtc-lp";
-		reg = <0x34 0x58>;
+		interrupts = <93 2>;
 	};
 
 =====================================================================
+System power off Driver
+
+  A SNVS child node that define system power off
+  SNVS_LPCR in SNVS module can power off the whole system by pull
+  PMIC_ON_REQ low if PMIC_ON_REQ is connected with external PMIC.
+  If you don't want to use PMIC_ON_REQ as power on/off control,
+  please set status='disabled' to disable this driver.
+
+  - compatible
+      Usage: regquied
+      Value type: <string>
+      Definition: Must include "fsl,sec-v4.0-poweroff"
+
+EXAMPLE
+	snvs_poweroff: snvs-poweroff {
+		compatible = "fsl,sec-v4.0-poweroff";
+};
+
+=====================================================================
 FULL EXAMPLE
 
 	crypto: crypto@300000 {
@@ -443,13 +466,15 @@ FULL EXAMPLE
 		compatible = "fsl,sec-v4.0-mon";
 		reg = <0x314000 0x1000>;
 		ranges = <0 0x314000 0x1000>;
-		interrupt-parent = <&mpic>;
-		interrupts = <93 2>;
 
 		sec_mon_rtc_lp@34 {
 			compatible = "fsl,sec-v4.0-mon-rtc-lp";
-			reg = <0x34 0x58>;
+			interrupts = <93 2>;
 		};
+
+		snvs_poweroff: snvs-poweroff@38 {
+                        compatible = "fsl,sec-v4.0-poweroff";
+                };
 	};
 
 =====================================================================
diff --git a/Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt b/Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt
index dc7c9ba..70c1425 100644
--- a/Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt
+++ b/Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt
@@ -1,23 +1 @@
-i.mx6 Poweroff Driver
-
-SNVS_LPCR in SNVS module can power off the whole system by pull
-PMIC_ON_REQ low if PMIC_ON_REQ is connected with external PMIC.
-If you don't want to use PMIC_ON_REQ as power on/off control,
-please set status='disabled' to disable this driver.
-
-Required Properties:
--compatible: "fsl,sec-v4.0-poweroff"
--reg: Specifies the physical address of the SNVS_LPCR register
-
-Example:
-	snvs@020cc000 {
-		compatible = "fsl,sec-v4.0-mon", "simple-bus";
-		#address-cells = <1>;
-		#size-cells = <1>;
-		ranges = <0 0x020cc000 0x4000>;
-		.....
-		snvs_poweroff: snvs-poweroff@38 {
-			compatible = "fsl,sec-v4.0-poweroff";
-			reg = <0x38 0x4>;
-		};
-	}
+See Documentation/devicetree/bindings/crypto/fsl-sec4.txt
-- 
1.9.1


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

* [PATCH v2 3/7] Document: dt: fsl: snvs: change support syscon
@ 2015-05-19 17:04   ` Frank.Li
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li at freescale.com @ 2015-05-19 17:04 UTC (permalink / raw)
  To: linux-arm-kernel

From: Frank Li <Frank.Li@freescale.com>

snvs actually is multi fucntion driver.
Change to use syscon to access register.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 .../devicetree/bindings/crypto/fsl-sec4.txt        | 51 ++++++++++++++++------
 .../bindings/power_supply/imx-snvs-poweroff.txt    | 24 +---------
 2 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
index e402277..ca04206 100644
--- a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
+++ b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
@@ -288,12 +288,13 @@ Secure Non-Volatile Storage (SNVS) Node
     Node defines address range and the associated
     interrupt for the SNVS function.  This function
     monitors security state information & reports
-    security violations.
+    security violations. This also included rtc,
+    system power off and ON/OFF key.
 
   - compatible
       Usage: required
       Value type: <string>
-      Definition: Must include "fsl,sec-v4.0-mon".
+      Definition: Must include "fsl,sec-v4.0-mon" and "syscon".
 
   - reg
       Usage: required
@@ -324,7 +325,7 @@ Secure Non-Volatile Storage (SNVS) Node
            the child address, parent address, & length.
 
    - interrupts
-      Usage: required
+      Usage: optional
       Value type: <prop_encoded-array>
       Definition:  Specifies the interrupts generated by this
            device.  The value of the interrupts property
@@ -341,7 +342,7 @@ Secure Non-Volatile Storage (SNVS) Node
 
 EXAMPLE
 	sec_mon at 314000 {
-		compatible = "fsl,sec-v4.0-mon";
+		compatible = "fsl,sec-v4.0-mon", "syscon";
 		reg = <0x314000 0x1000>;
 		ranges = <0 0x314000 0x1000>;
 		interrupt-parent = <&mpic>;
@@ -358,19 +359,41 @@ Secure Non-Volatile Storage (SNVS) Low Power (LP) RTC Node
       Value type: <string>
       Definition: Must include "fsl,sec-v4.0-mon-rtc-lp".
 
-  - reg
+  - interrupts
       Usage: required
-      Value type: <prop-encoded-array>
-      Definition: A standard property.  Specifies the physical
-          address and length of the SNVS LP configuration registers.
+      Value type: <prop_encoded-array>
+      Definition: Specifies the interrupts generated by this
+	   device.  The value of the interrupts property
+	   consists of one interrupt specifier. The format
+	   of the specifier is defined by the binding document
+	   describing the node's interrupt parent.
 
 EXAMPLE
-	sec_mon_rtc_lp at 314000 {
+	sec_mon_rtc_lp at 1 {
 		compatible = "fsl,sec-v4.0-mon-rtc-lp";
-		reg = <0x34 0x58>;
+		interrupts = <93 2>;
 	};
 
 =====================================================================
+System power off Driver
+
+  A SNVS child node that define system power off
+  SNVS_LPCR in SNVS module can power off the whole system by pull
+  PMIC_ON_REQ low if PMIC_ON_REQ is connected with external PMIC.
+  If you don't want to use PMIC_ON_REQ as power on/off control,
+  please set status='disabled' to disable this driver.
+
+  - compatible
+      Usage: regquied
+      Value type: <string>
+      Definition: Must include "fsl,sec-v4.0-poweroff"
+
+EXAMPLE
+	snvs_poweroff: snvs-poweroff {
+		compatible = "fsl,sec-v4.0-poweroff";
+};
+
+=====================================================================
 FULL EXAMPLE
 
 	crypto: crypto at 300000 {
@@ -443,13 +466,15 @@ FULL EXAMPLE
 		compatible = "fsl,sec-v4.0-mon";
 		reg = <0x314000 0x1000>;
 		ranges = <0 0x314000 0x1000>;
-		interrupt-parent = <&mpic>;
-		interrupts = <93 2>;
 
 		sec_mon_rtc_lp at 34 {
 			compatible = "fsl,sec-v4.0-mon-rtc-lp";
-			reg = <0x34 0x58>;
+			interrupts = <93 2>;
 		};
+
+		snvs_poweroff: snvs-poweroff at 38 {
+                        compatible = "fsl,sec-v4.0-poweroff";
+                };
 	};
 
 =====================================================================
diff --git a/Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt b/Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt
index dc7c9ba..70c1425 100644
--- a/Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt
+++ b/Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt
@@ -1,23 +1 @@
-i.mx6 Poweroff Driver
-
-SNVS_LPCR in SNVS module can power off the whole system by pull
-PMIC_ON_REQ low if PMIC_ON_REQ is connected with external PMIC.
-If you don't want to use PMIC_ON_REQ as power on/off control,
-please set status='disabled' to disable this driver.
-
-Required Properties:
--compatible: "fsl,sec-v4.0-poweroff"
--reg: Specifies the physical address of the SNVS_LPCR register
-
-Example:
-	snvs at 020cc000 {
-		compatible = "fsl,sec-v4.0-mon", "simple-bus";
-		#address-cells = <1>;
-		#size-cells = <1>;
-		ranges = <0 0x020cc000 0x4000>;
-		.....
-		snvs_poweroff: snvs-poweroff at 38 {
-			compatible = "fsl,sec-v4.0-poweroff";
-			reg = <0x38 0x4>;
-		};
-	}
+See Documentation/devicetree/bindings/crypto/fsl-sec4.txt
-- 
1.9.1

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

* [rtc-linux] [PATCH v2 4/7] arm: dts: imx: update snvs to use syscon access register
  2015-05-19 17:04 ` Frank.Li
  (?)
@ 2015-05-19 17:04   ` Frank.Li
  -1 siblings, 0 replies; 63+ messages in thread
From: Frank.Li @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni
  Cc: linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree, Frank Li

From: Frank Li <Frank.Li@freescale.com>

snvs is MFP device. Change dts to use syscon to allocate register resource.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 arch/arm/boot/dts/imx6qdl.dtsi | 12 ++++--------
 arch/arm/boot/dts/imx6sl.dtsi  | 12 ++++--------
 arch/arm/boot/dts/imx6sx.dtsi  | 12 ++++--------
 arch/arm/boot/dts/vfxxx.dtsi   |  9 +++------
 4 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 0482a66..9df9faf 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -687,21 +687,17 @@
 			};
 
 			snvs@020cc000 {
-				compatible = "fsl,sec-v4.0-mon", "simple-bus";
-				#address-cells = <1>;
-				#size-cells = <1>;
-				ranges = <0 0x020cc000 0x4000>;
+				compatible = "fsl,sec-v4.0-mon", "syscon",  "simple-mfd";
+				reg = <0x020cc000 0x4000>;
 
-				snvs_rtc: snvs-rtc-lp@34 {
+				snvs_rtc: snvs-rtc-lp {
 					compatible = "fsl,sec-v4.0-mon-rtc-lp";
-					reg = <0x34 0x58>;
 					interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>,
 						     <0 20 IRQ_TYPE_LEVEL_HIGH>;
 				};
 
-				snvs_poweroff: snvs-poweroff@38 {
+				snvs_poweroff: snvs-poweroff {
 					compatible = "fsl,sec-v4.0-poweroff";
-					reg = <0x38 0x4>;
 					status = "disabled";
 				};
 			};
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index a78e715..99f37f9 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -564,21 +564,17 @@
 			};
 
 			snvs@020cc000 {
-				compatible = "fsl,sec-v4.0-mon", "simple-bus";
-				#address-cells = <1>;
-				#size-cells = <1>;
-				ranges = <0 0x020cc000 0x4000>;
+				compatible = "fsl,sec-v4.0-mon", "syscon", "simple-mfd";
+				reg = <0x020cc000 0x4000>;
 
-				snvs_rtc: snvs-rtc-lp@34 {
+				snvs_rtc: snvs-rtc-lp {
 					compatible = "fsl,sec-v4.0-mon-rtc-lp";
-					reg = <0x34 0x58>;
 					interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>,
 						     <0 20 IRQ_TYPE_LEVEL_HIGH>;
 				};
 
-				snvs_poweroff: snvs-poweroff@38 {
+				snvs_poweroff: snvs-poweroff {
 					compatible = "fsl,sec-v4.0-poweroff";
-					reg = <0x38 0x4>;
 					status = "disabled";
 				};
 			};
diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index 708175d..97de407 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -662,20 +662,16 @@
 			};
 
 			snvs: snvs@020cc000 {
-				compatible = "fsl,sec-v4.0-mon", "simple-bus";
-				#address-cells = <1>;
-				#size-cells = <1>;
-				ranges = <0 0x020cc000 0x4000>;
+				compatible = "fsl,sec-v4.0-mon", "syscon", "simple-mfd";
+				reg = <0x020cc000 0x4000>;
 
-				snvs_rtc: snvs-rtc-lp@34 {
+				snvs_rtc: snvs-rtc-lp {
 					compatible = "fsl,sec-v4.0-mon-rtc-lp";
-					reg = <0x34 0x58>;
 					interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
 				};
 
-				snvs_poweroff: snvs-poweroff@38 {
+				snvs_poweroff: snvs-poweroff {
 					compatible = "fsl,sec-v4.0-poweroff";
-					reg = <0x38 0x4>;
 					status = "disabled";
 				};
 			};
diff --git a/arch/arm/boot/dts/vfxxx.dtsi b/arch/arm/boot/dts/vfxxx.dtsi
index 4aa3351..fccfc01 100644
--- a/arch/arm/boot/dts/vfxxx.dtsi
+++ b/arch/arm/boot/dts/vfxxx.dtsi
@@ -404,14 +404,11 @@
 			};
 
 			snvs0: snvs@400a7000 {
-			    compatible = "fsl,sec-v4.0-mon", "simple-bus";
-				#address-cells = <1>;
-				#size-cells = <1>;
-				ranges = <0 0x400a7000 0x2000>;
+			    compatible = "fsl,sec-v4.0-mon", "syscon", "simple-mfd";
+				reg = <0x400a7000 0x2000>;
 
-				snvsrtc: snvs-rtc-lp@34 {
+				snvsrtc: snvs-rtc-lp {
 					compatible = "fsl,sec-v4.0-mon-rtc-lp";
-					reg = <0x34 0x58>;
 					interrupts = <100 IRQ_TYPE_LEVEL_HIGH>;
 					clocks = <&clks VF610_CLK_SNVS>;
 					clock-names = "snvs-rtc";
-- 
1.9.1

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH v2 4/7] arm: dts: imx: update snvs to use syscon access register
@ 2015-05-19 17:04   ` Frank.Li
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni
  Cc: linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree, Frank Li

From: Frank Li <Frank.Li@freescale.com>

snvs is MFP device. Change dts to use syscon to allocate register resource.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 arch/arm/boot/dts/imx6qdl.dtsi | 12 ++++--------
 arch/arm/boot/dts/imx6sl.dtsi  | 12 ++++--------
 arch/arm/boot/dts/imx6sx.dtsi  | 12 ++++--------
 arch/arm/boot/dts/vfxxx.dtsi   |  9 +++------
 4 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 0482a66..9df9faf 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -687,21 +687,17 @@
 			};
 
 			snvs@020cc000 {
-				compatible = "fsl,sec-v4.0-mon", "simple-bus";
-				#address-cells = <1>;
-				#size-cells = <1>;
-				ranges = <0 0x020cc000 0x4000>;
+				compatible = "fsl,sec-v4.0-mon", "syscon",  "simple-mfd";
+				reg = <0x020cc000 0x4000>;
 
-				snvs_rtc: snvs-rtc-lp@34 {
+				snvs_rtc: snvs-rtc-lp {
 					compatible = "fsl,sec-v4.0-mon-rtc-lp";
-					reg = <0x34 0x58>;
 					interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>,
 						     <0 20 IRQ_TYPE_LEVEL_HIGH>;
 				};
 
-				snvs_poweroff: snvs-poweroff@38 {
+				snvs_poweroff: snvs-poweroff {
 					compatible = "fsl,sec-v4.0-poweroff";
-					reg = <0x38 0x4>;
 					status = "disabled";
 				};
 			};
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index a78e715..99f37f9 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -564,21 +564,17 @@
 			};
 
 			snvs@020cc000 {
-				compatible = "fsl,sec-v4.0-mon", "simple-bus";
-				#address-cells = <1>;
-				#size-cells = <1>;
-				ranges = <0 0x020cc000 0x4000>;
+				compatible = "fsl,sec-v4.0-mon", "syscon", "simple-mfd";
+				reg = <0x020cc000 0x4000>;
 
-				snvs_rtc: snvs-rtc-lp@34 {
+				snvs_rtc: snvs-rtc-lp {
 					compatible = "fsl,sec-v4.0-mon-rtc-lp";
-					reg = <0x34 0x58>;
 					interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>,
 						     <0 20 IRQ_TYPE_LEVEL_HIGH>;
 				};
 
-				snvs_poweroff: snvs-poweroff@38 {
+				snvs_poweroff: snvs-poweroff {
 					compatible = "fsl,sec-v4.0-poweroff";
-					reg = <0x38 0x4>;
 					status = "disabled";
 				};
 			};
diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index 708175d..97de407 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -662,20 +662,16 @@
 			};
 
 			snvs: snvs@020cc000 {
-				compatible = "fsl,sec-v4.0-mon", "simple-bus";
-				#address-cells = <1>;
-				#size-cells = <1>;
-				ranges = <0 0x020cc000 0x4000>;
+				compatible = "fsl,sec-v4.0-mon", "syscon", "simple-mfd";
+				reg = <0x020cc000 0x4000>;
 
-				snvs_rtc: snvs-rtc-lp@34 {
+				snvs_rtc: snvs-rtc-lp {
 					compatible = "fsl,sec-v4.0-mon-rtc-lp";
-					reg = <0x34 0x58>;
 					interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
 				};
 
-				snvs_poweroff: snvs-poweroff@38 {
+				snvs_poweroff: snvs-poweroff {
 					compatible = "fsl,sec-v4.0-poweroff";
-					reg = <0x38 0x4>;
 					status = "disabled";
 				};
 			};
diff --git a/arch/arm/boot/dts/vfxxx.dtsi b/arch/arm/boot/dts/vfxxx.dtsi
index 4aa3351..fccfc01 100644
--- a/arch/arm/boot/dts/vfxxx.dtsi
+++ b/arch/arm/boot/dts/vfxxx.dtsi
@@ -404,14 +404,11 @@
 			};
 
 			snvs0: snvs@400a7000 {
-			    compatible = "fsl,sec-v4.0-mon", "simple-bus";
-				#address-cells = <1>;
-				#size-cells = <1>;
-				ranges = <0 0x400a7000 0x2000>;
+			    compatible = "fsl,sec-v4.0-mon", "syscon", "simple-mfd";
+				reg = <0x400a7000 0x2000>;
 
-				snvsrtc: snvs-rtc-lp@34 {
+				snvsrtc: snvs-rtc-lp {
 					compatible = "fsl,sec-v4.0-mon-rtc-lp";
-					reg = <0x34 0x58>;
 					interrupts = <100 IRQ_TYPE_LEVEL_HIGH>;
 					clocks = <&clks VF610_CLK_SNVS>;
 					clock-names = "snvs-rtc";
-- 
1.9.1


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

* [PATCH v2 4/7] arm: dts: imx: update snvs to use syscon access register
@ 2015-05-19 17:04   ` Frank.Li
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li at freescale.com @ 2015-05-19 17:04 UTC (permalink / raw)
  To: linux-arm-kernel

From: Frank Li <Frank.Li@freescale.com>

snvs is MFP device. Change dts to use syscon to allocate register resource.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 arch/arm/boot/dts/imx6qdl.dtsi | 12 ++++--------
 arch/arm/boot/dts/imx6sl.dtsi  | 12 ++++--------
 arch/arm/boot/dts/imx6sx.dtsi  | 12 ++++--------
 arch/arm/boot/dts/vfxxx.dtsi   |  9 +++------
 4 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 0482a66..9df9faf 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -687,21 +687,17 @@
 			};
 
 			snvs at 020cc000 {
-				compatible = "fsl,sec-v4.0-mon", "simple-bus";
-				#address-cells = <1>;
-				#size-cells = <1>;
-				ranges = <0 0x020cc000 0x4000>;
+				compatible = "fsl,sec-v4.0-mon", "syscon",  "simple-mfd";
+				reg = <0x020cc000 0x4000>;
 
-				snvs_rtc: snvs-rtc-lp at 34 {
+				snvs_rtc: snvs-rtc-lp {
 					compatible = "fsl,sec-v4.0-mon-rtc-lp";
-					reg = <0x34 0x58>;
 					interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>,
 						     <0 20 IRQ_TYPE_LEVEL_HIGH>;
 				};
 
-				snvs_poweroff: snvs-poweroff at 38 {
+				snvs_poweroff: snvs-poweroff {
 					compatible = "fsl,sec-v4.0-poweroff";
-					reg = <0x38 0x4>;
 					status = "disabled";
 				};
 			};
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index a78e715..99f37f9 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -564,21 +564,17 @@
 			};
 
 			snvs at 020cc000 {
-				compatible = "fsl,sec-v4.0-mon", "simple-bus";
-				#address-cells = <1>;
-				#size-cells = <1>;
-				ranges = <0 0x020cc000 0x4000>;
+				compatible = "fsl,sec-v4.0-mon", "syscon", "simple-mfd";
+				reg = <0x020cc000 0x4000>;
 
-				snvs_rtc: snvs-rtc-lp at 34 {
+				snvs_rtc: snvs-rtc-lp {
 					compatible = "fsl,sec-v4.0-mon-rtc-lp";
-					reg = <0x34 0x58>;
 					interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>,
 						     <0 20 IRQ_TYPE_LEVEL_HIGH>;
 				};
 
-				snvs_poweroff: snvs-poweroff at 38 {
+				snvs_poweroff: snvs-poweroff {
 					compatible = "fsl,sec-v4.0-poweroff";
-					reg = <0x38 0x4>;
 					status = "disabled";
 				};
 			};
diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index 708175d..97de407 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -662,20 +662,16 @@
 			};
 
 			snvs: snvs at 020cc000 {
-				compatible = "fsl,sec-v4.0-mon", "simple-bus";
-				#address-cells = <1>;
-				#size-cells = <1>;
-				ranges = <0 0x020cc000 0x4000>;
+				compatible = "fsl,sec-v4.0-mon", "syscon", "simple-mfd";
+				reg = <0x020cc000 0x4000>;
 
-				snvs_rtc: snvs-rtc-lp at 34 {
+				snvs_rtc: snvs-rtc-lp {
 					compatible = "fsl,sec-v4.0-mon-rtc-lp";
-					reg = <0x34 0x58>;
 					interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
 				};
 
-				snvs_poweroff: snvs-poweroff at 38 {
+				snvs_poweroff: snvs-poweroff {
 					compatible = "fsl,sec-v4.0-poweroff";
-					reg = <0x38 0x4>;
 					status = "disabled";
 				};
 			};
diff --git a/arch/arm/boot/dts/vfxxx.dtsi b/arch/arm/boot/dts/vfxxx.dtsi
index 4aa3351..fccfc01 100644
--- a/arch/arm/boot/dts/vfxxx.dtsi
+++ b/arch/arm/boot/dts/vfxxx.dtsi
@@ -404,14 +404,11 @@
 			};
 
 			snvs0: snvs at 400a7000 {
-			    compatible = "fsl,sec-v4.0-mon", "simple-bus";
-				#address-cells = <1>;
-				#size-cells = <1>;
-				ranges = <0 0x400a7000 0x2000>;
+			    compatible = "fsl,sec-v4.0-mon", "syscon", "simple-mfd";
+				reg = <0x400a7000 0x2000>;
 
-				snvsrtc: snvs-rtc-lp at 34 {
+				snvsrtc: snvs-rtc-lp {
 					compatible = "fsl,sec-v4.0-mon-rtc-lp";
-					reg = <0x34 0x58>;
 					interrupts = <100 IRQ_TYPE_LEVEL_HIGH>;
 					clocks = <&clks VF610_CLK_SNVS>;
 					clock-names = "snvs-rtc";
-- 
1.9.1

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

* [rtc-linux] [PATCH v2 5/7] input: keyboard: imx: add snvs power key driver
  2015-05-19 17:04 ` Frank.Li
  (?)
@ 2015-05-19 17:04   ` Frank.Li
  -1 siblings, 0 replies; 63+ messages in thread
From: Frank.Li @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni
  Cc: linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree,
	Robin Gong, Frank Li

From: Robin Gong <b38343@freescale.com>

add snvs power key driver.
It work in imx chips after i.mx6sx

ON/OFF key used power on/off whole system.
This driver make it wakeup from suspend state when short press
ON/OFF key.

Long time press will trig SNVS power off chip without software
intervention.

Signed-off-by: Robin Gong <b38343@freescale.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 drivers/input/keyboard/Kconfig       |  11 ++
 drivers/input/keyboard/Makefile      |   1 +
 drivers/input/keyboard/snvs_pwrkey.c | 232 +++++++++++++++++++++++++++++++++++
 3 files changed, 244 insertions(+)
 create mode 100644 drivers/input/keyboard/snvs_pwrkey.c

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 106fbac..61b3fab 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -400,6 +400,17 @@ config KEYBOARD_MPR121
 	  To compile this driver as a module, choose M here: the
 	  module will be called mpr121_touchkey.
 
+config KEYBOARD_SNVS_PWRKEY
+	tristate "IMX SNVS Power Key Driver"
+	depends on SOC_IMX6SX
+	depends on OF
+	help
+	  This is the snvs powerkey driver for the Freescale i.MX application
+	  processors that are newer than i.MX6 SX.
+
+	  To compile this driver as a module, choose M here; the
+	  module will be called snvs_pwrkey.
+
 config KEYBOARD_IMX
 	tristate "IMX keypad support"
 	depends on ARCH_MXC
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index df28d55..1d416dd 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -51,6 +51,7 @@ obj-$(CONFIG_KEYBOARD_QT1070)           += qt1070.o
 obj-$(CONFIG_KEYBOARD_QT2160)		+= qt2160.o
 obj-$(CONFIG_KEYBOARD_SAMSUNG)		+= samsung-keypad.o
 obj-$(CONFIG_KEYBOARD_SH_KEYSC)		+= sh_keysc.o
+obj-$(CONFIG_KEYBOARD_SNVS_PWRKEY)	+= snvs_pwrkey.o
 obj-$(CONFIG_KEYBOARD_SPEAR)		+= spear-keyboard.o
 obj-$(CONFIG_KEYBOARD_STMPE)		+= stmpe-keypad.o
 obj-$(CONFIG_KEYBOARD_STOWAWAY)		+= stowaway.o
diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
new file mode 100644
index 0000000..98c340e
--- /dev/null
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -0,0 +1,232 @@
+/*
+ * Driver for the IMX SNVS ON/OFF Power Key
+ * Copyright (C) 2015 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
+
+#define SNVS_LPSR_REG	0x4C	/* LP Status Register */
+#define SNVS_LPCR_REG	0x38	/* LP Control Register */
+#define SNVS_HPSR_REG	0x14
+#define SNVS_HPSR_BTN	BIT(6)
+#define SNVS_LPSR_SPO	BIT(18)
+#define SNVS_LPCR_DEP_EN BIT(5)
+
+#define DEBOUNCE_TIME 30
+#define REPEAT_INTERVAL 60
+
+struct pwrkey_drv_data {
+	struct regmap *snvs;
+	int irq;
+	int keycode;
+	int keystate;  /* 1:pressed */
+	int wakeup;
+	struct timer_list check_timer;
+	struct input_dev *input;
+};
+
+static void imx_imx_snvs_check_for_events(unsigned long data)
+{
+	struct pwrkey_drv_data *pdata = (struct pwrkey_drv_data *) data;
+	struct input_dev *input = pdata->input;
+	u32 state;
+
+	regmap_read(pdata->snvs, SNVS_HPSR_REG, &state);
+	state = state & SNVS_HPSR_BTN ? 1 : 0;
+
+	/* only report new event if status changed */
+	if (state ^ pdata->keystate) {
+		pdata->keystate = state;
+		input_event(input, EV_KEY, pdata->keycode, state);
+		input_sync(input);
+		pm_relax(pdata->input->dev.parent);
+	}
+
+	/* repeat check if pressed long */
+	if (state) {
+		mod_timer(&pdata->check_timer,
+			  jiffies + msecs_to_jiffies(REPEAT_INTERVAL));
+	}
+}
+
+static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)
+{
+	struct platform_device *pdev = dev_id;
+	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
+	u32 lp_status;
+
+	pm_wakeup_event(pdata->input->dev.parent, 0);
+
+	regmap_read(pdata->snvs, SNVS_LPSR_REG, &lp_status);
+	if (lp_status & SNVS_LPSR_SPO)
+		mod_timer(&pdata->check_timer, jiffies + msecs_to_jiffies(DEBOUNCE_TIME));
+
+	/* clear SPO status */
+	regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
+
+	return IRQ_HANDLED;
+}
+
+static void imx_snvs_pwrkey_act(void *pdata)
+{
+	struct pwrkey_drv_data *pd = pdata;
+
+	del_timer_sync(&pd->check_timer);
+}
+
+static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
+{
+	struct pwrkey_drv_data *pdata = NULL;
+	struct input_dev *input = NULL;
+	struct device_node *np, *snvs_np;
+	int error;
+
+	/* Get SNVS register Page */
+	np = pdev->dev.of_node;
+	if (!np)
+		return -ENODEV;
+
+	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		return -ENOMEM;
+
+	snvs_np = of_get_parent(pdev->dev.of_node);
+	if (!snvs_np)
+		return -ENODEV;
+
+	pdata->snvs = syscon_node_to_regmap(snvs_np);
+	of_node_put(snvs_np);
+
+	if (!pdata->snvs) {
+		pr_err("Can't get snvs syscon\n");
+		return -ENODEV;
+	}
+
+	if (of_property_read_u32(np, "linux,keycode", &pdata->keycode)) {
+		pdata->keycode = KEY_POWER;
+		dev_warn(&pdev->dev, "KEY_POWER without setting in dts\n");
+	}
+
+	pdata->wakeup = of_property_read_bool(np, "wakeup");
+
+	pdata->irq = platform_get_irq(pdev, 0);
+	if (pdata->irq < 0) {
+		dev_err(&pdev->dev, "no irq defined in platform data\n");
+		return -EINVAL;
+	}
+
+	regmap_update_bits(pdata->snvs, SNVS_LPCR_REG, SNVS_LPCR_DEP_EN, SNVS_LPCR_DEP_EN);
+
+	/* clear the unexpected interrupt before driver ready */
+	regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
+
+	setup_timer(&pdata->check_timer,
+		    imx_imx_snvs_check_for_events, (unsigned long) pdata);
+
+	input = devm_input_allocate_device(&pdev->dev);
+	if (!input) {
+		dev_err(&pdev->dev, "failed to allocate the input device\n");
+		return -ENOMEM;
+	}
+
+	input->name = pdev->name;
+	input->phys = "snvs-pwrkey/input0";
+	input->id.bustype = BUS_HOST;
+
+	input_set_capability(input, EV_KEY, pdata->keycode);
+
+	/* input customer action to cancel release timer */
+	error = devm_add_action(&pdev->dev, imx_snvs_pwrkey_act, pdata);
+	if (error) {
+		dev_err(&pdev->dev, "failed to register remove action\n");
+		return error;
+	}
+
+	error = devm_request_irq(&pdev->dev, pdata->irq,
+			       imx_snvs_pwrkey_interrupt,
+			       0, pdev->name, pdev);
+
+	if (error) {
+		dev_err(&pdev->dev, "interrupt not available.\n");
+		return error;
+	}
+
+	error = input_register_device(input);
+	if (error < 0) {
+		dev_err(&pdev->dev, "failed to register input device\n");
+		input_free_device(input);
+		return error;
+	}
+
+	pdata->input = input;
+	platform_set_drvdata(pdev, pdata);
+
+	device_init_wakeup(&pdev->dev, pdata->wakeup);
+
+	return 0;
+}
+
+static int imx_snvs_pwrkey_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
+
+	if (device_may_wakeup(&pdev->dev))
+		enable_irq_wake(pdata->irq);
+
+	return 0;
+}
+
+static int imx_snvs_pwrkey_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
+
+	if (device_may_wakeup(&pdev->dev))
+		disable_irq_wake(pdata->irq);
+
+	return 0;
+}
+
+static const struct of_device_id imx_snvs_pwrkey_ids[] = {
+	{ .compatible = "fsl,sec-v4.0-pwrkey" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, imx_snvs_pwrkey_ids);
+
+static SIMPLE_DEV_PM_OPS(imx_snvs_pwrkey_pm_ops, imx_snvs_pwrkey_suspend,
+				imx_snvs_pwrkey_resume);
+
+static struct platform_driver imx_snvs_pwrkey_driver = {
+	.driver = {
+		.name = "snvs_pwrkey",
+		.pm     = &imx_snvs_pwrkey_pm_ops,
+		.of_match_table = imx_snvs_pwrkey_ids,
+	},
+	.probe = imx_snvs_pwrkey_probe,
+};
+module_platform_driver(imx_snvs_pwrkey_driver);
+
+MODULE_AUTHOR("Freescale Semiconductor");
+MODULE_DESCRIPTION("i.MX snvs power key Driver");
+MODULE_LICENSE("GPL");
-- 
1.9.1

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH v2 5/7] input: keyboard: imx: add snvs power key driver
@ 2015-05-19 17:04   ` Frank.Li
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni
  Cc: linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree,
	Robin Gong, Frank Li

From: Robin Gong <b38343@freescale.com>

add snvs power key driver.
It work in imx chips after i.mx6sx

ON/OFF key used power on/off whole system.
This driver make it wakeup from suspend state when short press
ON/OFF key.

Long time press will trig SNVS power off chip without software
intervention.

Signed-off-by: Robin Gong <b38343@freescale.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 drivers/input/keyboard/Kconfig       |  11 ++
 drivers/input/keyboard/Makefile      |   1 +
 drivers/input/keyboard/snvs_pwrkey.c | 232 +++++++++++++++++++++++++++++++++++
 3 files changed, 244 insertions(+)
 create mode 100644 drivers/input/keyboard/snvs_pwrkey.c

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 106fbac..61b3fab 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -400,6 +400,17 @@ config KEYBOARD_MPR121
 	  To compile this driver as a module, choose M here: the
 	  module will be called mpr121_touchkey.
 
+config KEYBOARD_SNVS_PWRKEY
+	tristate "IMX SNVS Power Key Driver"
+	depends on SOC_IMX6SX
+	depends on OF
+	help
+	  This is the snvs powerkey driver for the Freescale i.MX application
+	  processors that are newer than i.MX6 SX.
+
+	  To compile this driver as a module, choose M here; the
+	  module will be called snvs_pwrkey.
+
 config KEYBOARD_IMX
 	tristate "IMX keypad support"
 	depends on ARCH_MXC
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index df28d55..1d416dd 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -51,6 +51,7 @@ obj-$(CONFIG_KEYBOARD_QT1070)           += qt1070.o
 obj-$(CONFIG_KEYBOARD_QT2160)		+= qt2160.o
 obj-$(CONFIG_KEYBOARD_SAMSUNG)		+= samsung-keypad.o
 obj-$(CONFIG_KEYBOARD_SH_KEYSC)		+= sh_keysc.o
+obj-$(CONFIG_KEYBOARD_SNVS_PWRKEY)	+= snvs_pwrkey.o
 obj-$(CONFIG_KEYBOARD_SPEAR)		+= spear-keyboard.o
 obj-$(CONFIG_KEYBOARD_STMPE)		+= stmpe-keypad.o
 obj-$(CONFIG_KEYBOARD_STOWAWAY)		+= stowaway.o
diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
new file mode 100644
index 0000000..98c340e
--- /dev/null
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -0,0 +1,232 @@
+/*
+ * Driver for the IMX SNVS ON/OFF Power Key
+ * Copyright (C) 2015 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
+
+#define SNVS_LPSR_REG	0x4C	/* LP Status Register */
+#define SNVS_LPCR_REG	0x38	/* LP Control Register */
+#define SNVS_HPSR_REG	0x14
+#define SNVS_HPSR_BTN	BIT(6)
+#define SNVS_LPSR_SPO	BIT(18)
+#define SNVS_LPCR_DEP_EN BIT(5)
+
+#define DEBOUNCE_TIME 30
+#define REPEAT_INTERVAL 60
+
+struct pwrkey_drv_data {
+	struct regmap *snvs;
+	int irq;
+	int keycode;
+	int keystate;  /* 1:pressed */
+	int wakeup;
+	struct timer_list check_timer;
+	struct input_dev *input;
+};
+
+static void imx_imx_snvs_check_for_events(unsigned long data)
+{
+	struct pwrkey_drv_data *pdata = (struct pwrkey_drv_data *) data;
+	struct input_dev *input = pdata->input;
+	u32 state;
+
+	regmap_read(pdata->snvs, SNVS_HPSR_REG, &state);
+	state = state & SNVS_HPSR_BTN ? 1 : 0;
+
+	/* only report new event if status changed */
+	if (state ^ pdata->keystate) {
+		pdata->keystate = state;
+		input_event(input, EV_KEY, pdata->keycode, state);
+		input_sync(input);
+		pm_relax(pdata->input->dev.parent);
+	}
+
+	/* repeat check if pressed long */
+	if (state) {
+		mod_timer(&pdata->check_timer,
+			  jiffies + msecs_to_jiffies(REPEAT_INTERVAL));
+	}
+}
+
+static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)
+{
+	struct platform_device *pdev = dev_id;
+	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
+	u32 lp_status;
+
+	pm_wakeup_event(pdata->input->dev.parent, 0);
+
+	regmap_read(pdata->snvs, SNVS_LPSR_REG, &lp_status);
+	if (lp_status & SNVS_LPSR_SPO)
+		mod_timer(&pdata->check_timer, jiffies + msecs_to_jiffies(DEBOUNCE_TIME));
+
+	/* clear SPO status */
+	regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
+
+	return IRQ_HANDLED;
+}
+
+static void imx_snvs_pwrkey_act(void *pdata)
+{
+	struct pwrkey_drv_data *pd = pdata;
+
+	del_timer_sync(&pd->check_timer);
+}
+
+static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
+{
+	struct pwrkey_drv_data *pdata = NULL;
+	struct input_dev *input = NULL;
+	struct device_node *np, *snvs_np;
+	int error;
+
+	/* Get SNVS register Page */
+	np = pdev->dev.of_node;
+	if (!np)
+		return -ENODEV;
+
+	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		return -ENOMEM;
+
+	snvs_np = of_get_parent(pdev->dev.of_node);
+	if (!snvs_np)
+		return -ENODEV;
+
+	pdata->snvs = syscon_node_to_regmap(snvs_np);
+	of_node_put(snvs_np);
+
+	if (!pdata->snvs) {
+		pr_err("Can't get snvs syscon\n");
+		return -ENODEV;
+	}
+
+	if (of_property_read_u32(np, "linux,keycode", &pdata->keycode)) {
+		pdata->keycode = KEY_POWER;
+		dev_warn(&pdev->dev, "KEY_POWER without setting in dts\n");
+	}
+
+	pdata->wakeup = of_property_read_bool(np, "wakeup");
+
+	pdata->irq = platform_get_irq(pdev, 0);
+	if (pdata->irq < 0) {
+		dev_err(&pdev->dev, "no irq defined in platform data\n");
+		return -EINVAL;
+	}
+
+	regmap_update_bits(pdata->snvs, SNVS_LPCR_REG, SNVS_LPCR_DEP_EN, SNVS_LPCR_DEP_EN);
+
+	/* clear the unexpected interrupt before driver ready */
+	regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
+
+	setup_timer(&pdata->check_timer,
+		    imx_imx_snvs_check_for_events, (unsigned long) pdata);
+
+	input = devm_input_allocate_device(&pdev->dev);
+	if (!input) {
+		dev_err(&pdev->dev, "failed to allocate the input device\n");
+		return -ENOMEM;
+	}
+
+	input->name = pdev->name;
+	input->phys = "snvs-pwrkey/input0";
+	input->id.bustype = BUS_HOST;
+
+	input_set_capability(input, EV_KEY, pdata->keycode);
+
+	/* input customer action to cancel release timer */
+	error = devm_add_action(&pdev->dev, imx_snvs_pwrkey_act, pdata);
+	if (error) {
+		dev_err(&pdev->dev, "failed to register remove action\n");
+		return error;
+	}
+
+	error = devm_request_irq(&pdev->dev, pdata->irq,
+			       imx_snvs_pwrkey_interrupt,
+			       0, pdev->name, pdev);
+
+	if (error) {
+		dev_err(&pdev->dev, "interrupt not available.\n");
+		return error;
+	}
+
+	error = input_register_device(input);
+	if (error < 0) {
+		dev_err(&pdev->dev, "failed to register input device\n");
+		input_free_device(input);
+		return error;
+	}
+
+	pdata->input = input;
+	platform_set_drvdata(pdev, pdata);
+
+	device_init_wakeup(&pdev->dev, pdata->wakeup);
+
+	return 0;
+}
+
+static int imx_snvs_pwrkey_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
+
+	if (device_may_wakeup(&pdev->dev))
+		enable_irq_wake(pdata->irq);
+
+	return 0;
+}
+
+static int imx_snvs_pwrkey_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
+
+	if (device_may_wakeup(&pdev->dev))
+		disable_irq_wake(pdata->irq);
+
+	return 0;
+}
+
+static const struct of_device_id imx_snvs_pwrkey_ids[] = {
+	{ .compatible = "fsl,sec-v4.0-pwrkey" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, imx_snvs_pwrkey_ids);
+
+static SIMPLE_DEV_PM_OPS(imx_snvs_pwrkey_pm_ops, imx_snvs_pwrkey_suspend,
+				imx_snvs_pwrkey_resume);
+
+static struct platform_driver imx_snvs_pwrkey_driver = {
+	.driver = {
+		.name = "snvs_pwrkey",
+		.pm     = &imx_snvs_pwrkey_pm_ops,
+		.of_match_table = imx_snvs_pwrkey_ids,
+	},
+	.probe = imx_snvs_pwrkey_probe,
+};
+module_platform_driver(imx_snvs_pwrkey_driver);
+
+MODULE_AUTHOR("Freescale Semiconductor");
+MODULE_DESCRIPTION("i.MX snvs power key Driver");
+MODULE_LICENSE("GPL");
-- 
1.9.1


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

* [PATCH v2 5/7] input: keyboard: imx: add snvs power key driver
@ 2015-05-19 17:04   ` Frank.Li
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li at freescale.com @ 2015-05-19 17:04 UTC (permalink / raw)
  To: linux-arm-kernel

From: Robin Gong <b38343@freescale.com>

add snvs power key driver.
It work in imx chips after i.mx6sx

ON/OFF key used power on/off whole system.
This driver make it wakeup from suspend state when short press
ON/OFF key.

Long time press will trig SNVS power off chip without software
intervention.

Signed-off-by: Robin Gong <b38343@freescale.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 drivers/input/keyboard/Kconfig       |  11 ++
 drivers/input/keyboard/Makefile      |   1 +
 drivers/input/keyboard/snvs_pwrkey.c | 232 +++++++++++++++++++++++++++++++++++
 3 files changed, 244 insertions(+)
 create mode 100644 drivers/input/keyboard/snvs_pwrkey.c

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 106fbac..61b3fab 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -400,6 +400,17 @@ config KEYBOARD_MPR121
 	  To compile this driver as a module, choose M here: the
 	  module will be called mpr121_touchkey.
 
+config KEYBOARD_SNVS_PWRKEY
+	tristate "IMX SNVS Power Key Driver"
+	depends on SOC_IMX6SX
+	depends on OF
+	help
+	  This is the snvs powerkey driver for the Freescale i.MX application
+	  processors that are newer than i.MX6 SX.
+
+	  To compile this driver as a module, choose M here; the
+	  module will be called snvs_pwrkey.
+
 config KEYBOARD_IMX
 	tristate "IMX keypad support"
 	depends on ARCH_MXC
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index df28d55..1d416dd 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -51,6 +51,7 @@ obj-$(CONFIG_KEYBOARD_QT1070)           += qt1070.o
 obj-$(CONFIG_KEYBOARD_QT2160)		+= qt2160.o
 obj-$(CONFIG_KEYBOARD_SAMSUNG)		+= samsung-keypad.o
 obj-$(CONFIG_KEYBOARD_SH_KEYSC)		+= sh_keysc.o
+obj-$(CONFIG_KEYBOARD_SNVS_PWRKEY)	+= snvs_pwrkey.o
 obj-$(CONFIG_KEYBOARD_SPEAR)		+= spear-keyboard.o
 obj-$(CONFIG_KEYBOARD_STMPE)		+= stmpe-keypad.o
 obj-$(CONFIG_KEYBOARD_STOWAWAY)		+= stowaway.o
diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
new file mode 100644
index 0000000..98c340e
--- /dev/null
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -0,0 +1,232 @@
+/*
+ * Driver for the IMX SNVS ON/OFF Power Key
+ * Copyright (C) 2015 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
+
+#define SNVS_LPSR_REG	0x4C	/* LP Status Register */
+#define SNVS_LPCR_REG	0x38	/* LP Control Register */
+#define SNVS_HPSR_REG	0x14
+#define SNVS_HPSR_BTN	BIT(6)
+#define SNVS_LPSR_SPO	BIT(18)
+#define SNVS_LPCR_DEP_EN BIT(5)
+
+#define DEBOUNCE_TIME 30
+#define REPEAT_INTERVAL 60
+
+struct pwrkey_drv_data {
+	struct regmap *snvs;
+	int irq;
+	int keycode;
+	int keystate;  /* 1:pressed */
+	int wakeup;
+	struct timer_list check_timer;
+	struct input_dev *input;
+};
+
+static void imx_imx_snvs_check_for_events(unsigned long data)
+{
+	struct pwrkey_drv_data *pdata = (struct pwrkey_drv_data *) data;
+	struct input_dev *input = pdata->input;
+	u32 state;
+
+	regmap_read(pdata->snvs, SNVS_HPSR_REG, &state);
+	state = state & SNVS_HPSR_BTN ? 1 : 0;
+
+	/* only report new event if status changed */
+	if (state ^ pdata->keystate) {
+		pdata->keystate = state;
+		input_event(input, EV_KEY, pdata->keycode, state);
+		input_sync(input);
+		pm_relax(pdata->input->dev.parent);
+	}
+
+	/* repeat check if pressed long */
+	if (state) {
+		mod_timer(&pdata->check_timer,
+			  jiffies + msecs_to_jiffies(REPEAT_INTERVAL));
+	}
+}
+
+static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)
+{
+	struct platform_device *pdev = dev_id;
+	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
+	u32 lp_status;
+
+	pm_wakeup_event(pdata->input->dev.parent, 0);
+
+	regmap_read(pdata->snvs, SNVS_LPSR_REG, &lp_status);
+	if (lp_status & SNVS_LPSR_SPO)
+		mod_timer(&pdata->check_timer, jiffies + msecs_to_jiffies(DEBOUNCE_TIME));
+
+	/* clear SPO status */
+	regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
+
+	return IRQ_HANDLED;
+}
+
+static void imx_snvs_pwrkey_act(void *pdata)
+{
+	struct pwrkey_drv_data *pd = pdata;
+
+	del_timer_sync(&pd->check_timer);
+}
+
+static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
+{
+	struct pwrkey_drv_data *pdata = NULL;
+	struct input_dev *input = NULL;
+	struct device_node *np, *snvs_np;
+	int error;
+
+	/* Get SNVS register Page */
+	np = pdev->dev.of_node;
+	if (!np)
+		return -ENODEV;
+
+	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		return -ENOMEM;
+
+	snvs_np = of_get_parent(pdev->dev.of_node);
+	if (!snvs_np)
+		return -ENODEV;
+
+	pdata->snvs = syscon_node_to_regmap(snvs_np);
+	of_node_put(snvs_np);
+
+	if (!pdata->snvs) {
+		pr_err("Can't get snvs syscon\n");
+		return -ENODEV;
+	}
+
+	if (of_property_read_u32(np, "linux,keycode", &pdata->keycode)) {
+		pdata->keycode = KEY_POWER;
+		dev_warn(&pdev->dev, "KEY_POWER without setting in dts\n");
+	}
+
+	pdata->wakeup = of_property_read_bool(np, "wakeup");
+
+	pdata->irq = platform_get_irq(pdev, 0);
+	if (pdata->irq < 0) {
+		dev_err(&pdev->dev, "no irq defined in platform data\n");
+		return -EINVAL;
+	}
+
+	regmap_update_bits(pdata->snvs, SNVS_LPCR_REG, SNVS_LPCR_DEP_EN, SNVS_LPCR_DEP_EN);
+
+	/* clear the unexpected interrupt before driver ready */
+	regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
+
+	setup_timer(&pdata->check_timer,
+		    imx_imx_snvs_check_for_events, (unsigned long) pdata);
+
+	input = devm_input_allocate_device(&pdev->dev);
+	if (!input) {
+		dev_err(&pdev->dev, "failed to allocate the input device\n");
+		return -ENOMEM;
+	}
+
+	input->name = pdev->name;
+	input->phys = "snvs-pwrkey/input0";
+	input->id.bustype = BUS_HOST;
+
+	input_set_capability(input, EV_KEY, pdata->keycode);
+
+	/* input customer action to cancel release timer */
+	error = devm_add_action(&pdev->dev, imx_snvs_pwrkey_act, pdata);
+	if (error) {
+		dev_err(&pdev->dev, "failed to register remove action\n");
+		return error;
+	}
+
+	error = devm_request_irq(&pdev->dev, pdata->irq,
+			       imx_snvs_pwrkey_interrupt,
+			       0, pdev->name, pdev);
+
+	if (error) {
+		dev_err(&pdev->dev, "interrupt not available.\n");
+		return error;
+	}
+
+	error = input_register_device(input);
+	if (error < 0) {
+		dev_err(&pdev->dev, "failed to register input device\n");
+		input_free_device(input);
+		return error;
+	}
+
+	pdata->input = input;
+	platform_set_drvdata(pdev, pdata);
+
+	device_init_wakeup(&pdev->dev, pdata->wakeup);
+
+	return 0;
+}
+
+static int imx_snvs_pwrkey_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
+
+	if (device_may_wakeup(&pdev->dev))
+		enable_irq_wake(pdata->irq);
+
+	return 0;
+}
+
+static int imx_snvs_pwrkey_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
+
+	if (device_may_wakeup(&pdev->dev))
+		disable_irq_wake(pdata->irq);
+
+	return 0;
+}
+
+static const struct of_device_id imx_snvs_pwrkey_ids[] = {
+	{ .compatible = "fsl,sec-v4.0-pwrkey" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, imx_snvs_pwrkey_ids);
+
+static SIMPLE_DEV_PM_OPS(imx_snvs_pwrkey_pm_ops, imx_snvs_pwrkey_suspend,
+				imx_snvs_pwrkey_resume);
+
+static struct platform_driver imx_snvs_pwrkey_driver = {
+	.driver = {
+		.name = "snvs_pwrkey",
+		.pm     = &imx_snvs_pwrkey_pm_ops,
+		.of_match_table = imx_snvs_pwrkey_ids,
+	},
+	.probe = imx_snvs_pwrkey_probe,
+};
+module_platform_driver(imx_snvs_pwrkey_driver);
+
+MODULE_AUTHOR("Freescale Semiconductor");
+MODULE_DESCRIPTION("i.MX snvs power key Driver");
+MODULE_LICENSE("GPL");
-- 
1.9.1

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

* [rtc-linux] [PATCH v2 6/7] document: devicetree: input: imx: i.mx snvs power device tree bindings
  2015-05-19 17:04 ` Frank.Li
  (?)
@ 2015-05-19 17:04   ` Frank.Li
  -1 siblings, 0 replies; 63+ messages in thread
From: Frank.Li @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni
  Cc: linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree,
	Frank Li, Robin Gong

From: Frank Li <Frank.Li@freescale.com>

The snvs-pwrkey is designed to enable POWER key function which controlled
by SNVS ONOFF. the driver can report the status of POWER key and wakeup
system if pressed after system suspend.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: Robin Gong <b38343@freescale.com>
---
 .../devicetree/bindings/crypto/fsl-sec4.txt        | 42 ++++++++++++++++++++++
 .../devicetree/bindings/input/snvs-pwrkey.txt      |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/snvs-pwrkey.txt

diff --git a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
index ca04206..99a57b7 100644
--- a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
+++ b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
@@ -394,6 +394,41 @@ EXAMPLE
 };
 
 =====================================================================
+System ON/OFF key driver
+
+  The snvs-pwrkey is designed to enable POWER key function which controlled
+  by SNVS ONOFF, the driver can report the status of POWER key and wakeup
+  system if pressed after system suspend.
+
+  - compatible:
+      Usage: required
+      Value type: <string>
+      Definition: Mush include "fsl,sec-v4.0-pwrkey".
+
+  - interrupts:
+      Usage: required
+      Value type: <prop_encoded-array>
+      Definition: The SNVS ON/OFF interrupt number to the CPU(s).
+
+  - linux,keycode:
+      Usage: option
+      Value type: <int>
+      Definition: Keycode to emit, KEY_POWER by default.
+
+  - wakeup:
+      Usage: option
+      Value type: <boo>
+      Definition: Button can wake-up the system
+
+EXAMPLE:
+	snvs-pwrkey@0x020cc000 {
+		compatible = "fsl,sec-v4.0-pwrkey";
+		interrupts = <0 4 0x4>
+	        linux,keycode = <116>; /* KEY_POWER */
+		wakeup;
+	};
+
+=====================================================================
 FULL EXAMPLE
 
 	crypto: crypto@300000 {
@@ -475,6 +510,13 @@ FULL EXAMPLE
 		snvs_poweroff: snvs-poweroff@38 {
                         compatible = "fsl,sec-v4.0-poweroff";
                 };
+
+		snvs-pwrkey@0x020cc000 {
+			compatible = "fsl,sec-v4.0-pwrkey";
+			interrupts = <0 4 0x4>;
+			linux,keycode = <116>; /* KEY_POWER */
+			wakeup;
+		};
 	};
 
 =====================================================================
diff --git a/Documentation/devicetree/bindings/input/snvs-pwrkey.txt b/Documentation/devicetree/bindings/input/snvs-pwrkey.txt
new file mode 100644
index 0000000..70c1425
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/snvs-pwrkey.txt
@@ -0,0 +1 @@
+See Documentation/devicetree/bindings/crypto/fsl-sec4.txt
-- 
1.9.1

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH v2 6/7] document: devicetree: input: imx: i.mx snvs power device tree bindings
@ 2015-05-19 17:04   ` Frank.Li
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni
  Cc: linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree,
	Frank Li, Robin Gong

From: Frank Li <Frank.Li@freescale.com>

The snvs-pwrkey is designed to enable POWER key function which controlled
by SNVS ONOFF. the driver can report the status of POWER key and wakeup
system if pressed after system suspend.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: Robin Gong <b38343@freescale.com>
---
 .../devicetree/bindings/crypto/fsl-sec4.txt        | 42 ++++++++++++++++++++++
 .../devicetree/bindings/input/snvs-pwrkey.txt      |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/snvs-pwrkey.txt

diff --git a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
index ca04206..99a57b7 100644
--- a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
+++ b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
@@ -394,6 +394,41 @@ EXAMPLE
 };
 
 =====================================================================
+System ON/OFF key driver
+
+  The snvs-pwrkey is designed to enable POWER key function which controlled
+  by SNVS ONOFF, the driver can report the status of POWER key and wakeup
+  system if pressed after system suspend.
+
+  - compatible:
+      Usage: required
+      Value type: <string>
+      Definition: Mush include "fsl,sec-v4.0-pwrkey".
+
+  - interrupts:
+      Usage: required
+      Value type: <prop_encoded-array>
+      Definition: The SNVS ON/OFF interrupt number to the CPU(s).
+
+  - linux,keycode:
+      Usage: option
+      Value type: <int>
+      Definition: Keycode to emit, KEY_POWER by default.
+
+  - wakeup:
+      Usage: option
+      Value type: <boo>
+      Definition: Button can wake-up the system
+
+EXAMPLE:
+	snvs-pwrkey@0x020cc000 {
+		compatible = "fsl,sec-v4.0-pwrkey";
+		interrupts = <0 4 0x4>
+	        linux,keycode = <116>; /* KEY_POWER */
+		wakeup;
+	};
+
+=====================================================================
 FULL EXAMPLE
 
 	crypto: crypto@300000 {
@@ -475,6 +510,13 @@ FULL EXAMPLE
 		snvs_poweroff: snvs-poweroff@38 {
                         compatible = "fsl,sec-v4.0-poweroff";
                 };
+
+		snvs-pwrkey@0x020cc000 {
+			compatible = "fsl,sec-v4.0-pwrkey";
+			interrupts = <0 4 0x4>;
+			linux,keycode = <116>; /* KEY_POWER */
+			wakeup;
+		};
 	};
 
 =====================================================================
diff --git a/Documentation/devicetree/bindings/input/snvs-pwrkey.txt b/Documentation/devicetree/bindings/input/snvs-pwrkey.txt
new file mode 100644
index 0000000..70c1425
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/snvs-pwrkey.txt
@@ -0,0 +1 @@
+See Documentation/devicetree/bindings/crypto/fsl-sec4.txt
-- 
1.9.1


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

* [PATCH v2 6/7] document: devicetree: input: imx: i.mx snvs power device tree bindings
@ 2015-05-19 17:04   ` Frank.Li
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li at freescale.com @ 2015-05-19 17:04 UTC (permalink / raw)
  To: linux-arm-kernel

From: Frank Li <Frank.Li@freescale.com>

The snvs-pwrkey is designed to enable POWER key function which controlled
by SNVS ONOFF. the driver can report the status of POWER key and wakeup
system if pressed after system suspend.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: Robin Gong <b38343@freescale.com>
---
 .../devicetree/bindings/crypto/fsl-sec4.txt        | 42 ++++++++++++++++++++++
 .../devicetree/bindings/input/snvs-pwrkey.txt      |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/snvs-pwrkey.txt

diff --git a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
index ca04206..99a57b7 100644
--- a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
+++ b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
@@ -394,6 +394,41 @@ EXAMPLE
 };
 
 =====================================================================
+System ON/OFF key driver
+
+  The snvs-pwrkey is designed to enable POWER key function which controlled
+  by SNVS ONOFF, the driver can report the status of POWER key and wakeup
+  system if pressed after system suspend.
+
+  - compatible:
+      Usage: required
+      Value type: <string>
+      Definition: Mush include "fsl,sec-v4.0-pwrkey".
+
+  - interrupts:
+      Usage: required
+      Value type: <prop_encoded-array>
+      Definition: The SNVS ON/OFF interrupt number to the CPU(s).
+
+  - linux,keycode:
+      Usage: option
+      Value type: <int>
+      Definition: Keycode to emit, KEY_POWER by default.
+
+  - wakeup:
+      Usage: option
+      Value type: <boo>
+      Definition: Button can wake-up the system
+
+EXAMPLE:
+	snvs-pwrkey at 0x020cc000 {
+		compatible = "fsl,sec-v4.0-pwrkey";
+		interrupts = <0 4 0x4>
+	        linux,keycode = <116>; /* KEY_POWER */
+		wakeup;
+	};
+
+=====================================================================
 FULL EXAMPLE
 
 	crypto: crypto at 300000 {
@@ -475,6 +510,13 @@ FULL EXAMPLE
 		snvs_poweroff: snvs-poweroff at 38 {
                         compatible = "fsl,sec-v4.0-poweroff";
                 };
+
+		snvs-pwrkey at 0x020cc000 {
+			compatible = "fsl,sec-v4.0-pwrkey";
+			interrupts = <0 4 0x4>;
+			linux,keycode = <116>; /* KEY_POWER */
+			wakeup;
+		};
 	};
 
 =====================================================================
diff --git a/Documentation/devicetree/bindings/input/snvs-pwrkey.txt b/Documentation/devicetree/bindings/input/snvs-pwrkey.txt
new file mode 100644
index 0000000..70c1425
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/snvs-pwrkey.txt
@@ -0,0 +1 @@
+See Documentation/devicetree/bindings/crypto/fsl-sec4.txt
-- 
1.9.1

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

* [rtc-linux] [PATCH v2 7/7] arm: dts: imx6sx: enable snvs power key
  2015-05-19 17:04 ` Frank.Li
  (?)
@ 2015-05-19 17:04   ` Frank.Li
  -1 siblings, 0 replies; 63+ messages in thread
From: Frank.Li @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni
  Cc: linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree, Frank Li

From: Frank Li <Frank.Li@freescale.com>

enable snvs ONOFF power key support

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 arch/arm/boot/dts/imx6sx.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index 97de407..2977015 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -674,6 +674,13 @@
 					compatible = "fsl,sec-v4.0-poweroff";
 					status = "disabled";
 				};
+
+				snvs_pwrkey: snvs-powerkey {
+					compatible = "fsl,sec-v4.0-pwrkey";
+					interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+					linux,keycode = <116>; /* KEY_POWER */
+					wakeup;
+				};
 			};
 
 			epit1: epit@020d0000 {
-- 
1.9.1

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH v2 7/7] arm: dts: imx6sx: enable snvs power key
@ 2015-05-19 17:04   ` Frank.Li
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li @ 2015-05-19 17:04 UTC (permalink / raw)
  To: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni
  Cc: linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree, Frank Li

From: Frank Li <Frank.Li@freescale.com>

enable snvs ONOFF power key support

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 arch/arm/boot/dts/imx6sx.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index 97de407..2977015 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -674,6 +674,13 @@
 					compatible = "fsl,sec-v4.0-poweroff";
 					status = "disabled";
 				};
+
+				snvs_pwrkey: snvs-powerkey {
+					compatible = "fsl,sec-v4.0-pwrkey";
+					interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+					linux,keycode = <116>; /* KEY_POWER */
+					wakeup;
+				};
 			};
 
 			epit1: epit@020d0000 {
-- 
1.9.1


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

* [PATCH v2 7/7] arm: dts: imx6sx: enable snvs power key
@ 2015-05-19 17:04   ` Frank.Li
  0 siblings, 0 replies; 63+ messages in thread
From: Frank.Li at freescale.com @ 2015-05-19 17:04 UTC (permalink / raw)
  To: linux-arm-kernel

From: Frank Li <Frank.Li@freescale.com>

enable snvs ONOFF power key support

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 arch/arm/boot/dts/imx6sx.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index 97de407..2977015 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -674,6 +674,13 @@
 					compatible = "fsl,sec-v4.0-poweroff";
 					status = "disabled";
 				};
+
+				snvs_pwrkey: snvs-powerkey {
+					compatible = "fsl,sec-v4.0-pwrkey";
+					interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+					linux,keycode = <116>; /* KEY_POWER */
+					wakeup;
+				};
 			};
 
 			epit1: epit at 020d0000 {
-- 
1.9.1

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

* [rtc-linux] Re: [PATCH v2 2/7] rtc: arm: imx: snvs: change use syscon to access register
  2015-05-19 17:04   ` Frank.Li-KZfg59tc24xl57MIdRCFDg
  (?)
@ 2015-05-19 20:46     ` Alexandre Belloni
  -1 siblings, 0 replies; 63+ messages in thread
From: Alexandre Belloni @ 2015-05-19 20:46 UTC (permalink / raw)
  To: Frank.Li
  Cc: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree

On 20/05/2015 at 01:04:37 +0800, Frank.Li@freescale.com wrote :
> From: Frank Li <Frank.Li@freescale.com>
> 
> snvs included rtc, on/off key, power-off module
> change to syscon to access register
> 
> Signed-off-by: Frank Li <Frank.Li@freescale.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
>  drivers/rtc/rtc-snvs.c | 128 +++++++++++++++++++++----------------------------
>  1 file changed, 54 insertions(+), 74 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c
> index 0479e80..6eaebf1 100644
> --- a/drivers/rtc/rtc-snvs.c
> +++ b/drivers/rtc/rtc-snvs.c
> @@ -18,14 +18,15 @@
>  #include <linux/platform_device.h>
>  #include <linux/rtc.h>
>  #include <linux/clk.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/regmap.h>
>  
> -/* These register offsets are relative to LP (Low Power) range */
> -#define SNVS_LPCR		0x04
> -#define SNVS_LPSR		0x18
> -#define SNVS_LPSRTCMR		0x1c
> -#define SNVS_LPSRTCLR		0x20
> -#define SNVS_LPTAR		0x24
> -#define SNVS_LPPGDR		0x30
> +#define SNVS_LPCR		0x38
> +#define SNVS_LPSR		0x4c
> +#define SNVS_LPSRTCMR		0x50
> +#define SNVS_LPSRTCLR		0x54
> +#define SNVS_LPTAR		0x58
> +#define SNVS_LPPGDR		0x64
>  
>  #define SNVS_LPCR_SRTC_ENV	(1 << 0)
>  #define SNVS_LPCR_LPTA_EN	(1 << 1)
> @@ -37,31 +38,34 @@
>  
>  struct snvs_rtc_data {
>  	struct rtc_device *rtc;
> -	void __iomem *ioaddr;
> +	struct regmap *snvs;
>  	int irq;
> -	spinlock_t lock;
>  	struct clk *clk;
>  };
>  
> -static u32 rtc_read_lp_counter(void __iomem *ioaddr)
> +static u32 rtc_read_lp_counter(struct regmap *snvs)
>  {
>  	u64 read1, read2;
> -
> +	u32 val;
>  	do {
> -		read1 = readl(ioaddr + SNVS_LPSRTCMR);
> +		regmap_read(snvs, SNVS_LPSRTCMR, &val);
> +		read1 = val;
>  		read1 <<= 32;
> -		read1 |= readl(ioaddr + SNVS_LPSRTCLR);
> +		regmap_read(snvs, SNVS_LPSRTCLR, &val);
> +		read1 |= val;
>  
> -		read2 = readl(ioaddr + SNVS_LPSRTCMR);
> +		regmap_read(snvs, SNVS_LPSRTCMR, &val);
> +		read2 = val;
>  		read2 <<= 32;
> -		read2 |= readl(ioaddr + SNVS_LPSRTCLR);
> +		regmap_read(snvs, SNVS_LPSRTCLR, &val);
> +		read2 |= val;
>  	} while (read1 != read2);
>  
>  	/* Convert 47-bit counter to 32-bit raw second count */
>  	return (u32) (read1 >> CNTR_TO_SECS_SH);
>  }
>  
> -static void rtc_write_sync_lp(void __iomem *ioaddr)
> +static void rtc_write_sync_lp(struct regmap *snvs)
>  {
>  	u32 count1, count2, count3;
>  	int i;
> @@ -69,15 +73,15 @@ static void rtc_write_sync_lp(void __iomem *ioaddr)
>  	/* Wait for 3 CKIL cycles */
>  	for (i = 0; i < 3; i++) {
>  		do {
> -			count1 = readl(ioaddr + SNVS_LPSRTCLR);
> -			count2 = readl(ioaddr + SNVS_LPSRTCLR);
> +			regmap_read(snvs, SNVS_LPSRTCLR, &count1);
> +			regmap_read(snvs, SNVS_LPSRTCLR, &count2);
>  		} while (count1 != count2);
>  
>  		/* Now wait until counter value changes */
>  		do {
>  			do {
> -				count2 = readl(ioaddr + SNVS_LPSRTCLR);
> -				count3 = readl(ioaddr + SNVS_LPSRTCLR);
> +				regmap_read(snvs, SNVS_LPSRTCLR, &count2);
> +				regmap_read(snvs, SNVS_LPSRTCLR, &count3);
>  			} while (count2 != count3);
>  		} while (count3 == count1);
>  	}
> @@ -85,23 +89,14 @@ static void rtc_write_sync_lp(void __iomem *ioaddr)
>  
>  static int snvs_rtc_enable(struct snvs_rtc_data *data, bool enable)
>  {
> -	unsigned long flags;
>  	int timeout = 1000;
>  	u32 lpcr;
>  
> -	spin_lock_irqsave(&data->lock, flags);
> -
> -	lpcr = readl(data->ioaddr + SNVS_LPCR);
> -	if (enable)
> -		lpcr |= SNVS_LPCR_SRTC_ENV;
> -	else
> -		lpcr &= ~SNVS_LPCR_SRTC_ENV;
> -	writel(lpcr, data->ioaddr + SNVS_LPCR);
> -
> -	spin_unlock_irqrestore(&data->lock, flags);
> +	regmap_update_bits(data->snvs, SNVS_LPCR, SNVS_LPCR_SRTC_ENV,
> +			   enable ? SNVS_LPCR_SRTC_ENV : 0);
>  
>  	while (--timeout) {
> -		lpcr = readl(data->ioaddr + SNVS_LPCR);
> +		regmap_read(data->snvs, SNVS_LPCR, &lpcr);
>  
>  		if (enable) {
>  			if (lpcr & SNVS_LPCR_SRTC_ENV)
> @@ -121,7 +116,7 @@ static int snvs_rtc_enable(struct snvs_rtc_data *data, bool enable)
>  static int snvs_rtc_read_time(struct device *dev, struct rtc_time *tm)
>  {
>  	struct snvs_rtc_data *data = dev_get_drvdata(dev);
> -	unsigned long time = rtc_read_lp_counter(data->ioaddr);
> +	unsigned long time = rtc_read_lp_counter(data->snvs);
>  
>  	rtc_time_to_tm(time, tm);
>  
> @@ -139,8 +134,8 @@ static int snvs_rtc_set_time(struct device *dev, struct rtc_time *tm)
>  	snvs_rtc_enable(data, false);
>  
>  	/* Write 32-bit time to 47-bit timer, leaving 15 LSBs blank */
> -	writel(time << CNTR_TO_SECS_SH, data->ioaddr + SNVS_LPSRTCLR);
> -	writel(time >> (32 - CNTR_TO_SECS_SH), data->ioaddr + SNVS_LPSRTCMR);
> +	regmap_write(data->snvs, SNVS_LPSRTCLR, time << CNTR_TO_SECS_SH);
> +	regmap_write(data->snvs, SNVS_LPSRTCMR, time >> (32 - CNTR_TO_SECS_SH));
>  
>  	/* Enable RTC again */
>  	snvs_rtc_enable(data, true);
> @@ -153,10 +148,10 @@ static int snvs_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
>  	struct snvs_rtc_data *data = dev_get_drvdata(dev);
>  	u32 lptar, lpsr;
>  
> -	lptar = readl(data->ioaddr + SNVS_LPTAR);
> +	regmap_read(data->snvs, SNVS_LPTAR, &lptar);
>  	rtc_time_to_tm(lptar, &alrm->time);
>  
> -	lpsr = readl(data->ioaddr + SNVS_LPSR);
> +	regmap_read(data->snvs, SNVS_LPSR, &lpsr);
>  	alrm->pending = (lpsr & SNVS_LPSR_LPTA) ? 1 : 0;
>  
>  	return 0;
> @@ -165,21 +160,11 @@ static int snvs_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
>  static int snvs_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
>  {
>  	struct snvs_rtc_data *data = dev_get_drvdata(dev);
> -	u32 lpcr;
> -	unsigned long flags;
>  
> -	spin_lock_irqsave(&data->lock, flags);
> +	regmap_update_bits(data->snvs, SNVS_LPCR, (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN),
> +			   enable ? (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN) : 0);
>  
> -	lpcr = readl(data->ioaddr + SNVS_LPCR);
> -	if (enable)
> -		lpcr |= (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN);
> -	else
> -		lpcr &= ~(SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN);
> -	writel(lpcr, data->ioaddr + SNVS_LPCR);
> -
> -	spin_unlock_irqrestore(&data->lock, flags);
> -
> -	rtc_write_sync_lp(data->ioaddr);
> +	rtc_write_sync_lp(data->snvs);
>  
>  	return 0;
>  }
> @@ -189,24 +174,14 @@ static int snvs_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
>  	struct snvs_rtc_data *data = dev_get_drvdata(dev);
>  	struct rtc_time *alrm_tm = &alrm->time;
>  	unsigned long time;
> -	unsigned long flags;
> -	u32 lpcr;
>  
>  	rtc_tm_to_time(alrm_tm, &time);
>  
> -	spin_lock_irqsave(&data->lock, flags);
> -
> -	/* Have to clear LPTA_EN before programming new alarm time in LPTAR */
> -	lpcr = readl(data->ioaddr + SNVS_LPCR);
> -	lpcr &= ~SNVS_LPCR_LPTA_EN;
> -	writel(lpcr, data->ioaddr + SNVS_LPCR);
> -
> -	spin_unlock_irqrestore(&data->lock, flags);
> -
> -	writel(time, data->ioaddr + SNVS_LPTAR);
> +	regmap_update_bits(data->snvs, SNVS_LPCR, SNVS_LPCR_LPTA_EN, 0);
> +	regmap_write(data->snvs, SNVS_LPTAR, time);
>  
>  	/* Clear alarm interrupt status bit */
> -	writel(SNVS_LPSR_LPTA, data->ioaddr + SNVS_LPSR);
> +	regmap_write(data->snvs, SNVS_LPSR, SNVS_LPSR_LPTA);
>  
>  	return snvs_rtc_alarm_irq_enable(dev, alrm->enabled);
>  }
> @@ -226,7 +201,7 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
>  	u32 lpsr;
>  	u32 events = 0;
>  
> -	lpsr = readl(data->ioaddr + SNVS_LPSR);
> +	regmap_read(data->snvs, SNVS_LPSR, &lpsr);
>  
>  	if (lpsr & SNVS_LPSR_LPTA) {
>  		events |= (RTC_AF | RTC_IRQF);
> @@ -238,7 +213,7 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
>  	}
>  
>  	/* clear interrupt status */
> -	writel(lpsr, data->ioaddr + SNVS_LPSR);
> +	regmap_write(data->snvs, SNVS_LPSR, lpsr);
>  
>  	return events ? IRQ_HANDLED : IRQ_NONE;
>  }
> @@ -246,17 +221,24 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
>  static int snvs_rtc_probe(struct platform_device *pdev)
>  {
>  	struct snvs_rtc_data *data;
> -	struct resource *res;
>  	int ret;
> +	struct device_node *snvs_np;
>  
>  	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
>  	if (!data)
>  		return -ENOMEM;
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	data->ioaddr = devm_ioremap_resource(&pdev->dev, res);
> -	if (IS_ERR(data->ioaddr))
> -		return PTR_ERR(data->ioaddr);
> +	snvs_np = of_get_parent(pdev->dev.of_node);
> +	if (!snvs_np)
> +		return -ENODEV;
> +
> +	data->snvs = syscon_node_to_regmap(snvs_np);
> +	of_node_put(snvs_np);
> +
> +	if (!data->snvs) {
> +		pr_err("Can't snvs syscon\n");
> +		return -ENODEV;
> +	}
>  
>  	data->irq = platform_get_irq(pdev, 0);
>  	if (data->irq < 0)
> @@ -276,13 +258,11 @@ static int snvs_rtc_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, data);
>  
> -	spin_lock_init(&data->lock);
> -
>  	/* Initialize glitch detect */
> -	writel(SNVS_LPPGDR_INIT, data->ioaddr + SNVS_LPPGDR);
> +	regmap_write(data->snvs, SNVS_LPPGDR, SNVS_LPPGDR_INIT);
>  
>  	/* Clear interrupt status */
> -	writel(0xffffffff, data->ioaddr + SNVS_LPSR);
> +	regmap_write(data->snvs, SNVS_LPSR, 0xffffffff);
>  
>  	/* Enable RTC */
>  	snvs_rtc_enable(data, true);
> -- 
> 1.9.1
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH v2 2/7] rtc: arm: imx: snvs: change use syscon to access register
@ 2015-05-19 20:46     ` Alexandre Belloni
  0 siblings, 0 replies; 63+ messages in thread
From: Alexandre Belloni @ 2015-05-19 20:46 UTC (permalink / raw)
  To: Frank.Li
  Cc: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	linux-arm-kernel, linux-input, rtc-linux, linux-pm, devicetree

On 20/05/2015 at 01:04:37 +0800, Frank.Li@freescale.com wrote :
> From: Frank Li <Frank.Li@freescale.com>
> 
> snvs included rtc, on/off key, power-off module
> change to syscon to access register
> 
> Signed-off-by: Frank Li <Frank.Li@freescale.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
>  drivers/rtc/rtc-snvs.c | 128 +++++++++++++++++++++----------------------------
>  1 file changed, 54 insertions(+), 74 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c
> index 0479e80..6eaebf1 100644
> --- a/drivers/rtc/rtc-snvs.c
> +++ b/drivers/rtc/rtc-snvs.c
> @@ -18,14 +18,15 @@
>  #include <linux/platform_device.h>
>  #include <linux/rtc.h>
>  #include <linux/clk.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/regmap.h>
>  
> -/* These register offsets are relative to LP (Low Power) range */
> -#define SNVS_LPCR		0x04
> -#define SNVS_LPSR		0x18
> -#define SNVS_LPSRTCMR		0x1c
> -#define SNVS_LPSRTCLR		0x20
> -#define SNVS_LPTAR		0x24
> -#define SNVS_LPPGDR		0x30
> +#define SNVS_LPCR		0x38
> +#define SNVS_LPSR		0x4c
> +#define SNVS_LPSRTCMR		0x50
> +#define SNVS_LPSRTCLR		0x54
> +#define SNVS_LPTAR		0x58
> +#define SNVS_LPPGDR		0x64
>  
>  #define SNVS_LPCR_SRTC_ENV	(1 << 0)
>  #define SNVS_LPCR_LPTA_EN	(1 << 1)
> @@ -37,31 +38,34 @@
>  
>  struct snvs_rtc_data {
>  	struct rtc_device *rtc;
> -	void __iomem *ioaddr;
> +	struct regmap *snvs;
>  	int irq;
> -	spinlock_t lock;
>  	struct clk *clk;
>  };
>  
> -static u32 rtc_read_lp_counter(void __iomem *ioaddr)
> +static u32 rtc_read_lp_counter(struct regmap *snvs)
>  {
>  	u64 read1, read2;
> -
> +	u32 val;
>  	do {
> -		read1 = readl(ioaddr + SNVS_LPSRTCMR);
> +		regmap_read(snvs, SNVS_LPSRTCMR, &val);
> +		read1 = val;
>  		read1 <<= 32;
> -		read1 |= readl(ioaddr + SNVS_LPSRTCLR);
> +		regmap_read(snvs, SNVS_LPSRTCLR, &val);
> +		read1 |= val;
>  
> -		read2 = readl(ioaddr + SNVS_LPSRTCMR);
> +		regmap_read(snvs, SNVS_LPSRTCMR, &val);
> +		read2 = val;
>  		read2 <<= 32;
> -		read2 |= readl(ioaddr + SNVS_LPSRTCLR);
> +		regmap_read(snvs, SNVS_LPSRTCLR, &val);
> +		read2 |= val;
>  	} while (read1 != read2);
>  
>  	/* Convert 47-bit counter to 32-bit raw second count */
>  	return (u32) (read1 >> CNTR_TO_SECS_SH);
>  }
>  
> -static void rtc_write_sync_lp(void __iomem *ioaddr)
> +static void rtc_write_sync_lp(struct regmap *snvs)
>  {
>  	u32 count1, count2, count3;
>  	int i;
> @@ -69,15 +73,15 @@ static void rtc_write_sync_lp(void __iomem *ioaddr)
>  	/* Wait for 3 CKIL cycles */
>  	for (i = 0; i < 3; i++) {
>  		do {
> -			count1 = readl(ioaddr + SNVS_LPSRTCLR);
> -			count2 = readl(ioaddr + SNVS_LPSRTCLR);
> +			regmap_read(snvs, SNVS_LPSRTCLR, &count1);
> +			regmap_read(snvs, SNVS_LPSRTCLR, &count2);
>  		} while (count1 != count2);
>  
>  		/* Now wait until counter value changes */
>  		do {
>  			do {
> -				count2 = readl(ioaddr + SNVS_LPSRTCLR);
> -				count3 = readl(ioaddr + SNVS_LPSRTCLR);
> +				regmap_read(snvs, SNVS_LPSRTCLR, &count2);
> +				regmap_read(snvs, SNVS_LPSRTCLR, &count3);
>  			} while (count2 != count3);
>  		} while (count3 == count1);
>  	}
> @@ -85,23 +89,14 @@ static void rtc_write_sync_lp(void __iomem *ioaddr)
>  
>  static int snvs_rtc_enable(struct snvs_rtc_data *data, bool enable)
>  {
> -	unsigned long flags;
>  	int timeout = 1000;
>  	u32 lpcr;
>  
> -	spin_lock_irqsave(&data->lock, flags);
> -
> -	lpcr = readl(data->ioaddr + SNVS_LPCR);
> -	if (enable)
> -		lpcr |= SNVS_LPCR_SRTC_ENV;
> -	else
> -		lpcr &= ~SNVS_LPCR_SRTC_ENV;
> -	writel(lpcr, data->ioaddr + SNVS_LPCR);
> -
> -	spin_unlock_irqrestore(&data->lock, flags);
> +	regmap_update_bits(data->snvs, SNVS_LPCR, SNVS_LPCR_SRTC_ENV,
> +			   enable ? SNVS_LPCR_SRTC_ENV : 0);
>  
>  	while (--timeout) {
> -		lpcr = readl(data->ioaddr + SNVS_LPCR);
> +		regmap_read(data->snvs, SNVS_LPCR, &lpcr);
>  
>  		if (enable) {
>  			if (lpcr & SNVS_LPCR_SRTC_ENV)
> @@ -121,7 +116,7 @@ static int snvs_rtc_enable(struct snvs_rtc_data *data, bool enable)
>  static int snvs_rtc_read_time(struct device *dev, struct rtc_time *tm)
>  {
>  	struct snvs_rtc_data *data = dev_get_drvdata(dev);
> -	unsigned long time = rtc_read_lp_counter(data->ioaddr);
> +	unsigned long time = rtc_read_lp_counter(data->snvs);
>  
>  	rtc_time_to_tm(time, tm);
>  
> @@ -139,8 +134,8 @@ static int snvs_rtc_set_time(struct device *dev, struct rtc_time *tm)
>  	snvs_rtc_enable(data, false);
>  
>  	/* Write 32-bit time to 47-bit timer, leaving 15 LSBs blank */
> -	writel(time << CNTR_TO_SECS_SH, data->ioaddr + SNVS_LPSRTCLR);
> -	writel(time >> (32 - CNTR_TO_SECS_SH), data->ioaddr + SNVS_LPSRTCMR);
> +	regmap_write(data->snvs, SNVS_LPSRTCLR, time << CNTR_TO_SECS_SH);
> +	regmap_write(data->snvs, SNVS_LPSRTCMR, time >> (32 - CNTR_TO_SECS_SH));
>  
>  	/* Enable RTC again */
>  	snvs_rtc_enable(data, true);
> @@ -153,10 +148,10 @@ static int snvs_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
>  	struct snvs_rtc_data *data = dev_get_drvdata(dev);
>  	u32 lptar, lpsr;
>  
> -	lptar = readl(data->ioaddr + SNVS_LPTAR);
> +	regmap_read(data->snvs, SNVS_LPTAR, &lptar);
>  	rtc_time_to_tm(lptar, &alrm->time);
>  
> -	lpsr = readl(data->ioaddr + SNVS_LPSR);
> +	regmap_read(data->snvs, SNVS_LPSR, &lpsr);
>  	alrm->pending = (lpsr & SNVS_LPSR_LPTA) ? 1 : 0;
>  
>  	return 0;
> @@ -165,21 +160,11 @@ static int snvs_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
>  static int snvs_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
>  {
>  	struct snvs_rtc_data *data = dev_get_drvdata(dev);
> -	u32 lpcr;
> -	unsigned long flags;
>  
> -	spin_lock_irqsave(&data->lock, flags);
> +	regmap_update_bits(data->snvs, SNVS_LPCR, (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN),
> +			   enable ? (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN) : 0);
>  
> -	lpcr = readl(data->ioaddr + SNVS_LPCR);
> -	if (enable)
> -		lpcr |= (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN);
> -	else
> -		lpcr &= ~(SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN);
> -	writel(lpcr, data->ioaddr + SNVS_LPCR);
> -
> -	spin_unlock_irqrestore(&data->lock, flags);
> -
> -	rtc_write_sync_lp(data->ioaddr);
> +	rtc_write_sync_lp(data->snvs);
>  
>  	return 0;
>  }
> @@ -189,24 +174,14 @@ static int snvs_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
>  	struct snvs_rtc_data *data = dev_get_drvdata(dev);
>  	struct rtc_time *alrm_tm = &alrm->time;
>  	unsigned long time;
> -	unsigned long flags;
> -	u32 lpcr;
>  
>  	rtc_tm_to_time(alrm_tm, &time);
>  
> -	spin_lock_irqsave(&data->lock, flags);
> -
> -	/* Have to clear LPTA_EN before programming new alarm time in LPTAR */
> -	lpcr = readl(data->ioaddr + SNVS_LPCR);
> -	lpcr &= ~SNVS_LPCR_LPTA_EN;
> -	writel(lpcr, data->ioaddr + SNVS_LPCR);
> -
> -	spin_unlock_irqrestore(&data->lock, flags);
> -
> -	writel(time, data->ioaddr + SNVS_LPTAR);
> +	regmap_update_bits(data->snvs, SNVS_LPCR, SNVS_LPCR_LPTA_EN, 0);
> +	regmap_write(data->snvs, SNVS_LPTAR, time);
>  
>  	/* Clear alarm interrupt status bit */
> -	writel(SNVS_LPSR_LPTA, data->ioaddr + SNVS_LPSR);
> +	regmap_write(data->snvs, SNVS_LPSR, SNVS_LPSR_LPTA);
>  
>  	return snvs_rtc_alarm_irq_enable(dev, alrm->enabled);
>  }
> @@ -226,7 +201,7 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
>  	u32 lpsr;
>  	u32 events = 0;
>  
> -	lpsr = readl(data->ioaddr + SNVS_LPSR);
> +	regmap_read(data->snvs, SNVS_LPSR, &lpsr);
>  
>  	if (lpsr & SNVS_LPSR_LPTA) {
>  		events |= (RTC_AF | RTC_IRQF);
> @@ -238,7 +213,7 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
>  	}
>  
>  	/* clear interrupt status */
> -	writel(lpsr, data->ioaddr + SNVS_LPSR);
> +	regmap_write(data->snvs, SNVS_LPSR, lpsr);
>  
>  	return events ? IRQ_HANDLED : IRQ_NONE;
>  }
> @@ -246,17 +221,24 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
>  static int snvs_rtc_probe(struct platform_device *pdev)
>  {
>  	struct snvs_rtc_data *data;
> -	struct resource *res;
>  	int ret;
> +	struct device_node *snvs_np;
>  
>  	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
>  	if (!data)
>  		return -ENOMEM;
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	data->ioaddr = devm_ioremap_resource(&pdev->dev, res);
> -	if (IS_ERR(data->ioaddr))
> -		return PTR_ERR(data->ioaddr);
> +	snvs_np = of_get_parent(pdev->dev.of_node);
> +	if (!snvs_np)
> +		return -ENODEV;
> +
> +	data->snvs = syscon_node_to_regmap(snvs_np);
> +	of_node_put(snvs_np);
> +
> +	if (!data->snvs) {
> +		pr_err("Can't snvs syscon\n");
> +		return -ENODEV;
> +	}
>  
>  	data->irq = platform_get_irq(pdev, 0);
>  	if (data->irq < 0)
> @@ -276,13 +258,11 @@ static int snvs_rtc_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, data);
>  
> -	spin_lock_init(&data->lock);
> -
>  	/* Initialize glitch detect */
> -	writel(SNVS_LPPGDR_INIT, data->ioaddr + SNVS_LPPGDR);
> +	regmap_write(data->snvs, SNVS_LPPGDR, SNVS_LPPGDR_INIT);
>  
>  	/* Clear interrupt status */
> -	writel(0xffffffff, data->ioaddr + SNVS_LPSR);
> +	regmap_write(data->snvs, SNVS_LPSR, 0xffffffff);
>  
>  	/* Enable RTC */
>  	snvs_rtc_enable(data, true);
> -- 
> 1.9.1
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [PATCH v2 2/7] rtc: arm: imx: snvs: change use syscon to access register
@ 2015-05-19 20:46     ` Alexandre Belloni
  0 siblings, 0 replies; 63+ messages in thread
From: Alexandre Belloni @ 2015-05-19 20:46 UTC (permalink / raw)
  To: linux-arm-kernel

On 20/05/2015 at 01:04:37 +0800, Frank.Li at freescale.com wrote :
> From: Frank Li <Frank.Li@freescale.com>
> 
> snvs included rtc, on/off key, power-off module
> change to syscon to access register
> 
> Signed-off-by: Frank Li <Frank.Li@freescale.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
>  drivers/rtc/rtc-snvs.c | 128 +++++++++++++++++++++----------------------------
>  1 file changed, 54 insertions(+), 74 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c
> index 0479e80..6eaebf1 100644
> --- a/drivers/rtc/rtc-snvs.c
> +++ b/drivers/rtc/rtc-snvs.c
> @@ -18,14 +18,15 @@
>  #include <linux/platform_device.h>
>  #include <linux/rtc.h>
>  #include <linux/clk.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/regmap.h>
>  
> -/* These register offsets are relative to LP (Low Power) range */
> -#define SNVS_LPCR		0x04
> -#define SNVS_LPSR		0x18
> -#define SNVS_LPSRTCMR		0x1c
> -#define SNVS_LPSRTCLR		0x20
> -#define SNVS_LPTAR		0x24
> -#define SNVS_LPPGDR		0x30
> +#define SNVS_LPCR		0x38
> +#define SNVS_LPSR		0x4c
> +#define SNVS_LPSRTCMR		0x50
> +#define SNVS_LPSRTCLR		0x54
> +#define SNVS_LPTAR		0x58
> +#define SNVS_LPPGDR		0x64
>  
>  #define SNVS_LPCR_SRTC_ENV	(1 << 0)
>  #define SNVS_LPCR_LPTA_EN	(1 << 1)
> @@ -37,31 +38,34 @@
>  
>  struct snvs_rtc_data {
>  	struct rtc_device *rtc;
> -	void __iomem *ioaddr;
> +	struct regmap *snvs;
>  	int irq;
> -	spinlock_t lock;
>  	struct clk *clk;
>  };
>  
> -static u32 rtc_read_lp_counter(void __iomem *ioaddr)
> +static u32 rtc_read_lp_counter(struct regmap *snvs)
>  {
>  	u64 read1, read2;
> -
> +	u32 val;
>  	do {
> -		read1 = readl(ioaddr + SNVS_LPSRTCMR);
> +		regmap_read(snvs, SNVS_LPSRTCMR, &val);
> +		read1 = val;
>  		read1 <<= 32;
> -		read1 |= readl(ioaddr + SNVS_LPSRTCLR);
> +		regmap_read(snvs, SNVS_LPSRTCLR, &val);
> +		read1 |= val;
>  
> -		read2 = readl(ioaddr + SNVS_LPSRTCMR);
> +		regmap_read(snvs, SNVS_LPSRTCMR, &val);
> +		read2 = val;
>  		read2 <<= 32;
> -		read2 |= readl(ioaddr + SNVS_LPSRTCLR);
> +		regmap_read(snvs, SNVS_LPSRTCLR, &val);
> +		read2 |= val;
>  	} while (read1 != read2);
>  
>  	/* Convert 47-bit counter to 32-bit raw second count */
>  	return (u32) (read1 >> CNTR_TO_SECS_SH);
>  }
>  
> -static void rtc_write_sync_lp(void __iomem *ioaddr)
> +static void rtc_write_sync_lp(struct regmap *snvs)
>  {
>  	u32 count1, count2, count3;
>  	int i;
> @@ -69,15 +73,15 @@ static void rtc_write_sync_lp(void __iomem *ioaddr)
>  	/* Wait for 3 CKIL cycles */
>  	for (i = 0; i < 3; i++) {
>  		do {
> -			count1 = readl(ioaddr + SNVS_LPSRTCLR);
> -			count2 = readl(ioaddr + SNVS_LPSRTCLR);
> +			regmap_read(snvs, SNVS_LPSRTCLR, &count1);
> +			regmap_read(snvs, SNVS_LPSRTCLR, &count2);
>  		} while (count1 != count2);
>  
>  		/* Now wait until counter value changes */
>  		do {
>  			do {
> -				count2 = readl(ioaddr + SNVS_LPSRTCLR);
> -				count3 = readl(ioaddr + SNVS_LPSRTCLR);
> +				regmap_read(snvs, SNVS_LPSRTCLR, &count2);
> +				regmap_read(snvs, SNVS_LPSRTCLR, &count3);
>  			} while (count2 != count3);
>  		} while (count3 == count1);
>  	}
> @@ -85,23 +89,14 @@ static void rtc_write_sync_lp(void __iomem *ioaddr)
>  
>  static int snvs_rtc_enable(struct snvs_rtc_data *data, bool enable)
>  {
> -	unsigned long flags;
>  	int timeout = 1000;
>  	u32 lpcr;
>  
> -	spin_lock_irqsave(&data->lock, flags);
> -
> -	lpcr = readl(data->ioaddr + SNVS_LPCR);
> -	if (enable)
> -		lpcr |= SNVS_LPCR_SRTC_ENV;
> -	else
> -		lpcr &= ~SNVS_LPCR_SRTC_ENV;
> -	writel(lpcr, data->ioaddr + SNVS_LPCR);
> -
> -	spin_unlock_irqrestore(&data->lock, flags);
> +	regmap_update_bits(data->snvs, SNVS_LPCR, SNVS_LPCR_SRTC_ENV,
> +			   enable ? SNVS_LPCR_SRTC_ENV : 0);
>  
>  	while (--timeout) {
> -		lpcr = readl(data->ioaddr + SNVS_LPCR);
> +		regmap_read(data->snvs, SNVS_LPCR, &lpcr);
>  
>  		if (enable) {
>  			if (lpcr & SNVS_LPCR_SRTC_ENV)
> @@ -121,7 +116,7 @@ static int snvs_rtc_enable(struct snvs_rtc_data *data, bool enable)
>  static int snvs_rtc_read_time(struct device *dev, struct rtc_time *tm)
>  {
>  	struct snvs_rtc_data *data = dev_get_drvdata(dev);
> -	unsigned long time = rtc_read_lp_counter(data->ioaddr);
> +	unsigned long time = rtc_read_lp_counter(data->snvs);
>  
>  	rtc_time_to_tm(time, tm);
>  
> @@ -139,8 +134,8 @@ static int snvs_rtc_set_time(struct device *dev, struct rtc_time *tm)
>  	snvs_rtc_enable(data, false);
>  
>  	/* Write 32-bit time to 47-bit timer, leaving 15 LSBs blank */
> -	writel(time << CNTR_TO_SECS_SH, data->ioaddr + SNVS_LPSRTCLR);
> -	writel(time >> (32 - CNTR_TO_SECS_SH), data->ioaddr + SNVS_LPSRTCMR);
> +	regmap_write(data->snvs, SNVS_LPSRTCLR, time << CNTR_TO_SECS_SH);
> +	regmap_write(data->snvs, SNVS_LPSRTCMR, time >> (32 - CNTR_TO_SECS_SH));
>  
>  	/* Enable RTC again */
>  	snvs_rtc_enable(data, true);
> @@ -153,10 +148,10 @@ static int snvs_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
>  	struct snvs_rtc_data *data = dev_get_drvdata(dev);
>  	u32 lptar, lpsr;
>  
> -	lptar = readl(data->ioaddr + SNVS_LPTAR);
> +	regmap_read(data->snvs, SNVS_LPTAR, &lptar);
>  	rtc_time_to_tm(lptar, &alrm->time);
>  
> -	lpsr = readl(data->ioaddr + SNVS_LPSR);
> +	regmap_read(data->snvs, SNVS_LPSR, &lpsr);
>  	alrm->pending = (lpsr & SNVS_LPSR_LPTA) ? 1 : 0;
>  
>  	return 0;
> @@ -165,21 +160,11 @@ static int snvs_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
>  static int snvs_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
>  {
>  	struct snvs_rtc_data *data = dev_get_drvdata(dev);
> -	u32 lpcr;
> -	unsigned long flags;
>  
> -	spin_lock_irqsave(&data->lock, flags);
> +	regmap_update_bits(data->snvs, SNVS_LPCR, (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN),
> +			   enable ? (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN) : 0);
>  
> -	lpcr = readl(data->ioaddr + SNVS_LPCR);
> -	if (enable)
> -		lpcr |= (SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN);
> -	else
> -		lpcr &= ~(SNVS_LPCR_LPTA_EN | SNVS_LPCR_LPWUI_EN);
> -	writel(lpcr, data->ioaddr + SNVS_LPCR);
> -
> -	spin_unlock_irqrestore(&data->lock, flags);
> -
> -	rtc_write_sync_lp(data->ioaddr);
> +	rtc_write_sync_lp(data->snvs);
>  
>  	return 0;
>  }
> @@ -189,24 +174,14 @@ static int snvs_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
>  	struct snvs_rtc_data *data = dev_get_drvdata(dev);
>  	struct rtc_time *alrm_tm = &alrm->time;
>  	unsigned long time;
> -	unsigned long flags;
> -	u32 lpcr;
>  
>  	rtc_tm_to_time(alrm_tm, &time);
>  
> -	spin_lock_irqsave(&data->lock, flags);
> -
> -	/* Have to clear LPTA_EN before programming new alarm time in LPTAR */
> -	lpcr = readl(data->ioaddr + SNVS_LPCR);
> -	lpcr &= ~SNVS_LPCR_LPTA_EN;
> -	writel(lpcr, data->ioaddr + SNVS_LPCR);
> -
> -	spin_unlock_irqrestore(&data->lock, flags);
> -
> -	writel(time, data->ioaddr + SNVS_LPTAR);
> +	regmap_update_bits(data->snvs, SNVS_LPCR, SNVS_LPCR_LPTA_EN, 0);
> +	regmap_write(data->snvs, SNVS_LPTAR, time);
>  
>  	/* Clear alarm interrupt status bit */
> -	writel(SNVS_LPSR_LPTA, data->ioaddr + SNVS_LPSR);
> +	regmap_write(data->snvs, SNVS_LPSR, SNVS_LPSR_LPTA);
>  
>  	return snvs_rtc_alarm_irq_enable(dev, alrm->enabled);
>  }
> @@ -226,7 +201,7 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
>  	u32 lpsr;
>  	u32 events = 0;
>  
> -	lpsr = readl(data->ioaddr + SNVS_LPSR);
> +	regmap_read(data->snvs, SNVS_LPSR, &lpsr);
>  
>  	if (lpsr & SNVS_LPSR_LPTA) {
>  		events |= (RTC_AF | RTC_IRQF);
> @@ -238,7 +213,7 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
>  	}
>  
>  	/* clear interrupt status */
> -	writel(lpsr, data->ioaddr + SNVS_LPSR);
> +	regmap_write(data->snvs, SNVS_LPSR, lpsr);
>  
>  	return events ? IRQ_HANDLED : IRQ_NONE;
>  }
> @@ -246,17 +221,24 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
>  static int snvs_rtc_probe(struct platform_device *pdev)
>  {
>  	struct snvs_rtc_data *data;
> -	struct resource *res;
>  	int ret;
> +	struct device_node *snvs_np;
>  
>  	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
>  	if (!data)
>  		return -ENOMEM;
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	data->ioaddr = devm_ioremap_resource(&pdev->dev, res);
> -	if (IS_ERR(data->ioaddr))
> -		return PTR_ERR(data->ioaddr);
> +	snvs_np = of_get_parent(pdev->dev.of_node);
> +	if (!snvs_np)
> +		return -ENODEV;
> +
> +	data->snvs = syscon_node_to_regmap(snvs_np);
> +	of_node_put(snvs_np);
> +
> +	if (!data->snvs) {
> +		pr_err("Can't snvs syscon\n");
> +		return -ENODEV;
> +	}
>  
>  	data->irq = platform_get_irq(pdev, 0);
>  	if (data->irq < 0)
> @@ -276,13 +258,11 @@ static int snvs_rtc_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, data);
>  
> -	spin_lock_init(&data->lock);
> -
>  	/* Initialize glitch detect */
> -	writel(SNVS_LPPGDR_INIT, data->ioaddr + SNVS_LPPGDR);
> +	regmap_write(data->snvs, SNVS_LPPGDR, SNVS_LPPGDR_INIT);
>  
>  	/* Clear interrupt status */
> -	writel(0xffffffff, data->ioaddr + SNVS_LPSR);
> +	regmap_write(data->snvs, SNVS_LPSR, 0xffffffff);
>  
>  	/* Enable RTC */
>  	snvs_rtc_enable(data, true);
> -- 
> 1.9.1
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [rtc-linux] Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
  2015-05-19 17:04 ` Frank.Li
  (?)
@ 2015-05-20  1:58   ` Shawn Guo
  -1 siblings, 0 replies; 63+ messages in thread
From: Shawn Guo @ 2015-05-20  1:58 UTC (permalink / raw)
  To: Frank.Li
  Cc: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni, devicetree, rtc-linux, linux-pm, linux-input,
	linux-arm-kernel

On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
> From: Frank Li <Frank.Li@freescale.com>
> 
> Change from v1 to v2
>  - Change simple-bus to simple-mfd
>  - RTC remove lock.
>  - RTC remove comments "These register offsets are relative to LP (Low Power) range"
>  - power off, remove extra space
> 
> SNVS is MPF module.
> include rtc, power off, ON/OFF power key
> 
>   arm: imx: power-off: change to syscon to access register
>   rtc: arm: imx: snvs: change use syscon to access register
> Above two patch change existed power-off and rtc use syscon
> 
>   Document: dt: fsl: snvs: change support syscon
>   arm: dts: imx: update snvs to use syscon access register
> Update dt file and document
> 
>   input: keyboard: imx: add snvs power key driver
>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>   arm: dts: imx6sx: enable snvs power key
> Added on/off key driver
> 
> Frank Li (6):
>   arm: imx: power-off: change to syscon to access register
>   rtc: arm: imx: snvs: change use syscon to access register
>   Document: dt: fsl: snvs: change support syscon
>   arm: dts: imx: update snvs to use syscon access register
>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>   arm: dts: imx6sx: enable snvs power key

So, the series will break existing DTBs for RTC and poweroff, right?
If this is unavoidable, should we at least have some warning messages
telling users about his breakage?

Shawn

> 
> Robin Gong (1):
>   input: keyboard: imx: add snvs power key driver
> 
>  .../devicetree/bindings/crypto/fsl-sec4.txt        |  93 +++++++--
>  .../devicetree/bindings/input/snvs-pwrkey.txt      |   1 +
>  .../bindings/power_supply/imx-snvs-poweroff.txt    |  24 +--
>  arch/arm/boot/dts/imx6qdl.dtsi                     |  12 +-
>  arch/arm/boot/dts/imx6sl.dtsi                      |  12 +-
>  arch/arm/boot/dts/imx6sx.dtsi                      |  19 +-
>  arch/arm/boot/dts/vfxxx.dtsi                       |   9 +-
>  drivers/input/keyboard/Kconfig                     |  11 +
>  drivers/input/keyboard/Makefile                    |   1 +
>  drivers/input/keyboard/snvs_pwrkey.c               | 232 +++++++++++++++++++++
>  drivers/power/reset/imx-snvs-poweroff.c            |  21 +-
>  drivers/rtc/rtc-snvs.c                             | 128 +++++-------
>  12 files changed, 417 insertions(+), 146 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/input/snvs-pwrkey.txt
>  create mode 100644 drivers/input/keyboard/snvs_pwrkey.c
> 
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20  1:58   ` Shawn Guo
  0 siblings, 0 replies; 63+ messages in thread
From: Shawn Guo @ 2015-05-20  1:58 UTC (permalink / raw)
  To: Frank.Li
  Cc: lznuaa, shawn.guo, dmitry.torokhov, robh+dt, a.zummo, p.zabel,
	alexandre.belloni, devicetree, rtc-linux, linux-pm, linux-input,
	linux-arm-kernel

On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
> From: Frank Li <Frank.Li@freescale.com>
> 
> Change from v1 to v2
>  - Change simple-bus to simple-mfd
>  - RTC remove lock.
>  - RTC remove comments "These register offsets are relative to LP (Low Power) range"
>  - power off, remove extra space
> 
> SNVS is MPF module.
> include rtc, power off, ON/OFF power key
> 
>   arm: imx: power-off: change to syscon to access register
>   rtc: arm: imx: snvs: change use syscon to access register
> Above two patch change existed power-off and rtc use syscon
> 
>   Document: dt: fsl: snvs: change support syscon
>   arm: dts: imx: update snvs to use syscon access register
> Update dt file and document
> 
>   input: keyboard: imx: add snvs power key driver
>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>   arm: dts: imx6sx: enable snvs power key
> Added on/off key driver
> 
> Frank Li (6):
>   arm: imx: power-off: change to syscon to access register
>   rtc: arm: imx: snvs: change use syscon to access register
>   Document: dt: fsl: snvs: change support syscon
>   arm: dts: imx: update snvs to use syscon access register
>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>   arm: dts: imx6sx: enable snvs power key

So, the series will break existing DTBs for RTC and poweroff, right?
If this is unavoidable, should we at least have some warning messages
telling users about his breakage?

Shawn

> 
> Robin Gong (1):
>   input: keyboard: imx: add snvs power key driver
> 
>  .../devicetree/bindings/crypto/fsl-sec4.txt        |  93 +++++++--
>  .../devicetree/bindings/input/snvs-pwrkey.txt      |   1 +
>  .../bindings/power_supply/imx-snvs-poweroff.txt    |  24 +--
>  arch/arm/boot/dts/imx6qdl.dtsi                     |  12 +-
>  arch/arm/boot/dts/imx6sl.dtsi                      |  12 +-
>  arch/arm/boot/dts/imx6sx.dtsi                      |  19 +-
>  arch/arm/boot/dts/vfxxx.dtsi                       |   9 +-
>  drivers/input/keyboard/Kconfig                     |  11 +
>  drivers/input/keyboard/Makefile                    |   1 +
>  drivers/input/keyboard/snvs_pwrkey.c               | 232 +++++++++++++++++++++
>  drivers/power/reset/imx-snvs-poweroff.c            |  21 +-
>  drivers/rtc/rtc-snvs.c                             | 128 +++++-------
>  12 files changed, 417 insertions(+), 146 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/input/snvs-pwrkey.txt
>  create mode 100644 drivers/input/keyboard/snvs_pwrkey.c
> 
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20  1:58   ` Shawn Guo
  0 siblings, 0 replies; 63+ messages in thread
From: Shawn Guo @ 2015-05-20  1:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li at freescale.com wrote:
> From: Frank Li <Frank.Li@freescale.com>
> 
> Change from v1 to v2
>  - Change simple-bus to simple-mfd
>  - RTC remove lock.
>  - RTC remove comments "These register offsets are relative to LP (Low Power) range"
>  - power off, remove extra space
> 
> SNVS is MPF module.
> include rtc, power off, ON/OFF power key
> 
>   arm: imx: power-off: change to syscon to access register
>   rtc: arm: imx: snvs: change use syscon to access register
> Above two patch change existed power-off and rtc use syscon
> 
>   Document: dt: fsl: snvs: change support syscon
>   arm: dts: imx: update snvs to use syscon access register
> Update dt file and document
> 
>   input: keyboard: imx: add snvs power key driver
>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>   arm: dts: imx6sx: enable snvs power key
> Added on/off key driver
> 
> Frank Li (6):
>   arm: imx: power-off: change to syscon to access register
>   rtc: arm: imx: snvs: change use syscon to access register
>   Document: dt: fsl: snvs: change support syscon
>   arm: dts: imx: update snvs to use syscon access register
>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>   arm: dts: imx6sx: enable snvs power key

So, the series will break existing DTBs for RTC and poweroff, right?
If this is unavoidable, should we at least have some warning messages
telling users about his breakage?

Shawn

> 
> Robin Gong (1):
>   input: keyboard: imx: add snvs power key driver
> 
>  .../devicetree/bindings/crypto/fsl-sec4.txt        |  93 +++++++--
>  .../devicetree/bindings/input/snvs-pwrkey.txt      |   1 +
>  .../bindings/power_supply/imx-snvs-poweroff.txt    |  24 +--
>  arch/arm/boot/dts/imx6qdl.dtsi                     |  12 +-
>  arch/arm/boot/dts/imx6sl.dtsi                      |  12 +-
>  arch/arm/boot/dts/imx6sx.dtsi                      |  19 +-
>  arch/arm/boot/dts/vfxxx.dtsi                       |   9 +-
>  drivers/input/keyboard/Kconfig                     |  11 +
>  drivers/input/keyboard/Makefile                    |   1 +
>  drivers/input/keyboard/snvs_pwrkey.c               | 232 +++++++++++++++++++++
>  drivers/power/reset/imx-snvs-poweroff.c            |  21 +-
>  drivers/rtc/rtc-snvs.c                             | 128 +++++-------
>  12 files changed, 417 insertions(+), 146 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/input/snvs-pwrkey.txt
>  create mode 100644 drivers/input/keyboard/snvs_pwrkey.c
> 
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [rtc-linux] Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
  2015-05-20  1:58   ` Shawn Guo
  (?)
@ 2015-05-20  2:44     ` Zhi Li
  -1 siblings, 0 replies; 63+ messages in thread
From: Zhi Li @ 2015-05-20  2:44 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Frank.Li, Shawn Guo, Dmitry Torokhov, Rob Herring, a.zummo,
	p.zabel, alexandre.belloni, devicetree, rtc-linux, linux-pm,
	linux-input, linux-arm-kernel

On Tue, May 19, 2015 at 8:58 PM, Shawn Guo <shawnguo@kernel.org> wrote:
> On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
>> From: Frank Li <Frank.Li@freescale.com>
>>
>> Change from v1 to v2
>>  - Change simple-bus to simple-mfd
>>  - RTC remove lock.
>>  - RTC remove comments "These register offsets are relative to LP (Low Power) range"
>>  - power off, remove extra space
>>
>> SNVS is MPF module.
>> include rtc, power off, ON/OFF power key
>>
>>   arm: imx: power-off: change to syscon to access register
>>   rtc: arm: imx: snvs: change use syscon to access register
>> Above two patch change existed power-off and rtc use syscon
>>
>>   Document: dt: fsl: snvs: change support syscon
>>   arm: dts: imx: update snvs to use syscon access register
>> Update dt file and document
>>
>>   input: keyboard: imx: add snvs power key driver
>>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>>   arm: dts: imx6sx: enable snvs power key
>> Added on/off key driver
>>
>> Frank Li (6):
>>   arm: imx: power-off: change to syscon to access register
>>   rtc: arm: imx: snvs: change use syscon to access register
>>   Document: dt: fsl: snvs: change support syscon
>>   arm: dts: imx: update snvs to use syscon access register
>>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>>   arm: dts: imx6sx: enable snvs power key
>
> So, the series will break existing DTBs for RTC and poweroff, right?
> If this is unavoidable, should we at least have some warning messages
> telling users about his breakage?

How to do that?
Just added it commit message or need runtime warning?

>
> Shawn
>
>>
>> Robin Gong (1):
>>   input: keyboard: imx: add snvs power key driver
>>
>>  .../devicetree/bindings/crypto/fsl-sec4.txt        |  93 +++++++--
>>  .../devicetree/bindings/input/snvs-pwrkey.txt      |   1 +
>>  .../bindings/power_supply/imx-snvs-poweroff.txt    |  24 +--
>>  arch/arm/boot/dts/imx6qdl.dtsi                     |  12 +-
>>  arch/arm/boot/dts/imx6sl.dtsi                      |  12 +-
>>  arch/arm/boot/dts/imx6sx.dtsi                      |  19 +-
>>  arch/arm/boot/dts/vfxxx.dtsi                       |   9 +-
>>  drivers/input/keyboard/Kconfig                     |  11 +
>>  drivers/input/keyboard/Makefile                    |   1 +
>>  drivers/input/keyboard/snvs_pwrkey.c               | 232 +++++++++++++++++++++
>>  drivers/power/reset/imx-snvs-poweroff.c            |  21 +-
>>  drivers/rtc/rtc-snvs.c                             | 128 +++++-------
>>  12 files changed, 417 insertions(+), 146 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/input/snvs-pwrkey.txt
>>  create mode 100644 drivers/input/keyboard/snvs_pwrkey.c
>>
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20  2:44     ` Zhi Li
  0 siblings, 0 replies; 63+ messages in thread
From: Zhi Li @ 2015-05-20  2:44 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Frank.Li, Shawn Guo, Dmitry Torokhov, Rob Herring, a.zummo,
	p.zabel, alexandre.belloni, devicetree, rtc-linux, linux-pm,
	linux-input, linux-arm-kernel

On Tue, May 19, 2015 at 8:58 PM, Shawn Guo <shawnguo@kernel.org> wrote:
> On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
>> From: Frank Li <Frank.Li@freescale.com>
>>
>> Change from v1 to v2
>>  - Change simple-bus to simple-mfd
>>  - RTC remove lock.
>>  - RTC remove comments "These register offsets are relative to LP (Low Power) range"
>>  - power off, remove extra space
>>
>> SNVS is MPF module.
>> include rtc, power off, ON/OFF power key
>>
>>   arm: imx: power-off: change to syscon to access register
>>   rtc: arm: imx: snvs: change use syscon to access register
>> Above two patch change existed power-off and rtc use syscon
>>
>>   Document: dt: fsl: snvs: change support syscon
>>   arm: dts: imx: update snvs to use syscon access register
>> Update dt file and document
>>
>>   input: keyboard: imx: add snvs power key driver
>>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>>   arm: dts: imx6sx: enable snvs power key
>> Added on/off key driver
>>
>> Frank Li (6):
>>   arm: imx: power-off: change to syscon to access register
>>   rtc: arm: imx: snvs: change use syscon to access register
>>   Document: dt: fsl: snvs: change support syscon
>>   arm: dts: imx: update snvs to use syscon access register
>>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>>   arm: dts: imx6sx: enable snvs power key
>
> So, the series will break existing DTBs for RTC and poweroff, right?
> If this is unavoidable, should we at least have some warning messages
> telling users about his breakage?

How to do that?
Just added it commit message or need runtime warning?

>
> Shawn
>
>>
>> Robin Gong (1):
>>   input: keyboard: imx: add snvs power key driver
>>
>>  .../devicetree/bindings/crypto/fsl-sec4.txt        |  93 +++++++--
>>  .../devicetree/bindings/input/snvs-pwrkey.txt      |   1 +
>>  .../bindings/power_supply/imx-snvs-poweroff.txt    |  24 +--
>>  arch/arm/boot/dts/imx6qdl.dtsi                     |  12 +-
>>  arch/arm/boot/dts/imx6sl.dtsi                      |  12 +-
>>  arch/arm/boot/dts/imx6sx.dtsi                      |  19 +-
>>  arch/arm/boot/dts/vfxxx.dtsi                       |   9 +-
>>  drivers/input/keyboard/Kconfig                     |  11 +
>>  drivers/input/keyboard/Makefile                    |   1 +
>>  drivers/input/keyboard/snvs_pwrkey.c               | 232 +++++++++++++++++++++
>>  drivers/power/reset/imx-snvs-poweroff.c            |  21 +-
>>  drivers/rtc/rtc-snvs.c                             | 128 +++++-------
>>  12 files changed, 417 insertions(+), 146 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/input/snvs-pwrkey.txt
>>  create mode 100644 drivers/input/keyboard/snvs_pwrkey.c
>>
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20  2:44     ` Zhi Li
  0 siblings, 0 replies; 63+ messages in thread
From: Zhi Li @ 2015-05-20  2:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 19, 2015 at 8:58 PM, Shawn Guo <shawnguo@kernel.org> wrote:
> On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li at freescale.com wrote:
>> From: Frank Li <Frank.Li@freescale.com>
>>
>> Change from v1 to v2
>>  - Change simple-bus to simple-mfd
>>  - RTC remove lock.
>>  - RTC remove comments "These register offsets are relative to LP (Low Power) range"
>>  - power off, remove extra space
>>
>> SNVS is MPF module.
>> include rtc, power off, ON/OFF power key
>>
>>   arm: imx: power-off: change to syscon to access register
>>   rtc: arm: imx: snvs: change use syscon to access register
>> Above two patch change existed power-off and rtc use syscon
>>
>>   Document: dt: fsl: snvs: change support syscon
>>   arm: dts: imx: update snvs to use syscon access register
>> Update dt file and document
>>
>>   input: keyboard: imx: add snvs power key driver
>>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>>   arm: dts: imx6sx: enable snvs power key
>> Added on/off key driver
>>
>> Frank Li (6):
>>   arm: imx: power-off: change to syscon to access register
>>   rtc: arm: imx: snvs: change use syscon to access register
>>   Document: dt: fsl: snvs: change support syscon
>>   arm: dts: imx: update snvs to use syscon access register
>>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>>   arm: dts: imx6sx: enable snvs power key
>
> So, the series will break existing DTBs for RTC and poweroff, right?
> If this is unavoidable, should we at least have some warning messages
> telling users about his breakage?

How to do that?
Just added it commit message or need runtime warning?

>
> Shawn
>
>>
>> Robin Gong (1):
>>   input: keyboard: imx: add snvs power key driver
>>
>>  .../devicetree/bindings/crypto/fsl-sec4.txt        |  93 +++++++--
>>  .../devicetree/bindings/input/snvs-pwrkey.txt      |   1 +
>>  .../bindings/power_supply/imx-snvs-poweroff.txt    |  24 +--
>>  arch/arm/boot/dts/imx6qdl.dtsi                     |  12 +-
>>  arch/arm/boot/dts/imx6sl.dtsi                      |  12 +-
>>  arch/arm/boot/dts/imx6sx.dtsi                      |  19 +-
>>  arch/arm/boot/dts/vfxxx.dtsi                       |   9 +-
>>  drivers/input/keyboard/Kconfig                     |  11 +
>>  drivers/input/keyboard/Makefile                    |   1 +
>>  drivers/input/keyboard/snvs_pwrkey.c               | 232 +++++++++++++++++++++
>>  drivers/power/reset/imx-snvs-poweroff.c            |  21 +-
>>  drivers/rtc/rtc-snvs.c                             | 128 +++++-------
>>  12 files changed, 417 insertions(+), 146 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/input/snvs-pwrkey.txt
>>  create mode 100644 drivers/input/keyboard/snvs_pwrkey.c
>>
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [rtc-linux] Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
  2015-05-20  2:44     ` Zhi Li
  (?)
@ 2015-05-20 14:22       ` Shawn Guo
  -1 siblings, 0 replies; 63+ messages in thread
From: Shawn Guo @ 2015-05-20 14:22 UTC (permalink / raw)
  To: Zhi Li
  Cc: Shawn Guo, Frank.Li, Dmitry Torokhov, Rob Herring, a.zummo,
	p.zabel, alexandre.belloni, devicetree, rtc-linux, linux-pm,
	linux-input, linux-arm-kernel

On Tue, May 19, 2015 at 09:44:46PM -0500, Zhi Li wrote:
> On Tue, May 19, 2015 at 8:58 PM, Shawn Guo <shawnguo@kernel.org> wrote:
> > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
> >> From: Frank Li <Frank.Li@freescale.com>
> >>
> >> Change from v1 to v2
> >>  - Change simple-bus to simple-mfd
> >>  - RTC remove lock.
> >>  - RTC remove comments "These register offsets are relative to LP (Low Power) range"
> >>  - power off, remove extra space
> >>
> >> SNVS is MPF module.
> >> include rtc, power off, ON/OFF power key
> >>
> >>   arm: imx: power-off: change to syscon to access register
> >>   rtc: arm: imx: snvs: change use syscon to access register
> >> Above two patch change existed power-off and rtc use syscon
> >>
> >>   Document: dt: fsl: snvs: change support syscon
> >>   arm: dts: imx: update snvs to use syscon access register
> >> Update dt file and document
> >>
> >>   input: keyboard: imx: add snvs power key driver
> >>   document: devicetree: input: imx: i.mx snvs power device tree bindings
> >>   arm: dts: imx6sx: enable snvs power key
> >> Added on/off key driver
> >>
> >> Frank Li (6):
> >>   arm: imx: power-off: change to syscon to access register
> >>   rtc: arm: imx: snvs: change use syscon to access register
> >>   Document: dt: fsl: snvs: change support syscon
> >>   arm: dts: imx: update snvs to use syscon access register
> >>   document: devicetree: input: imx: i.mx snvs power device tree bindings
> >>   arm: dts: imx6sx: enable snvs power key
> >
> > So, the series will break existing DTBs for RTC and poweroff, right?
> > If this is unavoidable, should we at least have some warning messages
> > telling users about his breakage?
> 
> How to do that?
> Just added it commit message or need runtime warning?

runtime, so that users can know why their installed DTBs break with the
new kernel.

Shawn

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 14:22       ` Shawn Guo
  0 siblings, 0 replies; 63+ messages in thread
From: Shawn Guo @ 2015-05-20 14:22 UTC (permalink / raw)
  To: Zhi Li
  Cc: Shawn Guo, Frank.Li, Dmitry Torokhov, Rob Herring, a.zummo,
	p.zabel, alexandre.belloni, devicetree, rtc-linux, linux-pm,
	linux-input, linux-arm-kernel

On Tue, May 19, 2015 at 09:44:46PM -0500, Zhi Li wrote:
> On Tue, May 19, 2015 at 8:58 PM, Shawn Guo <shawnguo@kernel.org> wrote:
> > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
> >> From: Frank Li <Frank.Li@freescale.com>
> >>
> >> Change from v1 to v2
> >>  - Change simple-bus to simple-mfd
> >>  - RTC remove lock.
> >>  - RTC remove comments "These register offsets are relative to LP (Low Power) range"
> >>  - power off, remove extra space
> >>
> >> SNVS is MPF module.
> >> include rtc, power off, ON/OFF power key
> >>
> >>   arm: imx: power-off: change to syscon to access register
> >>   rtc: arm: imx: snvs: change use syscon to access register
> >> Above two patch change existed power-off and rtc use syscon
> >>
> >>   Document: dt: fsl: snvs: change support syscon
> >>   arm: dts: imx: update snvs to use syscon access register
> >> Update dt file and document
> >>
> >>   input: keyboard: imx: add snvs power key driver
> >>   document: devicetree: input: imx: i.mx snvs power device tree bindings
> >>   arm: dts: imx6sx: enable snvs power key
> >> Added on/off key driver
> >>
> >> Frank Li (6):
> >>   arm: imx: power-off: change to syscon to access register
> >>   rtc: arm: imx: snvs: change use syscon to access register
> >>   Document: dt: fsl: snvs: change support syscon
> >>   arm: dts: imx: update snvs to use syscon access register
> >>   document: devicetree: input: imx: i.mx snvs power device tree bindings
> >>   arm: dts: imx6sx: enable snvs power key
> >
> > So, the series will break existing DTBs for RTC and poweroff, right?
> > If this is unavoidable, should we at least have some warning messages
> > telling users about his breakage?
> 
> How to do that?
> Just added it commit message or need runtime warning?

runtime, so that users can know why their installed DTBs break with the
new kernel.

Shawn

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

* [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 14:22       ` Shawn Guo
  0 siblings, 0 replies; 63+ messages in thread
From: Shawn Guo @ 2015-05-20 14:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 19, 2015 at 09:44:46PM -0500, Zhi Li wrote:
> On Tue, May 19, 2015 at 8:58 PM, Shawn Guo <shawnguo@kernel.org> wrote:
> > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li at freescale.com wrote:
> >> From: Frank Li <Frank.Li@freescale.com>
> >>
> >> Change from v1 to v2
> >>  - Change simple-bus to simple-mfd
> >>  - RTC remove lock.
> >>  - RTC remove comments "These register offsets are relative to LP (Low Power) range"
> >>  - power off, remove extra space
> >>
> >> SNVS is MPF module.
> >> include rtc, power off, ON/OFF power key
> >>
> >>   arm: imx: power-off: change to syscon to access register
> >>   rtc: arm: imx: snvs: change use syscon to access register
> >> Above two patch change existed power-off and rtc use syscon
> >>
> >>   Document: dt: fsl: snvs: change support syscon
> >>   arm: dts: imx: update snvs to use syscon access register
> >> Update dt file and document
> >>
> >>   input: keyboard: imx: add snvs power key driver
> >>   document: devicetree: input: imx: i.mx snvs power device tree bindings
> >>   arm: dts: imx6sx: enable snvs power key
> >> Added on/off key driver
> >>
> >> Frank Li (6):
> >>   arm: imx: power-off: change to syscon to access register
> >>   rtc: arm: imx: snvs: change use syscon to access register
> >>   Document: dt: fsl: snvs: change support syscon
> >>   arm: dts: imx: update snvs to use syscon access register
> >>   document: devicetree: input: imx: i.mx snvs power device tree bindings
> >>   arm: dts: imx6sx: enable snvs power key
> >
> > So, the series will break existing DTBs for RTC and poweroff, right?
> > If this is unavoidable, should we at least have some warning messages
> > telling users about his breakage?
> 
> How to do that?
> Just added it commit message or need runtime warning?

runtime, so that users can know why their installed DTBs break with the
new kernel.

Shawn

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

* [rtc-linux] Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
  2015-05-20 14:22       ` Shawn Guo
  (?)
@ 2015-05-20 14:30         ` Zhi Li
  -1 siblings, 0 replies; 63+ messages in thread
From: Zhi Li @ 2015-05-20 14:30 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Shawn Guo, Frank.Li, Dmitry Torokhov, Rob Herring, a.zummo,
	Philipp Zabel, alexandre.belloni, devicetree, rtc-linux,
	linux-pm, linux-input, linux-arm-kernel

On Wed, May 20, 2015 at 9:22 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> On Tue, May 19, 2015 at 09:44:46PM -0500, Zhi Li wrote:
>> On Tue, May 19, 2015 at 8:58 PM, Shawn Guo <shawnguo@kernel.org> wrote:
>> > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
>> >> From: Frank Li <Frank.Li@freescale.com>
>> >>
>> >> Change from v1 to v2
>> >>  - Change simple-bus to simple-mfd
>> >>  - RTC remove lock.
>> >>  - RTC remove comments "These register offsets are relative to LP (Low Power) range"
>> >>  - power off, remove extra space
>> >>
>> >> SNVS is MPF module.
>> >> include rtc, power off, ON/OFF power key
>> >>
>> >>   arm: imx: power-off: change to syscon to access register
>> >>   rtc: arm: imx: snvs: change use syscon to access register
>> >> Above two patch change existed power-off and rtc use syscon
>> >>
>> >>   Document: dt: fsl: snvs: change support syscon
>> >>   arm: dts: imx: update snvs to use syscon access register
>> >> Update dt file and document
>> >>
>> >>   input: keyboard: imx: add snvs power key driver
>> >>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>> >>   arm: dts: imx6sx: enable snvs power key
>> >> Added on/off key driver
>> >>
>> >> Frank Li (6):
>> >>   arm: imx: power-off: change to syscon to access register
>> >>   rtc: arm: imx: snvs: change use syscon to access register
>> >>   Document: dt: fsl: snvs: change support syscon
>> >>   arm: dts: imx: update snvs to use syscon access register
>> >>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>> >>   arm: dts: imx6sx: enable snvs power key
>> >
>> > So, the series will break existing DTBs for RTC and poweroff, right?
>> > If this is unavoidable, should we at least have some warning messages
>> > telling users about his breakage?
>>
>> How to do that?
>> Just added it commit message or need runtime warning?
>
> runtime, so that users can know why their installed DTBs break with the
> new kernel.

+       snvs_np = of_get_parent(pdev->dev.of_node);
+       if (!snvs_np)
+               return -ENODEV;
+
+       data->snvs = syscon_node_to_regmap(snvs_np);
+       of_node_put(snvs_np);
+
+       if (!data->snvs) {
+               pr_err("Can't snvs syscon\n");
+               return -ENODEV;
+       }

How about change error message to " Can't snvs syscon, probably use
old dts file"?

>
> Shawn

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 14:30         ` Zhi Li
  0 siblings, 0 replies; 63+ messages in thread
From: Zhi Li @ 2015-05-20 14:30 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Shawn Guo, Frank.Li, Dmitry Torokhov, Rob Herring, a.zummo,
	Philipp Zabel, alexandre.belloni, devicetree, rtc-linux,
	linux-pm, linux-input, linux-arm-kernel

On Wed, May 20, 2015 at 9:22 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> On Tue, May 19, 2015 at 09:44:46PM -0500, Zhi Li wrote:
>> On Tue, May 19, 2015 at 8:58 PM, Shawn Guo <shawnguo@kernel.org> wrote:
>> > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
>> >> From: Frank Li <Frank.Li@freescale.com>
>> >>
>> >> Change from v1 to v2
>> >>  - Change simple-bus to simple-mfd
>> >>  - RTC remove lock.
>> >>  - RTC remove comments "These register offsets are relative to LP (Low Power) range"
>> >>  - power off, remove extra space
>> >>
>> >> SNVS is MPF module.
>> >> include rtc, power off, ON/OFF power key
>> >>
>> >>   arm: imx: power-off: change to syscon to access register
>> >>   rtc: arm: imx: snvs: change use syscon to access register
>> >> Above two patch change existed power-off and rtc use syscon
>> >>
>> >>   Document: dt: fsl: snvs: change support syscon
>> >>   arm: dts: imx: update snvs to use syscon access register
>> >> Update dt file and document
>> >>
>> >>   input: keyboard: imx: add snvs power key driver
>> >>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>> >>   arm: dts: imx6sx: enable snvs power key
>> >> Added on/off key driver
>> >>
>> >> Frank Li (6):
>> >>   arm: imx: power-off: change to syscon to access register
>> >>   rtc: arm: imx: snvs: change use syscon to access register
>> >>   Document: dt: fsl: snvs: change support syscon
>> >>   arm: dts: imx: update snvs to use syscon access register
>> >>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>> >>   arm: dts: imx6sx: enable snvs power key
>> >
>> > So, the series will break existing DTBs for RTC and poweroff, right?
>> > If this is unavoidable, should we at least have some warning messages
>> > telling users about his breakage?
>>
>> How to do that?
>> Just added it commit message or need runtime warning?
>
> runtime, so that users can know why their installed DTBs break with the
> new kernel.

+       snvs_np = of_get_parent(pdev->dev.of_node);
+       if (!snvs_np)
+               return -ENODEV;
+
+       data->snvs = syscon_node_to_regmap(snvs_np);
+       of_node_put(snvs_np);
+
+       if (!data->snvs) {
+               pr_err("Can't snvs syscon\n");
+               return -ENODEV;
+       }

How about change error message to " Can't snvs syscon, probably use
old dts file"?

>
> Shawn

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

* [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 14:30         ` Zhi Li
  0 siblings, 0 replies; 63+ messages in thread
From: Zhi Li @ 2015-05-20 14:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 20, 2015 at 9:22 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> On Tue, May 19, 2015 at 09:44:46PM -0500, Zhi Li wrote:
>> On Tue, May 19, 2015 at 8:58 PM, Shawn Guo <shawnguo@kernel.org> wrote:
>> > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li at freescale.com wrote:
>> >> From: Frank Li <Frank.Li@freescale.com>
>> >>
>> >> Change from v1 to v2
>> >>  - Change simple-bus to simple-mfd
>> >>  - RTC remove lock.
>> >>  - RTC remove comments "These register offsets are relative to LP (Low Power) range"
>> >>  - power off, remove extra space
>> >>
>> >> SNVS is MPF module.
>> >> include rtc, power off, ON/OFF power key
>> >>
>> >>   arm: imx: power-off: change to syscon to access register
>> >>   rtc: arm: imx: snvs: change use syscon to access register
>> >> Above two patch change existed power-off and rtc use syscon
>> >>
>> >>   Document: dt: fsl: snvs: change support syscon
>> >>   arm: dts: imx: update snvs to use syscon access register
>> >> Update dt file and document
>> >>
>> >>   input: keyboard: imx: add snvs power key driver
>> >>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>> >>   arm: dts: imx6sx: enable snvs power key
>> >> Added on/off key driver
>> >>
>> >> Frank Li (6):
>> >>   arm: imx: power-off: change to syscon to access register
>> >>   rtc: arm: imx: snvs: change use syscon to access register
>> >>   Document: dt: fsl: snvs: change support syscon
>> >>   arm: dts: imx: update snvs to use syscon access register
>> >>   document: devicetree: input: imx: i.mx snvs power device tree bindings
>> >>   arm: dts: imx6sx: enable snvs power key
>> >
>> > So, the series will break existing DTBs for RTC and poweroff, right?
>> > If this is unavoidable, should we at least have some warning messages
>> > telling users about his breakage?
>>
>> How to do that?
>> Just added it commit message or need runtime warning?
>
> runtime, so that users can know why their installed DTBs break with the
> new kernel.

+       snvs_np = of_get_parent(pdev->dev.of_node);
+       if (!snvs_np)
+               return -ENODEV;
+
+       data->snvs = syscon_node_to_regmap(snvs_np);
+       of_node_put(snvs_np);
+
+       if (!data->snvs) {
+               pr_err("Can't snvs syscon\n");
+               return -ENODEV;
+       }

How about change error message to " Can't snvs syscon, probably use
old dts file"?

>
> Shawn

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

* [rtc-linux] Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 14:46           ` Joshua Clayton
  0 siblings, 0 replies; 63+ messages in thread
From: Joshua Clayton @ 2015-05-20 14:46 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Zhi Li, Shawn Guo, a.zummo, Frank.Li, rtc-linux, devicetree,
	linux-pm, Dmitry Torokhov, Rob Herring, alexandre.belloni,
	Philipp Zabel, linux-input, Shawn Guo

> 
> +       snvs_np = of_get_parent(pdev->dev.of_node);
> +       if (!snvs_np)
> +               return -ENODEV;
> +
> +       data->snvs = syscon_node_to_regmap(snvs_np);
> +       of_node_put(snvs_np);
> +
> +       if (!data->snvs) {
> +               pr_err("Can't snvs syscon\n");
> +               return -ENODEV;
> +       }
> 
> How about change error message to " Can't snvs syscon, probably use
> old dts file"?
How about simply: "Cannot find snvs syscon node in devicetree."


-- 
~Joshua Clayton

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 14:46           ` Joshua Clayton
  0 siblings, 0 replies; 63+ messages in thread
From: Joshua Clayton @ 2015-05-20 14:46 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Zhi Li, Shawn Guo, a.zummo-BfzFCNDTiLLj+vYz1yj4TQ,
	Frank.Li-KZfg59tc24xl57MIdRCFDg,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-pm-u79uwXL29TY76Z2rM5mHXA, Dmitry Torokhov, Rob Herring,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	Philipp Zabel, linux-input-u79uwXL29TY76Z2rM5mHXA, Shawn Guo

> 
> +       snvs_np = of_get_parent(pdev->dev.of_node);
> +       if (!snvs_np)
> +               return -ENODEV;
> +
> +       data->snvs = syscon_node_to_regmap(snvs_np);
> +       of_node_put(snvs_np);
> +
> +       if (!data->snvs) {
> +               pr_err("Can't snvs syscon\n");
> +               return -ENODEV;
> +       }
> 
> How about change error message to " Can't snvs syscon, probably use
> old dts file"?
How about simply: "Cannot find snvs syscon node in devicetree."


-- 
~Joshua Clayton
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 14:46           ` Joshua Clayton
  0 siblings, 0 replies; 63+ messages in thread
From: Joshua Clayton @ 2015-05-20 14:46 UTC (permalink / raw)
  To: linux-arm-kernel

> 
> +       snvs_np = of_get_parent(pdev->dev.of_node);
> +       if (!snvs_np)
> +               return -ENODEV;
> +
> +       data->snvs = syscon_node_to_regmap(snvs_np);
> +       of_node_put(snvs_np);
> +
> +       if (!data->snvs) {
> +               pr_err("Can't snvs syscon\n");
> +               return -ENODEV;
> +       }
> 
> How about change error message to " Can't snvs syscon, probably use
> old dts file"?
How about simply: "Cannot find snvs syscon node in devicetree."


-- 
~Joshua Clayton

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

* [rtc-linux] Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
  2015-05-20 14:46           ` Joshua Clayton
  (?)
@ 2015-05-20 15:03             ` Zhi Li
  -1 siblings, 0 replies; 63+ messages in thread
From: Zhi Li @ 2015-05-20 15:03 UTC (permalink / raw)
  To: Joshua Clayton
  Cc: linux-arm-kernel, Shawn Guo, Alessandro Zummo, Frank.Li,
	rtc-linux, devicetree, linux-pm, Dmitry Torokhov, Rob Herring,
	alexandre.belloni, Philipp Zabel, linux-input, Shawn Guo

On Wed, May 20, 2015 at 9:46 AM, Joshua Clayton
<stillcompiling@gmail.com> wrote:
>>
>> +       snvs_np = of_get_parent(pdev->dev.of_node);
>> +       if (!snvs_np)
>> +               return -ENODEV;
>> +
>> +       data->snvs = syscon_node_to_regmap(snvs_np);
>> +       of_node_put(snvs_np);
>> +
>> +       if (!data->snvs) {
>> +               pr_err("Can't snvs syscon\n");
>> +               return -ENODEV;
>> +       }
>>
>> How about change error message to " Can't snvs syscon, probably use
>> old dts file"?
> How about simply: "Cannot find snvs syscon node in devicetree."

Shawn:
          Are you okay for that?

best regards
Frank Li

>
>
> --
> ~Joshua Clayton

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 15:03             ` Zhi Li
  0 siblings, 0 replies; 63+ messages in thread
From: Zhi Li @ 2015-05-20 15:03 UTC (permalink / raw)
  To: Joshua Clayton
  Cc: linux-arm-kernel, Shawn Guo, Alessandro Zummo, Frank.Li,
	rtc-linux, devicetree, linux-pm, Dmitry Torokhov, Rob Herring,
	alexandre.belloni, Philipp Zabel, linux-input, Shawn Guo

On Wed, May 20, 2015 at 9:46 AM, Joshua Clayton
<stillcompiling@gmail.com> wrote:
>>
>> +       snvs_np = of_get_parent(pdev->dev.of_node);
>> +       if (!snvs_np)
>> +               return -ENODEV;
>> +
>> +       data->snvs = syscon_node_to_regmap(snvs_np);
>> +       of_node_put(snvs_np);
>> +
>> +       if (!data->snvs) {
>> +               pr_err("Can't snvs syscon\n");
>> +               return -ENODEV;
>> +       }
>>
>> How about change error message to " Can't snvs syscon, probably use
>> old dts file"?
> How about simply: "Cannot find snvs syscon node in devicetree."

Shawn:
          Are you okay for that?

best regards
Frank Li

>
>
> --
> ~Joshua Clayton

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

* [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 15:03             ` Zhi Li
  0 siblings, 0 replies; 63+ messages in thread
From: Zhi Li @ 2015-05-20 15:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 20, 2015 at 9:46 AM, Joshua Clayton
<stillcompiling@gmail.com> wrote:
>>
>> +       snvs_np = of_get_parent(pdev->dev.of_node);
>> +       if (!snvs_np)
>> +               return -ENODEV;
>> +
>> +       data->snvs = syscon_node_to_regmap(snvs_np);
>> +       of_node_put(snvs_np);
>> +
>> +       if (!data->snvs) {
>> +               pr_err("Can't snvs syscon\n");
>> +               return -ENODEV;
>> +       }
>>
>> How about change error message to " Can't snvs syscon, probably use
>> old dts file"?
> How about simply: "Cannot find snvs syscon node in devicetree."

Shawn:
          Are you okay for that?

best regards
Frank Li

>
>
> --
> ~Joshua Clayton

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

* [rtc-linux] Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
  2015-05-20  1:58   ` Shawn Guo
  (?)
@ 2015-05-20 18:25     ` Russell King - ARM Linux
  -1 siblings, 0 replies; 63+ messages in thread
From: Russell King - ARM Linux @ 2015-05-20 18:25 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Frank.Li, a.zummo, rtc-linux, devicetree, linux-pm,
	dmitry.torokhov, robh+dt, alexandre.belloni, p.zabel,
	linux-input, lznuaa, shawn.guo, linux-arm-kernel

On Wed, May 20, 2015 at 09:58:51AM +0800, Shawn Guo wrote:
> On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
> > Frank Li (6):
> >   arm: imx: power-off: change to syscon to access register
> >   rtc: arm: imx: snvs: change use syscon to access register
> >   Document: dt: fsl: snvs: change support syscon
> >   arm: dts: imx: update snvs to use syscon access register
> >   document: devicetree: input: imx: i.mx snvs power device tree bindings
> >   arm: dts: imx6sx: enable snvs power key
> 
> So, the series will break existing DTBs for RTC and poweroff, right?
> If this is unavoidable, should we at least have some warning messages
> telling users about his breakage?

What's the justification for breaking existing DTBs?  Really, this is
something we should strive to avoid, _and_ actually avoid by providing
backwards compatibility.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 18:25     ` Russell King - ARM Linux
  0 siblings, 0 replies; 63+ messages in thread
From: Russell King - ARM Linux @ 2015-05-20 18:25 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Frank.Li, a.zummo, rtc-linux, devicetree, linux-pm,
	dmitry.torokhov, robh+dt, alexandre.belloni, p.zabel,
	linux-input, lznuaa, shawn.guo, linux-arm-kernel

On Wed, May 20, 2015 at 09:58:51AM +0800, Shawn Guo wrote:
> On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
> > Frank Li (6):
> >   arm: imx: power-off: change to syscon to access register
> >   rtc: arm: imx: snvs: change use syscon to access register
> >   Document: dt: fsl: snvs: change support syscon
> >   arm: dts: imx: update snvs to use syscon access register
> >   document: devicetree: input: imx: i.mx snvs power device tree bindings
> >   arm: dts: imx6sx: enable snvs power key
> 
> So, the series will break existing DTBs for RTC and poweroff, right?
> If this is unavoidable, should we at least have some warning messages
> telling users about his breakage?

What's the justification for breaking existing DTBs?  Really, this is
something we should strive to avoid, _and_ actually avoid by providing
backwards compatibility.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

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

* [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 18:25     ` Russell King - ARM Linux
  0 siblings, 0 replies; 63+ messages in thread
From: Russell King - ARM Linux @ 2015-05-20 18:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 20, 2015 at 09:58:51AM +0800, Shawn Guo wrote:
> On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li at freescale.com wrote:
> > Frank Li (6):
> >   arm: imx: power-off: change to syscon to access register
> >   rtc: arm: imx: snvs: change use syscon to access register
> >   Document: dt: fsl: snvs: change support syscon
> >   arm: dts: imx: update snvs to use syscon access register
> >   document: devicetree: input: imx: i.mx snvs power device tree bindings
> >   arm: dts: imx6sx: enable snvs power key
> 
> So, the series will break existing DTBs for RTC and poweroff, right?
> If this is unavoidable, should we at least have some warning messages
> telling users about his breakage?

What's the justification for breaking existing DTBs?  Really, this is
something we should strive to avoid, _and_ actually avoid by providing
backwards compatibility.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

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

* [rtc-linux] Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 18:30       ` Russell King - ARM Linux
  0 siblings, 0 replies; 63+ messages in thread
From: Russell King - ARM Linux @ 2015-05-20 18:30 UTC (permalink / raw)
  To: Shawn Guo
  Cc: a.zummo, Frank.Li, rtc-linux, linux-pm, dmitry.torokhov,
	devicetree, robh+dt, alexandre.belloni, p.zabel, linux-input,
	lznuaa, shawn.guo, linux-arm-kernel

On Wed, May 20, 2015 at 07:25:41PM +0100, Russell King - ARM Linux wrote:
> On Wed, May 20, 2015 at 09:58:51AM +0800, Shawn Guo wrote:
> > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
> > > Frank Li (6):
> > >   arm: imx: power-off: change to syscon to access register
> > >   rtc: arm: imx: snvs: change use syscon to access register
> > >   Document: dt: fsl: snvs: change support syscon
> > >   arm: dts: imx: update snvs to use syscon access register
> > >   document: devicetree: input: imx: i.mx snvs power device tree bindings
> > >   arm: dts: imx6sx: enable snvs power key
> > 
> > So, the series will break existing DTBs for RTC and poweroff, right?
> > If this is unavoidable, should we at least have some warning messages
> > telling users about his breakage?
> 
> What's the justification for breaking existing DTBs?  Really, this is
> something we should strive to avoid, _and_ actually avoid by providing
> backwards compatibility.

Looking at the RTC code, it would be pretty trivial to do.

Rather than passing around struct regmap, pass around the private data
structure.

Rename the regmap_* function calls to be private accessors.  Implement
a set of new accessors - if the private data has the regmap, use the
regmap API.  Otherwise, use the old method, and print a warning that an
old DT is being used.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 18:30       ` Russell King - ARM Linux
  0 siblings, 0 replies; 63+ messages in thread
From: Russell King - ARM Linux @ 2015-05-20 18:30 UTC (permalink / raw)
  To: Shawn Guo
  Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, Frank.Li-KZfg59tc24xl57MIdRCFDg,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-pm-u79uwXL29TY76Z2rM5mHXA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	lznuaa-Re5JQEeQqe8AvxtiuMwx3w, shawn.guo-QSEj5FYQhm4dnm+yROfE0A,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Wed, May 20, 2015 at 07:25:41PM +0100, Russell King - ARM Linux wrote:
> On Wed, May 20, 2015 at 09:58:51AM +0800, Shawn Guo wrote:
> > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li-KZfg59tc24xl57MIdRCFDg@public.gmane.org wrote:
> > > Frank Li (6):
> > >   arm: imx: power-off: change to syscon to access register
> > >   rtc: arm: imx: snvs: change use syscon to access register
> > >   Document: dt: fsl: snvs: change support syscon
> > >   arm: dts: imx: update snvs to use syscon access register
> > >   document: devicetree: input: imx: i.mx snvs power device tree bindings
> > >   arm: dts: imx6sx: enable snvs power key
> > 
> > So, the series will break existing DTBs for RTC and poweroff, right?
> > If this is unavoidable, should we at least have some warning messages
> > telling users about his breakage?
> 
> What's the justification for breaking existing DTBs?  Really, this is
> something we should strive to avoid, _and_ actually avoid by providing
> backwards compatibility.

Looking at the RTC code, it would be pretty trivial to do.

Rather than passing around struct regmap, pass around the private data
structure.

Rename the regmap_* function calls to be private accessors.  Implement
a set of new accessors - if the private data has the regmap, use the
regmap API.  Otherwise, use the old method, and print a warning that an
old DT is being used.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 18:30       ` Russell King - ARM Linux
  0 siblings, 0 replies; 63+ messages in thread
From: Russell King - ARM Linux @ 2015-05-20 18:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 20, 2015 at 07:25:41PM +0100, Russell King - ARM Linux wrote:
> On Wed, May 20, 2015 at 09:58:51AM +0800, Shawn Guo wrote:
> > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li at freescale.com wrote:
> > > Frank Li (6):
> > >   arm: imx: power-off: change to syscon to access register
> > >   rtc: arm: imx: snvs: change use syscon to access register
> > >   Document: dt: fsl: snvs: change support syscon
> > >   arm: dts: imx: update snvs to use syscon access register
> > >   document: devicetree: input: imx: i.mx snvs power device tree bindings
> > >   arm: dts: imx6sx: enable snvs power key
> > 
> > So, the series will break existing DTBs for RTC and poweroff, right?
> > If this is unavoidable, should we at least have some warning messages
> > telling users about his breakage?
> 
> What's the justification for breaking existing DTBs?  Really, this is
> something we should strive to avoid, _and_ actually avoid by providing
> backwards compatibility.

Looking at the RTC code, it would be pretty trivial to do.

Rather than passing around struct regmap, pass around the private data
structure.

Rename the regmap_* function calls to be private accessors.  Implement
a set of new accessors - if the private data has the regmap, use the
regmap API.  Otherwise, use the old method, and print a warning that an
old DT is being used.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

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

* [rtc-linux] Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 18:44         ` Zhi Li
  0 siblings, 0 replies; 63+ messages in thread
From: Zhi Li @ 2015-05-20 18:44 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Shawn Guo, Alessandro Zummo, Frank.Li, rtc-linux, linux-pm,
	Dmitry Torokhov, devicetree, Rob Herring, alexandre.belloni,
	Philipp Zabel, linux-input, Shawn Guo, linux-arm-kernel

On Wed, May 20, 2015 at 1:30 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Wed, May 20, 2015 at 07:25:41PM +0100, Russell King - ARM Linux wrote:
>> On Wed, May 20, 2015 at 09:58:51AM +0800, Shawn Guo wrote:
>> > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
>> > > Frank Li (6):
>> > >   arm: imx: power-off: change to syscon to access register
>> > >   rtc: arm: imx: snvs: change use syscon to access register
>> > >   Document: dt: fsl: snvs: change support syscon
>> > >   arm: dts: imx: update snvs to use syscon access register
>> > >   document: devicetree: input: imx: i.mx snvs power device tree bindings
>> > >   arm: dts: imx6sx: enable snvs power key
>> >
>> > So, the series will break existing DTBs for RTC and poweroff, right?
>> > If this is unavoidable, should we at least have some warning messages
>> > telling users about his breakage?
>>
>> What's the justification for breaking existing DTBs?  Really, this is
>> something we should strive to avoid, _and_ actually avoid by providing
>> backwards compatibility.
>
> Looking at the RTC code, it would be pretty trivial to do.
>
> Rather than passing around struct regmap, pass around the private data
> structure.
>
> Rename the regmap_* function calls to be private accessors.  Implement
> a set of new accessors - if the private data has the regmap, use the
> regmap API.  Otherwise, use the old method, and print a warning that an
> old DT is being used.

This method work.  But code will become ugly and complex. I seach
whole dts tree.
Only imx6 use this driver.

Does it really valuable to keep compatiblity with cost of complex driver code?

best regards
Frank Li

>
> --
> FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
> according to speedtest.net.

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 18:44         ` Zhi Li
  0 siblings, 0 replies; 63+ messages in thread
From: Zhi Li @ 2015-05-20 18:44 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Shawn Guo, Alessandro Zummo, Frank.Li-KZfg59tc24xl57MIdRCFDg,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-pm-u79uwXL29TY76Z2rM5mHXA, Dmitry Torokhov,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	Philipp Zabel, linux-input-u79uwXL29TY76Z2rM5mHXA, Shawn Guo,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Wed, May 20, 2015 at 1:30 PM, Russell King - ARM Linux
<linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org> wrote:
> On Wed, May 20, 2015 at 07:25:41PM +0100, Russell King - ARM Linux wrote:
>> On Wed, May 20, 2015 at 09:58:51AM +0800, Shawn Guo wrote:
>> > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li-KZfg59tc24xl57MIdRCFDg@public.gmane.org wrote:
>> > > Frank Li (6):
>> > >   arm: imx: power-off: change to syscon to access register
>> > >   rtc: arm: imx: snvs: change use syscon to access register
>> > >   Document: dt: fsl: snvs: change support syscon
>> > >   arm: dts: imx: update snvs to use syscon access register
>> > >   document: devicetree: input: imx: i.mx snvs power device tree bindings
>> > >   arm: dts: imx6sx: enable snvs power key
>> >
>> > So, the series will break existing DTBs for RTC and poweroff, right?
>> > If this is unavoidable, should we at least have some warning messages
>> > telling users about his breakage?
>>
>> What's the justification for breaking existing DTBs?  Really, this is
>> something we should strive to avoid, _and_ actually avoid by providing
>> backwards compatibility.
>
> Looking at the RTC code, it would be pretty trivial to do.
>
> Rather than passing around struct regmap, pass around the private data
> structure.
>
> Rename the regmap_* function calls to be private accessors.  Implement
> a set of new accessors - if the private data has the regmap, use the
> regmap API.  Otherwise, use the old method, and print a warning that an
> old DT is being used.

This method work.  But code will become ugly and complex. I seach
whole dts tree.
Only imx6 use this driver.

Does it really valuable to keep compatiblity with cost of complex driver code?

best regards
Frank Li

>
> --
> FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
> according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 18:44         ` Zhi Li
  0 siblings, 0 replies; 63+ messages in thread
From: Zhi Li @ 2015-05-20 18:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 20, 2015 at 1:30 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Wed, May 20, 2015 at 07:25:41PM +0100, Russell King - ARM Linux wrote:
>> On Wed, May 20, 2015 at 09:58:51AM +0800, Shawn Guo wrote:
>> > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li at freescale.com wrote:
>> > > Frank Li (6):
>> > >   arm: imx: power-off: change to syscon to access register
>> > >   rtc: arm: imx: snvs: change use syscon to access register
>> > >   Document: dt: fsl: snvs: change support syscon
>> > >   arm: dts: imx: update snvs to use syscon access register
>> > >   document: devicetree: input: imx: i.mx snvs power device tree bindings
>> > >   arm: dts: imx6sx: enable snvs power key
>> >
>> > So, the series will break existing DTBs for RTC and poweroff, right?
>> > If this is unavoidable, should we at least have some warning messages
>> > telling users about his breakage?
>>
>> What's the justification for breaking existing DTBs?  Really, this is
>> something we should strive to avoid, _and_ actually avoid by providing
>> backwards compatibility.
>
> Looking at the RTC code, it would be pretty trivial to do.
>
> Rather than passing around struct regmap, pass around the private data
> structure.
>
> Rename the regmap_* function calls to be private accessors.  Implement
> a set of new accessors - if the private data has the regmap, use the
> regmap API.  Otherwise, use the old method, and print a warning that an
> old DT is being used.

This method work.  But code will become ugly and complex. I seach
whole dts tree.
Only imx6 use this driver.

Does it really valuable to keep compatiblity with cost of complex driver code?

best regards
Frank Li

>
> --
> FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
> according to speedtest.net.

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

* [rtc-linux] Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
  2015-05-20 18:44         ` Zhi Li
  (?)
@ 2015-05-20 21:56           ` Russell King - ARM Linux
  -1 siblings, 0 replies; 63+ messages in thread
From: Russell King - ARM Linux @ 2015-05-20 21:56 UTC (permalink / raw)
  To: Zhi Li
  Cc: Shawn Guo, Alessandro Zummo, Frank.Li, rtc-linux, linux-pm,
	Dmitry Torokhov, devicetree, Rob Herring, alexandre.belloni,
	Philipp Zabel, linux-input, Shawn Guo, linux-arm-kernel

On Wed, May 20, 2015 at 01:44:58PM -0500, Zhi Li wrote:
> On Wed, May 20, 2015 at 1:30 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
> > Looking at the RTC code, it would be pretty trivial to do.
> >
> > Rather than passing around struct regmap, pass around the private data
> > structure.
> >
> > Rename the regmap_* function calls to be private accessors.  Implement
> > a set of new accessors - if the private data has the regmap, use the
> > regmap API.  Otherwise, use the old method, and print a warning that an
> > old DT is being used.
> 
> This method work.  But code will become ugly and complex. I seach
> whole dts tree.
> Only imx6 use this driver.
> 
> Does it really valuable to keep compatiblity with cost of complex driver code?

Let me put this a different way.

Would you be upset if you installed a new kernel, rebooted and found that
the system then fscked your filesystem, stamping a date of 1 Jan 1970
on it.  Then you use a later dtb, and you have to go through another
fsck of your filesystem because it's apparently been more than "31 days"
or so since it was last fscked, and all this caused by the RTC vanishing
because we couldn't be bothered with backward compatibility?

There are real products out there which use iMX6 today.  In production,
being sold.

Do not break existing DTBs unless there really is no other choice.

And I don't think it makes the code ugly, though it does make it _slightly_
more complex.  That's a price worth paying for keeping stuff working.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 21:56           ` Russell King - ARM Linux
  0 siblings, 0 replies; 63+ messages in thread
From: Russell King - ARM Linux @ 2015-05-20 21:56 UTC (permalink / raw)
  To: Zhi Li
  Cc: Shawn Guo, Alessandro Zummo, Frank.Li, rtc-linux, linux-pm,
	Dmitry Torokhov, devicetree, Rob Herring, alexandre.belloni,
	Philipp Zabel, linux-input, Shawn Guo, linux-arm-kernel

On Wed, May 20, 2015 at 01:44:58PM -0500, Zhi Li wrote:
> On Wed, May 20, 2015 at 1:30 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
> > Looking at the RTC code, it would be pretty trivial to do.
> >
> > Rather than passing around struct regmap, pass around the private data
> > structure.
> >
> > Rename the regmap_* function calls to be private accessors.  Implement
> > a set of new accessors - if the private data has the regmap, use the
> > regmap API.  Otherwise, use the old method, and print a warning that an
> > old DT is being used.
> 
> This method work.  But code will become ugly and complex. I seach
> whole dts tree.
> Only imx6 use this driver.
> 
> Does it really valuable to keep compatiblity with cost of complex driver code?

Let me put this a different way.

Would you be upset if you installed a new kernel, rebooted and found that
the system then fscked your filesystem, stamping a date of 1 Jan 1970
on it.  Then you use a later dtb, and you have to go through another
fsck of your filesystem because it's apparently been more than "31 days"
or so since it was last fscked, and all this caused by the RTC vanishing
because we couldn't be bothered with backward compatibility?

There are real products out there which use iMX6 today.  In production,
being sold.

Do not break existing DTBs unless there really is no other choice.

And I don't think it makes the code ugly, though it does make it _slightly_
more complex.  That's a price worth paying for keeping stuff working.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

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

* [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-20 21:56           ` Russell King - ARM Linux
  0 siblings, 0 replies; 63+ messages in thread
From: Russell King - ARM Linux @ 2015-05-20 21:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 20, 2015 at 01:44:58PM -0500, Zhi Li wrote:
> On Wed, May 20, 2015 at 1:30 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
> > Looking at the RTC code, it would be pretty trivial to do.
> >
> > Rather than passing around struct regmap, pass around the private data
> > structure.
> >
> > Rename the regmap_* function calls to be private accessors.  Implement
> > a set of new accessors - if the private data has the regmap, use the
> > regmap API.  Otherwise, use the old method, and print a warning that an
> > old DT is being used.
> 
> This method work.  But code will become ugly and complex. I seach
> whole dts tree.
> Only imx6 use this driver.
> 
> Does it really valuable to keep compatiblity with cost of complex driver code?

Let me put this a different way.

Would you be upset if you installed a new kernel, rebooted and found that
the system then fscked your filesystem, stamping a date of 1 Jan 1970
on it.  Then you use a later dtb, and you have to go through another
fsck of your filesystem because it's apparently been more than "31 days"
or so since it was last fscked, and all this caused by the RTC vanishing
because we couldn't be bothered with backward compatibility?

There are real products out there which use iMX6 today.  In production,
being sold.

Do not break existing DTBs unless there really is no other choice.

And I don't think it makes the code ugly, though it does make it _slightly_
more complex.  That's a price worth paying for keeping stuff working.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

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

* [rtc-linux] Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
  2015-05-20 18:30       ` Russell King - ARM Linux
  (?)
@ 2015-05-21  0:20         ` Dmitry Torokhov
  -1 siblings, 0 replies; 63+ messages in thread
From: Dmitry Torokhov @ 2015-05-21  0:20 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Shawn Guo, a.zummo, Frank.Li, rtc-linux, linux-pm, devicetree,
	robh+dt, alexandre.belloni, p.zabel, linux-input, lznuaa,
	shawn.guo, linux-arm-kernel

On Wed, May 20, 2015 at 07:30:50PM +0100, Russell King - ARM Linux wrote:
> On Wed, May 20, 2015 at 07:25:41PM +0100, Russell King - ARM Linux wrote:
> > On Wed, May 20, 2015 at 09:58:51AM +0800, Shawn Guo wrote:
> > > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
> > > > Frank Li (6):
> > > >   arm: imx: power-off: change to syscon to access register
> > > >   rtc: arm: imx: snvs: change use syscon to access register
> > > >   Document: dt: fsl: snvs: change support syscon
> > > >   arm: dts: imx: update snvs to use syscon access register
> > > >   document: devicetree: input: imx: i.mx snvs power device tree bindings
> > > >   arm: dts: imx6sx: enable snvs power key
> > > 
> > > So, the series will break existing DTBs for RTC and poweroff, right?
> > > If this is unavoidable, should we at least have some warning messages
> > > telling users about his breakage?
> > 
> > What's the justification for breaking existing DTBs?  Really, this is
> > something we should strive to avoid, _and_ actually avoid by providing
> > backwards compatibility.
> 
> Looking at the RTC code, it would be pretty trivial to do.
> 
> Rather than passing around struct regmap, pass around the private data
> structure.
> 
> Rename the regmap_* function calls to be private accessors.  Implement
> a set of new accessors - if the private data has the regmap, use the
> regmap API.  Otherwise, use the old method, and print a warning that an
> old DT is being used.

Or maybe have drivers create regmap themselves if they see old DTS and
not bother with the 2 sets of accessors?

Thanks.

-- 
Dmitry

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-21  0:20         ` Dmitry Torokhov
  0 siblings, 0 replies; 63+ messages in thread
From: Dmitry Torokhov @ 2015-05-21  0:20 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Shawn Guo, a.zummo, Frank.Li, rtc-linux, linux-pm, devicetree,
	robh+dt, alexandre.belloni, p.zabel, linux-input, lznuaa,
	shawn.guo, linux-arm-kernel

On Wed, May 20, 2015 at 07:30:50PM +0100, Russell King - ARM Linux wrote:
> On Wed, May 20, 2015 at 07:25:41PM +0100, Russell King - ARM Linux wrote:
> > On Wed, May 20, 2015 at 09:58:51AM +0800, Shawn Guo wrote:
> > > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
> > > > Frank Li (6):
> > > >   arm: imx: power-off: change to syscon to access register
> > > >   rtc: arm: imx: snvs: change use syscon to access register
> > > >   Document: dt: fsl: snvs: change support syscon
> > > >   arm: dts: imx: update snvs to use syscon access register
> > > >   document: devicetree: input: imx: i.mx snvs power device tree bindings
> > > >   arm: dts: imx6sx: enable snvs power key
> > > 
> > > So, the series will break existing DTBs for RTC and poweroff, right?
> > > If this is unavoidable, should we at least have some warning messages
> > > telling users about his breakage?
> > 
> > What's the justification for breaking existing DTBs?  Really, this is
> > something we should strive to avoid, _and_ actually avoid by providing
> > backwards compatibility.
> 
> Looking at the RTC code, it would be pretty trivial to do.
> 
> Rather than passing around struct regmap, pass around the private data
> structure.
> 
> Rename the regmap_* function calls to be private accessors.  Implement
> a set of new accessors - if the private data has the regmap, use the
> regmap API.  Otherwise, use the old method, and print a warning that an
> old DT is being used.

Or maybe have drivers create regmap themselves if they see old DTS and
not bother with the 2 sets of accessors?

Thanks.

-- 
Dmitry

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

* [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-21  0:20         ` Dmitry Torokhov
  0 siblings, 0 replies; 63+ messages in thread
From: Dmitry Torokhov @ 2015-05-21  0:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 20, 2015 at 07:30:50PM +0100, Russell King - ARM Linux wrote:
> On Wed, May 20, 2015 at 07:25:41PM +0100, Russell King - ARM Linux wrote:
> > On Wed, May 20, 2015 at 09:58:51AM +0800, Shawn Guo wrote:
> > > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li at freescale.com wrote:
> > > > Frank Li (6):
> > > >   arm: imx: power-off: change to syscon to access register
> > > >   rtc: arm: imx: snvs: change use syscon to access register
> > > >   Document: dt: fsl: snvs: change support syscon
> > > >   arm: dts: imx: update snvs to use syscon access register
> > > >   document: devicetree: input: imx: i.mx snvs power device tree bindings
> > > >   arm: dts: imx6sx: enable snvs power key
> > > 
> > > So, the series will break existing DTBs for RTC and poweroff, right?
> > > If this is unavoidable, should we at least have some warning messages
> > > telling users about his breakage?
> > 
> > What's the justification for breaking existing DTBs?  Really, this is
> > something we should strive to avoid, _and_ actually avoid by providing
> > backwards compatibility.
> 
> Looking at the RTC code, it would be pretty trivial to do.
> 
> Rather than passing around struct regmap, pass around the private data
> structure.
> 
> Rename the regmap_* function calls to be private accessors.  Implement
> a set of new accessors - if the private data has the regmap, use the
> regmap API.  Otherwise, use the old method, and print a warning that an
> old DT is being used.

Or maybe have drivers create regmap themselves if they see old DTS and
not bother with the 2 sets of accessors?

Thanks.

-- 
Dmitry

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

* [rtc-linux] Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
  2015-05-21  0:20         ` Dmitry Torokhov
  (?)
@ 2015-05-21  1:16           ` Zhi Li
  -1 siblings, 0 replies; 63+ messages in thread
From: Zhi Li @ 2015-05-21  1:16 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Russell King - ARM Linux, Shawn Guo, Alessandro Zummo, Frank.Li,
	rtc-linux, linux-pm, devicetree, Rob Herring, alexandre.belloni,
	Philipp Zabel, linux-input, Shawn Guo, linux-arm-kernel

On Wed, May 20, 2015 at 7:20 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Wed, May 20, 2015 at 07:30:50PM +0100, Russell King - ARM Linux wrote:
>> On Wed, May 20, 2015 at 07:25:41PM +0100, Russell King - ARM Linux wrote:
>> > On Wed, May 20, 2015 at 09:58:51AM +0800, Shawn Guo wrote:
>> > > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
>> > > > Frank Li (6):
>> > > >   arm: imx: power-off: change to syscon to access register
>> > > >   rtc: arm: imx: snvs: change use syscon to access register
>> > > >   Document: dt: fsl: snvs: change support syscon
>> > > >   arm: dts: imx: update snvs to use syscon access register
>> > > >   document: devicetree: input: imx: i.mx snvs power device tree bindings
>> > > >   arm: dts: imx6sx: enable snvs power key
>> > >
>> > > So, the series will break existing DTBs for RTC and poweroff, right?
>> > > If this is unavoidable, should we at least have some warning messages
>> > > telling users about his breakage?
>> >
>> > What's the justification for breaking existing DTBs?  Really, this is
>> > something we should strive to avoid, _and_ actually avoid by providing
>> > backwards compatibility.
>>
>> Looking at the RTC code, it would be pretty trivial to do.
>>
>> Rather than passing around struct regmap, pass around the private data
>> structure.
>>
>> Rename the regmap_* function calls to be private accessors.  Implement
>> a set of new accessors - if the private data has the regmap, use the
>> regmap API.  Otherwise, use the old method, and print a warning that an
>> old DT is being used.
>
> Or maybe have drivers create regmap themselves if they see old DTS and
> not bother with the 2 sets of accessors?

Does any dt node convert to regmap regardless if there are "syscon"
compatible string?

>
> Thanks.
>
> --
> Dmitry

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-21  1:16           ` Zhi Li
  0 siblings, 0 replies; 63+ messages in thread
From: Zhi Li @ 2015-05-21  1:16 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Russell King - ARM Linux, Shawn Guo, Alessandro Zummo, Frank.Li,
	rtc-linux, linux-pm, devicetree, Rob Herring, alexandre.belloni,
	Philipp Zabel, linux-input, Shawn Guo, linux-arm-kernel

On Wed, May 20, 2015 at 7:20 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Wed, May 20, 2015 at 07:30:50PM +0100, Russell King - ARM Linux wrote:
>> On Wed, May 20, 2015 at 07:25:41PM +0100, Russell King - ARM Linux wrote:
>> > On Wed, May 20, 2015 at 09:58:51AM +0800, Shawn Guo wrote:
>> > > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li@freescale.com wrote:
>> > > > Frank Li (6):
>> > > >   arm: imx: power-off: change to syscon to access register
>> > > >   rtc: arm: imx: snvs: change use syscon to access register
>> > > >   Document: dt: fsl: snvs: change support syscon
>> > > >   arm: dts: imx: update snvs to use syscon access register
>> > > >   document: devicetree: input: imx: i.mx snvs power device tree bindings
>> > > >   arm: dts: imx6sx: enable snvs power key
>> > >
>> > > So, the series will break existing DTBs for RTC and poweroff, right?
>> > > If this is unavoidable, should we at least have some warning messages
>> > > telling users about his breakage?
>> >
>> > What's the justification for breaking existing DTBs?  Really, this is
>> > something we should strive to avoid, _and_ actually avoid by providing
>> > backwards compatibility.
>>
>> Looking at the RTC code, it would be pretty trivial to do.
>>
>> Rather than passing around struct regmap, pass around the private data
>> structure.
>>
>> Rename the regmap_* function calls to be private accessors.  Implement
>> a set of new accessors - if the private data has the regmap, use the
>> regmap API.  Otherwise, use the old method, and print a warning that an
>> old DT is being used.
>
> Or maybe have drivers create regmap themselves if they see old DTS and
> not bother with the 2 sets of accessors?

Does any dt node convert to regmap regardless if there are "syscon"
compatible string?

>
> Thanks.
>
> --
> Dmitry

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

* [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver
@ 2015-05-21  1:16           ` Zhi Li
  0 siblings, 0 replies; 63+ messages in thread
From: Zhi Li @ 2015-05-21  1:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 20, 2015 at 7:20 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Wed, May 20, 2015 at 07:30:50PM +0100, Russell King - ARM Linux wrote:
>> On Wed, May 20, 2015 at 07:25:41PM +0100, Russell King - ARM Linux wrote:
>> > On Wed, May 20, 2015 at 09:58:51AM +0800, Shawn Guo wrote:
>> > > On Wed, May 20, 2015 at 01:04:35AM +0800, Frank.Li at freescale.com wrote:
>> > > > Frank Li (6):
>> > > >   arm: imx: power-off: change to syscon to access register
>> > > >   rtc: arm: imx: snvs: change use syscon to access register
>> > > >   Document: dt: fsl: snvs: change support syscon
>> > > >   arm: dts: imx: update snvs to use syscon access register
>> > > >   document: devicetree: input: imx: i.mx snvs power device tree bindings
>> > > >   arm: dts: imx6sx: enable snvs power key
>> > >
>> > > So, the series will break existing DTBs for RTC and poweroff, right?
>> > > If this is unavoidable, should we at least have some warning messages
>> > > telling users about his breakage?
>> >
>> > What's the justification for breaking existing DTBs?  Really, this is
>> > something we should strive to avoid, _and_ actually avoid by providing
>> > backwards compatibility.
>>
>> Looking at the RTC code, it would be pretty trivial to do.
>>
>> Rather than passing around struct regmap, pass around the private data
>> structure.
>>
>> Rename the regmap_* function calls to be private accessors.  Implement
>> a set of new accessors - if the private data has the regmap, use the
>> regmap API.  Otherwise, use the old method, and print a warning that an
>> old DT is being used.
>
> Or maybe have drivers create regmap themselves if they see old DTS and
> not bother with the 2 sets of accessors?

Does any dt node convert to regmap regardless if there are "syscon"
compatible string?

>
> Thanks.
>
> --
> Dmitry

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

end of thread, other threads:[~2015-05-21  1:16 UTC | newest]

Thread overview: 63+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-19 17:04 [rtc-linux] [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver Frank.Li
2015-05-19 17:04 ` Frank.Li at freescale.com
2015-05-19 17:04 ` Frank.Li
2015-05-19 17:04 ` [rtc-linux] [PATCH v2 1/7] arm: imx: power-off: change to syscon to access register Frank.Li
2015-05-19 17:04   ` Frank.Li at freescale.com
2015-05-19 17:04   ` Frank.Li
2015-05-19 17:04 ` [rtc-linux] [PATCH v2 2/7] rtc: arm: imx: snvs: change use " Frank.Li
2015-05-19 17:04   ` Frank.Li at freescale.com
2015-05-19 17:04   ` Frank.Li-KZfg59tc24xl57MIdRCFDg
2015-05-19 20:46   ` [rtc-linux] " Alexandre Belloni
2015-05-19 20:46     ` Alexandre Belloni
2015-05-19 20:46     ` Alexandre Belloni
2015-05-19 17:04 ` [rtc-linux] [PATCH v2 3/7] Document: dt: fsl: snvs: change support syscon Frank.Li
2015-05-19 17:04   ` Frank.Li at freescale.com
2015-05-19 17:04   ` Frank.Li
2015-05-19 17:04 ` [rtc-linux] [PATCH v2 4/7] arm: dts: imx: update snvs to use syscon access register Frank.Li
2015-05-19 17:04   ` Frank.Li at freescale.com
2015-05-19 17:04   ` Frank.Li
2015-05-19 17:04 ` [rtc-linux] [PATCH v2 5/7] input: keyboard: imx: add snvs power key driver Frank.Li
2015-05-19 17:04   ` Frank.Li at freescale.com
2015-05-19 17:04   ` Frank.Li
2015-05-19 17:04 ` [rtc-linux] [PATCH v2 6/7] document: devicetree: input: imx: i.mx snvs power device tree bindings Frank.Li
2015-05-19 17:04   ` Frank.Li at freescale.com
2015-05-19 17:04   ` Frank.Li
2015-05-19 17:04 ` [rtc-linux] [PATCH v2 7/7] arm: dts: imx6sx: enable snvs power key Frank.Li
2015-05-19 17:04   ` Frank.Li at freescale.com
2015-05-19 17:04   ` Frank.Li
2015-05-20  1:58 ` [rtc-linux] Re: [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver Shawn Guo
2015-05-20  1:58   ` Shawn Guo
2015-05-20  1:58   ` Shawn Guo
2015-05-20  2:44   ` [rtc-linux] " Zhi Li
2015-05-20  2:44     ` Zhi Li
2015-05-20  2:44     ` Zhi Li
2015-05-20 14:22     ` [rtc-linux] " Shawn Guo
2015-05-20 14:22       ` Shawn Guo
2015-05-20 14:22       ` Shawn Guo
2015-05-20 14:30       ` [rtc-linux] " Zhi Li
2015-05-20 14:30         ` Zhi Li
2015-05-20 14:30         ` Zhi Li
2015-05-20 14:46         ` [rtc-linux] " Joshua Clayton
2015-05-20 14:46           ` Joshua Clayton
2015-05-20 14:46           ` Joshua Clayton
2015-05-20 15:03           ` [rtc-linux] " Zhi Li
2015-05-20 15:03             ` Zhi Li
2015-05-20 15:03             ` Zhi Li
2015-05-20 18:25   ` [rtc-linux] " Russell King - ARM Linux
2015-05-20 18:25     ` Russell King - ARM Linux
2015-05-20 18:25     ` Russell King - ARM Linux
2015-05-20 18:30     ` [rtc-linux] " Russell King - ARM Linux
2015-05-20 18:30       ` Russell King - ARM Linux
2015-05-20 18:30       ` Russell King - ARM Linux
2015-05-20 18:44       ` [rtc-linux] " Zhi Li
2015-05-20 18:44         ` Zhi Li
2015-05-20 18:44         ` Zhi Li
2015-05-20 21:56         ` [rtc-linux] " Russell King - ARM Linux
2015-05-20 21:56           ` Russell King - ARM Linux
2015-05-20 21:56           ` Russell King - ARM Linux
2015-05-21  0:20       ` [rtc-linux] " Dmitry Torokhov
2015-05-21  0:20         ` Dmitry Torokhov
2015-05-21  0:20         ` Dmitry Torokhov
2015-05-21  1:16         ` [rtc-linux] " Zhi Li
2015-05-21  1:16           ` Zhi Li
2015-05-21  1:16           ` Zhi Li

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.