sdp.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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 <netdev.h>
  26. #include <twl4030.h>
  27. #include <asm/io.h>
  28. #include <asm/arch/mmc_host_def.h>
  29. #include <asm/arch/mux.h>
  30. #include <asm/arch/mem.h>
  31. #include <asm/arch/sys_proto.h>
  32. #include <asm/mach-types.h>
  33. #include "sdp.h"
  34. DECLARE_GLOBAL_DATA_PTR;
  35. const omap3_sysinfo sysinfo = {
  36. DDR_DISCRETE,
  37. "OMAP3 SDP3430 board",
  38. #if defined(CONFIG_ENV_IS_IN_ONENAND)
  39. "OneNAND",
  40. #elif defined(CONFIG_ENV_IS_IN_NAND)
  41. "NAND",
  42. #else
  43. "NOR",
  44. #endif
  45. };
  46. /* Timing definitions for GPMC controller for Sibley NOR */
  47. static const u32 gpmc_sdp_nor[] = {
  48. SDP3430_NOR_GPMC_CONF1,
  49. SDP3430_NOR_GPMC_CONF2,
  50. SDP3430_NOR_GPMC_CONF3,
  51. SDP3430_NOR_GPMC_CONF4,
  52. SDP3430_NOR_GPMC_CONF5,
  53. SDP3430_NOR_GPMC_CONF6,
  54. /*CONF7- computed as params */
  55. };
  56. /*
  57. * Timing definitions for GPMC controller for Debug Board
  58. * Debug board contains access to ethernet and DIP Switch setting
  59. * information etc.
  60. */
  61. static const u32 gpmc_sdp_debug[] = {
  62. SDP3430_DEBUG_GPMC_CONF1,
  63. SDP3430_DEBUG_GPMC_CONF2,
  64. SDP3430_DEBUG_GPMC_CONF3,
  65. SDP3430_DEBUG_GPMC_CONF4,
  66. SDP3430_DEBUG_GPMC_CONF5,
  67. SDP3430_DEBUG_GPMC_CONF6,
  68. /*CONF7- computed as params */
  69. };
  70. /* Timing defintions for GPMC OneNAND */
  71. static const u32 gpmc_sdp_onenand[] = {
  72. SDP3430_ONENAND_GPMC_CONF1,
  73. SDP3430_ONENAND_GPMC_CONF2,
  74. SDP3430_ONENAND_GPMC_CONF3,
  75. SDP3430_ONENAND_GPMC_CONF4,
  76. SDP3430_ONENAND_GPMC_CONF5,
  77. SDP3430_ONENAND_GPMC_CONF6,
  78. /*CONF7- computed as params */
  79. };
  80. /* GPMC definitions for GPMC NAND */
  81. static const u32 gpmc_sdp_nand[] = {
  82. SDP3430_NAND_GPMC_CONF1,
  83. SDP3430_NAND_GPMC_CONF2,
  84. SDP3430_NAND_GPMC_CONF3,
  85. SDP3430_NAND_GPMC_CONF4,
  86. SDP3430_NAND_GPMC_CONF5,
  87. SDP3430_NAND_GPMC_CONF6,
  88. /*CONF7- computed as params */
  89. };
  90. /* gpmc_cfg is initialized by gpmc_init and we use it here */
  91. extern struct gpmc *gpmc_cfg;
  92. /**
  93. * @brief board_init - gpmc and basic setup as phase1 of boot sequence
  94. *
  95. * @return 0
  96. */
  97. int board_init(void)
  98. {
  99. gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
  100. /* TODO: Dynamically pop out CS mapping and program accordingly */
  101. /* Configure devices for default ON ON ON settings */
  102. enable_gpmc_cs_config(gpmc_sdp_nor, &gpmc_cfg->cs[0],
  103. CONFIG_SYS_FLASH_BASE, GPMC_SIZE_128M);
  104. enable_gpmc_cs_config(gpmc_sdp_nand, &gpmc_cfg->cs[1], 0x28000000,
  105. GPMC_SIZE_16M);
  106. enable_gpmc_cs_config(gpmc_sdp_onenand, &gpmc_cfg->cs[2], 0x20000000,
  107. GPMC_SIZE_16M);
  108. enable_gpmc_cs_config(gpmc_sdp_debug, &gpmc_cfg->cs[3], DEBUG_BASE,
  109. GPMC_SIZE_16M);
  110. /* board id for Linux */
  111. gd->bd->bi_arch_number = MACH_TYPE_OMAP_3430SDP;
  112. /* boot param addr */
  113. gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
  114. return 0;
  115. }
  116. #define LAN_RESET_REGISTER (CONFIG_LAN91C96_BASE + 0x01c)
  117. #define ETH_CONTROL_REG (CONFIG_LAN91C96_BASE + 0x30b)
  118. /**
  119. * @brief board_eth_init Take the Ethernet controller out of reset and wait
  120. * for the EEPROM load to complete.
  121. */
  122. int board_eth_init(bd_t *bis)
  123. {
  124. int rc = 0;
  125. #ifdef CONFIG_LAN91C96
  126. int cnt = 20;
  127. writew(0x0, LAN_RESET_REGISTER);
  128. do {
  129. writew(0x1, LAN_RESET_REGISTER);
  130. udelay(100);
  131. if (cnt == 0)
  132. goto reset_err_out;
  133. --cnt;
  134. } while (readw(LAN_RESET_REGISTER) != 0x1);
  135. cnt = 20;
  136. do {
  137. writew(0x0, LAN_RESET_REGISTER);
  138. udelay(100);
  139. if (cnt == 0)
  140. goto reset_err_out;
  141. --cnt;
  142. } while (readw(LAN_RESET_REGISTER) != 0x0000);
  143. udelay(1000);
  144. writeb(readb(ETH_CONTROL_REG) & ~0x1, ETH_CONTROL_REG);
  145. udelay(1000);
  146. rc = lan91c96_initialize(0, CONFIG_LAN91C96_BASE);
  147. reset_err_out:
  148. #endif
  149. return rc;
  150. }
  151. /**
  152. * @brief misc_init_r - Configure SDP board specific configurations
  153. * such as power configurations, ethernet initialization as phase2 of
  154. * boot sequence
  155. *
  156. * @return 0
  157. */
  158. int misc_init_r(void)
  159. {
  160. /* Partial setup:
  161. * VAUX3 - 2.8V for DVI
  162. * VPLL1 - 1.8V
  163. * VDAC - 1.8V
  164. * and turns on LEDA/LEDB (not needed ... NOP?)
  165. */
  166. twl4030_power_init();
  167. /* FIXME finish setup:
  168. * VAUX1 - 2.8V for mainboard I/O
  169. * VAUX2 - 2.8V for camera
  170. * VAUX4 - 1.8V for OMAP3 CSI
  171. * VMMC1 - 3.15V (init, variable) for MMC1
  172. * VMMC2 - 1.85V for MMC2
  173. * VSIM - off (init, variable) for MMC1.DAT[3..7], SIM
  174. * VPLL2 - 1.8V
  175. */
  176. return 0;
  177. }
  178. /**
  179. * @brief set_muxconf_regs Setting up the configuration Mux registers
  180. * specific to the hardware. Many pins need to be moved from protect
  181. * to primary mode.
  182. */
  183. void set_muxconf_regs(void)
  184. {
  185. /* platform specific muxes */
  186. MUX_SDP3430();
  187. }
  188. #ifdef CONFIG_GENERIC_MMC
  189. int board_mmc_init(bd_t *bis)
  190. {
  191. omap_mmc_init(0);
  192. return 0;
  193. }
  194. #endif