linkstation.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * linkstation.c
  3. *
  4. * Misc LinkStation specific functions
  5. *
  6. * Copyright (C) 2006 Mihai Georgian <u-boot@linuxnotincluded.org.uk>
  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 <version.h>
  24. #include <common.h>
  25. #include <mpc824x.h>
  26. #include <asm/io.h>
  27. #include <ns16550.h>
  28. #ifdef CONFIG_PCI
  29. #include <pci.h>
  30. #endif
  31. extern void init_AVR_DUART(void);
  32. int checkboard (void)
  33. {
  34. DECLARE_GLOBAL_DATA_PTR;
  35. char *p;
  36. bd_t *bd = gd->bd;
  37. init_AVR_DUART();
  38. if ((p = getenv ("console_nr")) != NULL) {
  39. unsigned long con_nr = simple_strtoul (p, NULL, 10) & 3;
  40. bd->bi_baudrate &= ~3;
  41. bd->bi_baudrate |= con_nr & 3;
  42. }
  43. return 0;
  44. }
  45. long int initdram (int board_type)
  46. {
  47. return (get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE));
  48. }
  49. /*
  50. * Initialize PCI Devices
  51. */
  52. #ifdef CONFIG_PCI
  53. #ifndef CONFIG_PCI_PNP
  54. static struct pci_config_table pci_linkstation_config_table[] = {
  55. /* vendor, device, class */
  56. /* bus, dev, func */
  57. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
  58. PCI_ANY_ID, 0x0b, 0, /* AN983B or RTL8110S */
  59. /* ethernet controller */
  60. pci_cfgfunc_config_device, { PCI_ETH_IOADDR,
  61. PCI_ETH_MEMADDR,
  62. PCI_COMMAND_IO |
  63. PCI_COMMAND_MEMORY |
  64. PCI_COMMAND_MASTER }},
  65. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
  66. PCI_ANY_ID, 0x0c, 0, /* SII680 or IT8211AF */
  67. /* ide controller */
  68. pci_cfgfunc_config_device, { PCI_IDE_IOADDR,
  69. PCI_IDE_MEMADDR,
  70. PCI_COMMAND_IO |
  71. PCI_COMMAND_MEMORY |
  72. PCI_COMMAND_MASTER }},
  73. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
  74. PCI_ANY_ID, 0x0e, 0, /* D720101 USB controller, 1st USB 1.1 */
  75. pci_cfgfunc_config_device, { PCI_USB0_IOADDR,
  76. PCI_USB0_MEMADDR,
  77. PCI_COMMAND_MEMORY |
  78. PCI_COMMAND_MASTER }},
  79. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
  80. PCI_ANY_ID, 0x0e, 1, /* D720101 USB controller, 2nd USB 1.1 */
  81. pci_cfgfunc_config_device, { PCI_USB1_IOADDR,
  82. PCI_USB1_MEMADDR,
  83. PCI_COMMAND_MEMORY |
  84. PCI_COMMAND_MASTER }},
  85. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
  86. PCI_ANY_ID, 0x0e, 2, /* D720101 USB controller, USB 2.0 */
  87. pci_cfgfunc_config_device, { PCI_USB2_IOADDR,
  88. PCI_USB2_MEMADDR,
  89. PCI_COMMAND_MEMORY |
  90. PCI_COMMAND_MASTER }},
  91. { }
  92. };
  93. #endif
  94. struct pci_controller hose = {
  95. #ifndef CONFIG_PCI_PNP
  96. config_table:pci_linkstation_config_table,
  97. #endif
  98. };
  99. void pci_init_board (void)
  100. {
  101. pci_mpc824x_init (&hose);
  102. /* Reset USB 1.1 */
  103. /* Haven't seen any change without these on a HG, maybe it is
  104. * needed on other models */
  105. out_le32((volatile unsigned*)(PCI_USB0_MEMADDR + 8), 1);
  106. out_le32((volatile unsigned*)(PCI_USB1_MEMADDR + 8), 1);
  107. }
  108. #endif /* CONFIG_PCI */
  109. #define UART_DCR 0x80004511
  110. int board_early_init_f (void)
  111. {
  112. /* set DUART mode */
  113. out_8((volatile u8*)UART_DCR, 1);
  114. return 0;
  115. }