igep0020.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. * (C) Copyright 2010
  3. * ISEE 2007 SL, <www.iseebcn.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <netdev.h>
  25. #include <twl4030.h>
  26. #include <asm/io.h>
  27. #include <asm/arch/gpio.h>
  28. #include <asm/arch/mem.h>
  29. #include <asm/arch/mmc_host_def.h>
  30. #include <asm/arch/mux.h>
  31. #include <asm/arch/sys_proto.h>
  32. #include <asm/mach-types.h>
  33. #include "igep0020.h"
  34. DECLARE_GLOBAL_DATA_PTR;
  35. /* GPMC definitions for LAN9221 chips */
  36. static const u32 gpmc_lan_config[] = {
  37. NET_LAN9221_GPMC_CONFIG1,
  38. NET_LAN9221_GPMC_CONFIG2,
  39. NET_LAN9221_GPMC_CONFIG3,
  40. NET_LAN9221_GPMC_CONFIG4,
  41. NET_LAN9221_GPMC_CONFIG5,
  42. NET_LAN9221_GPMC_CONFIG6,
  43. };
  44. /*
  45. * Routine: board_init
  46. * Description: Early hardware init.
  47. */
  48. int board_init(void)
  49. {
  50. gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
  51. /* board id for Linux */
  52. gd->bd->bi_arch_number = MACH_TYPE_IGEP0020;
  53. /* boot param addr */
  54. gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
  55. return 0;
  56. }
  57. /*
  58. * Routine: setup_net_chip
  59. * Description: Setting up the configuration GPMC registers specific to the
  60. * Ethernet hardware.
  61. */
  62. #if defined(CONFIG_CMD_NET)
  63. static void setup_net_chip(void)
  64. {
  65. struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
  66. enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5], 0x2C000000,
  67. GPMC_SIZE_16M);
  68. /* Enable off mode for NWE in PADCONF_GPMC_NWE register */
  69. writew(readw(&ctrl_base->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
  70. /* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */
  71. writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe);
  72. /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */
  73. writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
  74. &ctrl_base->gpmc_nadv_ale);
  75. /* Make GPIO 64 as output pin and send a magic pulse through it */
  76. if (!omap_request_gpio(64)) {
  77. omap_set_gpio_direction(64, 0);
  78. omap_set_gpio_dataout(64, 1);
  79. udelay(1);
  80. omap_set_gpio_dataout(64, 0);
  81. udelay(1);
  82. omap_set_gpio_dataout(64, 1);
  83. }
  84. }
  85. #endif
  86. #ifdef CONFIG_GENERIC_MMC
  87. int board_mmc_init(bd_t *bis)
  88. {
  89. omap_mmc_init(0);
  90. return 0;
  91. }
  92. #endif
  93. /*
  94. * Routine: misc_init_r
  95. * Description: Configure board specific parts
  96. */
  97. int misc_init_r(void)
  98. {
  99. twl4030_power_init();
  100. #if defined(CONFIG_CMD_NET)
  101. setup_net_chip();
  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_DEFAULT();
  115. }
  116. int board_eth_init(bd_t *bis)
  117. {
  118. int rc = 0;
  119. #ifdef CONFIG_SMC911X
  120. rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
  121. #endif
  122. return rc;
  123. }