15b73cb5bSMatthew Gerlach /* 25b73cb5bSMatthew Gerlach * Driver for Altera Partial Reconfiguration IP Core 35b73cb5bSMatthew Gerlach * 45b73cb5bSMatthew Gerlach * Copyright (C) 2016-2017 Intel Corporation 55b73cb5bSMatthew Gerlach * 65b73cb5bSMatthew Gerlach * Based on socfpga-a10.c Copyright (C) 2015-2016 Altera Corporation 75b73cb5bSMatthew Gerlach * by Alan Tull <atull@opensource.altera.com> 85b73cb5bSMatthew Gerlach * 95b73cb5bSMatthew Gerlach * This program is free software; you can redistribute it and/or modify it 105b73cb5bSMatthew Gerlach * under the terms and conditions of the GNU General Public License, 115b73cb5bSMatthew Gerlach * version 2, as published by the Free Software Foundation. 125b73cb5bSMatthew Gerlach * 135b73cb5bSMatthew Gerlach * This program is distributed in the hope it will be useful, but WITHOUT 145b73cb5bSMatthew Gerlach * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 155b73cb5bSMatthew Gerlach * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 165b73cb5bSMatthew Gerlach * more details. 175b73cb5bSMatthew Gerlach * 185b73cb5bSMatthew Gerlach * You should have received a copy of the GNU General Public License along with 195b73cb5bSMatthew Gerlach * this program. If not, see <http://www.gnu.org/licenses/>. 205b73cb5bSMatthew Gerlach */ 215b73cb5bSMatthew Gerlach #include <linux/fpga/altera-pr-ip-core.h> 225b73cb5bSMatthew Gerlach #include <linux/module.h> 235b73cb5bSMatthew Gerlach #include <linux/of_device.h> 245b73cb5bSMatthew Gerlach 255b73cb5bSMatthew Gerlach static int alt_pr_platform_probe(struct platform_device *pdev) 265b73cb5bSMatthew Gerlach { 275b73cb5bSMatthew Gerlach struct device *dev = &pdev->dev; 285b73cb5bSMatthew Gerlach void __iomem *reg_base; 295b73cb5bSMatthew Gerlach struct resource *res; 305b73cb5bSMatthew Gerlach 315b73cb5bSMatthew Gerlach /* First mmio base is for register access */ 325b73cb5bSMatthew Gerlach res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 335b73cb5bSMatthew Gerlach 345b73cb5bSMatthew Gerlach reg_base = devm_ioremap_resource(dev, res); 355b73cb5bSMatthew Gerlach 365b73cb5bSMatthew Gerlach if (IS_ERR(reg_base)) 375b73cb5bSMatthew Gerlach return PTR_ERR(reg_base); 385b73cb5bSMatthew Gerlach 395b73cb5bSMatthew Gerlach return alt_pr_register(dev, reg_base); 405b73cb5bSMatthew Gerlach } 415b73cb5bSMatthew Gerlach 425b73cb5bSMatthew Gerlach static int alt_pr_platform_remove(struct platform_device *pdev) 435b73cb5bSMatthew Gerlach { 445b73cb5bSMatthew Gerlach struct device *dev = &pdev->dev; 455b73cb5bSMatthew Gerlach 465b73cb5bSMatthew Gerlach return alt_pr_unregister(dev); 475b73cb5bSMatthew Gerlach } 485b73cb5bSMatthew Gerlach 495b73cb5bSMatthew Gerlach static const struct of_device_id alt_pr_of_match[] = { 505b73cb5bSMatthew Gerlach { .compatible = "altr,a10-pr-ip", }, 515b73cb5bSMatthew Gerlach {}, 525b73cb5bSMatthew Gerlach }; 535b73cb5bSMatthew Gerlach 545b73cb5bSMatthew Gerlach MODULE_DEVICE_TABLE(of, alt_pr_of_match); 555b73cb5bSMatthew Gerlach 565b73cb5bSMatthew Gerlach static struct platform_driver alt_pr_platform_driver = { 575b73cb5bSMatthew Gerlach .probe = alt_pr_platform_probe, 585b73cb5bSMatthew Gerlach .remove = alt_pr_platform_remove, 595b73cb5bSMatthew Gerlach .driver = { 605b73cb5bSMatthew Gerlach .name = "alt_a10_pr_ip", 615b73cb5bSMatthew Gerlach .of_match_table = alt_pr_of_match, 625b73cb5bSMatthew Gerlach }, 635b73cb5bSMatthew Gerlach }; 645b73cb5bSMatthew Gerlach 655b73cb5bSMatthew Gerlach module_platform_driver(alt_pr_platform_driver); 665b73cb5bSMatthew Gerlach MODULE_AUTHOR("Matthew Gerlach <matthew.gerlach@linux.intel.com>"); 675b73cb5bSMatthew Gerlach MODULE_DESCRIPTION("Altera Partial Reconfiguration IP Platform Driver"); 685b73cb5bSMatthew Gerlach MODULE_LICENSE("GPL v2"); 69