overo.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. * Maintainer : Steve Sakoman <steve@sakoman.com>
  3. *
  4. * Derived from Beagle Board, 3430 SDP, and OMAP3EVM code by
  5. * Richard Woodruff <r-woodruff2@ti.com>
  6. * Syed Mohammed Khasim <khasim@ti.com>
  7. * Sunil Kumar <sunilsaini05@gmail.com>
  8. * Shashi Ranjan <shashiranjanmca05@gmail.com>
  9. *
  10. * (C) Copyright 2004-2008
  11. * Texas Instruments, <www.ti.com>
  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. #include <twl4030.h>
  34. #include <asm/io.h>
  35. #include <asm/arch/mux.h>
  36. #include <asm/arch/mem.h>
  37. #include <asm/arch/sys_proto.h>
  38. #include <asm/arch/gpio.h>
  39. #include <asm/mach-types.h>
  40. #include "overo.h"
  41. #if defined(CONFIG_CMD_NET)
  42. static void setup_net_chip(void);
  43. #endif
  44. /*
  45. * Routine: board_init
  46. * Description: Early hardware init.
  47. */
  48. int board_init(void)
  49. {
  50. DECLARE_GLOBAL_DATA_PTR;
  51. gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
  52. /* board id for Linux */
  53. gd->bd->bi_arch_number = MACH_TYPE_OVERO;
  54. /* boot param addr */
  55. gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
  56. return 0;
  57. }
  58. /*
  59. * Routine: misc_init_r
  60. * Description: Configure board specific parts
  61. */
  62. int misc_init_r(void)
  63. {
  64. twl4030_power_init();
  65. twl4030_led_init();
  66. #if defined(CONFIG_CMD_NET)
  67. setup_net_chip();
  68. #endif
  69. dieid_num_r();
  70. return 0;
  71. }
  72. /*
  73. * Routine: set_muxconf_regs
  74. * Description: Setting up the configuration Mux registers specific to the
  75. * hardware. Many pins need to be moved from protect to primary
  76. * mode.
  77. */
  78. void set_muxconf_regs(void)
  79. {
  80. MUX_OVERO();
  81. }
  82. #if defined(CONFIG_CMD_NET)
  83. /*
  84. * Routine: setup_net_chip
  85. * Description: Setting up the configuration GPMC registers specific to the
  86. * Ethernet hardware.
  87. */
  88. static void setup_net_chip(void)
  89. {
  90. struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
  91. /* Configure GPMC registers */
  92. writel(NET_GPMC_CONFIG1, &gpmc_cfg->cs[5].config1);
  93. writel(NET_GPMC_CONFIG2, &gpmc_cfg->cs[5].config2);
  94. writel(NET_GPMC_CONFIG3, &gpmc_cfg->cs[5].config3);
  95. writel(NET_GPMC_CONFIG4, &gpmc_cfg->cs[5].config4);
  96. writel(NET_GPMC_CONFIG5, &gpmc_cfg->cs[5].config5);
  97. writel(NET_GPMC_CONFIG6, &gpmc_cfg->cs[5].config6);
  98. writel(NET_GPMC_CONFIG7, &gpmc_cfg->cs[5].config7);
  99. /* Enable off mode for NWE in PADCONF_GPMC_NWE register */
  100. writew(readw(&ctrl_base ->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
  101. /* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */
  102. writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe);
  103. /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */
  104. writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
  105. &ctrl_base->gpmc_nadv_ale);
  106. /* Make GPIO 64 as output pin and send a magic pulse through it */
  107. if (!omap_request_gpio(64)) {
  108. omap_set_gpio_direction(64, 0);
  109. omap_set_gpio_dataout(64, 1);
  110. udelay(1);
  111. omap_set_gpio_dataout(64, 0);
  112. udelay(1);
  113. omap_set_gpio_dataout(64, 1);
  114. }
  115. }
  116. #endif
  117. int board_eth_init(bd_t *bis)
  118. {
  119. int rc = 0;
  120. #ifdef CONFIG_SMC911X
  121. rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
  122. #endif
  123. return rc;
  124. }