zoom1.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2004-2008
  4. * Texas Instruments, <www.ti.com>
  5. *
  6. * Author :
  7. * Nishanth Menon <nm@ti.com>
  8. *
  9. * Derived from Beagle Board and 3430 SDP code by
  10. * Sunil Kumar <sunilsaini05@gmail.com>
  11. * Shashi Ranjan <shashiranjanmca05@gmail.com>
  12. * Richard Woodruff <r-woodruff2@ti.com>
  13. * Syed Mohammed Khasim <khasim@ti.com>
  14. *
  15. */
  16. #include <common.h>
  17. #include <dm.h>
  18. #include <env.h>
  19. #include <environment.h>
  20. #include <ns16550.h>
  21. #include <netdev.h>
  22. #include <twl4030.h>
  23. #include <linux/mtd/omap_gpmc.h>
  24. #include <asm/io.h>
  25. #include <asm/arch/mem.h>
  26. #include <asm/arch/mmc_host_def.h>
  27. #include <asm/arch/mux.h>
  28. #include <asm/arch/sys_proto.h>
  29. #include <asm/mach-types.h>
  30. #include "zoom1.h"
  31. DECLARE_GLOBAL_DATA_PTR;
  32. /*
  33. * gpmc_cfg is initialized by gpmc_init and we use it here.
  34. * GPMC definitions for Ethenet Controller LAN9211
  35. */
  36. static const u32 gpmc_lab_enet[] = {
  37. ZOOM1_ENET_GPMC_CONF1,
  38. ZOOM1_ENET_GPMC_CONF2,
  39. ZOOM1_ENET_GPMC_CONF3,
  40. ZOOM1_ENET_GPMC_CONF4,
  41. ZOOM1_ENET_GPMC_CONF5,
  42. ZOOM1_ENET_GPMC_CONF6,
  43. /*CONF7- computed as params */
  44. };
  45. static const struct ns16550_platdata zoom1_serial = {
  46. .base = OMAP34XX_UART3,
  47. .reg_shift = 2,
  48. .clock = V_NS16550_CLK,
  49. .fcr = UART_FCR_DEFVAL,
  50. };
  51. U_BOOT_DEVICE(zoom1_uart) = {
  52. "ns16550_serial",
  53. &zoom1_serial
  54. };
  55. /*
  56. * Routine: board_init
  57. * Description: Early hardware init.
  58. */
  59. int board_init(void)
  60. {
  61. gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
  62. /* CS1 is Ethernet LAN9211 */
  63. enable_gpmc_cs_config(gpmc_lab_enet, &gpmc_cfg->cs[1],
  64. DEBUG_BASE, GPMC_SIZE_16M);
  65. /* board id for Linux */
  66. gd->bd->bi_arch_number = MACH_TYPE_OMAP_LDP;
  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 zoom board specific configurations
  74. */
  75. int misc_init_r(void)
  76. {
  77. twl4030_power_init();
  78. twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
  79. omap_die_id_display();
  80. /*
  81. * Board Reset
  82. * The board is reset by holding the red button on the
  83. * top right front face for eight seconds.
  84. */
  85. twl4030_power_reset_init();
  86. return 0;
  87. }
  88. /*
  89. * Routine: set_muxconf_regs
  90. * Description: Setting up the configuration Mux registers specific to the
  91. * hardware. Many pins need to be moved from protect to primary
  92. * mode.
  93. */
  94. void set_muxconf_regs(void)
  95. {
  96. /* platform specific muxes */
  97. MUX_ZOOM1_MDK();
  98. }
  99. #ifdef CONFIG_MMC
  100. int board_mmc_init(bd_t *bis)
  101. {
  102. return omap_mmc_init(0, 0, 0, -1, -1);
  103. }
  104. void board_mmc_power_init(void)
  105. {
  106. twl4030_power_mmc_init(0);
  107. }
  108. #endif
  109. #ifdef CONFIG_CMD_NET
  110. int board_eth_init(bd_t *bis)
  111. {
  112. int rc = 0;
  113. #ifdef CONFIG_SMC911X
  114. #define STR_ENV_ETHADDR "ethaddr"
  115. struct eth_device *dev;
  116. uchar eth_addr[6];
  117. rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
  118. if (!eth_env_get_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
  119. dev = eth_get_dev_by_index(0);
  120. if (dev) {
  121. eth_env_set_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
  122. } else {
  123. printf("zoom1: Couldn't get eth device\n");
  124. rc = -1;
  125. }
  126. }
  127. #endif
  128. return rc;
  129. }
  130. #endif