devkit8000.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*
  2. * (C) Copyright 2004-2008
  3. * Texas Instruments, <www.ti.com>
  4. *
  5. * Author :
  6. * Sunil Kumar <sunilsaini05@gmail.com>
  7. * Shashi Ranjan <shashiranjanmca05@gmail.com>
  8. *
  9. * (C) Copyright 2009
  10. * Frederik Kriewitz <frederik@kriewitz.eu>
  11. *
  12. * Derived from Beagle Board and 3430 SDP code by
  13. * Richard Woodruff <r-woodruff2@ti.com>
  14. * Syed Mohammed Khasim <khasim@ti.com>
  15. *
  16. *
  17. * See file CREDITS for list of people who contributed to this
  18. * project.
  19. *
  20. * This program is free software; you can redistribute it and/or
  21. * modify it under the terms of the GNU General Public License as
  22. * published by the Free Software Foundation; either version 2 of
  23. * the License, or (at your option) any later version.
  24. *
  25. * This program is distributed in the hope that it will be useful,
  26. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  27. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  28. * GNU General Public License for more details.
  29. *
  30. * You should have received a copy of the GNU General Public License
  31. * along with this program; if not, write to the Free Software
  32. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  33. * MA 02111-1307 USA
  34. */
  35. #include <common.h>
  36. #include <twl4030.h>
  37. #include <asm/io.h>
  38. #include <asm/arch/mmc_host_def.h>
  39. #include <asm/arch/mux.h>
  40. #include <asm/arch/sys_proto.h>
  41. #include <asm/arch/mem.h>
  42. #include <asm/mach-types.h>
  43. #include "devkit8000.h"
  44. #ifdef CONFIG_DRIVER_DM9000
  45. #include <net.h>
  46. #include <netdev.h>
  47. #endif
  48. DECLARE_GLOBAL_DATA_PTR;
  49. static u32 gpmc_net_config[GPMC_MAX_REG] = {
  50. NET_GPMC_CONFIG1,
  51. NET_GPMC_CONFIG2,
  52. NET_GPMC_CONFIG3,
  53. NET_GPMC_CONFIG4,
  54. NET_GPMC_CONFIG5,
  55. NET_GPMC_CONFIG6,
  56. 0
  57. };
  58. /*
  59. * Routine: board_init
  60. * Description: Early hardware init.
  61. */
  62. int board_init(void)
  63. {
  64. gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
  65. /* board id for Linux */
  66. gd->bd->bi_arch_number = MACH_TYPE_DEVKIT8000;
  67. /* boot param addr */
  68. gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
  69. return 0;
  70. }
  71. /*
  72. * Routine: misc_init_r
  73. * Description: Configure board specific parts
  74. */
  75. int misc_init_r(void)
  76. {
  77. struct ctrl_id *id_base = (struct ctrl_id *)OMAP34XX_ID_L4_IO_BASE;
  78. #ifdef CONFIG_DRIVER_DM9000
  79. uchar enetaddr[6];
  80. u32 die_id_0;
  81. #endif
  82. twl4030_power_init();
  83. #ifdef CONFIG_TWL4030_LED
  84. twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
  85. #endif
  86. #ifdef CONFIG_DRIVER_DM9000
  87. /* Configure GPMC registers for DM9000 */
  88. enable_gpmc_cs_config(gpmc_net_config, &gpmc_cfg->cs[6],
  89. CONFIG_DM9000_BASE, GPMC_SIZE_16M);
  90. /* Use OMAP DIE_ID as MAC address */
  91. if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
  92. printf("ethaddr not set, using Die ID\n");
  93. die_id_0 = readl(&id_base->die_id_0);
  94. enetaddr[0] = 0x02; /* locally administered */
  95. enetaddr[1] = readl(&id_base->die_id_1) & 0xff;
  96. enetaddr[2] = (die_id_0 & 0xff000000) >> 24;
  97. enetaddr[3] = (die_id_0 & 0x00ff0000) >> 16;
  98. enetaddr[4] = (die_id_0 & 0x0000ff00) >> 8;
  99. enetaddr[5] = (die_id_0 & 0x000000ff);
  100. eth_setenv_enetaddr("ethaddr", enetaddr);
  101. }
  102. #endif
  103. dieid_num_r();
  104. return 0;
  105. }
  106. /*
  107. * Routine: set_muxconf_regs
  108. * Description: Setting up the configuration Mux registers specific to the
  109. * hardware. Many pins need to be moved from protect to primary
  110. * mode.
  111. */
  112. void set_muxconf_regs(void)
  113. {
  114. MUX_DEVKIT8000();
  115. }
  116. #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
  117. int board_mmc_init(bd_t *bis)
  118. {
  119. omap_mmc_init(0);
  120. return 0;
  121. }
  122. #endif
  123. #if defined(CONFIG_DRIVER_DM9000) & !defined(CONFIG_SPL_BUILD)
  124. /*
  125. * Routine: board_eth_init
  126. * Description: Setting up the Ethernet hardware.
  127. */
  128. int board_eth_init(bd_t *bis)
  129. {
  130. return dm9000_initialize(bis);
  131. }
  132. #endif
  133. /*
  134. * Routine: get_board_mem_timings
  135. * Description: If we use SPL then there is no x-loader nor config header
  136. * so we have to setup the DDR timings ourself on the first bank. This
  137. * provides the timing values back to the function that configures
  138. * the memory. We have either one or two banks of 128MB DDR.
  139. */
  140. void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
  141. u32 *mr)
  142. {
  143. /* General SDRC config */
  144. *mcfg = MICRON_V_MCFG_165(128 << 20);
  145. *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
  146. /* AC timings */
  147. *ctrla = MICRON_V_ACTIMA_165;
  148. *ctrlb = MICRON_V_ACTIMB_165;
  149. *mr = MICRON_V_MR_165;
  150. }