Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH 1/3] ARM: dts: imx6: add pm_power_off support for i.mx6 chips

157 views
Skip to first unread message

Robin Gong

unread,
Nov 12, 2014, 4:30:06 AM11/12/14
to
All chips of i.mx6 can be powered off by programming SNVS.
For example :
On i.mx6q-sabresd board, PMIC_ON_REQ connect with external
pmic ON/OFF pin, that will cause the whole PMIC powered off
except VSNVS. And system can restart once PMIC_ON_REQ goes
high by push POWRER key.

Signed-off-by: Robin Gong <b38...@freescale.com>
---
arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 4 ++++
arch/arm/boot/dts/imx6qdl.dtsi | 6 ++++++
arch/arm/boot/dts/imx6sl-evk.dts | 4 ++++
arch/arm/boot/dts/imx6sl.dtsi | 6 ++++++
arch/arm/boot/dts/imx6sx-sdb.dts | 4 ++++
arch/arm/boot/dts/imx6sx.dtsi | 6 ++++++
6 files changed, 30 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index 07fb302..ba12cc6 100644
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -531,6 +531,10 @@
status = "okay";
};

+&snvs-poweroff {
+ status = "okay";
+};
+
&ssi2 {
status = "okay";
};
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index c701af9..3a032d1 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -645,6 +645,12 @@
interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>,
<0 20 IRQ_TYPE_LEVEL_HIGH>;
};
+
+ snvs-poweroff: snvs-poweroff@38 {
+ compatible = "fsl,sec-v4.0-poweroff";
+ reg = <0x38 0x4>;
+ status = "disabled";
+ };
};

epit1: epit@020d0000 { /* EPIT1 */
diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts
index 3f9e041..dab588f 100644
--- a/arch/arm/boot/dts/imx6sl-evk.dts
+++ b/arch/arm/boot/dts/imx6sl-evk.dts
@@ -488,6 +488,10 @@
status = "okay";
};

+&snvs-poweroff {
+ status = "okay";
+};
+
&ssi2 {
status = "okay";
};
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index 505da9e..5e5ed07 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -565,6 +565,12 @@
interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>,
<0 20 IRQ_TYPE_LEVEL_HIGH>;
};
+
+ snvs-poweroff: snvs-poweroff@38 {
+ compatible = "fsl,sec-v4.0-poweroff";
+ reg = <0x38 0x4>;
+ status = "disabled";
+ };
};

epit1: epit@020d0000 {
diff --git a/arch/arm/boot/dts/imx6sx-sdb.dts b/arch/arm/boot/dts/imx6sx-sdb.dts
index a3980d9..78dc031 100644
--- a/arch/arm/boot/dts/imx6sx-sdb.dts
+++ b/arch/arm/boot/dts/imx6sx-sdb.dts
@@ -251,6 +251,10 @@
};
};

+&snvs-poweroff {
+ status = "okay";
+};
+
&ssi2 {
status = "okay";
};
diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index f4b9da6..652be9f 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -668,6 +668,12 @@
reg = <0x34 0x58>;
interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
};
+
+ snvs-poweroff: snvs-poweroff@38 {
+ compatible = "fsl,sec-v4.0-poweroff";
+ reg = <0x38 0x4>;
+ status = "disabled";
+ };
};

