setup-r8a7740.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * R8A7740 processor support
  3. *
  4. * Copyright (C) 2011 Renesas Solutions Corp.
  5. * Copyright (C) 2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; version 2 of the License.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/init.h>
  18. #include <linux/io.h>
  19. #include <linux/irqchip.h>
  20. #include <linux/irqchip/arm-gic.h>
  21. #include <asm/mach/map.h>
  22. #include <asm/mach/arch.h>
  23. #include <asm/mach/time.h>
  24. #include "common.h"
  25. /*
  26. * r8a7740 chip has lasting errata on MERAM buffer.
  27. * this is work-around for it.
  28. * see
  29. * "Media RAM (MERAM)" on r8a7740 documentation
  30. */
  31. #define MEBUFCNTR 0xFE950098
  32. static void __init r8a7740_meram_workaround(void)
  33. {
  34. void __iomem *reg;
  35. reg = ioremap_nocache(MEBUFCNTR, 4);
  36. if (reg) {
  37. iowrite32(0x01600164, reg);
  38. iounmap(reg);
  39. }
  40. }
  41. static void __init r8a7740_init_irq_of(void)
  42. {
  43. void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10);
  44. void __iomem *intc_msk_base = ioremap_nocache(0xe6900040, 0x10);
  45. void __iomem *pfc_inta_ctrl = ioremap_nocache(0xe605807c, 0x4);
  46. irqchip_init();
  47. /* route signals to GIC */
  48. iowrite32(0x0, pfc_inta_ctrl);
  49. /*
  50. * To mask the shared interrupt to SPI 149 we must ensure to set
  51. * PRIO *and* MASK. Else we run into IRQ floods when registering
  52. * the intc_irqpin devices
  53. */
  54. iowrite32(0x0, intc_prio_base + 0x0);
  55. iowrite32(0x0, intc_prio_base + 0x4);
  56. iowrite32(0x0, intc_prio_base + 0x8);
  57. iowrite32(0x0, intc_prio_base + 0xc);
  58. iowrite8(0xff, intc_msk_base + 0x0);
  59. iowrite8(0xff, intc_msk_base + 0x4);
  60. iowrite8(0xff, intc_msk_base + 0x8);
  61. iowrite8(0xff, intc_msk_base + 0xc);
  62. iounmap(intc_prio_base);
  63. iounmap(intc_msk_base);
  64. iounmap(pfc_inta_ctrl);
  65. }
  66. static void __init r8a7740_generic_init(void)
  67. {
  68. r8a7740_meram_workaround();
  69. }
  70. static const char *const r8a7740_boards_compat_dt[] __initconst = {
  71. "renesas,r8a7740",
  72. NULL,
  73. };
  74. DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")
  75. .l2c_aux_val = 0,
  76. .l2c_aux_mask = ~0,
  77. .init_early = shmobile_init_delay,
  78. .init_irq = r8a7740_init_irq_of,
  79. .init_machine = r8a7740_generic_init,
  80. .init_late = shmobile_init_late,
  81. .dt_compat = r8a7740_boards_compat_dt,
  82. MACHINE_END