common.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * board/renesas/rcar-common/common.c
  4. *
  5. * Copyright (C) 2013 Renesas Electronics Corporation
  6. * Copyright (C) 2013 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
  7. * Copyright (C) 2015 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  8. */
  9. #include <common.h>
  10. #include <asm/io.h>
  11. #include <asm/arch/sys_proto.h>
  12. #include <asm/arch/rmobile.h>
  13. #include <asm/arch/rcar-mstp.h>
  14. #define TSTR0 0x04
  15. #define TSTR0_STR0 0x01
  16. static struct mstp_ctl mstptbl[] = {
  17. { SMSTPCR0, MSTP0_BITS, CONFIG_SMSTP0_ENA,
  18. RMSTPCR0, MSTP0_BITS, CONFIG_RMSTP0_ENA },
  19. { SMSTPCR1, MSTP1_BITS, CONFIG_SMSTP1_ENA,
  20. RMSTPCR1, MSTP1_BITS, CONFIG_RMSTP1_ENA },
  21. { SMSTPCR2, MSTP2_BITS, CONFIG_SMSTP2_ENA,
  22. RMSTPCR2, MSTP2_BITS, CONFIG_RMSTP2_ENA },
  23. { SMSTPCR3, MSTP3_BITS, CONFIG_SMSTP3_ENA,
  24. RMSTPCR3, MSTP3_BITS, CONFIG_RMSTP3_ENA },
  25. { SMSTPCR4, MSTP4_BITS, CONFIG_SMSTP4_ENA,
  26. RMSTPCR4, MSTP4_BITS, CONFIG_RMSTP4_ENA },
  27. { SMSTPCR5, MSTP5_BITS, CONFIG_SMSTP5_ENA,
  28. RMSTPCR5, MSTP5_BITS, CONFIG_RMSTP5_ENA },
  29. #ifdef CONFIG_RCAR_GEN3
  30. { SMSTPCR6, MSTP6_BITS, CONFIG_SMSTP6_ENA,
  31. RMSTPCR6, MSTP6_BITS, CONFIG_RMSTP6_ENA },
  32. #endif
  33. { SMSTPCR7, MSTP7_BITS, CONFIG_SMSTP7_ENA,
  34. RMSTPCR7, MSTP7_BITS, CONFIG_RMSTP7_ENA },
  35. { SMSTPCR8, MSTP8_BITS, CONFIG_SMSTP8_ENA,
  36. RMSTPCR8, MSTP8_BITS, CONFIG_RMSTP8_ENA },
  37. { SMSTPCR9, MSTP9_BITS, CONFIG_SMSTP9_ENA,
  38. RMSTPCR9, MSTP9_BITS, CONFIG_RMSTP9_ENA },
  39. { SMSTPCR10, MSTP10_BITS, CONFIG_SMSTP10_ENA,
  40. RMSTPCR10, MSTP10_BITS, CONFIG_RMSTP10_ENA },
  41. { SMSTPCR11, MSTP11_BITS, CONFIG_SMSTP1_ENA,
  42. RMSTPCR11, MSTP11_BITS, CONFIG_RMSTP11_ENA },
  43. };
  44. void arch_preboot_os(void)
  45. {
  46. int i;
  47. /* stop TMU0 */
  48. mstp_clrbits_le32(TMU_BASE + TSTR0, TMU_BASE + TSTR0, TSTR0_STR0);
  49. /* Stop module clock */
  50. for (i = 0; i < ARRAY_SIZE(mstptbl); i++) {
  51. mstp_setclrbits_le32((uintptr_t)mstptbl[i].s_addr,
  52. mstptbl[i].s_dis,
  53. mstptbl[i].s_ena);
  54. mstp_setclrbits_le32((uintptr_t)mstptbl[i].r_addr,
  55. mstptbl[i].r_dis,
  56. mstptbl[i].r_ena);
  57. }
  58. }