zoom2.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /*
  2. * Copyright (c) 2009 Wind River Systems, Inc.
  3. * Tom Rix <Tom.Rix@windriver.com>
  4. *
  5. * Derived from Zoom1 code by
  6. * Nishanth Menon <nm@ti.com>
  7. * Sunil Kumar <sunilsaini05@gmail.com>
  8. * Shashi Ranjan <shashiranjanmca05@gmail.com>
  9. * Richard Woodruff <r-woodruff2@ti.com>
  10. * Syed Mohammed Khasim <khasim@ti.com>
  11. *
  12. *
  13. * See file CREDITS for list of people who contributed to this
  14. * project.
  15. *
  16. * This program is free software; you can redistribute it and/or
  17. * modify it under the terms of the GNU General Public License as
  18. * published by the Free Software Foundation; either version 2 of
  19. * the License, or (at your option) any later version.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with this program; if not, write to the Free Software
  28. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  29. * MA 02111-1307 USA
  30. */
  31. #include <common.h>
  32. #include <netdev.h>
  33. #ifdef CONFIG_STATUS_LED
  34. #include <status_led.h>
  35. #endif
  36. #include <twl4030.h>
  37. #include <asm/io.h>
  38. #include <asm/arch/mmc_host_def.h>
  39. #include <asm/gpio.h>
  40. #include <asm/arch/mem.h>
  41. #include <asm/arch/mux.h>
  42. #include <asm/arch/sys_proto.h>
  43. #include <asm/mach-types.h>
  44. #include "zoom2.h"
  45. #include "zoom2_serial.h"
  46. DECLARE_GLOBAL_DATA_PTR;
  47. /*
  48. * This the the zoom2, board specific, gpmc configuration for the
  49. * quad uart on the debug board. The more general gpmc configurations
  50. * are setup at the cpu level in arch/arm/cpu/armv7/omap3/mem.c
  51. *
  52. * The details of the setting of the serial gpmc setup are not available.
  53. * The values were provided by another party.
  54. */
  55. static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = {
  56. 0x00011000,
  57. 0x001F1F01,
  58. 0x00080803,
  59. 0x1D091D09,
  60. 0x041D1F1F,
  61. 0x1D0904C4, 0
  62. };
  63. /* Used to track the revision of the board */
  64. static zoom2_revision revision = ZOOM2_REVISION_UNKNOWN;
  65. /*
  66. * Routine: zoom2_get_revision
  67. * Description: Return the revision of the Zoom2 this code is running on.
  68. */
  69. zoom2_revision zoom2_get_revision(void)
  70. {
  71. return revision;
  72. }
  73. /*
  74. * Routine: zoom2_identify
  75. * Description: Detect which version of Zoom2 we are running on.
  76. */
  77. void zoom2_identify(void)
  78. {
  79. /*
  80. * To check for production board vs beta board,
  81. * check if gpio 94 is clear.
  82. *
  83. * No way yet to check for alpha board identity.
  84. * Alpha boards were produced in very limited quantities
  85. * and they are not commonly used. They are mentioned here
  86. * only for completeness.
  87. */
  88. if (!gpio_request(94, "")) {
  89. unsigned int val;
  90. gpio_direction_input(94);
  91. val = gpio_get_value(94);
  92. gpio_free(94);
  93. if (val)
  94. revision = ZOOM2_REVISION_BETA;
  95. else
  96. revision = ZOOM2_REVISION_PRODUCTION;
  97. }
  98. printf("Board revision ");
  99. switch (revision) {
  100. case ZOOM2_REVISION_PRODUCTION:
  101. printf("Production\n");
  102. break;
  103. case ZOOM2_REVISION_BETA:
  104. printf("Beta\n");
  105. break;
  106. default:
  107. printf("Unknown\n");
  108. break;
  109. }
  110. }
  111. /*
  112. * Routine: board_init
  113. * Description: Early hardware init.
  114. */
  115. int board_init (void)
  116. {
  117. u32 *gpmc_config;
  118. gpmc_init (); /* in SRAM or SDRAM, finish GPMC */
  119. /* Configure console support on zoom2 */
  120. gpmc_config = gpmc_serial_TL16CP754C;
  121. enable_gpmc_cs_config(gpmc_config, &gpmc_cfg->cs[3],
  122. SERIAL_TL16CP754C_BASE, GPMC_SIZE_16M);
  123. /* board id for Linux */
  124. gd->bd->bi_arch_number = MACH_TYPE_OMAP_ZOOM2;
  125. /* boot param addr */
  126. gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
  127. #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
  128. status_led_set (STATUS_LED_BOOT, STATUS_LED_ON);
  129. #endif
  130. return 0;
  131. }
  132. /*
  133. * Routine: misc_init_r
  134. * Description: Configure zoom board specific configurations
  135. */
  136. int misc_init_r(void)
  137. {
  138. zoom2_identify();
  139. twl4030_power_init();
  140. twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
  141. dieid_num_r();
  142. /*
  143. * Board Reset
  144. * The board is reset by holding the the large button
  145. * on the top right side of the main board for
  146. * eight seconds.
  147. *
  148. * There are reported problems of some beta boards
  149. * continously resetting. For those boards, disable resetting.
  150. */
  151. if (ZOOM2_REVISION_PRODUCTION <= zoom2_get_revision())
  152. twl4030_power_reset_init();
  153. return 0;
  154. }
  155. /*
  156. * Routine: set_muxconf_regs
  157. * Description: Setting up the configuration Mux registers specific to the
  158. * hardware. Many pins need to be moved from protect to primary
  159. * mode.
  160. */
  161. void set_muxconf_regs (void)
  162. {
  163. /* platform specific muxes */
  164. MUX_ZOOM2 ();
  165. }
  166. #ifdef CONFIG_GENERIC_MMC
  167. int board_mmc_init(bd_t *bis)
  168. {
  169. omap_mmc_init(0);
  170. return 0;
  171. }
  172. #endif
  173. #ifdef CONFIG_CMD_NET
  174. int board_eth_init(bd_t *bis)
  175. {
  176. int rc = 0;
  177. #ifdef CONFIG_LAN91C96
  178. rc = lan91c96_initialize(0, CONFIG_LAN91C96_BASE);
  179. #endif
  180. return rc;
  181. }
  182. #endif