via.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright 2006 Freescale Semiconductor.
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #include <common.h>
  23. #include <pci.h>
  24. /* Config the VIA chip */
  25. void mpc85xx_config_via(struct pci_controller *hose,
  26. pci_dev_t dev, struct pci_config_table *tab)
  27. {
  28. pci_dev_t bridge;
  29. /* Enable USB and IDE functions */
  30. pci_hose_write_config_byte(hose, dev, 0x48, 0x08);
  31. pciauto_config_device(hose, dev);
  32. /*
  33. * Force the backplane P2P bridge to have a window
  34. * open from 0x00000000-0x00001fff in PCI I/O space.
  35. * This allows legacy I/O (i8259, etc) on the VIA
  36. * southbridge to be accessed.
  37. */
  38. bridge = PCI_BDF(0,17,0);
  39. pci_hose_write_config_byte(hose, bridge, PCI_IO_BASE, 0);
  40. pci_hose_write_config_word(hose, bridge, PCI_IO_BASE_UPPER16, 0);
  41. pci_hose_write_config_byte(hose, bridge, PCI_IO_LIMIT, 0x10);
  42. pci_hose_write_config_word(hose, bridge, PCI_IO_LIMIT_UPPER16, 0);
  43. }
  44. /* Function 1, IDE */
  45. void mpc85xx_config_via_usbide(struct pci_controller *hose,
  46. pci_dev_t dev, struct pci_config_table *tab)
  47. {
  48. pciauto_config_device(hose, dev);
  49. /*
  50. * Since the P2P window was forced to cover the fixed
  51. * legacy I/O addresses, it is necessary to manually
  52. * place the base addresses for the IDE and USB functions
  53. * within this window.
  54. */
  55. pci_hose_write_config_dword(hose, dev, PCI_BASE_ADDRESS_0, 0x1ff8);
  56. pci_hose_write_config_dword(hose, dev, PCI_BASE_ADDRESS_1, 0x1ff4);
  57. pci_hose_write_config_dword(hose, dev, PCI_BASE_ADDRESS_2, 0x1fe8);
  58. pci_hose_write_config_dword(hose, dev, PCI_BASE_ADDRESS_3, 0x1fe4);
  59. pci_hose_write_config_dword(hose, dev, PCI_BASE_ADDRESS_4, 0x1fd0);
  60. }
  61. /* Function 2, USB ports 0-1 */
  62. void mpc85xx_config_via_usb(struct pci_controller *hose,
  63. pci_dev_t dev, struct pci_config_table *tab)
  64. {
  65. pciauto_config_device(hose, dev);
  66. pci_hose_write_config_dword(hose, dev, PCI_BASE_ADDRESS_4, 0x1fa0);
  67. }
  68. /* Function 3, USB ports 2-3 */
  69. void mpc85xx_config_via_usb2(struct pci_controller *hose,
  70. pci_dev_t dev, struct pci_config_table *tab)
  71. {
  72. pciauto_config_device(hose, dev);
  73. pci_hose_write_config_dword(hose, dev, PCI_BASE_ADDRESS_4, 0x1f80);
  74. }
  75. /* Function 5, Power Management */
  76. void mpc85xx_config_via_power(struct pci_controller *hose,
  77. pci_dev_t dev, struct pci_config_table *tab)
  78. {
  79. pciauto_config_device(hose, dev);
  80. pci_hose_write_config_dword(hose, dev, PCI_BASE_ADDRESS_0, 0x1e00);
  81. pci_hose_write_config_dword(hose, dev, PCI_BASE_ADDRESS_1, 0x1dfc);
  82. pci_hose_write_config_dword(hose, dev, PCI_BASE_ADDRESS_2, 0x1df8);
  83. }
  84. /* Function 6, AC97 Interface */
  85. void mpc85xx_config_via_ac97(struct pci_controller *hose,
  86. pci_dev_t dev, struct pci_config_table *tab)
  87. {
  88. pciauto_config_device(hose, dev);
  89. pci_hose_write_config_dword(hose, dev, PCI_BASE_ADDRESS_0, 0x1c00);
  90. }