pm-r8a7790.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * r8a7790 Power management support
  3. *
  4. * Copyright (C) 2013 Renesas Electronics Corporation
  5. * Copyright (C) 2011 Renesas Solutions Corp.
  6. * Copyright (C) 2011 Magnus Damm
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file "COPYING" in the main directory of this archive
  10. * for more details.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/smp.h>
  14. #include <asm/io.h>
  15. #include "common.h"
  16. #include "pm-rcar.h"
  17. #include "r8a7790.h"
  18. /* RST */
  19. #define RST 0xe6160000
  20. #define CA15BAR 0x0020
  21. #define CA7BAR 0x0030
  22. #define CA15RESCNT 0x0040
  23. #define CA7RESCNT 0x0044
  24. /* On-chip RAM */
  25. #define MERAM 0xe8080000
  26. /* SYSC */
  27. #define SYSCIER 0x0c
  28. #define SYSCIMR 0x10
  29. #if defined(CONFIG_SMP)
  30. static void __init r8a7790_sysc_init(void)
  31. {
  32. void __iomem *base = rcar_sysc_init(0xe6180000);
  33. /* enable all interrupt sources, but do not use interrupt handler */
  34. iowrite32(0x0131000e, base + SYSCIER);
  35. iowrite32(0, base + SYSCIMR);
  36. }
  37. #else /* CONFIG_SMP */
  38. static inline void r8a7790_sysc_init(void) {}
  39. #endif /* CONFIG_SMP */
  40. void __init r8a7790_pm_init(void)
  41. {
  42. void __iomem *p;
  43. u32 bar;
  44. static int once;
  45. if (once++)
  46. return;
  47. /* MERAM for jump stub, because BAR requires 256KB aligned address */
  48. p = ioremap_nocache(MERAM, shmobile_boot_size);
  49. memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
  50. iounmap(p);
  51. /* setup reset vectors */
  52. p = ioremap_nocache(RST, 0x63);
  53. bar = (MERAM >> 8) & 0xfffffc00;
  54. writel_relaxed(bar, p + CA15BAR);
  55. writel_relaxed(bar, p + CA7BAR);
  56. writel_relaxed(bar | 0x10, p + CA15BAR);
  57. writel_relaxed(bar | 0x10, p + CA7BAR);
  58. /* de-assert reset for all CPUs */
  59. writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
  60. p + CA15RESCNT);
  61. writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | 0x5a5a0000,
  62. p + CA7RESCNT);
  63. iounmap(p);
  64. r8a7790_sysc_init();
  65. shmobile_smp_apmu_suspend_init();
  66. }