smdkv310.c 3.4 KB

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