sdb_board.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * TNETV107X-EVM: Board initialization
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21. #include <common.h>
  22. #include <miiphy.h>
  23. #include <linux/mtd/nand.h>
  24. #include <asm/arch/hardware.h>
  25. #include <asm/arch/clock.h>
  26. #include <asm/io.h>
  27. #include <asm/mach-types.h>
  28. #include <asm/arch/nand_defs.h>
  29. #include <asm/arch/mux.h>
  30. DECLARE_GLOBAL_DATA_PTR;
  31. static struct async_emif_config async_emif_config[ASYNC_EMIF_NUM_CS] = {
  32. { /* CS0 */
  33. .mode = ASYNC_EMIF_MODE_NAND,
  34. .wr_setup = 5,
  35. .wr_strobe = 5,
  36. .wr_hold = 2,
  37. .rd_setup = 5,
  38. .rd_strobe = 5,
  39. .rd_hold = 2,
  40. .turn_around = 5,
  41. .width = ASYNC_EMIF_8,
  42. },
  43. { /* CS1 */
  44. .mode = ASYNC_EMIF_MODE_NOR,
  45. .wr_setup = 2,
  46. .wr_strobe = 27,
  47. .wr_hold = 4,
  48. .rd_setup = 2,
  49. .rd_strobe = 27,
  50. .rd_hold = 4,
  51. .turn_around = 2,
  52. .width = ASYNC_EMIF_PRESERVE,
  53. },
  54. { /* CS2 */
  55. .mode = ASYNC_EMIF_MODE_NOR,
  56. .wr_setup = 2,
  57. .wr_strobe = 27,
  58. .wr_hold = 4,
  59. .rd_setup = 2,
  60. .rd_strobe = 27,
  61. .rd_hold = 4,
  62. .turn_around = 2,
  63. .width = ASYNC_EMIF_PRESERVE,
  64. },
  65. { /* CS3 */
  66. .mode = ASYNC_EMIF_MODE_NOR,
  67. .wr_setup = 1,
  68. .wr_strobe = 90,
  69. .wr_hold = 3,
  70. .rd_setup = 1,
  71. .rd_strobe = 26,
  72. .rd_hold = 3,
  73. .turn_around = 1,
  74. .width = ASYNC_EMIF_8,
  75. },
  76. };
  77. static struct pll_init_data pll_config[] = {
  78. {
  79. .pll = ETH_PLL,
  80. .internal_osc = 1,
  81. .pll_freq = 500000000,
  82. .div_freq = {
  83. 5000000, 50000000, 125000000, 250000000, 25000000,
  84. },
  85. },
  86. };
  87. static const short sdio1_pins[] = {
  88. TNETV107X_PIN_SDIO1_CLK_1, TNETV107X_PIN_SDIO1_CMD_1,
  89. TNETV107X_PIN_SDIO1_DATA0_1, TNETV107X_PIN_SDIO1_DATA1_1,
  90. TNETV107X_PIN_SDIO1_DATA2_1, TNETV107X_PIN_SDIO1_DATA3_1,
  91. -1
  92. };
  93. static const short uart1_pins[] = {
  94. TNETV107X_PIN_UART1_RD, TNETV107X_PIN_UART1_TD, -1
  95. };
  96. static const short ssp_pins[] = {
  97. TNETV107X_PIN_SSP0_0, TNETV107X_PIN_SSP0_1, TNETV107X_PIN_SSP0_2,
  98. TNETV107X_PIN_SSP1_0, TNETV107X_PIN_SSP1_1, TNETV107X_PIN_SSP1_2,
  99. TNETV107X_PIN_SSP1_3, -1
  100. };
  101. int board_init(void)
  102. {
  103. #ifndef CONFIG_USE_IRQ
  104. __raw_writel(0, INTC_GLB_EN); /* Global disable */
  105. __raw_writel(0, INTC_HINT_EN); /* Disable host ints */
  106. __raw_writel(0, INTC_EN_CLR0 + 0); /* Clear enable */
  107. __raw_writel(0, INTC_EN_CLR0 + 4); /* Clear enable */
  108. __raw_writel(0, INTC_EN_CLR0 + 8); /* Clear enable */
  109. #endif
  110. gd->bd->bi_arch_number = MACH_TYPE_TNETV107X;
  111. gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;
  112. init_plls(ARRAY_SIZE(pll_config), pll_config);
  113. init_async_emif(ARRAY_SIZE(async_emif_config), async_emif_config);
  114. mux_select_pin(TNETV107X_PIN_ASR_CS3);
  115. mux_select_pins(sdio1_pins);
  116. mux_select_pins(uart1_pins);
  117. mux_select_pins(ssp_pins);
  118. return 0;
  119. }
  120. int dram_init(void)
  121. {
  122. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  123. gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
  124. return 0;
  125. }
  126. #ifdef CONFIG_NAND_DAVINCI
  127. int board_nand_init(struct nand_chip *nand)
  128. {
  129. davinci_nand_init(nand);
  130. return 0;
  131. }
  132. #endif