pm-r8a7791.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * r8a7791 Power management support
  3. *
  4. * Copyright (C) 2014 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 "r8a7791.h"
  18. #define RST 0xe6160000
  19. #define CA15BAR 0x0020
  20. #define CA15RESCNT 0x0040
  21. #define RAM 0xe6300000
  22. /* SYSC */
  23. #define SYSCIER 0x0c
  24. #define SYSCIMR 0x10
  25. #if defined(CONFIG_SMP)
  26. static void __init r8a7791_sysc_init(void)
  27. {
  28. void __iomem *base = rcar_sysc_init(0xe6180000);
  29. /* enable all interrupt sources, but do not use interrupt handler */
  30. iowrite32(0x0131000e, base + SYSCIER);
  31. iowrite32(0, base + SYSCIMR);
  32. }
  33. #else /* CONFIG_SMP */
  34. static inline void r8a7791_sysc_init(void) {}
  35. #endif /* CONFIG_SMP */
  36. void __init r8a7791_pm_init(void)
  37. {
  38. void __iomem *p;
  39. u32 bar;
  40. static int once;
  41. if (once++)
  42. return;
  43. /* RAM for jump stub, because BAR requires 256KB aligned address */
  44. p = ioremap_nocache(RAM, shmobile_boot_size);
  45. memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
  46. iounmap(p);
  47. /* setup reset vectors */
  48. p = ioremap_nocache(RST, 0x63);
  49. bar = (RAM >> 8) & 0xfffffc00;
  50. writel_relaxed(bar, p + CA15BAR);
  51. writel_relaxed(bar | 0x10, p + CA15BAR);
  52. /* enable clocks to all CPUs */
  53. writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
  54. p + CA15RESCNT);
  55. iounmap(p);
  56. r8a7791_sysc_init();
  57. shmobile_smp_apmu_suspend_init();
  58. }