altera-pr-ip-core-plat.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Driver for Altera Partial Reconfiguration IP Core
  4. *
  5. * Copyright (C) 2016-2017 Intel Corporation
  6. *
  7. * Based on socfpga-a10.c Copyright (C) 2015-2016 Altera Corporation
  8. * by Alan Tull <[email protected]>
  9. */
  10. #include <linux/fpga/altera-pr-ip-core.h>
  11. #include <linux/module.h>
  12. #include <linux/of_device.h>
  13. static int alt_pr_platform_probe(struct platform_device *pdev)
  14. {
  15. struct device *dev = &pdev->dev;
  16. void __iomem *reg_base;
  17. struct resource *res;
  18. /* First mmio base is for register access */
  19. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  20. reg_base = devm_ioremap_resource(dev, res);
  21. if (IS_ERR(reg_base))
  22. return PTR_ERR(reg_base);
  23. return alt_pr_register(dev, reg_base);
  24. }
  25. static const struct of_device_id alt_pr_of_match[] = {
  26. { .compatible = "altr,a10-pr-ip", },
  27. {},
  28. };
  29. MODULE_DEVICE_TABLE(of, alt_pr_of_match);
  30. static struct platform_driver alt_pr_platform_driver = {
  31. .probe = alt_pr_platform_probe,
  32. .driver = {
  33. .name = "alt_a10_pr_ip",
  34. .of_match_table = alt_pr_of_match,
  35. },
  36. };
  37. module_platform_driver(alt_pr_platform_driver);
  38. MODULE_AUTHOR("Matthew Gerlach <[email protected]>");
  39. MODULE_DESCRIPTION("Altera Partial Reconfiguration IP Platform Driver");
  40. MODULE_LICENSE("GPL v2");