smdk5250.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * Copyright (C) 2012 Samsung Electronics
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #include <common.h>
  23. #include <asm/io.h>
  24. #include <netdev.h>
  25. #include <asm/arch/cpu.h>
  26. #include <asm/arch/gpio.h>
  27. #include <asm/arch/mmc.h>
  28. #include <asm/arch/sromc.h>
  29. DECLARE_GLOBAL_DATA_PTR;
  30. struct exynos5_gpio_part1 *gpio1;
  31. int board_init(void)
  32. {
  33. gpio1 = (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
  34. gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
  35. return 0;
  36. }
  37. int dram_init(void)
  38. {
  39. gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE)
  40. + get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE)
  41. + get_ram_size((long *)PHYS_SDRAM_3, PHYS_SDRAM_3_SIZE)
  42. + get_ram_size((long *)PHYS_SDRAM_4, PHYS_SDRAM_4_SIZE)
  43. + get_ram_size((long *)PHYS_SDRAM_5, PHYS_SDRAM_7_SIZE)
  44. + get_ram_size((long *)PHYS_SDRAM_6, PHYS_SDRAM_7_SIZE)
  45. + get_ram_size((long *)PHYS_SDRAM_7, PHYS_SDRAM_7_SIZE)
  46. + get_ram_size((long *)PHYS_SDRAM_8, PHYS_SDRAM_8_SIZE);
  47. return 0;
  48. }
  49. void dram_init_banksize(void)
  50. {
  51. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  52. gd->bd->bi_dram[0].size = get_ram_size((long *)PHYS_SDRAM_1,
  53. PHYS_SDRAM_1_SIZE);
  54. gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
  55. gd->bd->bi_dram[1].size = get_ram_size((long *)PHYS_SDRAM_2,
  56. PHYS_SDRAM_2_SIZE);
  57. gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
  58. gd->bd->bi_dram[2].size = get_ram_size((long *)PHYS_SDRAM_3,
  59. PHYS_SDRAM_3_SIZE);
  60. gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
  61. gd->bd->bi_dram[3].size = get_ram_size((long *)PHYS_SDRAM_4,
  62. PHYS_SDRAM_4_SIZE);
  63. gd->bd->bi_dram[4].start = PHYS_SDRAM_5;
  64. gd->bd->bi_dram[4].size = get_ram_size((long *)PHYS_SDRAM_5,
  65. PHYS_SDRAM_5_SIZE);
  66. gd->bd->bi_dram[5].start = PHYS_SDRAM_6;
  67. gd->bd->bi_dram[5].size = get_ram_size((long *)PHYS_SDRAM_6,
  68. PHYS_SDRAM_6_SIZE);
  69. gd->bd->bi_dram[6].start = PHYS_SDRAM_7;
  70. gd->bd->bi_dram[6].size = get_ram_size((long *)PHYS_SDRAM_7,
  71. PHYS_SDRAM_7_SIZE);
  72. gd->bd->bi_dram[7].start = PHYS_SDRAM_8;
  73. gd->bd->bi_dram[7].size = get_ram_size((long *)PHYS_SDRAM_8,
  74. PHYS_SDRAM_8_SIZE);
  75. }
  76. #ifdef CONFIG_DISPLAY_BOARDINFO
  77. int checkboard(void)
  78. {
  79. printf("\nBoard: SMDK5250\n");
  80. return 0;
  81. }
  82. #endif
  83. #ifdef CONFIG_GENERIC_MMC
  84. int board_mmc_init(bd_t *bis)
  85. {
  86. int i, err;
  87. /*
  88. * MMC2 SD card GPIO:
  89. *
  90. * GPC2[0] SD_2_CLK(2)
  91. * GPC2[1] SD_2_CMD(2)
  92. * GPC2[2] SD_2_CDn
  93. * GPC2[3:6] SD_2_DATA[0:3](2)
  94. */
  95. for (i = 0; i < 7; i++) {
  96. /* GPC2[0:6] special function 2 */
  97. s5p_gpio_cfg_pin(&gpio1->c2, i, GPIO_FUNC(0x2));
  98. /* GPK2[0:6] drv 4x */
  99. s5p_gpio_set_drv(&gpio1->c2, i, GPIO_DRV_4X);
  100. /* GPK2[0:1] pull disable */
  101. if (i == 0 || i == 1) {
  102. s5p_gpio_set_pull(&gpio1->c2, i, GPIO_PULL_NONE);
  103. continue;
  104. }
  105. /* GPK2[2:6] pull up */
  106. s5p_gpio_set_pull(&gpio1->c2, i, GPIO_PULL_UP);
  107. }
  108. err = s5p_mmc_init(2, 4);
  109. return err;
  110. }
  111. #endif
  112. static void board_uart_init(void)
  113. {
  114. struct exynos5_gpio_part1 *gpio1 =
  115. (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
  116. int i;
  117. /* UART1 GPIOs (part1) : GPA0CON[7:4] 0x2222 */
  118. for (i = 4; i < 8; i++) {
  119. s5p_gpio_set_pull(&gpio1->a0, i, GPIO_PULL_NONE);
  120. s5p_gpio_cfg_pin(&gpio1->a0, i, GPIO_FUNC(0x2));
  121. }
  122. }
  123. #ifdef CONFIG_BOARD_EARLY_INIT_F
  124. int board_early_init_f(void)
  125. {
  126. board_uart_init();
  127. return 0;
  128. }
  129. #endif