epit1: epit@020d0000 {
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Robin Gong

unread,
Nov 12, 2014, 4:30:06 AM11/12/14
to
Resend the patchset with the latest MAINTAINERS
Add simple power off driver for i.mx6, including:
- add basic imx-snvs-poweroff driver in drivers/power/reset
- add device node in all dts files of i.mx6.
- enable in config file

Change from v3:
- disable poweroff driver in soc level dts and enable it in board level dts
- replace 'EIO' with 'ENODEV' while of_iomap fail.
Change from v2:
- remove useless included head files
- split device binding doc from dts patch
- add description for the case that PMIC_ON_REQ not used as external power
control

Robin Gong (3):
ARM: dts: imx6: add pm_power_off support for i.mx6 chips
power: reset: imx-snvs-poweroff: add power off driver for i.mx6
ARM: configs: imx_v6_v7_defconfig: add power off driver

arch/arm/boot/dts/imx6qdl.dtsi | 5 +++
arch/arm/boot/dts/imx6sl.dtsi | 5 +++
arch/arm/boot/dts/imx6sx.dtsi | 5 +++
arch/arm/configs/imx_v6_v7_defconfig | 3 ++
drivers/power/reset/Kconfig | 5 +++
drivers/power/reset/Makefile | 1 +
drivers/power/reset/imx-snvs-poweroff.c | 69 +++++++++++++++++++++++++++++++++
7 files changed, 93 insertions(+)
create mode 100644 drivers/power/reset/imx-snvs-poweroff.c

--
1.9.1

Robin Gong

unread,
Nov 12, 2014, 4:30:06 AM11/12/14
to
Add power off driver in config file.

Signed-off-by: Robin Gong <b38...@freescale.com>
---
arch/arm/configs/imx_v6_v7_defconfig | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 16cfec4..a310e61 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -165,6 +165,9 @@ CONFIG_SPI_IMX=y
CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_MC9S08DZ60=y
CONFIG_GPIO_STMPE=y
+CONFIG_POWER_SUPPLY=y
+CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_IMX=y
# CONFIG_HWMON is not set
CONFIG_WATCHDOG=y
CONFIG_IMX2_WDT=y
--
1.7.9.5

Robin Gong

unread,
Nov 12, 2014, 4:30:08 AM11/12/14
to
This driver register pm_power_off with snvs power off function. If
your boards NOT use PMIC_ON_REQ to turn on/off external pmic, or use
other pin to do, please disable the driver in dts, otherwise, your
pm_power_off maybe overwrote by this driver.

Signed-off-by: Robin Gong <b38...@freescale.com>
---
.../bindings/power_supply/imx-snvs-poweroff.txt | 23 +++++++
drivers/power/reset/Kconfig | 9 +++
drivers/power/reset/Makefile | 1 +
drivers/power/reset/imx-snvs-poweroff.c | 66 ++++++++++++++++++++
4 files changed, 99 insertions(+)
create mode 100644 Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt
create mode 100644 drivers/power/reset/imx-snvs-poweroff.c

diff --git a/Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt b/Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt
new file mode 100644
index 0000000..3d824b6
--- /dev/null
+++ b/Documentation/devicetree/bindings/power_supply/imx-snvs-poweroff.txt
@@ -0,0 +1,23 @@
+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>;
+ };
+ }
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index ca41523..b26c547 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -45,6 +45,15 @@ config POWER_RESET_HISI
help
Reboot support for Hisilicon boards.

