smdkv310.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2011 Samsung Electronics
  4. */
  5. #include <common.h>
  6. #include <init.h>
  7. #include <asm/gpio.h>
  8. #include <asm/io.h>
  9. #include <netdev.h>
  10. #include <asm/arch/cpu.h>
  11. #include <asm/arch/mmc.h>
  12. #include <asm/arch/periph.h>
  13. #include <asm/arch/pinmux.h>
  14. #include <asm/arch/sromc.h>
  15. DECLARE_GLOBAL_DATA_PTR;
  16. static void smc9115_pre_init(void)
  17. {
  18. u32 smc_bw_conf, smc_bc_conf;
  19. /* gpio configuration GPK0CON */
  20. gpio_cfg_pin(EXYNOS4_GPIO_Y00 + CONFIG_ENV_SROM_BANK, S5P_GPIO_FUNC(2));
  21. /* Ethernet needs bus width of 16 bits */
  22. smc_bw_conf = SROMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK);
  23. smc_bc_conf = SROMC_BC_TACS(0x0F) | SROMC_BC_TCOS(0x0F)
  24. | SROMC_BC_TACC(0x0F) | SROMC_BC_TCOH(0x0F)
  25. | SROMC_BC_TAH(0x0F) | SROMC_BC_TACP(0x0F)
  26. | SROMC_BC_PMC(0x0F);
  27. /* Select and configure the SROMC bank */
  28. s5p_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, smc_bc_conf);
  29. }
  30. int board_init(void)
  31. {
  32. smc9115_pre_init();
  33. gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
  34. return 0;
  35. }
  36. int dram_init(void)
  37. {
  38. gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE)
  39. + get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE)
  40. + get_ram_size((long *)PHYS_SDRAM_3, PHYS_SDRAM_3_SIZE)
  41. + get_ram_size((long *)PHYS_SDRAM_4, PHYS_SDRAM_4_SIZE);
  42. return 0;
  43. }
  44. int dram_init_banksize(void)
  45. {
  46. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  47. gd->bd->bi_dram[0].size = get_ram_size((long *)PHYS_SDRAM_1,
  48. PHYS_SDRAM_1_SIZE);
  49. gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
  50. gd->bd->bi_dram[1].size = get_ram_size((long *)PHYS_SDRAM_2,
  51. PHYS_SDRAM_2_SIZE);
  52. gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
  53. gd->bd->bi_dram[2].size = get_ram_size((long *)PHYS_SDRAM_3,
  54. PHYS_SDRAM_3_SIZE);
  55. gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
  56. gd->bd->bi_dram[3].size = get_ram_size((long *)PHYS_SDRAM_4,
  57. PHYS_SDRAM_4_SIZE);
  58. return 0;
  59. }
  60. int board_eth_init(bd_t *bis)
  61. {
  62. int rc = 0;
  63. #ifdef CONFIG_SMC911X
  64. rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
  65. #endif
  66. return rc;
  67. }
  68. #ifdef CONFIG_DISPLAY_BOARDINFO
  69. int checkboard(void)
  70. {
  71. printf("\nBoard: SMDKV310\n");
  72. return 0;
  73. }
  74. #endif
  75. #ifdef CONFIG_MMC
  76. int board_mmc_init(bd_t *bis)
  77. {
  78. int i, err;
  79. /*
  80. * MMC2 SD card GPIO:
  81. *
  82. * GPK2[0] SD_2_CLK(2)
  83. * GPK2[1] SD_2_CMD(2)
  84. * GPK2[2] SD_2_CDn
  85. * GPK2[3:6] SD_2_DATA[0:3](2)
  86. */
  87. for (i = EXYNOS4_GPIO_K20; i < EXYNOS4_GPIO_K27; i++) {
  88. /* GPK2[0:6] special function 2 */
  89. gpio_cfg_pin(i, S5P_GPIO_FUNC(0x2));
  90. /* GPK2[0:6] drv 4x */
  91. gpio_set_drv(i, S5P_GPIO_DRV_4X);
  92. /* GPK2[0:1] pull disable */
  93. if (i == EXYNOS4_GPIO_K20 || i == EXYNOS4_GPIO_K21) {
  94. gpio_set_pull(i, S5P_GPIO_PULL_NONE);
  95. continue;
  96. }
  97. /* GPK2[2:6] pull up */
  98. gpio_set_pull(i, S5P_GPIO_PULL_UP);
  99. }
  100. err = s5p_mmc_init(2, 4);
  101. return err;
  102. }
  103. #endif
  104. static int board_uart_init(void)
  105. {
  106. int err;
  107. err = exynos_pinmux_config(PERIPH_ID_UART0, PINMUX_FLAG_NONE);
  108. if (err) {
  109. debug("UART0 not configured\n");
  110. return err;
  111. }
  112. err = exynos_pinmux_config(PERIPH_ID_UART1, PINMUX_FLAG_NONE);
  113. if (err) {
  114. debug("UART1 not configured\n");
  115. return err;
  116. }
  117. err = exynos_pinmux_config(PERIPH_ID_UART2, PINMUX_FLAG_NONE);
  118. if (err) {
  119. debug("UART2 not configured\n");
  120. return err;
  121. }
  122. err = exynos_pinmux_config(PERIPH_ID_UART3, PINMUX_FLAG_NONE);
  123. if (err) {
  124. debug("UART3 not configured\n");
  125. return err;
  126. }
  127. return 0;
  128. }
  129. #ifdef CONFIG_BOARD_EARLY_INIT_F
  130. int board_early_init_f(void)
  131. {
  132. int err;
  133. err = board_uart_init();
  134. if (err) {
  135. debug("UART init failed\n");
  136. return err;
  137. }
  138. return err;
  139. }
  140. #endif