ap325rxa.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * Copyright (C) 2008 Renesas Solutions Corp.
  3. * Copyright (C) 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  18. * MA 02111-1307 USA
  19. */
  20. #include <common.h>
  21. #include <asm/io.h>
  22. #include <asm/processor.h>
  23. /* PRI control register */
  24. #define PRPRICR5 0xFF800048 /* LMB */
  25. #define PRPRICR5_D 0x2a
  26. /* FPGA control */
  27. #define FPGA_NAND_CTL 0xB410020C
  28. #define FPGA_NAND_RST 0x0008
  29. #define FPGA_NAND_INIT 0x0000
  30. #define FPGA_NAND_RST_WAIT 10000
  31. /* I/O port data */
  32. #define PACR_D 0x0000
  33. #define PBCR_D 0x0000
  34. #define PCCR_D 0x1000
  35. #define PDCR_D 0x0000
  36. #define PECR_D 0x0410
  37. #define PFCR_D 0xffff
  38. #define PGCR_D 0x0000
  39. #define PHCR_D 0x5011
  40. #define PJCR_D 0x4400
  41. #define PKCR_D 0x7c00
  42. #define PLCR_D 0x0000
  43. #define PMCR_D 0x0000
  44. #define PNCR_D 0x0000
  45. #define PQCR_D 0x0000
  46. #define PRCR_D 0x0000
  47. #define PSCR_D 0x0000
  48. #define PTCR_D 0x0010
  49. #define PUCR_D 0x0fff
  50. #define PVCR_D 0xffff
  51. #define PWCR_D 0x0000
  52. #define PXCR_D 0x7500
  53. #define PYCR_D 0x0000
  54. #define PZCR_D 0x5540
  55. /* Pin Function Controler data */
  56. #define PSELA_D 0x1410
  57. #define PSELB_D 0x0140
  58. #define PSELC_D 0x0000
  59. #define PSELD_D 0x0400
  60. /* I/O Buffer Hi-Z data */
  61. #define HIZCRA_D 0x0000
  62. #define HIZCRB_D 0x1000
  63. #define HIZCRC_D 0x0000
  64. #define HIZCRD_D 0x0000
  65. /* Module select reg data */
  66. #define MSELCRA_D 0x0014
  67. #define MSELCRB_D 0x0018
  68. /* Module Stop reg Data */
  69. #define MSTPCR2_D 0xFFD9F280
  70. /* CPLD loader */
  71. extern void init_cpld(void);
  72. int checkboard(void)
  73. {
  74. puts("BOARD: AP325RXA\n");
  75. return 0;
  76. }
  77. int board_init(void)
  78. {
  79. /* Pin Function Controler Init */
  80. outw(PSELA_D, PSELA);
  81. outw(PSELB_D, PSELB);
  82. outw(PSELC_D, PSELC);
  83. outw(PSELD_D, PSELD);
  84. /* I/O Buffer Hi-Z Init */
  85. outw(HIZCRA_D, HIZCRA);
  86. outw(HIZCRB_D, HIZCRB);
  87. outw(HIZCRC_D, HIZCRC);
  88. outw(HIZCRD_D, HIZCRD);
  89. /* Module select reg Init */
  90. outw(MSELCRA_D, MSELCRA);
  91. outw(MSELCRB_D, MSELCRB);
  92. /* Module Stop reg Init */
  93. outl(MSTPCR2_D, MSTPCR2);
  94. /* I/O ports */
  95. outw(PACR_D, PACR);
  96. outw(PBCR_D, PBCR);
  97. outw(PCCR_D, PCCR);
  98. outw(PDCR_D, PDCR);
  99. outw(PECR_D, PECR);
  100. outw(PFCR_D, PFCR);
  101. outw(PGCR_D, PGCR);
  102. outw(PHCR_D, PHCR);
  103. outw(PJCR_D, PJCR);
  104. outw(PKCR_D, PKCR);
  105. outw(PLCR_D, PLCR);
  106. outw(PMCR_D, PMCR);
  107. outw(PNCR_D, PNCR);
  108. outw(PQCR_D, PQCR);
  109. outw(PRCR_D, PRCR);
  110. outw(PSCR_D, PSCR);
  111. outw(PTCR_D, PTCR);
  112. outw(PUCR_D, PUCR);
  113. outw(PVCR_D, PVCR);
  114. outw(PWCR_D, PWCR);
  115. outw(PXCR_D, PXCR);
  116. outw(PYCR_D, PYCR);
  117. outw(PZCR_D, PZCR);
  118. /* PRI control register Init */
  119. outl(PRPRICR5_D, PRPRICR5);
  120. /* cpld init */
  121. init_cpld();
  122. return 0;
  123. }
  124. int dram_init(void)
  125. {
  126. DECLARE_GLOBAL_DATA_PTR;
  127. gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
  128. gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
  129. printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
  130. return 0;
  131. }
  132. void led_set_state(unsigned short value)
  133. {
  134. }
  135. void ide_set_reset(int idereset)
  136. {
  137. outw(FPGA_NAND_RST, FPGA_NAND_CTL); /* NAND RESET */
  138. udelay(FPGA_NAND_RST_WAIT);
  139. outw(FPGA_NAND_INIT, FPGA_NAND_CTL);
  140. }