evm.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * (C) Copyright 2004-2008
  3. * Texas Instruments, <www.ti.com>
  4. *
  5. * Author :
  6. * Manikandan Pillai <mani.pillai@ti.com>
  7. *
  8. * Derived from Beagle Board and 3430 SDP code by
  9. * Richard Woodruff <r-woodruff2@ti.com>
  10. * Syed Mohammed Khasim <khasim@ti.com>
  11. *
  12. * See file CREDITS for list of people who contributed to this
  13. * project.
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License as
  17. * published by the Free Software Foundation; either version 2 of
  18. * the License, or (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, write to the Free Software
  27. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  28. * MA 02111-1307 USA
  29. */
  30. #include <common.h>
  31. #include <asm/io.h>
  32. #include <asm/arch/mem.h>
  33. #include <asm/arch/mux.h>
  34. #include <asm/arch/sys_proto.h>
  35. #include <i2c.h>
  36. #include <asm/mach-types.h>
  37. #include "evm.h"
  38. /******************************************************************************
  39. * Routine: board_init
  40. * Description: Early hardware init.
  41. *****************************************************************************/
  42. int board_init(void)
  43. {
  44. DECLARE_GLOBAL_DATA_PTR;
  45. gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
  46. /* board id for Linux */
  47. gd->bd->bi_arch_number = MACH_TYPE_OMAP3EVM;
  48. /* boot param addr */
  49. gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
  50. return 0;
  51. }
  52. /******************************************************************************
  53. * Routine: misc_init_r
  54. * Description: Init ethernet (done here so udelay works)
  55. *****************************************************************************/
  56. int misc_init_r(void)
  57. {
  58. #ifdef CONFIG_DRIVER_OMAP34XX_I2C
  59. i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
  60. #endif
  61. #if defined(CONFIG_CMD_NET)
  62. setup_net_chip();
  63. #endif
  64. return 0;
  65. }
  66. /******************************************************************************
  67. * Routine: set_muxconf_regs
  68. * Description: Setting up the configuration Mux registers specific to the
  69. * hardware. Many pins need to be moved from protect to primary
  70. * mode.
  71. *****************************************************************************/
  72. void set_muxconf_regs(void)
  73. {
  74. MUX_EVM();
  75. }
  76. /******************************************************************************
  77. * Routine: setup_net_chip
  78. * Description: Setting up the configuration GPMC registers specific to the
  79. * Ethernet hardware.
  80. *****************************************************************************/
  81. static void setup_net_chip(void)
  82. {
  83. gpio_t *gpio3_base = (gpio_t *)OMAP34XX_GPIO3_BASE;
  84. gpmc_csx_t *gpmc_cs6_base = (gpmc_csx_t *)GPMC_CONFIG_CS6_BASE;
  85. ctrl_t *ctrl_base = (ctrl_t *)OMAP34XX_CTRL_BASE;
  86. /* Configure GPMC registers */
  87. writel(NET_GPMC_CONFIG1, &gpmc_cs6_base->config1);
  88. writel(NET_GPMC_CONFIG2, &gpmc_cs6_base->config2);
  89. writel(NET_GPMC_CONFIG3, &gpmc_cs6_base->config3);
  90. writel(NET_GPMC_CONFIG4, &gpmc_cs6_base->config4);
  91. writel(NET_GPMC_CONFIG5, &gpmc_cs6_base->config5);
  92. writel(NET_GPMC_CONFIG6, &gpmc_cs6_base->config6);
  93. writel(NET_GPMC_CONFIG7, &gpmc_cs6_base->config7);
  94. /* Enable off mode for NWE in PADCONF_GPMC_NWE register */
  95. writew(readw(&ctrl_base ->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
  96. /* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */
  97. writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe);
  98. /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */
  99. writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
  100. &ctrl_base->gpmc_nadv_ale);
  101. /* Make GPIO 64 as output pin */
  102. writel(readl(&gpio3_base->oe) & ~(GPIO0), &gpio3_base->oe);
  103. /* Now send a pulse on the GPIO pin */
  104. writel(GPIO0, &gpio3_base->setdataout);
  105. udelay(1);
  106. writel(GPIO0, &gpio3_base->cleardataout);
  107. udelay(1);
  108. writel(GPIO0, &gpio3_base->setdataout);
  109. }