acadia.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. * (C) Copyright 2007
  3. * Stefan Roese, DENX Software Engineering, sr@denx.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <asm/processor.h>
  25. extern void board_pll_init_f(void);
  26. /* Some specific Acadia Defines */
  27. #define CPLD_BASE 0x80000000
  28. void liveoak_gpio_init(void)
  29. {
  30. /*
  31. * GPIO0 setup (select GPIO or alternate function)
  32. */
  33. out32(GPIO0_OSRL, CFG_GPIO0_OSRL);
  34. out32(GPIO0_OSRH, CFG_GPIO0_OSRH); /* output select */
  35. out32(GPIO0_ISR1L, CFG_GPIO0_ISR1L);
  36. out32(GPIO0_ISR1H, CFG_GPIO0_ISR1H); /* input select */
  37. out32(GPIO0_TSRL, CFG_GPIO0_TSRL);
  38. out32(GPIO0_TSRH, CFG_GPIO0_TSRH); /* three-state select */
  39. out32(GPIO0_TCR, CFG_GPIO0_TCR); /* enable output driver for outputs */
  40. /*
  41. * Ultra (405EZ) was nice enough to add another GPIO controller
  42. */
  43. out32(GPIO1_OSRH, CFG_GPIO1_OSRH); /* output select */
  44. out32(GPIO1_OSRL, CFG_GPIO1_OSRL);
  45. out32(GPIO1_ISR1H, CFG_GPIO1_ISR1H); /* input select */
  46. out32(GPIO1_ISR1L, CFG_GPIO1_ISR1L);
  47. out32(GPIO1_TSRH, CFG_GPIO1_TSRH); /* three-state select */
  48. out32(GPIO1_TSRL, CFG_GPIO1_TSRL);
  49. out32(GPIO1_TCR, CFG_GPIO1_TCR); /* enable output driver for outputs */
  50. }
  51. #if 0 /* test-only: not called at all??? */
  52. void ext_bus_cntlr_init(void)
  53. {
  54. #if (defined(EBC_PB4AP) && defined(EBC_PB4CR) && !(CFG_INIT_DCACHE_CS == 4))
  55. mtebc(pb4ap, EBC_PB4AP);
  56. mtebc(pb4cr, EBC_PB4CR);
  57. #endif
  58. }
  59. #endif
  60. int board_early_init_f(void)
  61. {
  62. unsigned int reg;
  63. #if 0 /* test-only */
  64. /*
  65. * If CRAM memory and SPI/NAND boot, and if the CRAM memory is
  66. * already initialized by the pre-loader then we can't reinitialize
  67. * CPR registers, GPIO registers and EBC registers as this will
  68. * have the effect of un-initializing CRAM.
  69. */
  70. spr_reg = (volatile unsigned long) mfspr(SPRG7);
  71. if (spr_reg != LOAK_CRAM) { /* != CRAM */
  72. board_pll_init_f();
  73. liveoak_gpio_init();
  74. ext_bus_cntlr_init();
  75. mtebc(pb1ap, CFG_EBC_PB1AP);
  76. mtebc(pb1cr, CFG_EBC_PB1CR);
  77. mtebc(pb2ap, CFG_EBC_PB2AP);
  78. mtebc(pb2cr, CFG_EBC_PB2CR);
  79. }
  80. #else
  81. board_pll_init_f();
  82. liveoak_gpio_init();
  83. /* ext_bus_cntlr_init(); */
  84. #endif
  85. #if 0 /* test-only (orig) */
  86. /*
  87. * If we boot from NAND Flash, we are running in
  88. * RAM, so disable the EBC_CS0 so that it goes back
  89. * to the NOR Flash. It will be enabled later
  90. * for the NAND Flash on EBC_CS1
  91. */
  92. mfsdr(sdrultra0, reg);
  93. mtsdr(sdrultra0, reg & ~SDR_ULTRA0_CSNSEL0);
  94. #endif
  95. #if 0 /* test-only */
  96. /* configure for NAND */
  97. mfsdr(sdrultra0, reg);
  98. reg &= ~SDR_ULTRA0_CSN_MASK;
  99. reg |= SDR_ULTRA0_CSNSEL0 >> CFG_NAND_CS;
  100. mtsdr(sdrultra0, reg & ~SDR_ULTRA0_CSNSEL0);
  101. #endif
  102. /* USB Host core needs this bit set */
  103. mfsdr(sdrultra1, reg);
  104. mtsdr(sdrultra1, reg | SDR_ULTRA1_LEDNENABLE);
  105. mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */
  106. mtdcr(uicer, 0x00000000); /* disable all ints */
  107. mtdcr(uiccr, 0x00000010);
  108. mtdcr(uicpr, 0xFE7FFFF0); /* set int polarities */
  109. mtdcr(uictr, 0x00000010); /* set int trigger levels */
  110. mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */
  111. return 0;
  112. }
  113. int misc_init_f(void)
  114. {
  115. /* Set EPLD to take PHY out of reset */
  116. out8(CPLD_BASE + 0x05, 0x00);
  117. udelay(100000);
  118. return 0;
  119. }
  120. /*
  121. * Check Board Identity:
  122. */
  123. int checkboard(void)
  124. {
  125. char *s = getenv("serial#");
  126. printf("Board: Acadia - AMCC PPC405EZ Evaluation Board");
  127. if (s != NULL) {
  128. puts(", serial# ");
  129. puts(s);
  130. }
  131. putc('\n');
  132. return (0);
  133. }