zoom2.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. #ifdef CONFIG_STATUS_LED
  33. #include <status_led.h>
  34. #endif
  35. #include <asm/io.h>
  36. #include <asm/arch/gpio.h>
  37. #include <asm/arch/mem.h>
  38. #include <asm/arch/mux.h>
  39. #include <asm/arch/sys_proto.h>
  40. #include <asm/mach-types.h>
  41. #include "zoom2.h"
  42. #include "zoom2_serial.h"
  43. /*
  44. * This the the zoom2, board specific, gpmc configuration for the
  45. * quad uart on the debug board. The more general gpmc configurations
  46. * are setup at the cpu level in cpu/arm_cortexa8/omap3/mem.c
  47. *
  48. * The details of the setting of the serial gpmc setup are not available.
  49. * The values were provided by another party.
  50. */
  51. extern void enable_gpmc_config(u32 *gpmc_config, gpmc_csx_t *gpmc_cs_base,
  52. u32 base, u32 size);
  53. static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = {
  54. 0x00011000,
  55. 0x001F1F01,
  56. 0x00080803,
  57. 0x1D091D09,
  58. 0x041D1F1F,
  59. 0x1D0904C4, 0
  60. };
  61. /* Used to track the revision of the board */
  62. static zoom2_revision revision = ZOOM2_REVISION_UNKNOWN;
  63. /*
  64. * Routine: zoom2_get_revision
  65. * Description: Return the revision of the Zoom2 this code is running on.
  66. */
  67. zoom2_revision zoom2_get_revision(void)
  68. {
  69. return revision;
  70. }
  71. /*
  72. * Routine: zoom2_identify
  73. * Description: Detect which version of Zoom2 we are running on.
  74. */
  75. void zoom2_identify(void)
  76. {
  77. /*
  78. * To check for production board vs beta board,
  79. * check if gpio 94 is clear.
  80. *
  81. * No way yet to check for alpha board identity.
  82. * Alpha boards were produced in very limited quantities
  83. * and they are not commonly used. They are mentioned here
  84. * only for completeness.
  85. */
  86. if (!omap_request_gpio(94)) {
  87. unsigned int val;
  88. omap_set_gpio_direction(94, 1);
  89. val = omap_get_gpio_datain(94);
  90. omap_free_gpio(94);
  91. if (val)
  92. revision = ZOOM2_REVISION_BETA;
  93. else
  94. revision = ZOOM2_REVISION_PRODUCTION;
  95. }
  96. printf("Board revision ");
  97. switch (revision) {
  98. case ZOOM2_REVISION_PRODUCTION:
  99. printf("Production\n");
  100. break;
  101. case ZOOM2_REVISION_BETA:
  102. printf("Beta\n");
  103. break;
  104. default:
  105. printf("Unknown\n");
  106. break;
  107. }
  108. }
  109. /*
  110. * Routine: board_init
  111. * Description: Early hardware init.
  112. */
  113. int board_init (void)
  114. {
  115. DECLARE_GLOBAL_DATA_PTR;
  116. gpmc_csx_t *serial_cs_base;
  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. serial_cs_base = (gpmc_csx_t *) (GPMC_CONFIG_CS0_BASE +
  122. (3 * GPMC_CONFIG_WIDTH));
  123. enable_gpmc_config(gpmc_config,
  124. serial_cs_base,
  125. SERIAL_TL16CP754C_BASE,
  126. GPMC_SIZE_16M);
  127. /* board id for Linux */
  128. gd->bd->bi_arch_number = MACH_TYPE_OMAP_ZOOM2;
  129. /* boot param addr */
  130. gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
  131. #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
  132. status_led_set (STATUS_LED_BOOT, STATUS_LED_ON);
  133. #endif
  134. return 0;
  135. }
  136. /*
  137. * Routine: misc_init_r
  138. * Description: Configure zoom board specific configurations
  139. */
  140. int misc_init_r(void)
  141. {
  142. zoom2_identify();
  143. power_init_r();
  144. dieid_num_r();
  145. return 0;
  146. }
  147. /*
  148. * Routine: set_muxconf_regs
  149. * Description: Setting up the configuration Mux registers specific to the
  150. * hardware. Many pins need to be moved from protect to primary
  151. * mode.
  152. */
  153. void set_muxconf_regs (void)
  154. {
  155. /* platform specific muxes */
  156. MUX_ZOOM2 ();
  157. }