pcie-mobiveil-plat.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * PCIe host controller driver for Mobiveil PCIe Host controller
  4. *
  5. * Copyright (c) 2018 Mobiveil Inc.
  6. * Copyright 2019 NXP
  7. *
  8. * Author: Subrahmanya Lingappa <[email protected]>
  9. * Hou Zhiqiang <[email protected]>
  10. */
  11. #include <linux/init.h>
  12. #include <linux/kernel.h>
  13. #include <linux/module.h>
  14. #include <linux/of_pci.h>
  15. #include <linux/pci.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/slab.h>
  18. #include "pcie-mobiveil.h"
  19. static int mobiveil_pcie_probe(struct platform_device *pdev)
  20. {
  21. struct mobiveil_pcie *pcie;
  22. struct pci_host_bridge *bridge;
  23. struct device *dev = &pdev->dev;
  24. /* allocate the PCIe port */
  25. bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
  26. if (!bridge)
  27. return -ENOMEM;
  28. pcie = pci_host_bridge_priv(bridge);
  29. pcie->rp.bridge = bridge;
  30. pcie->pdev = pdev;
  31. return mobiveil_pcie_host_probe(pcie);
  32. }
  33. static const struct of_device_id mobiveil_pcie_of_match[] = {
  34. {.compatible = "mbvl,gpex40-pcie",},
  35. {},
  36. };
  37. MODULE_DEVICE_TABLE(of, mobiveil_pcie_of_match);
  38. static struct platform_driver mobiveil_pcie_driver = {
  39. .probe = mobiveil_pcie_probe,
  40. .driver = {
  41. .name = "mobiveil-pcie",
  42. .of_match_table = mobiveil_pcie_of_match,
  43. .suppress_bind_attrs = true,
  44. },
  45. };
  46. builtin_platform_driver(mobiveil_pcie_driver);
  47. MODULE_LICENSE("GPL v2");
  48. MODULE_DESCRIPTION("Mobiveil PCIe host controller driver");
  49. MODULE_AUTHOR("Subrahmanya Lingappa <[email protected]>");