zoom1.c 3.0 KB

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