common.c 2.0 KB

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