1473f01f7SAlan Tull // SPDX-License-Identifier: GPL-2.0
25b73cb5bSMatthew Gerlach /*
35b73cb5bSMatthew Gerlach  * Driver for Altera Partial Reconfiguration IP Core
45b73cb5bSMatthew Gerlach  *
55b73cb5bSMatthew Gerlach  * Copyright (C) 2016-2017 Intel Corporation
65b73cb5bSMatthew Gerlach  *
75b73cb5bSMatthew Gerlach  * Based on socfpga-a10.c Copyright (C) 2015-2016 Altera Corporation
85b73cb5bSMatthew Gerlach  *  by Alan Tull <atull@opensource.altera.com>
95b73cb5bSMatthew Gerlach  */
105b73cb5bSMatthew Gerlach #include <linux/fpga/altera-pr-ip-core.h>
115b73cb5bSMatthew Gerlach #include <linux/module.h>
12*84020839SRob Herring #include <linux/mod_devicetable.h>
13*84020839SRob Herring #include <linux/platform_device.h>
145b73cb5bSMatthew Gerlach 
alt_pr_platform_probe(struct platform_device * pdev)155b73cb5bSMatthew Gerlach static int alt_pr_platform_probe(struct platform_device *pdev)
165b73cb5bSMatthew Gerlach {
175b73cb5bSMatthew Gerlach 	struct device *dev = &pdev->dev;
185b73cb5bSMatthew Gerlach 	void __iomem *reg_base;
195b73cb5bSMatthew Gerlach 
205b73cb5bSMatthew Gerlach 	/* First mmio base is for register access */
21c9b5ff3bSYangtao Li 	reg_base = devm_platform_ioremap_resource(pdev, 0);
225b73cb5bSMatthew Gerlach 	if (IS_ERR(reg_base))
235b73cb5bSMatthew Gerlach 		return PTR_ERR(reg_base);
245b73cb5bSMatthew Gerlach 
255b73cb5bSMatthew Gerlach 	return alt_pr_register(dev, reg_base);
265b73cb5bSMatthew Gerlach }
275b73cb5bSMatthew Gerlach 
285b73cb5bSMatthew Gerlach static const struct of_device_id alt_pr_of_match[] = {
295b73cb5bSMatthew Gerlach 	{ .compatible = "altr,a10-pr-ip", },
305b73cb5bSMatthew Gerlach 	{},
315b73cb5bSMatthew Gerlach };
325b73cb5bSMatthew Gerlach 
335b73cb5bSMatthew Gerlach MODULE_DEVICE_TABLE(of, alt_pr_of_match);
345b73cb5bSMatthew Gerlach 
355b73cb5bSMatthew Gerlach static struct platform_driver alt_pr_platform_driver = {
365b73cb5bSMatthew Gerlach 	.probe = alt_pr_platform_probe,
375b73cb5bSMatthew Gerlach 	.driver = {
385b73cb5bSMatthew Gerlach 		.name	= "alt_a10_pr_ip",
395b73cb5bSMatthew Gerlach 		.of_match_table = alt_pr_of_match,
405b73cb5bSMatthew Gerlach 	},
415b73cb5bSMatthew Gerlach };
425b73cb5bSMatthew Gerlach 
435b73cb5bSMatthew Gerlach module_platform_driver(alt_pr_platform_driver);
445b73cb5bSMatthew Gerlach MODULE_AUTHOR("Matthew Gerlach <matthew.gerlach@linux.intel.com>");
455b73cb5bSMatthew Gerlach MODULE_DESCRIPTION("Altera Partial Reconfiguration IP Platform Driver");
465b73cb5bSMatthew Gerlach MODULE_LICENSE("GPL v2");
47