linkstation.c 3.5 KB

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