ap325rxa.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 <netdev.h>
  22. #include <asm/io.h>
  23. #include <asm/processor.h>
  24. DECLARE_GLOBAL_DATA_PTR;
  25. /* PRI control register */
  26. #define PRPRICR5 0xFF800048 /* LMB */
  27. #define PRPRICR5_D 0x2a
  28. /* FPGA control */
  29. #define FPGA_NAND_CTL 0xB410020C
  30. #define FPGA_NAND_RST 0x0008
  31. #define FPGA_NAND_INIT 0x0000
  32. #define FPGA_NAND_RST_WAIT 10000
  33. /* I/O port data */
  34. #define PACR_D 0x0000
  35. #define PBCR_D 0x0000
  36. #define PCCR_D 0x1000
  37. #define PDCR_D 0x0000
  38. #define PECR_D 0x0410
  39. #define PFCR_D 0xffff
  40. #define PGCR_D 0x0000
  41. #define PHCR_D 0x5011
  42. #define PJCR_D 0x4400
  43. #define PKCR_D 0x7c00
  44. #define PLCR_D 0x0000
  45. #define PMCR_D 0x0000
  46. #define PNCR_D 0x0000
  47. #define PQCR_D 0x0000
  48. #define PRCR_D 0x0000
  49. #define PSCR_D 0x0000
  50. #define PTCR_D 0x0010
  51. #define PUCR_D 0x0fff
  52. #define PVCR_D 0xffff
  53. #define PWCR_D 0x0000
  54. #define PXCR_D 0x7500
  55. #define PYCR_D 0x0000
  56. #define PZCR_D 0x5540
  57. /* Pin Function Controler data */
  58. #define PSELA_D 0x1410
  59. #define PSELB_D 0x0140
  60. #define PSELC_D 0x0000
  61. #define PSELD_D 0x0400
  62. /* I/O Buffer Hi-Z data */
  63. #define HIZCRA_D 0x0000
  64. #define HIZCRB_D 0x1000
  65. #define HIZCRC_D 0x0000
  66. #define HIZCRD_D 0x0000
  67. /* Module select reg data */
  68. #define MSELCRA_D 0x0014
  69. #define MSELCRB_D 0x0018
  70. /* Module Stop reg Data */
  71. #define MSTPCR2_D 0xFFD9F280
  72. /* CPLD loader */
  73. extern void init_cpld(void);
  74. int checkboard(void)
  75. {
  76. puts("BOARD: AP325RXA\n");
  77. return 0;
  78. }
  79. int board_init(void)
  80. {
  81. /* Pin Function Controler Init */
  82. outw(PSELA_D, PSELA);
  83. outw(PSELB_D, PSELB);
  84. outw(PSELC_D, PSELC);
  85. outw(PSELD_D, PSELD);
  86. /* I/O Buffer Hi-Z Init */
  87. outw(HIZCRA_D, HIZCRA);
  88. outw(HIZCRB_D, HIZCRB);
  89. outw(HIZCRC_D, HIZCRC);
  90. outw(HIZCRD_D, HIZCRD);
  91. /* Module select reg Init */
  92. outw(MSELCRA_D, MSELCRA);
  93. outw(MSELCRB_D, MSELCRB);
  94. /* Module Stop reg Init */
  95. outl(MSTPCR2_D, MSTPCR2);
  96. /* I/O ports */
  97. outw(PACR_D, PACR);
  98. outw(PBCR_D, PBCR);
  99. outw(PCCR_D, PCCR);
  100. outw(PDCR_D, PDCR);
  101. outw(PECR_D, PECR);
  102. outw(PFCR_D, PFCR);
  103. outw(PGCR_D, PGCR);
  104. outw(PHCR_D, PHCR);
  105. outw(PJCR_D, PJCR);
  106. outw(PKCR_D, PKCR);
  107. outw(PLCR_D, PLCR);
  108. outw(PMCR_D, PMCR);
  109. outw(PNCR_D, PNCR);
  110. outw(PQCR_D, PQCR);
  111. outw(PRCR_D, PRCR);
  112. outw(PSCR_D, PSCR);
  113. outw(PTCR_D, PTCR);
  114. outw(PUCR_D, PUCR);
  115. outw(PVCR_D, PVCR);
  116. outw(PWCR_D, PWCR);
  117. outw(PXCR_D, PXCR);
  118. outw(PYCR_D, PYCR);
  119. outw(PZCR_D, PZCR);
  120. /* PRI control register Init */
  121. outl(PRPRICR5_D, PRPRICR5);
  122. /* cpld init */
  123. init_cpld();
  124. return 0;
  125. }
  126. int dram_init(void)
  127. {
  128. gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
  129. gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
  130. printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
  131. return 0;
  132. }
  133. void led_set_state(unsigned short value)
  134. {
  135. }
  136. void ide_set_reset(int idereset)
  137. {
  138. outw(FPGA_NAND_RST, FPGA_NAND_CTL); /* NAND RESET */
  139. udelay(FPGA_NAND_RST_WAIT);
  140. outw(FPGA_NAND_INIT, FPGA_NAND_CTL);
  141. }
  142. int board_eth_init(bd_t *bis)
  143. {
  144. int rc = 0;
  145. #ifdef CONFIG_SMC911X
  146. rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
  147. #endif
  148. return rc;
  149. }