ap325rxa.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2008 Renesas Solutions Corp.
  4. * Copyright (C) 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
  5. */
  6. #include <common.h>
  7. #include <netdev.h>
  8. #include <asm/io.h>
  9. #include <asm/processor.h>
  10. /* PRI control register */
  11. #define PRPRICR5 0xFF800048 /* LMB */
  12. #define PRPRICR5_D 0x2a
  13. /* FPGA control */
  14. #define FPGA_NAND_CTL 0xB410020C
  15. #define FPGA_NAND_RST 0x0008
  16. #define FPGA_NAND_INIT 0x0000
  17. #define FPGA_NAND_RST_WAIT 10000
  18. /* I/O port data */
  19. #define PACR_D 0x0000
  20. #define PBCR_D 0x0000
  21. #define PCCR_D 0x1000
  22. #define PDCR_D 0x0000
  23. #define PECR_D 0x0410
  24. #define PFCR_D 0xffff
  25. #define PGCR_D 0x0000
  26. #define PHCR_D 0x5011
  27. #define PJCR_D 0x4400
  28. #define PKCR_D 0x7c00
  29. #define PLCR_D 0x0000
  30. #define PMCR_D 0x0000
  31. #define PNCR_D 0x0000
  32. #define PQCR_D 0x0000
  33. #define PRCR_D 0x0000
  34. #define PSCR_D 0x0000
  35. #define PTCR_D 0x0010
  36. #define PUCR_D 0x0fff
  37. #define PVCR_D 0xffff
  38. #define PWCR_D 0x0000
  39. #define PXCR_D 0x7500
  40. #define PYCR_D 0x0000
  41. #define PZCR_D 0x5540
  42. /* Pin Function Controler data */
  43. #define PSELA_D 0x1410
  44. #define PSELB_D 0x0140
  45. #define PSELC_D 0x0000
  46. #define PSELD_D 0x0400
  47. /* I/O Buffer Hi-Z data */
  48. #define HIZCRA_D 0x0000
  49. #define HIZCRB_D 0x1000
  50. #define HIZCRC_D 0x0000
  51. #define HIZCRD_D 0x0000
  52. /* Module select reg data */
  53. #define MSELCRA_D 0x0014
  54. #define MSELCRB_D 0x0018
  55. /* Module Stop reg Data */
  56. #define MSTPCR2_D 0xFFD9F280
  57. /* CPLD loader */
  58. extern void init_cpld(void);
  59. int checkboard(void)
  60. {
  61. puts("BOARD: AP325RXA\n");
  62. return 0;
  63. }
  64. int board_init(void)
  65. {
  66. /* Pin Function Controler Init */
  67. outw(PSELA_D, PSELA);
  68. outw(PSELB_D, PSELB);
  69. outw(PSELC_D, PSELC);
  70. outw(PSELD_D, PSELD);
  71. /* I/O Buffer Hi-Z Init */
  72. outw(HIZCRA_D, HIZCRA);
  73. outw(HIZCRB_D, HIZCRB);
  74. outw(HIZCRC_D, HIZCRC);
  75. outw(HIZCRD_D, HIZCRD);
  76. /* Module select reg Init */
  77. outw(MSELCRA_D, MSELCRA);
  78. outw(MSELCRB_D, MSELCRB);
  79. /* Module Stop reg Init */
  80. outl(MSTPCR2_D, MSTPCR2);
  81. /* I/O ports */
  82. outw(PACR_D, PACR);
  83. outw(PBCR_D, PBCR);
  84. outw(PCCR_D, PCCR);
  85. outw(PDCR_D, PDCR);
  86. outw(PECR_D, PECR);
  87. outw(PFCR_D, PFCR);
  88. outw(PGCR_D, PGCR);
  89. outw(PHCR_D, PHCR);
  90. outw(PJCR_D, PJCR);
  91. outw(PKCR_D, PKCR);
  92. outw(PLCR_D, PLCR);
  93. outw(PMCR_D, PMCR);
  94. outw(PNCR_D, PNCR);
  95. outw(PQCR_D, PQCR);
  96. outw(PRCR_D, PRCR);
  97. outw(PSCR_D, PSCR);
  98. outw(PTCR_D, PTCR);
  99. outw(PUCR_D, PUCR);
  100. outw(PVCR_D, PVCR);
  101. outw(PWCR_D, PWCR);
  102. outw(PXCR_D, PXCR);
  103. outw(PYCR_D, PYCR);
  104. outw(PZCR_D, PZCR);
  105. /* PRI control register Init */
  106. outl(PRPRICR5_D, PRPRICR5);
  107. /* cpld init */
  108. init_cpld();
  109. return 0;
  110. }
  111. void led_set_state(unsigned short value)
  112. {
  113. }
  114. void ide_set_reset(int idereset)
  115. {
  116. outw(FPGA_NAND_RST, FPGA_NAND_CTL); /* NAND RESET */
  117. udelay(FPGA_NAND_RST_WAIT);
  118. outw(FPGA_NAND_INIT, FPGA_NAND_CTL);
  119. }
  120. int board_eth_init(bd_t *bis)
  121. {
  122. int rc = 0;
  123. #ifdef CONFIG_SMC911X
  124. rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
  125. #endif
  126. return rc;
  127. }