smdk2410.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * (C) Copyright 2002
  3. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  4. * Marius Groeger <mgroeger@sysgo.de>
  5. *
  6. * (C) Copyright 2002
  7. * David Mueller, ELSOFT AG, <d.mueller@elsoft.ch>
  8. *
  9. * See file CREDITS for list of people who contributed to this
  10. * project.
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License as
  14. * published by the Free Software Foundation; either version 2 of
  15. * the License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  25. * MA 02111-1307 USA
  26. */
  27. #include <common.h>
  28. #include <netdev.h>
  29. #include <asm/arch/s3c24x0_cpu.h>
  30. DECLARE_GLOBAL_DATA_PTR;
  31. #define FCLK_SPEED 1
  32. #if FCLK_SPEED==0 /* Fout = 203MHz, Fin = 12MHz for Audio */
  33. #define M_MDIV 0xC3
  34. #define M_PDIV 0x4
  35. #define M_SDIV 0x1
  36. #elif FCLK_SPEED==1 /* Fout = 202.8MHz */
  37. #define M_MDIV 0xA1
  38. #define M_PDIV 0x3
  39. #define M_SDIV 0x1
  40. #endif
  41. #define USB_CLOCK 1
  42. #if USB_CLOCK==0
  43. #define U_M_MDIV 0xA1
  44. #define U_M_PDIV 0x3
  45. #define U_M_SDIV 0x1
  46. #elif USB_CLOCK==1
  47. #define U_M_MDIV 0x48
  48. #define U_M_PDIV 0x3
  49. #define U_M_SDIV 0x2
  50. #endif
  51. static inline void delay (unsigned long loops)
  52. {
  53. __asm__ volatile ("1:\n"
  54. "subs %0, %1, #1\n"
  55. "bne 1b":"=r" (loops):"0" (loops));
  56. }
  57. /*
  58. * Miscellaneous platform dependent initialisations
  59. */
  60. int board_init (void)
  61. {
  62. struct s3c24x0_clock_power * const clk_power =
  63. s3c24x0_get_base_clock_power();
  64. struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
  65. /* to reduce PLL lock time, adjust the LOCKTIME register */
  66. clk_power->locktime = 0xFFFFFF;
  67. /* configure MPLL */
  68. clk_power->mpllcon = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV);
  69. /* some delay between MPLL and UPLL */
  70. delay (4000);
  71. /* configure UPLL */
  72. clk_power->upllcon = ((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV);
  73. /* some delay between MPLL and UPLL */
  74. delay (8000);
  75. /* set up the I/O ports */
  76. gpio->gpacon = 0x007FFFFF;
  77. gpio->gpbcon = 0x00044555;
  78. gpio->gpbup = 0x000007FF;
  79. gpio->gpccon = 0xAAAAAAAA;
  80. gpio->gpcup = 0x0000FFFF;
  81. gpio->gpdcon = 0xAAAAAAAA;
  82. gpio->gpdup = 0x0000FFFF;
  83. gpio->gpecon = 0xAAAAAAAA;
  84. gpio->gpeup = 0x0000FFFF;
  85. gpio->gpfcon = 0x000055AA;
  86. gpio->gpfup = 0x000000FF;
  87. gpio->gpgcon = 0xFF95FFBA;
  88. gpio->gpgup = 0x0000FFFF;
  89. gpio->gphcon = 0x002AFAAA;
  90. gpio->gphup = 0x000007FF;
  91. /* arch number of SMDK2410-Board */
  92. gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;
  93. /* adress of boot parameters */
  94. gd->bd->bi_boot_params = 0x30000100;
  95. icache_enable();
  96. dcache_enable();
  97. return 0;
  98. }
  99. int dram_init (void)
  100. {
  101. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  102. gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
  103. return 0;
  104. }
  105. #ifdef CONFIG_CMD_NET
  106. int board_eth_init(bd_t *bis)
  107. {
  108. int rc = 0;
  109. #ifdef CONFIG_CS8900
  110. rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
  111. #endif
  112. return rc;
  113. }
  114. #endif
  115. /*
  116. * Hardcoded flash setup:
  117. * Flash 0 is a non-CFI AMD AM29LV800BB flash.
  118. */
  119. ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
  120. {
  121. info->portwidth = FLASH_CFI_16BIT;
  122. info->chipwidth = FLASH_CFI_BY16;
  123. info->interface = FLASH_CFI_X16;
  124. return 1;
  125. }