Linux Audio

Check our new training course

Loading...
v5.9
 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 <atull@opensource.altera.com>
 
 
 
 
 
 
 
 
 
 
 
 
 9 */
10#include <linux/fpga/altera-pr-ip-core.h>
11#include <linux/module.h>
12#include <linux/of_device.h>
13
14static int alt_pr_platform_probe(struct platform_device *pdev)
15{
16	struct device *dev = &pdev->dev;
17	void __iomem *reg_base;
18	struct resource *res;
19
20	/* First mmio base is for register access */
21	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
22
23	reg_base = devm_ioremap_resource(dev, res);
24
25	if (IS_ERR(reg_base))
26		return PTR_ERR(reg_base);
27
28	return alt_pr_register(dev, reg_base);
29}
30
31static int alt_pr_platform_remove(struct platform_device *pdev)
32{
33	struct device *dev = &pdev->dev;
34
35	alt_pr_unregister(dev);
36
37	return 0;
38}
39
40static const struct of_device_id alt_pr_of_match[] = {
41	{ .compatible = "altr,a10-pr-ip", },
42	{},
43};
44
45MODULE_DEVICE_TABLE(of, alt_pr_of_match);
46
47static struct platform_driver alt_pr_platform_driver = {
48	.probe = alt_pr_platform_probe,
49	.remove = alt_pr_platform_remove,
50	.driver = {
51		.name	= "alt_a10_pr_ip",
52		.of_match_table = alt_pr_of_match,
53	},
54};
55
56module_platform_driver(alt_pr_platform_driver);
57MODULE_AUTHOR("Matthew Gerlach <matthew.gerlach@linux.intel.com>");
58MODULE_DESCRIPTION("Altera Partial Reconfiguration IP Platform Driver");
59MODULE_LICENSE("GPL v2");
v4.17
 
 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
25static int alt_pr_platform_probe(struct platform_device *pdev)
26{
27	struct device *dev = &pdev->dev;
28	void __iomem *reg_base;
29	struct resource *res;
30
31	/* First mmio base is for register access */
32	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
33
34	reg_base = devm_ioremap_resource(dev, res);
35
36	if (IS_ERR(reg_base))
37		return PTR_ERR(reg_base);
38
39	return alt_pr_register(dev, reg_base);
40}
41
42static int alt_pr_platform_remove(struct platform_device *pdev)
43{
44	struct device *dev = &pdev->dev;
45
46	return alt_pr_unregister(dev);
 
 
47}
48
49static const struct of_device_id alt_pr_of_match[] = {
50	{ .compatible = "altr,a10-pr-ip", },
51	{},
52};
53
54MODULE_DEVICE_TABLE(of, alt_pr_of_match);
55
56static struct platform_driver alt_pr_platform_driver = {
57	.probe = alt_pr_platform_probe,
58	.remove = alt_pr_platform_remove,
59	.driver = {
60		.name	= "alt_a10_pr_ip",
61		.of_match_table = alt_pr_of_match,
62	},
63};
64
65module_platform_driver(alt_pr_platform_driver);
66MODULE_AUTHOR("Matthew Gerlach <matthew.gerlach@linux.intel.com>");
67MODULE_DESCRIPTION("Altera Partial Reconfiguration IP Platform Driver");
68MODULE_LICENSE("GPL v2");