+config POWER_RESET_IMX
+ bool "IMX6 power-off driver"
+ depends on POWER_RESET && SOC_IMX6
+ help
+ This driver support power off external PMIC by PMIC_ON_REQ on i.mx6
+ boards.If you want to use other pin to control external power,please
+ say N here or disable in dts to make sure pm_power_off never be
+ overwrote wrongly by this driver.
+
config POWER_RESET_MSM
bool "Qualcomm MSM power-off driver"
depends on POWER_RESET && ARCH_QCOM
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index a42e70e..2524daf 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_POWER_RESET_AXXIA) += axxia-reset.o
obj-$(CONFIG_POWER_RESET_BRCMSTB) += brcmstb-reboot.o
obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o
obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o
+obj-$(CONFIG_POWER_RESET_IMX) += imx-snvs-poweroff.o
obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o
obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o
obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o
diff --git a/drivers/power/reset/imx-snvs-poweroff.c b/drivers/power/reset/imx-snvs-poweroff.c
new file mode 100644
index 0000000..ad6ce50
--- /dev/null
+++ b/drivers/power/reset/imx-snvs-poweroff.c
@@ -0,0 +1,66 @@
+/* Power off driver for i.mx6
+ * Copyright (c) 2014, FREESCALE CORPORATION. All rights reserved.
+ *
+ * based on msm-poweroff.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+
+static void __iomem *snvs_base;
+
+static void do_imx_poweroff(void)
+{
+ u32 value = readl(snvs_base);
+
+ /* set TOP and DP_EN bit */
+ writel(value | 0x60, snvs_base);
+}
+
+static int imx_poweroff_probe(struct platform_device *pdev)
+{
+ snvs_base = of_iomap(pdev->dev.of_node, 0);
+ if (!snvs_base) {
+ dev_err(&pdev->dev, "failed to get memory\n");
+ return -ENODEV;
+ }
+
+ pm_power_off = do_imx_poweroff;
+ return 0;
+}
+
+static const struct of_device_id of_imx_poweroff_match[] = {
+ { .compatible = "fsl,sec-v4.0-poweroff", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, of_imx_poweroff_match);
+
+static struct platform_driver imx_poweroff_driver = {
+ .probe = imx_poweroff_probe,
+ .driver = {
+ .name = "imx-snvs-poweroff",
+ .of_match_table = of_match_ptr(of_imx_poweroff_match),
+ },
+};
+
+static int __init imx_poweroff_init(void)
+{
+ return platform_driver_register(&imx_poweroff_driver);
+}
+device_initcall(imx_poweroff_init);
--
1.7.9.5

Shawn Guo

unread,
Nov 12, 2014, 6:00:06 AM11/12/14
to
On Wed, Nov 12, 2014 at 04:20:36PM +0800, Robin Gong wrote:
> Resend the patchset with the latest MAINTAINERS
> Add simple power off driver for i.mx6, including:
> - add basic imx-snvs-poweroff driver in drivers/power/reset
> - add device node in all dts files of i.mx6.
> - enable in config file
>
> Change from v3:
> - disable poweroff driver in soc level dts and enable it in board level dts
> - replace 'EIO' with 'ENODEV' while of_iomap fail.
> Change from v2:
> - remove useless included head files
> - split device binding doc from dts patch
> - add description for the case that PMIC_ON_REQ not used as external power
> control
>
> Robin Gong (3):
> ARM: dts: imx6: add pm_power_off support for i.mx6 chips
> power: reset: imx-snvs-poweroff: add power off driver for i.mx6
> ARM: configs: imx_v6_v7_defconfig: add power off driver

I'm fine with the series. But before I take the patches, I need an ACK
from DT folks on the bindings.

Shawn

Arnd Bergmann

unread,
Nov 12, 2014, 6:30:10 AM11/12/14
to
On Wednesday 12 November 2014 18:56:22 Shawn Guo wrote:
> On Wed, Nov 12, 2014 at 04:20:36PM +0800, Robin Gong wrote:
> > Resend the patchset with the latest MAINTAINERS
> > Add simple power off driver for i.mx6, including:
> > - add basic imx-snvs-poweroff driver in drivers/power/reset
> > - add device node in all dts files of i.mx6.
> > - enable in config file
> >
> > Change from v3:
> > - disable poweroff driver in soc level dts and enable it in board level dts
> > - replace 'EIO' with 'ENODEV' while of_iomap fail.
> > Change from v2:
> > - remove useless included head files
> > - split device binding doc from dts patch
> > - add description for the case that PMIC_ON_REQ not used as external power
> > control
> >
> > Robin Gong (3):
> > ARM: dts: imx6: add pm_power_off support for i.mx6 chips
> > power: reset: imx-snvs-poweroff: add power off driver for i.mx6
> > ARM: configs: imx_v6_v7_defconfig: add power off driver
>
> I'm fine with the series. But before I take the patches, I need an ACK
> from DT folks on the bindings.

Looks ok to me. Using a syscon for fsl,sec-v4.0-mon might have been nicer
than making it a simple-bus, but that decision has been made already,
so this version is a logical extension of what we have already.

Arnd

Sebastian Reichel

unread,
Nov 12, 2014, 12:00:06 PM11/12/14
to
Hi,

On Wed, Nov 12, 2014 at 04:20:38PM +0800, Robin Gong wrote:
> This driver register pm_power_off with snvs power off function. If
> your boards NOT use PMIC_ON_REQ to turn on/off external pmic, or use
> other pin to do, please disable the driver in dts, otherwise, your
> pm_power_off maybe overwrote by this driver.
>
> Signed-off-by: Robin Gong <b38...@freescale.com>

Acked-By: Sebastian Reichel <s...@kernel.org>

-- Sebastian
signature.asc

Robin Gong

unread,
Nov 12, 2014, 9:10:06 PM11/12/14
to
Thanks, Shawn.

Shawn Guo

unread,
Nov 18, 2014, 10:20:06 PM11/18/14
to
I'm not sure if it's because my DTC version is too low or you didn't
test, the DTC reports error in label name 'snvs-poweroff'. IIRC, hyphen
'-' cannot be used in label name, but underscore '_' can.

Shawn

Soeren Moch

unread,
Nov 19, 2014, 12:30:07 AM11/19/14
to
In the patch series "[PATCH v4 0/3] add power off driver for i.mx6" from
Sep 26 (what I have tested) snvs_poweroff was used. This worked as expected.

So this series "[PATCH v4 0/3] add power off driver for i.mx6" (sent on
Nov 12) apparently contains old patches and is not simply resent as
stated in the cover letter.

Soeren

Robin Gong

unread,
Nov 19, 2014, 12:50:06 AM11/19/14
to
Sorry, the patch resent wrongly...
Hi Shawn, Can you apply the first v4 patches on Sep 26, or I resend it again?

Shawn Guo

unread,
Nov 19, 2014, 1:10:06 AM11/19/14
to
On Wed, Nov 19, 2014 at 01:50:07PM +0800, Robin Gong wrote:
> Sorry, the patch resent wrongly...
> Hi Shawn, Can you apply the first v4 patches on Sep 26, or I resend it again?

I fixed it up and tested the series on my imx6q-sabresd board.

Applied the series.

Shawn

Robin Gong

unread,
Nov 21, 2014, 4:00:06 AM11/21/14
to
Thanks Shawn and Soeren. :)
0 new messages