smdk2410.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 <s3c2410.h>
  29. /* ------------------------------------------------------------------------- */
  30. #define FCLK_SPEED 1
  31. #if FCLK_SPEED==0 /* Fout = 203MHz, Fin = 12MHz for Audio */
  32. #define M_MDIV 0xC3
  33. #define M_PDIV 0x4
  34. #define M_SDIV 0x1
  35. #elif FCLK_SPEED==1 /* Fout = 202.8MHz */
  36. #define M_MDIV 0xA1
  37. #define M_PDIV 0x3
  38. #define M_SDIV 0x1
  39. #endif
  40. #define USB_CLOCK 1
  41. #if USB_CLOCK==0
  42. #define U_M_MDIV 0xA1
  43. #define U_M_PDIV 0x3
  44. #define U_M_SDIV 0x1
  45. #elif USB_CLOCK==1
  46. #define U_M_MDIV 0x48
  47. #define U_M_PDIV 0x3
  48. #define U_M_SDIV 0x2
  49. #endif
  50. static inline void delay (unsigned long loops)
  51. {
  52. __asm__ volatile ("1:\n"
  53. "subs %0, %1, #1\n"
  54. "bne 1b":"=r" (loops):"0" (loops));
  55. }
  56. /*
  57. * Miscellaneous platform dependent initialisations
  58. */
  59. int board_init (void)
  60. {
  61. DECLARE_GLOBAL_DATA_PTR;
  62. /* to reduce PLL lock time, adjust the LOCKTIME register */
  63. rLOCKTIME = 0xFFFFFF;
  64. /* configure MPLL */
  65. rMPLLCON = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV);
  66. /* some delay between MPLL and UPLL */
  67. delay (4000);
  68. /* configure UPLL */
  69. rUPLLCON = ((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV);
  70. /* some delay between MPLL and UPLL */
  71. delay (8000);
  72. /* set up the I/O ports */
  73. rGPACON = 0x007FFFFF;
  74. rGPBCON = 0x00044555;
  75. rGPBUP = 0x000007FF;
  76. rGPCCON = 0xAAAAAAAA;
  77. rGPCUP = 0x0000FFFF;
  78. rGPDCON = 0xAAAAAAAA;
  79. rGPDUP = 0x0000FFFF;
  80. rGPECON = 0xAAAAAAAA;
  81. rGPEUP = 0x0000FFFF;
  82. rGPFCON = 0x000055AA;
  83. rGPFUP = 0x000000FF;
  84. rGPGCON = 0xFF95FFBA;
  85. rGPGUP = 0x0000FFFF;
  86. rGPHCON = 0x002AFAAA;
  87. rGPHUP = 0x000007FF;
  88. /* arch number of SMDK2410-Board */
  89. gd->bd->bi_arch_number = 193;
  90. /* adress of boot parameters */
  91. gd->bd->bi_boot_params = 0x30000100;
  92. icache_enable();
  93. dcache_enable();
  94. return 0;
  95. }
  96. int dram_init (void)
  97. {
  98. DECLARE_GLOBAL_DATA_PTR;
  99. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  100. gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
  101. return 0;
  102. }