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