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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Driver for Altera Partial Reconfiguration IP Core
  3. *
  4. * Copyright (C) 2016-2017 Intel Corporation
  5. *
  6. * Based on socfpga-a10.c Copyright (C) 2015-2016 Altera Corporation
  7. * by Alan Tull <atull@opensource.altera.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms and conditions of the GNU General Public License,
  11. * version 2, as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope it will be useful, but WITHOUT
  14. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  16. * more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along with
  19. * this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #include <linux/fpga/altera-pr-ip-core.h>
  22. #include <linux/module.h>
  23. #include <linux/of_device.h>
  24. static int alt_pr_platform_probe(struct platform_device *pdev)
  25. {
  26. struct device *dev = &pdev->dev;
  27. void __iomem *reg_base;
  28. struct resource *res;
  29. /* First mmio base is for register access */
  30. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  31. reg_base = devm_ioremap_resource(dev, res);
  32. if (IS_ERR(reg_base))
  33. return PTR_ERR(reg_base);
  34. return alt_pr_register(dev, reg_base);
  35. }
  36. static int alt_pr_platform_remove(struct platform_device *pdev)
  37. {
  38. struct device *dev = &pdev->dev;
  39. return alt_pr_unregister(dev);
  40. }
  41. static const struct of_device_id alt_pr_of_match[] = {
  42. { .compatible = "altr,a10-pr-ip", },
  43. {},
  44. };
  45. MODULE_DEVICE_TABLE(of, alt_pr_of_match);
  46. static struct platform_driver alt_pr_platform_driver = {
  47. .probe = alt_pr_platform_probe,
  48. .remove = alt_pr_platform_remove,
  49. .driver = {
  50. .name = "alt_a10_pr_ip",
  51. .of_match_table = alt_pr_of_match,
  52. },
  53. };
  54. module_platform_driver(alt_pr_platform_driver);
  55. MODULE_AUTHOR("Matthew Gerlach <matthew.gerlach@linux.intel.com>");
  56. MODULE_DESCRIPTION("Altera Partial Reconfiguration IP Platform Driver");
  57. MODULE_LICENSE("GPL v2");