1 From 5d7f8473e3472c16703bf5692d0b13f47d08c70a Mon Sep 17 00:00:00 2001
2 From: Shaohui Xie <Shaohui.Xie@freescale.com>
3 Date: Fri, 22 Jan 2016 12:01:28 +0800
4 Subject: [PATCH 37/70] ls1043a: Add support for reset
6 The reset in ls1043a is similar to ls2085a, but accessed in big endian,
7 so we modify the existing driver to handle endianness, if driver probes
8 property 'big-endian' in DTS, driver works in big endian mode,
9 otherwise, driver works in little endian by default.
11 Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
13 drivers/power/reset/ls-reboot.c | 18 +++++++++++++++---
14 1 file changed, 15 insertions(+), 3 deletions(-)
16 --- a/drivers/power/reset/ls-reboot.c
17 +++ b/drivers/power/reset/ls-reboot.c
19 struct ls_reboot_priv {
25 static struct ls_reboot_priv *ls_reboot_priv;
26 @@ -39,9 +40,15 @@ static void ls_reboot(enum reboot_mode r
27 unsigned long timeout;
30 - val = readl(priv->rstcr);
32 - writel(val, priv->rstcr);
33 + if (priv->is_big_endian) {
34 + val = ioread32be(priv->rstcr);
36 + iowrite32be(val, priv->rstcr);
38 + val = readl(priv->rstcr);
40 + writel(val, priv->rstcr);
44 timeout = jiffies + HZ;
45 @@ -66,6 +73,11 @@ static int ls_reboot_probe(struct platfo
49 + if (of_get_property(pdev->dev.of_node, "big-endian", NULL))
50 + ls_reboot_priv->is_big_endian = true;
52 + ls_reboot_priv->is_big_endian = false;
54 ls_reboot_priv->dev = &pdev->dev;
56 arm_pm_restart = ls_reboot;