at91rm9200dk.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * (C) Copyright 2002
  3. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  4. * Marius Groeger <mgroeger@sysgo.de>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. #include <common.h>
  25. #include <asm/arch/AT91RM9200.h>
  26. #include <at91rm9200_net.h>
  27. #include <dm9161.h>
  28. /* ------------------------------------------------------------------------- */
  29. /*
  30. * Miscelaneous platform dependent initialisations
  31. */
  32. int board_init (void)
  33. {
  34. DECLARE_GLOBAL_DATA_PTR;
  35. /* Enable Ctrlc */
  36. console_init_f ();
  37. /* Correct IRDA resistor problem */
  38. /* Set PA23_TXD in Output */
  39. (AT91PS_PIO) AT91C_BASE_PIOA->PIO_OER = AT91C_PA23_TXD2;
  40. /* memory and cpu-speed are setup before relocation */
  41. /* so we do _nothing_ here */
  42. /* arch number of AT91RM9200DK-Board */
  43. gd->bd->bi_arch_number = MACH_TYPE_AT91RM9200;
  44. /* adress of boot parameters */
  45. gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
  46. return 0;
  47. }
  48. int dram_init (void)
  49. {
  50. DECLARE_GLOBAL_DATA_PTR;
  51. gd->bd->bi_dram[0].start = PHYS_SDRAM;
  52. gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
  53. return 0;
  54. }
  55. #ifdef CONFIG_DRIVER_ETHER
  56. #if (CONFIG_COMMANDS & CFG_CMD_NET)
  57. /*
  58. * Name:
  59. * at91rm9200_GetPhyInterface
  60. * Description:
  61. * Initialise the interface functions to the PHY
  62. * Arguments:
  63. * None
  64. * Return value:
  65. * None
  66. */
  67. void at91rm9200_GetPhyInterface(AT91PS_PhyOps p_phyops)
  68. {
  69. p_phyops->Init = dm9161_InitPhy;
  70. p_phyops->IsPhyConnected = dm9161_IsPhyConnected;
  71. p_phyops->GetLinkSpeed = dm9161_GetLinkSpeed;
  72. p_phyops->AutoNegotiate = dm9161_AutoNegotiate;
  73. }
  74. #endif /* CONFIG_COMMANDS & CFG_CMD_NET */
  75. #endif /* CONFIG_DRIVER_ETHER */
  76. /*
  77. * Disk On Chip (NAND) Millenium initialization.
  78. * The NAND lives in the CS2* space
  79. */
  80. #if (CONFIG_COMMANDS & CFG_CMD_NAND)
  81. extern ulong nand_probe (ulong physadr);
  82. #define AT91_SMARTMEDIA_BASE 0x40000000 /* physical address to access memory on NCS3 */
  83. void nand_init (void)
  84. {
  85. /* Setup Smart Media, fitst enable the address range of CS3 */
  86. *AT91C_EBI_CSA |= AT91C_EBI_CS3A_SMC_SmartMedia;
  87. /* set the bus interface characteristics based on
  88. tDS Data Set up Time 30 - ns
  89. tDH Data Hold Time 20 - ns
  90. tALS ALE Set up Time 20 - ns
  91. 16ns at 60 MHz ~= 3 */
  92. /*memory mapping structures */
  93. #define SM_ID_RWH (5 << 28)
  94. #define SM_RWH (1 << 28)
  95. #define SM_RWS (0 << 24)
  96. #define SM_TDF (1 << 8)
  97. #define SM_NWS (3)
  98. AT91C_BASE_SMC2->SMC2_CSR[3] = (SM_RWH | SM_RWS |
  99. AT91C_SMC2_ACSS_STANDARD | AT91C_SMC2_DBW_8 |
  100. SM_TDF | AT91C_SMC2_WSEN | SM_NWS);
  101. /* enable the SMOE line PC0=SMCE, A21=CLE, A22=ALE */
  102. *AT91C_PIOC_ASR = AT91C_PC0_BFCK | AT91C_PC1_BFRDY_SMOE |
  103. AT91C_PC3_BFBAA_SMWE;
  104. *AT91C_PIOC_PDR = AT91C_PC0_BFCK | AT91C_PC1_BFRDY_SMOE |
  105. AT91C_PC3_BFBAA_SMWE;
  106. /* Configure PC2 as input (signal READY of the SmartMedia) */
  107. *AT91C_PIOC_PER = AT91C_PC2_BFAVD; /* enable direct output enable */
  108. *AT91C_PIOC_ODR = AT91C_PC2_BFAVD; /* disable output */
  109. /* Configure PB1 as input (signal Card Detect of the SmartMedia) */
  110. *AT91C_PIOB_PER = AT91C_PIO_PB1; /* enable direct output enable */
  111. *AT91C_PIOB_ODR = AT91C_PIO_PB1; /* disable output */
  112. /* PIOB and PIOC clock enabling */
  113. *AT91C_PMC_PCER = 1 << AT91C_ID_PIOB;
  114. *AT91C_PMC_PCER = 1 << AT91C_ID_PIOC;
  115. if (*AT91C_PIOB_PDSR & AT91C_PIO_PB1)
  116. printf (" No SmartMedia card inserted\n");
  117. #ifdef DEBUG
  118. printf (" SmartMedia card inserted\n");
  119. printf ("Probing at 0x%.8x\n", AT91_SMARTMEDIA_BASE);
  120. #endif
  121. printf ("%4lu MB\n", nand_probe(AT91_SMARTMEDIA_BASE) >> 20);
  122. }
  123. #endif