ixdp425.c 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. /*
  2. * (C) Copyright 2006
  3. * Stefan Roese, DENX Software Engineering, sr@denx.de.
  4. *
  5. * (C) Copyright 2002
  6. * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
  7. *
  8. * (C) Copyright 2002
  9. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  10. * Marius Groeger <mgroeger@sysgo.de>
  11. *
  12. * See file CREDITS for list of people who contributed to this
  13. * project.
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License as
  17. * published by the Free Software Foundation; either version 2 of
  18. * the License, or (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, write to the Free Software
  27. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  28. * MA 02111-1307 USA
  29. */
  30. #include <common.h>
  31. #include <command.h>
  32. #include <malloc.h>
  33. #include <netdev.h>
  34. #include <asm/arch/ixp425.h>
  35. #include <asm/io.h>
  36. #ifdef CONFIG_PCI
  37. #include <pci.h>
  38. #include <asm/arch/ixp425pci.h>
  39. #endif
  40. DECLARE_GLOBAL_DATA_PTR;
  41. #define IXDP425_LED_PORT 0x52000000 /* 4-digit hex display */
  42. int board_early_init_f(void)
  43. {
  44. /* CS2: LED port */
  45. writel(0xbcff0002, IXP425_EXP_CS2);
  46. writew(0x0001, IXDP425_LED_PORT); /* output postcode to LEDs */
  47. return 0;
  48. }
  49. #ifdef CONFIG_PCI
  50. #ifndef CONFIG_PCI_PNP
  51. static struct pci_config_table pci_ixpdp425_config_table[] = {
  52. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x00, PCI_ANY_ID,
  53. pci_cfgfunc_config_device,
  54. { 0x400,
  55. 0x40000000,
  56. PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER } },
  57. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x01, PCI_ANY_ID,
  58. pci_cfgfunc_config_device,
  59. { 0x800,
  60. 0x40010000,
  61. PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER } },
  62. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x02, PCI_ANY_ID,
  63. pci_cfgfunc_config_device,
  64. { 0xc00,
  65. 0x40020000,
  66. PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER } },
  67. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x03, PCI_ANY_ID,
  68. pci_cfgfunc_config_device,
  69. { 0x1000,
  70. 0x40030000,
  71. PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER } },
  72. { }
  73. };
  74. #endif
  75. struct pci_controller hose = {
  76. #ifndef CONFIG_PCI_PNP
  77. config_table: pci_ixpdp425_config_table,
  78. #endif
  79. };
  80. #endif /* CONFIG_PCI */
  81. /*
  82. * Miscelaneous platform dependent initialisations
  83. */
  84. int board_init(void)
  85. {
  86. writew(0x0002, IXDP425_LED_PORT); /* output postcode to LEDs */
  87. #ifdef CONFIG_IXDPG425
  88. /* arch number of IXDP */
  89. gd->bd->bi_arch_number = MACH_TYPE_IXDPG425;
  90. #else
  91. /* arch number of IXDP */
  92. gd->bd->bi_arch_number = MACH_TYPE_IXDP425;
  93. #endif
  94. /* adress of boot parameters */
  95. gd->bd->bi_boot_params = 0x00000100;
  96. #ifdef CONFIG_IXDPG425
  97. /*
  98. * Get realtek RTL8305 switch and SLIC out of reset
  99. */
  100. GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_SWITCH_RESET_N);
  101. GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_SWITCH_RESET_N);
  102. GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_SLIC_RESET_N);
  103. GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_SLIC_RESET_N);
  104. /*
  105. * Setup GPIOs for PCI INTA & INTB
  106. */
  107. GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_PCI_INTA_N);
  108. GPIO_INT_ACT_LOW_SET(CONFIG_SYS_GPIO_PCI_INTA_N);
  109. GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_PCI_INTB_N);
  110. GPIO_INT_ACT_LOW_SET(CONFIG_SYS_GPIO_PCI_INTB_N);
  111. /* Setup GPIOs for 33MHz clock output */
  112. writel(0x01FF01FF, IXP425_GPIO_GPCLKR);
  113. GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_PCI_CLK);
  114. GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_EXTBUS_CLK);
  115. /* set GPIO8..11 interrupt type to active low */
  116. writel((0x1 << 9) | (0x1 << 6) | (0x1 << 3) | 0x1, IXP425_GPIO_GPIT2R);
  117. /* clear pending interrupts */
  118. writel(-1, IXP425_GPIO_GPISR);
  119. /* assert PCI reset */
  120. GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_SLIC_RESET_N);
  121. udelay(533);
  122. /* deassert PCI reset */
  123. GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_SLIC_RESET_N);
  124. udelay(533);
  125. #else /* IXDP425 */
  126. /* Setup GPIOs for 33MHz ExpBus and PCI clock output */
  127. writel(0x01FF01FF, IXP425_GPIO_GPCLKR);
  128. GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_PCI_CLK);
  129. GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_EXTBUS_CLK);
  130. GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_PCI_RESET_N);
  131. /* set GPIO8..11 interrupt type to active low */
  132. writel((0x1 << 9) | (0x1 << 6) | (0x1 << 3) | 0x1, IXP425_GPIO_GPIT2R);
  133. /* clear pending interrupts */
  134. writel(-1, IXP425_GPIO_GPISR);
  135. /* assert PCI reset */
  136. GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_PCI_RESET_N);
  137. udelay(533);
  138. /* deassert PCI reset */
  139. GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_PCI_RESET_N);
  140. udelay(533);
  141. #endif
  142. return 0;
  143. }
  144. /*
  145. * Check Board Identity
  146. */
  147. int checkboard(void)
  148. {
  149. char buf[64];
  150. int i = getenv_f("serial#", buf, sizeof(buf));
  151. #ifdef CONFIG_IXDPG425
  152. puts("Board: IXDPG425 - Intel Network Gateway Reference Platform");
  153. #else
  154. puts("Board: IXDP425 - Intel Development Platform");
  155. #endif
  156. if (i > 0) {
  157. puts(", serial# ");
  158. puts(buf);
  159. }
  160. putc('\n');
  161. return 0;
  162. }
  163. int dram_init(void)
  164. {
  165. /* we can only map 64MB via PCI, so we limit memory
  166. until a better solution is implemented. */
  167. #ifdef CONFIG_PCI
  168. gd->ram_size = get_ram_size(CONFIG_SYS_SDRAM_BASE, 64<<20);
  169. #else
  170. gd->ram_size = get_ram_size(CONFIG_SYS_SDRAM_BASE, 256<<20);
  171. #endif
  172. return 0;
  173. }
  174. #ifdef CONFIG_PCI
  175. void pci_init_board(void)
  176. {
  177. pci_ixp_init(&hose);
  178. }
  179. /*
  180. * dev 0 on the PCI bus is not the host bridge, so we have to override
  181. * these functions in order to not skip PCI slot 0 during configuration.
  182. */
  183. int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev)
  184. {
  185. return 0;
  186. }
  187. int pci_print_dev(struct pci_controller *hose, pci_dev_t dev)
  188. {
  189. return 1;
  190. }
  191. #endif
  192. int board_eth_init(bd_t *bis)
  193. {
  194. #ifdef CONFIG_PCI
  195. pci_eth_init(bis);
  196. #endif
  197. return cpu_eth_init(bis);
  198. }