pci.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (c) 2011 The Chromium OS Authors.
  3. * (C) Copyright 2008,2009
  4. * Graeme Russ, <graeme.russ@gmail.com>
  5. *
  6. * (C) Copyright 2002
  7. * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  8. *
  9. * SPDX-License-Identifier: GPL-2.0+
  10. */
  11. #include <common.h>
  12. #include <dm.h>
  13. #include <pci.h>
  14. #include <asm/pci.h>
  15. #include <asm/post.h>
  16. #include <asm/arch/bd82x6x.h>
  17. #include <asm/arch/pch.h>
  18. static int pci_ivybridge_probe(struct udevice *bus)
  19. {
  20. struct pci_controller *hose = dev_get_uclass_priv(bus);
  21. pci_dev_t dev;
  22. u16 reg16;
  23. if (!(gd->flags & GD_FLG_RELOC))
  24. return 0;
  25. post_code(0x50);
  26. bd82x6x_init();
  27. post_code(0x51);
  28. reg16 = 0xff;
  29. dev = PCH_DEV;
  30. reg16 = x86_pci_read_config16(dev, PCI_COMMAND);
  31. reg16 |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
  32. x86_pci_write_config16(dev, PCI_COMMAND, reg16);
  33. /*
  34. * Clear non-reserved bits in status register.
  35. */
  36. pci_hose_write_config_word(hose, dev, PCI_STATUS, 0xffff);
  37. pci_hose_write_config_byte(hose, dev, PCI_LATENCY_TIMER, 0x80);
  38. pci_hose_write_config_byte(hose, dev, PCI_CACHE_LINE_SIZE, 0x08);
  39. pci_write_bar32(hose, dev, 0, 0xf0000000);
  40. post_code(0x52);
  41. return 0;
  42. }
  43. static const struct dm_pci_ops pci_ivybridge_ops = {
  44. .read_config = pci_x86_read_config,
  45. .write_config = pci_x86_write_config,
  46. };
  47. static const struct udevice_id pci_ivybridge_ids[] = {
  48. { .compatible = "intel,pci-ivybridge" },
  49. { }
  50. };
  51. U_BOOT_DRIVER(pci_ivybridge_drv) = {
  52. .name = "pci_ivybridge",
  53. .id = UCLASS_PCI,
  54. .of_match = pci_ivybridge_ids,
  55. .ops = &pci_ivybridge_ops,
  56. .probe = pci_ivybridge_probe,
  57. };