origen.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * Copyright (C) 2011 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 <asm/arch/cpu.h>
  25. #include <asm/arch/gpio.h>
  26. #include <asm/arch/mmc.h>
  27. #include <asm/arch/periph.h>
  28. #include <asm/arch/pinmux.h>
  29. DECLARE_GLOBAL_DATA_PTR;
  30. struct exynos4_gpio_part1 *gpio1;
  31. struct exynos4_gpio_part2 *gpio2;
  32. int board_init(void)
  33. {
  34. gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
  35. gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
  36. gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
  37. return 0;
  38. }
  39. static int board_uart_init(void)
  40. {
  41. int err;
  42. err = exynos_pinmux_config(PERIPH_ID_UART0, PINMUX_FLAG_NONE);
  43. if (err) {
  44. debug("UART0 not configured\n");
  45. return err;
  46. }
  47. err = exynos_pinmux_config(PERIPH_ID_UART1, PINMUX_FLAG_NONE);
  48. if (err) {
  49. debug("UART1 not configured\n");
  50. return err;
  51. }
  52. err = exynos_pinmux_config(PERIPH_ID_UART2, PINMUX_FLAG_NONE);
  53. if (err) {
  54. debug("UART2 not configured\n");
  55. return err;
  56. }
  57. err = exynos_pinmux_config(PERIPH_ID_UART3, PINMUX_FLAG_NONE);
  58. if (err) {
  59. debug("UART3 not configured\n");
  60. return err;
  61. }
  62. return 0;
  63. }
  64. #ifdef CONFIG_BOARD_EARLY_INIT_F
  65. int board_early_init_f(void)
  66. {
  67. int err;
  68. err = board_uart_init();
  69. if (err) {
  70. debug("UART init failed\n");
  71. return err;
  72. }
  73. return err;
  74. }
  75. #endif
  76. int dram_init(void)
  77. {
  78. gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE)
  79. + get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE)
  80. + get_ram_size((long *)PHYS_SDRAM_3, PHYS_SDRAM_3_SIZE)
  81. + get_ram_size((long *)PHYS_SDRAM_4, PHYS_SDRAM_4_SIZE);
  82. return 0;
  83. }
  84. void dram_init_banksize(void)
  85. {
  86. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  87. gd->bd->bi_dram[0].size = get_ram_size((long *)PHYS_SDRAM_1, \
  88. PHYS_SDRAM_1_SIZE);
  89. gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
  90. gd->bd->bi_dram[1].size = get_ram_size((long *)PHYS_SDRAM_2, \
  91. PHYS_SDRAM_2_SIZE);
  92. gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
  93. gd->bd->bi_dram[2].size = get_ram_size((long *)PHYS_SDRAM_3, \
  94. PHYS_SDRAM_3_SIZE);
  95. gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
  96. gd->bd->bi_dram[3].size = get_ram_size((long *)PHYS_SDRAM_4, \
  97. PHYS_SDRAM_4_SIZE);
  98. }
  99. #ifdef CONFIG_DISPLAY_BOARDINFO
  100. int checkboard(void)
  101. {
  102. printf("\nBoard: ORIGEN\n");
  103. return 0;
  104. }
  105. #endif
  106. #ifdef CONFIG_GENERIC_MMC
  107. int board_mmc_init(bd_t *bis)
  108. {
  109. int i, err;
  110. /*
  111. * MMC2 SD card GPIO:
  112. *
  113. * GPK2[0] SD_2_CLK(2)
  114. * GPK2[1] SD_2_CMD(2)
  115. * GPK2[2] SD_2_CDn
  116. * GPK2[3:6] SD_2_DATA[0:3](2)
  117. */
  118. for (i = 0; i < 7; i++) {
  119. /* GPK2[0:6] special function 2 */
  120. s5p_gpio_cfg_pin(&gpio2->k2, i, GPIO_FUNC(0x2));
  121. /* GPK2[0:6] drv 4x */
  122. s5p_gpio_set_drv(&gpio2->k2, i, GPIO_DRV_4X);
  123. /* GPK2[0:1] pull disable */
  124. if (i == 0 || i == 1) {
  125. s5p_gpio_set_pull(&gpio2->k2, i, GPIO_PULL_NONE);
  126. continue;
  127. }
  128. /* GPK2[2:6] pull up */
  129. s5p_gpio_set_pull(&gpio2->k2, i, GPIO_PULL_UP);
  130. }
  131. err = s5p_mmc_init(2, 4);
  132. return err;
  133. }
  134. #endif