smdkv310.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. * Copyright (C) 2011 Samsung Electronics
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.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. void 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. }
  59. int board_eth_init(bd_t *bis)
  60. {
  61. int rc = 0;
  62. #ifdef CONFIG_SMC911X
  63. rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
  64. #endif
  65. return rc;
  66. }
  67. #ifdef CONFIG_DISPLAY_BOARDINFO
  68. int checkboard(void)
  69. {
  70. printf("\nBoard: SMDKV310\n");
  71. return 0;
  72. }
  73. #endif
  74. #ifdef CONFIG_GENERIC_MMC
  75. int board_mmc_init(bd_t *bis)
  76. {
  77. int i, err;
  78. /*
  79. * MMC2 SD card GPIO:
  80. *
  81. * GPK2[0] SD_2_CLK(2)
  82. * GPK2[1] SD_2_CMD(2)
  83. * GPK2[2] SD_2_CDn
  84. * GPK2[3:6] SD_2_DATA[0:3](2)
  85. */
  86. for (i = EXYNOS4_GPIO_K20; i < EXYNOS4_GPIO_K27; i++) {
  87. /* GPK2[0:6] special function 2 */
  88. gpio_cfg_pin(i, S5P_GPIO_FUNC(0x2));
  89. /* GPK2[0:6] drv 4x */
  90. gpio_set_drv(i, S5P_GPIO_DRV_4X);
  91. /* GPK2[0:1] pull disable */
  92. if (i == EXYNOS4_GPIO_K20 || i == EXYNOS4_GPIO_K21) {
  93. gpio_set_pull(i, S5P_GPIO_PULL_NONE);
  94. continue;
  95. }
  96. /* GPK2[2:6] pull up */
  97. gpio_set_pull(i, S5P_GPIO_PULL_UP);
  98. }
  99. err = s5p_mmc_init(2, 4);
  100. return err;
  101. }
  102. #endif
  103. static int board_uart_init(void)
  104. {
  105. int err;
  106. err = exynos_pinmux_config(PERIPH_ID_UART0, PINMUX_FLAG_NONE);
  107. if (err) {
  108. debug("UART0 not configured\n");
  109. return err;
  110. }
  111. err = exynos_pinmux_config(PERIPH_ID_UART1, PINMUX_FLAG_NONE);
  112. if (err) {
  113. debug("UART1 not configured\n");
  114. return err;
  115. }
  116. err = exynos_pinmux_config(PERIPH_ID_UART2, PINMUX_FLAG_NONE);
  117. if (err) {
  118. debug("UART2 not configured\n");
  119. return err;
  120. }
  121. err = exynos_pinmux_config(PERIPH_ID_UART3, PINMUX_FLAG_NONE);
  122. if (err) {
  123. debug("UART3 not configured\n");
  124. return err;
  125. }
  126. return 0;
  127. }
  128. #ifdef CONFIG_BOARD_EARLY_INIT_F
  129. int board_early_init_f(void)
  130. {
  131. int err;
  132. err = board_uart_init();
  133. if (err) {
  134. debug("UART init failed\n");
  135. return err;
  136. }
  137. return err;
  138. }
  139. #endif