cpu_init.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. *
  3. * (C) Copyright 2000-2003
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. *
  6. * (C) Copyright 2007 Freescale Semiconductor, Inc.
  7. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  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 <MCD_dma.h>
  29. #include <asm/immap.h>
  30. /*
  31. * Breath some life into the CPU...
  32. *
  33. * Set up the memory map,
  34. * initialize a bunch of registers,
  35. * initialize the UPM's
  36. */
  37. void cpu_init_f(void)
  38. {
  39. volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
  40. volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS;
  41. volatile xlbarb_t *xlbarb = (volatile xlbarb_t *) MMAP_XARB;
  42. xlbarb->adrto = 0x2000;
  43. xlbarb->datto = 0x2000;
  44. xlbarb->busto = 0x3000;
  45. xlbarb->cfg = XARB_SR_AT | XARB_SR_DT;
  46. /* Master Priority Enable */
  47. xlbarb->pri = 0;
  48. xlbarb->prien = 0xff;
  49. #if (defined(CFG_CS0_BASE) && defined(CFG_CS0_MASK) && defined(CFG_CS0_CTRL))
  50. fbcs->csar0 = CFG_CS0_BASE;
  51. fbcs->cscr0 = CFG_CS0_CTRL;
  52. fbcs->csmr0 = CFG_CS0_MASK;
  53. #endif
  54. #if (defined(CFG_CS1_BASE) && defined(CFG_CS1_MASK) && defined(CFG_CS1_CTRL))
  55. fbcs->csar1 = CFG_CS1_BASE;
  56. fbcs->cscr1 = CFG_CS1_CTRL;
  57. fbcs->csmr1 = CFG_CS1_MASK;
  58. #endif
  59. #if (defined(CFG_CS2_BASE) && defined(CFG_CS2_MASK) && defined(CFG_CS2_CTRL))
  60. fbcs->csar2 = CFG_CS2_BASE;
  61. fbcs->cscr2 = CFG_CS2_CTRL;
  62. fbcs->csmr2 = CFG_CS2_MASK;
  63. #endif
  64. #if (defined(CFG_CS3_BASE) && defined(CFG_CS3_MASK) && defined(CFG_CS3_CTRL))
  65. fbcs->csar3 = CFG_CS3_BASE;
  66. fbcs->cscr3 = CFG_CS3_CTRL;
  67. fbcs->csmr3 = CFG_CS3_MASK;
  68. #endif
  69. #if (defined(CFG_CS4_BASE) && defined(CFG_CS4_MASK) && defined(CFG_CS4_CTRL))
  70. fbcs->csar4 = CFG_CS4_BASE;
  71. fbcs->cscr4 = CFG_CS4_CTRL;
  72. fbcs->csmr4 = CFG_CS4_MASK;
  73. #endif
  74. #if (defined(CFG_CS5_BASE) && defined(CFG_CS5_MASK) && defined(CFG_CS5_CTRL))
  75. fbcs->csar5 = CFG_CS5_BASE;
  76. fbcs->cscr5 = CFG_CS5_CTRL;
  77. fbcs->csmr5 = CFG_CS5_MASK;
  78. #endif
  79. #ifdef CONFIG_FSL_I2C
  80. gpio->par_feci2cirq = GPIO_PAR_FECI2CIRQ_SCL | GPIO_PAR_FECI2CIRQ_SDA;
  81. #endif
  82. icache_enable();
  83. }
  84. /*
  85. * initialize higher level parts of CPU like timers
  86. */
  87. int cpu_init_r(void)
  88. {
  89. #if defined(CONFIG_CMD_NET) && defined(CONFIG_FSLDMAFEC)
  90. MCD_initDma((dmaRegs *) (MMAP_MCDMA), (void *)(MMAP_SRAM + 512),
  91. MCD_RELOC_TASKS);
  92. #endif
  93. return (0);
  94. }
  95. void uart_port_conf(void)
  96. {
  97. volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
  98. volatile u8 *pscsicr = (u8 *) (CFG_UART_BASE + 0x40);
  99. /* Setup Ports: */
  100. switch (CFG_UART_PORT) {
  101. case 0:
  102. gpio->par_psc0 = (GPIO_PAR_PSC0_TXD0 | GPIO_PAR_PSC0_RXD0);
  103. break;
  104. case 1:
  105. gpio->par_psc1 = (GPIO_PAR_PSC1_TXD1 | GPIO_PAR_PSC1_RXD1);
  106. break;
  107. case 2:
  108. gpio->par_psc2 = (GPIO_PAR_PSC2_TXD2 | GPIO_PAR_PSC2_RXD2);
  109. break;
  110. case 3:
  111. gpio->par_psc3 = (GPIO_PAR_PSC3_TXD3 | GPIO_PAR_PSC3_RXD3);
  112. break;
  113. }
  114. *pscsicr &= 0xF8;
  115. }