sdp.c 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /*
  2. * (C) Copyright 2004-2009
  3. * Texas Instruments Incorporated, <www.ti.com>
  4. * Richard Woodruff <r-woodruff2@ti.com>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. #include <common.h>
  25. #include <twl4030.h>
  26. #include <asm/io.h>
  27. #include <asm/arch/mux.h>
  28. #include <asm/arch/mem.h>
  29. #include <asm/arch/sys_proto.h>
  30. #include <asm/mach-types.h>
  31. #include "sdp.h"
  32. const omap3_sysinfo sysinfo = {
  33. DDR_DISCRETE,
  34. "OMAP3 SDP3430 board",
  35. #if defined(CONFIG_ENV_IS_IN_ONENAND)
  36. "OneNAND",
  37. #elif defined(CONFIG_ENV_IS_IN_NAND)
  38. "NAND",
  39. #else
  40. "NOR",
  41. #endif
  42. };
  43. /* Timing definitions for GPMC controller for Sibley NOR */
  44. static const u32 gpmc_sdp_nor[] = {
  45. SDP3430_NOR_GPMC_CONF1,
  46. SDP3430_NOR_GPMC_CONF2,
  47. SDP3430_NOR_GPMC_CONF3,
  48. SDP3430_NOR_GPMC_CONF4,
  49. SDP3430_NOR_GPMC_CONF5,
  50. SDP3430_NOR_GPMC_CONF6,
  51. /*CONF7- computed as params */
  52. };
  53. /*
  54. * Timing definitions for GPMC controller for Debug Board
  55. * Debug board contains access to ethernet and DIP Switch setting
  56. * information etc.
  57. */
  58. static const u32 gpmc_sdp_debug[] = {
  59. SDP3430_DEBUG_GPMC_CONF1,
  60. SDP3430_DEBUG_GPMC_CONF2,
  61. SDP3430_DEBUG_GPMC_CONF3,
  62. SDP3430_DEBUG_GPMC_CONF4,
  63. SDP3430_DEBUG_GPMC_CONF5,
  64. SDP3430_DEBUG_GPMC_CONF6,
  65. /*CONF7- computed as params */
  66. };
  67. /* Timing defintions for GPMC OneNAND */
  68. static const u32 gpmc_sdp_onenand[] = {
  69. SDP3430_ONENAND_GPMC_CONF1,
  70. SDP3430_ONENAND_GPMC_CONF2,
  71. SDP3430_ONENAND_GPMC_CONF3,
  72. SDP3430_ONENAND_GPMC_CONF4,
  73. SDP3430_ONENAND_GPMC_CONF5,
  74. SDP3430_ONENAND_GPMC_CONF6,
  75. /*CONF7- computed as params */
  76. };
  77. /* GPMC definitions for GPMC NAND */
  78. static const u32 gpmc_sdp_nand[] = {
  79. SDP3430_NAND_GPMC_CONF1,
  80. SDP3430_NAND_GPMC_CONF2,
  81. SDP3430_NAND_GPMC_CONF3,
  82. SDP3430_NAND_GPMC_CONF4,
  83. SDP3430_NAND_GPMC_CONF5,
  84. SDP3430_NAND_GPMC_CONF6,
  85. /*CONF7- computed as params */
  86. };
  87. /* gpmc_cfg is initialized by gpmc_init and we use it here */
  88. extern struct gpmc *gpmc_cfg;
  89. /**
  90. * @brief board_init - gpmc and basic setup as phase1 of boot sequence
  91. *
  92. * @return 0
  93. */
  94. int board_init(void)
  95. {
  96. DECLARE_GLOBAL_DATA_PTR;
  97. gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
  98. /* TODO: Dynamically pop out CS mapping and program accordingly */
  99. /* Configure devices for default ON ON ON settings */
  100. enable_gpmc_cs_config(gpmc_sdp_nor, &gpmc_cfg->cs[0],
  101. CONFIG_SYS_FLASH_BASE, GPMC_SIZE_128M);
  102. enable_gpmc_cs_config(gpmc_sdp_nand, &gpmc_cfg->cs[1], 0x28000000,
  103. GPMC_SIZE_16M);
  104. enable_gpmc_cs_config(gpmc_sdp_onenand, &gpmc_cfg->cs[2], 0x20000000,
  105. GPMC_SIZE_16M);
  106. enable_gpmc_cs_config(gpmc_sdp_debug, &gpmc_cfg->cs[3], DEBUG_BASE,
  107. GPMC_SIZE_16M);
  108. /* board id for Linux */
  109. gd->bd->bi_arch_number = MACH_TYPE_OMAP_3430SDP;
  110. /* boot param addr */
  111. gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
  112. return 0;
  113. }
  114. #define LAN_RESET_REGISTER (CONFIG_LAN91C96_BASE + 0x01c)
  115. #define ETH_CONTROL_REG (CONFIG_LAN91C96_BASE + 0x30b)
  116. /**
  117. * @brief ether_init Take the Ethernet controller out of reset and wait
  118. * for the EEPROM load to complete.
  119. */
  120. static void ether_init(void)
  121. {
  122. #ifdef CONFIG_DRIVER_LAN91C96
  123. int cnt = 20;
  124. writew(0x0, LAN_RESET_REGISTER);
  125. do {
  126. writew(0x1, LAN_RESET_REGISTER);
  127. udelay(100);
  128. if (cnt == 0)
  129. goto reset_err_out;
  130. --cnt;
  131. } while (readw(LAN_RESET_REGISTER) != 0x1);
  132. cnt = 20;
  133. do {
  134. writew(0x0, LAN_RESET_REGISTER);
  135. udelay(100);
  136. if (cnt == 0)
  137. goto reset_err_out;
  138. --cnt;
  139. } while (readw(LAN_RESET_REGISTER) != 0x0000);
  140. udelay(1000);
  141. writeb(readb(ETH_CONTROL_REG) & ~0x1, ETH_CONTROL_REG);
  142. udelay(1000);
  143. reset_err_out:
  144. return;
  145. #endif
  146. }
  147. /**
  148. * @brief misc_init_r - Configure SDP board specific configurations
  149. * such as power configurations, ethernet initialization as phase2 of
  150. * boot sequence
  151. *
  152. * @return 0
  153. */
  154. int misc_init_r(void)
  155. {
  156. /* Partial setup:
  157. * VAUX3 - 2.8V for DVI
  158. * VPLL1 - 1.8V
  159. * VDAC - 1.8V
  160. * and turns on LEDA/LEDB (not needed ... NOP?)
  161. */
  162. twl4030_power_init();
  163. /* FIXME finish setup:
  164. * VAUX1 - 2.8V for mainboard I/O
  165. * VAUX2 - 2.8V for camera
  166. * VAUX4 - 1.8V for OMAP3 CSI
  167. * VMMC1 - 3.15V (init, variable) for MMC1
  168. * VMMC2 - 1.85V for MMC2
  169. * VSIM - off (init, variable) for MMC1.DAT[3..7], SIM
  170. * VPLL2 - 1.8V
  171. */
  172. ether_init();
  173. return 0;
  174. }
  175. /**
  176. * @brief set_muxconf_regs Setting up the configuration Mux registers
  177. * specific to the hardware. Many pins need to be moved from protect
  178. * to primary mode.
  179. */
  180. void set_muxconf_regs(void)
  181. {
  182. /* platform specific muxes */
  183. MUX_SDP3430();
  184. }