smdk6400.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. * (C) Copyright 2008
  10. * Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de>
  11. *
  12. * See file CREDITS for list of people who contributed to this
  13. * project.
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License as
  17. * published by the Free Software Foundation; either version 2 of
  18. * the License, or (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, write to the Free Software
  27. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  28. * MA 02111-1307 USA
  29. */
  30. #include <common.h>
  31. #include <s3c6400.h>
  32. /* ------------------------------------------------------------------------- */
  33. #define CS8900_Tacs 0x0 /* 0clk address set-up */
  34. #define CS8900_Tcos 0x4 /* 4clk chip selection set-up */
  35. #define CS8900_Tacc 0xE /* 14clk access cycle */
  36. #define CS8900_Tcoh 0x1 /* 1clk chip selection hold */
  37. #define CS8900_Tah 0x4 /* 4clk address holding time */
  38. #define CS8900_Tacp 0x6 /* 6clk page mode access cycle */
  39. #define CS8900_PMC 0x0 /* normal(1data)page mode configuration */
  40. static inline void delay(unsigned long loops)
  41. {
  42. __asm__ volatile ("1:\n" "subs %0, %1, #1\n"
  43. "bne 1b"
  44. : "=r" (loops) : "0" (loops));
  45. }
  46. /*
  47. * Miscellaneous platform dependent initialisations
  48. */
  49. static void cs8900_pre_init(void)
  50. {
  51. SROM_BW_REG &= ~(0xf << 4);
  52. SROM_BW_REG |= (1 << 7) | (1 << 6) | (1 << 4);
  53. SROM_BC1_REG = ((CS8900_Tacs << 28) + (CS8900_Tcos << 24) +
  54. (CS8900_Tacc << 16) + (CS8900_Tcoh << 12) +
  55. (CS8900_Tah << 8) + (CS8900_Tacp << 4) + CS8900_PMC);
  56. }
  57. int board_init(void)
  58. {
  59. DECLARE_GLOBAL_DATA_PTR;
  60. cs8900_pre_init();
  61. /* NOR-flash in SROM0 */
  62. /* Enable WAIT */
  63. SROM_BW_REG |= 4 | 8 | 1;
  64. gd->bd->bi_arch_number = MACH_TYPE;
  65. gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
  66. return 0;
  67. }
  68. int dram_init(void)
  69. {
  70. DECLARE_GLOBAL_DATA_PTR;
  71. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  72. gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
  73. return 0;
  74. }
  75. #ifdef CONFIG_DISPLAY_BOARDINFO
  76. int checkboard(void)
  77. {
  78. printf("Board: SMDK6400\n");
  79. return 0;
  80. }
  81. #endif
  82. #ifdef CONFIG_ENABLE_MMU
  83. ulong virt_to_phy_smdk6400(ulong addr)
  84. {
  85. if ((0xc0000000 <= addr) && (addr < 0xc8000000))
  86. return addr - 0xc0000000 + 0x50000000;
  87. else
  88. printf("do not support this address : %08lx\n", addr);
  89. return addr;
  90. }
  91. #endif
  92. #if defined(CONFIG_CMD_NAND) && defined(CFG_NAND_LEGACY)
  93. #include <linux/mtd/nand.h>
  94. extern struct nand_chip nand_dev_desc[CFG_MAX_NAND_DEVICE];
  95. void nand_init(void)
  96. {
  97. nand_probe(CFG_NAND_BASE);
  98. if (nand_dev_desc[0].ChipID != NAND_ChipID_UNKNOWN)
  99. print_size(nand_dev_desc[0].totlen, "\n");
  100. }
  101. #endif
  102. ulong board_flash_get_legacy (ulong base, int banknum, flash_info_t *info)
  103. {
  104. if (banknum == 0) { /* non-CFI boot flash */
  105. info->portwidth = FLASH_CFI_16BIT;
  106. info->chipwidth = FLASH_CFI_BY16;
  107. info->interface = FLASH_CFI_X16;
  108. return 1;
  109. } else
  110. return 0;
  111. }