acadia.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * (C) Copyright 2007
  3. * Stefan Roese, DENX Software Engineering, sr@denx.de.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <asm/processor.h>
  9. extern void board_pll_init_f(void);
  10. static void acadia_gpio_init(void)
  11. {
  12. /*
  13. * GPIO0 setup (select GPIO or alternate function)
  14. */
  15. out32(GPIO0_OSRL, CONFIG_SYS_GPIO0_OSRL);
  16. out32(GPIO0_OSRH, CONFIG_SYS_GPIO0_OSRH); /* output select */
  17. out32(GPIO0_ISR1L, CONFIG_SYS_GPIO0_ISR1L);
  18. out32(GPIO0_ISR1H, CONFIG_SYS_GPIO0_ISR1H); /* input select */
  19. out32(GPIO0_TSRL, CONFIG_SYS_GPIO0_TSRL);
  20. out32(GPIO0_TSRH, CONFIG_SYS_GPIO0_TSRH); /* three-state select */
  21. out32(GPIO0_TCR, CONFIG_SYS_GPIO0_TCR); /* enable output driver for outputs */
  22. /*
  23. * Ultra (405EZ) was nice enough to add another GPIO controller
  24. */
  25. out32(GPIO1_OSRH, CONFIG_SYS_GPIO1_OSRH); /* output select */
  26. out32(GPIO1_OSRL, CONFIG_SYS_GPIO1_OSRL);
  27. out32(GPIO1_ISR1H, CONFIG_SYS_GPIO1_ISR1H); /* input select */
  28. out32(GPIO1_ISR1L, CONFIG_SYS_GPIO1_ISR1L);
  29. out32(GPIO1_TSRH, CONFIG_SYS_GPIO1_TSRH); /* three-state select */
  30. out32(GPIO1_TSRL, CONFIG_SYS_GPIO1_TSRL);
  31. out32(GPIO1_TCR, CONFIG_SYS_GPIO1_TCR); /* enable output driver for outputs */
  32. }
  33. int board_early_init_f(void)
  34. {
  35. unsigned int reg;
  36. /* don't reinit PLL when booting via I2C bootstrap option */
  37. mfsdr(SDR0_PINSTP, reg);
  38. if (reg != 0xf0000000)
  39. board_pll_init_f();
  40. acadia_gpio_init();
  41. /* Configure 405EZ for NAND usage */
  42. mtsdr(SDR0_NAND0, SDR_NAND0_NDEN | SDR_NAND0_NDAREN | SDR_NAND0_NDRBEN);
  43. mfsdr(SDR0_ULTRA0, reg);
  44. reg &= ~SDR_ULTRA0_CSN_MASK;
  45. reg |= (SDR_ULTRA0_CSNSEL0 >> CONFIG_SYS_NAND_CS) |
  46. SDR_ULTRA0_NDGPIOBP |
  47. SDR_ULTRA0_EBCRDYEN |
  48. SDR_ULTRA0_NFSRSTEN;
  49. mtsdr(SDR0_ULTRA0, reg);
  50. /* USB Host core needs this bit set */
  51. mfsdr(SDR0_ULTRA1, reg);
  52. mtsdr(SDR0_ULTRA1, reg | SDR_ULTRA1_LEDNENABLE);
  53. mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */
  54. mtdcr(UIC0ER, 0x00000000); /* disable all ints */
  55. mtdcr(UIC0CR, 0x00000010);
  56. mtdcr(UIC0PR, 0xFE7FFFF0); /* set int polarities */
  57. mtdcr(UIC0TR, 0x00000010); /* set int trigger levels */
  58. mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */
  59. return 0;
  60. }
  61. int misc_init_f(void)
  62. {
  63. /* Set EPLD to take PHY out of reset */
  64. out8(CONFIG_SYS_CPLD_BASE + 0x05, 0x00);
  65. udelay(100000);
  66. return 0;
  67. }
  68. /*
  69. * Check Board Identity:
  70. */
  71. int checkboard(void)
  72. {
  73. char buf[64];
  74. int i = getenv_f("serial#", buf, sizeof(buf));
  75. u8 rev;
  76. rev = in8(CONFIG_SYS_CPLD_BASE + 0);
  77. printf("Board: Acadia - AMCC PPC405EZ Evaluation Board, Rev. %X", rev);
  78. if (i > 0) {
  79. puts(", serial# ");
  80. puts(buf);
  81. }
  82. putc('\n');
  83. return (0);
  84. }