ebisu.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * board/renesas/ebisu/ebisu.c
  4. * This file is Ebisu board support.
  5. *
  6. * Copyright (C) 2018 Marek Vasut <marek.vasut+renesas@gmail.com>
  7. */
  8. #include <common.h>
  9. #include <malloc.h>
  10. #include <netdev.h>
  11. #include <dm.h>
  12. #include <dm/platform_data/serial_sh.h>
  13. #include <asm/processor.h>
  14. #include <asm/mach-types.h>
  15. #include <asm/io.h>
  16. #include <linux/errno.h>
  17. #include <asm/arch/sys_proto.h>
  18. #include <asm/gpio.h>
  19. #include <asm/arch/gpio.h>
  20. #include <asm/arch/rmobile.h>
  21. #include <asm/arch/rcar-mstp.h>
  22. #include <asm/arch/sh_sdhi.h>
  23. #include <i2c.h>
  24. #include <mmc.h>
  25. DECLARE_GLOBAL_DATA_PTR;
  26. void s_init(void)
  27. {
  28. }
  29. #define TMU0_MSTP125 BIT(25) /* secure */
  30. int board_early_init_f(void)
  31. {
  32. /* TMU0 */
  33. mstp_clrbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125);
  34. return 0;
  35. }
  36. int board_init(void)
  37. {
  38. /* adress of boot parameters */
  39. gd->bd->bi_boot_params = CONFIG_SYS_TEXT_BASE + 0x50000;
  40. return 0;
  41. }
  42. int dram_init(void)
  43. {
  44. if (fdtdec_setup_memory_size() != 0)
  45. return -EINVAL;
  46. return 0;
  47. }
  48. int dram_init_banksize(void)
  49. {
  50. fdtdec_setup_memory_banksize();
  51. return 0;
  52. }
  53. #define RST_BASE 0xE6160000
  54. #define RST_CA57RESCNT (RST_BASE + 0x40)
  55. #define RST_CA53RESCNT (RST_BASE + 0x44)
  56. #define RST_RSTOUTCR (RST_BASE + 0x58)
  57. #define RST_CA57_CODE 0xA5A5000F
  58. #define RST_CA53_CODE 0x5A5A000F
  59. void reset_cpu(ulong addr)
  60. {
  61. unsigned long midr, cputype;
  62. asm volatile("mrs %0, midr_el1" : "=r" (midr));
  63. cputype = (midr >> 4) & 0xfff;
  64. if (cputype == 0xd03)
  65. writel(RST_CA53_CODE, RST_CA53RESCNT);
  66. else if (cputype == 0xd07)
  67. writel(RST_CA57_CODE, RST_CA57RESCNT);
  68. else
  69. hang();
  70. }