atstk1000.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * Copyright (C) 2005-2006 Atmel Corporation
  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/sdram.h>
  25. #include <asm/arch/clk.h>
  26. #include <asm/arch/gpio.h>
  27. #include <asm/arch/hmatrix2.h>
  28. DECLARE_GLOBAL_DATA_PTR;
  29. #ifdef CONFIG_ATSTK1006
  30. /* Dual MT48LC16M16A2-7E on daughterboard */
  31. static const struct sdram_info sdram = {
  32. .phys_addr = CFG_SDRAM_BASE,
  33. .row_bits = 13,
  34. .col_bits = 9,
  35. .bank_bits = 2,
  36. .cas = 2,
  37. .twr = 2,
  38. .trc = 7,
  39. .trp = 2,
  40. .trcd = 2,
  41. .tras = 4,
  42. .txsr = 7,
  43. /* 7.81 us */
  44. .refresh_period = (781 * (SDRAMC_BUS_HZ / 1000)) / 100000,
  45. };
  46. #else
  47. /* MT48LC2M32B2-5 on motherboard */
  48. static const struct sdram_info sdram = {
  49. .phys_addr = CFG_SDRAM_BASE,
  50. .row_bits = 11,
  51. .col_bits = 8,
  52. .bank_bits = 2,
  53. .cas = 3,
  54. .twr = 2,
  55. .trc = 7,
  56. .trp = 2,
  57. .trcd = 2,
  58. .tras = 5,
  59. .txsr = 5,
  60. /* 15.6 us */
  61. .refresh_period = (156 * (SDRAMC_BUS_HZ / 1000)) / 10000,
  62. };
  63. #endif
  64. int board_early_init_f(void)
  65. {
  66. /* Set the SDRAM_ENABLE bit in the HEBI SFR */
  67. hmatrix2_writel(SFR4, 1 << 1);
  68. gpio_enable_ebi();
  69. gpio_enable_usart1();
  70. #if defined(CONFIG_MACB)
  71. gpio_enable_macb0();
  72. gpio_enable_macb1();
  73. #endif
  74. #if defined(CONFIG_MMC)
  75. gpio_enable_mmci();
  76. #endif
  77. return 0;
  78. }
  79. long int initdram(int board_type)
  80. {
  81. return sdram_init(&sdram);
  82. }
  83. void board_init_info(void)
  84. {
  85. gd->bd->bi_phy_id[0] = 0x10;
  86. gd->bd->bi_phy_id[1] = 0x11;
  87. }