sdp.c 5.2 KB

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