devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Frank.Li@freescale.com>
To: lznuaa@gmail.com, shawn.guo@linaro.org,
	dmitry.torokhov@gmail.com, robh+dt@kernel.org,
	a.zummo@towertech.it, p.zabel@pengutronix.de,
	alexandre.belloni@free-electrons.com
Cc: linux-arm-kernel@lists.infradead.org,
	linux-input@vger.kernel.org, rtc-linux@googlegroups.com,
	linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
	Frank Li <Frank.Li@freescale.com>
Subject: [PATCH v2 1/7] arm: imx: power-off: change to syscon to access register
Date: Wed, 20 May 2015 01:04:36 +0800	[thread overview]
Message-ID: <1432055082-28983-2-git-send-email-Frank.Li@freescale.com> (raw)
In-Reply-To: <1432055082-28983-1-git-send-email-Frank.Li@freescale.com>

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


  reply	other threads:[~2015-05-19 17:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19 17:04 [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver Frank.Li
2015-05-19 17:04 ` Frank.Li [this message]
     [not found] ` <1432055082-28983-1-git-send-email-Frank.Li-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2015-05-19 17:04   ` [PATCH v2 2/7] rtc: arm: imx: snvs: change use syscon to access register Frank.Li-KZfg59tc24xl57MIdRCFDg
2015-05-19 20:46     ` Alexandre Belloni
2015-05-19 17:04 ` [PATCH v2 3/7] Document: dt: fsl: snvs: change support syscon Frank.Li
2015-05-19 17:04 ` [PATCH v2 4/7] arm: dts: imx: update snvs to use syscon access register Frank.Li
2015-05-19 17:04 ` [PATCH v2 5/7] input: keyboard: imx: add snvs power key driver Frank.Li
2015-05-19 17:04 ` [PATCH v2 6/7] document: devicetree: input: imx: i.mx snvs power device tree bindings Frank.Li
2015-05-19 17:04 ` [PATCH v2 7/7] arm: dts: imx6sx: enable snvs power key Frank.Li
2015-05-20  1:58 ` [PATCH v2 0/7] Change snvs rtc and poweroff to use syscon add pwrkey driver Shawn Guo
2015-05-20  2:44   ` Zhi Li
2015-05-20 14:22     ` Shawn Guo
2015-05-20 14:30       ` Zhi Li
     [not found]         ` <CAHrpEqSpeMO=zLyii8qZUznP+9EAQqJ-D3O8hbXj99m+UNvpzA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-20 14:46           ` Joshua Clayton
2015-05-20 15:03             ` Zhi Li
2015-05-20 18:25   ` Russell King - ARM Linux
     [not found]     ` <20150520182540.GQ2067-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2015-05-20 18:30       ` Russell King - ARM Linux
     [not found]         ` <20150520183050.GR2067-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2015-05-20 18:44           ` Zhi Li
2015-05-20 21:56             ` Russell King - ARM Linux
2015-05-21  0:20         ` Dmitry Torokhov
2015-05-21  1:16           ` Zhi Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1432055082-28983-2-git-send-email-Frank.Li@freescale.com \
    --to=frank.li@freescale.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lznuaa@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=shawn.guo@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).