simpc8313.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * Copyright (C) Freescale Semiconductor, Inc. 2006-2007
  3. * Copyright (C) Sheldon Instruments, Inc. 2008
  4. *
  5. * Author: Ron Madrid <info@sheldoninst.com>
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #include <common.h>
  26. #include <libfdt.h>
  27. #include <pci.h>
  28. #include <mpc83xx.h>
  29. #include <ns16550.h>
  30. #include <nand.h>
  31. DECLARE_GLOBAL_DATA_PTR;
  32. int checkboard(void)
  33. {
  34. puts("Board: Sheldon Instruments SIMPC8313\n");
  35. return 0;
  36. }
  37. #ifndef CONFIG_NAND_SPL
  38. static struct pci_region pci_regions[] = {
  39. {
  40. bus_start: CONFIG_SYS_PCI1_MEM_BASE,
  41. phys_start: CONFIG_SYS_PCI1_MEM_PHYS,
  42. size: CONFIG_SYS_PCI1_MEM_SIZE,
  43. flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
  44. },
  45. {
  46. bus_start: CONFIG_SYS_PCI1_MMIO_BASE,
  47. phys_start: CONFIG_SYS_PCI1_MMIO_PHYS,
  48. size: CONFIG_SYS_PCI1_MMIO_SIZE,
  49. flags: PCI_REGION_MEM
  50. },
  51. {
  52. bus_start: CONFIG_SYS_PCI1_IO_BASE,
  53. phys_start: CONFIG_SYS_PCI1_IO_PHYS,
  54. size: CONFIG_SYS_PCI1_IO_SIZE,
  55. flags: PCI_REGION_IO
  56. }
  57. };
  58. void pci_init_board(void)
  59. {
  60. volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
  61. volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
  62. volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
  63. struct pci_region *reg[] = { pci_regions };
  64. int warmboot;
  65. /* Enable all 3 PCI_CLK_OUTPUTs. */
  66. clk->occr |= 0xe0000000;
  67. /*
  68. * Configure PCI Local Access Windows
  69. */
  70. pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR;
  71. pci_law[0].ar = LBLAWAR_EN | LBLAWAR_512MB;
  72. pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR;
  73. pci_law[1].ar = LBLAWAR_EN | LBLAWAR_1MB;
  74. warmboot = gd->bd->bi_bootflags & BOOTFLAG_WARM;
  75. mpc83xx_pci_init(1, reg, warmboot);
  76. }
  77. /*
  78. * Miscellaneous late-boot configurations
  79. */
  80. int misc_init_r(void)
  81. {
  82. int rc = 0;
  83. return rc;
  84. }
  85. #if defined(CONFIG_OF_BOARD_SETUP)
  86. void ft_board_setup(void *blob, bd_t *bd)
  87. {
  88. ft_cpu_setup(blob, bd);
  89. #ifdef CONFIG_PCI
  90. ft_pci_setup(blob, bd);
  91. #endif
  92. }
  93. #endif
  94. #else /* CONFIG_NAND_SPL */
  95. void board_init_f(ulong bootflag)
  96. {
  97. NS16550_init((NS16550_t)(CONFIG_SYS_IMMR + 0x4500),
  98. CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
  99. puts("NAND boot... ");
  100. init_timebase();
  101. initdram(0);
  102. relocate_code(CONFIG_SYS_NAND_U_BOOT_RELOC + 0x10000, (gd_t *)gd,
  103. CONFIG_SYS_NAND_U_BOOT_RELOC);
  104. }
  105. void board_init_r(gd_t *gd, ulong dest_addr)
  106. {
  107. nand_boot();
  108. }
  109. void putc(char c)
  110. {
  111. if (gd->flags & GD_FLG_SILENT)
  112. return;
  113. if (c == '\n')
  114. NS16550_putc((NS16550_t)(CONFIG_SYS_IMMR + 0x4500), '\r');
  115. NS16550_putc((NS16550_t)(CONFIG_SYS_IMMR + 0x4500), c);
  116. }
  117. #endif