common.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * board/renesas/rcar-gen2-common/common.c
  3. *
  4. * Copyright (C) 2013 Renesas Electronics Corporation
  5. * Copyright (C) 2013 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
  6. *
  7. * SPDX-License-Identifier: GPL-2.0
  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. /* No MSTP6 */
  30. { SMSTPCR7, MSTP7_BITS, CONFIG_SMSTP7_ENA,
  31. RMSTPCR7, MSTP7_BITS, CONFIG_RMSTP7_ENA },
  32. { SMSTPCR8, MSTP8_BITS, CONFIG_SMSTP8_ENA,
  33. RMSTPCR8, MSTP8_BITS, CONFIG_RMSTP8_ENA },
  34. { SMSTPCR9, MSTP9_BITS, CONFIG_SMSTP9_ENA,
  35. RMSTPCR9, MSTP9_BITS, CONFIG_RMSTP9_ENA },
  36. { SMSTPCR10, MSTP10_BITS, CONFIG_SMSTP10_ENA,
  37. RMSTPCR10, MSTP10_BITS, CONFIG_RMSTP10_ENA },
  38. { SMSTPCR11, MSTP11_BITS, CONFIG_SMSTP1_ENA,
  39. RMSTPCR11, MSTP11_BITS, CONFIG_RMSTP11_ENA },
  40. };
  41. void arch_preboot_os(void)
  42. {
  43. int i;
  44. /* stop TMU0 */
  45. mstp_clrbits_le32(TMU_BASE + TSTR0, TMU_BASE + TSTR0, TSTR0_STR0);
  46. /* Stop module clock */
  47. for (i = 0; i < ARRAY_SIZE(mstptbl); i++) {
  48. mstp_setclrbits_le32(mstptbl[i].s_addr, mstptbl[i].s_dis,
  49. mstptbl[i].s_ena);
  50. mstp_setclrbits_le32(mstptbl[i].r_addr, mstptbl[i].r_dis,
  51. mstptbl[i].r_ena);
  52. }
  53. }