@@ -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;
}