8037-ls1043a-Add-support-for-reset.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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
  5. The reset in ls1043a is similar to ls2085a, but accessed in big endian,
  6. so we modify the existing driver to handle endianness, if driver probes
  7. property 'big-endian' in DTS, driver works in big endian mode,
  8. otherwise, driver works in little endian by default.
  9. Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
  10. ---
  11. drivers/power/reset/ls-reboot.c | 18 +++++++++++++++---
  12. 1 file changed, 15 insertions(+), 3 deletions(-)
  13. --- a/drivers/power/reset/ls-reboot.c
  14. +++ b/drivers/power/reset/ls-reboot.c
  15. @@ -28,6 +28,7 @@
  16. struct ls_reboot_priv {
  17. struct device *dev;
  18. u32 *rstcr;
  19. + bool is_big_endian;
  20. };
  21. static struct ls_reboot_priv *ls_reboot_priv;
  22. @@ -39,9 +40,15 @@ static void ls_reboot(enum reboot_mode r
  23. unsigned long timeout;
  24. if (ls_reboot_priv) {
  25. - val = readl(priv->rstcr);
  26. - val |= 0x02;
  27. - writel(val, priv->rstcr);
  28. + if (priv->is_big_endian) {
  29. + val = ioread32be(priv->rstcr);
  30. + val |= 0x02;
  31. + iowrite32be(val, priv->rstcr);
  32. + } else {
  33. + val = readl(priv->rstcr);
  34. + val |= 0x02;
  35. + writel(val, priv->rstcr);
  36. + }
  37. }
  38. timeout = jiffies + HZ;
  39. @@ -66,6 +73,11 @@ static int ls_reboot_probe(struct platfo
  40. return -ENODEV;
  41. }
  42. + if (of_get_property(pdev->dev.of_node, "big-endian", NULL))
  43. + ls_reboot_priv->is_big_endian = true;
  44. + else
  45. + ls_reboot_priv->is_big_endian = false;
  46. +
  47. ls_reboot_priv->dev = &pdev->dev;
  48. arm_pm_restart = ls_reboot;