Altera Partial Reconfiguration IP
Subsystems (2)
v6 cover Altera Partial Reconfiguration IP
From: Matthew Gerlach <[email protected]>
This set of patches implements a fpga-mgr driver for the Altera Partial Reconfiguration IP. The driver depends on a patch from Alan Tull that adds a config complete timeout. The driver code itself is divided into core functions and functions to implement a platform driver. It is expected that drivers for other buses like PCIe would also use the core functions.
Alan Tull (1):
fpga: add config complete timeout
Matthew Gerlach (3):
fpga pr ip: Core driver support for Altera Partial Reconfiguration IP. fpga dt: bindings for Altera Partial Reconfiguration IP. fpga pr ip: Platform driver for Altera Partial Reconfiguration IP.
.../devicetree/bindings/fpga/altera-pr-ip.txt | 12 ++ drivers/fpga/Kconfig | 12 ++ drivers/fpga/Makefile | 2 + drivers/fpga/altera-pr-ip-core-plat.c | 68 +++++++ drivers/fpga/altera-pr-ip-core.c | 220 +++++++++++++++++++++ drivers/fpga/fpga-region.c | 3 + include/linux/fpga/altera-pr-ip-core.h | 29 +++ include/linux/fpga/fpga-mgr.h | 3 + 8 files changed, 349 insertions(+) create mode 100644 Documentation/devicetree/bindings/fpga/altera-pr-ip.txt create mode 100644 drivers/fpga/altera-pr-ip-core-plat.c create mode 100644 drivers/fpga/altera-pr-ip-core.c create mode 100644 include/linux/fpga/altera-pr-ip-core.h
Signature · 1 line
2.7.4
PATCH v6 1/4 fpga: add config complete timeout
From: Alan Tull <[email protected]>
Adding timeout for maximum allowed time for FPGA to go to operating mode after a FPGA region has been programmed.
--- drivers/fpga/fpga-region.c | 3 +++ include/linux/fpga/fpga-mgr.h | 3 +++ 2 files changed, 6 insertions(+)
drivers/fpga/fpga-region.c +3 -0
@@ -385,6 +385,9 @@ static int fpga_region_notify_pre_apply(struct fpga_region *region,of_property_read_u32 (nd->overlay,"region-freeze-timeout-us" , &info->disable_timeout_us); +of_property_read_u32 (nd->overlay,"config-complete-timeout-us" , + &info->config_complete_timeout_us); +/* If FPGA was externally programmed, don't specify firmware */ if ((info->flags &FPGA_MGR_EXTERNAL_CONFIG ) && firmware_name) {pr_err ("error: specified firmware and external-fpga-config" );
include/linux/fpga/fpga-mgr.h +3 -0
@@ -77,11 +77,14 @@ enum fpga_mgr_states {* @flags: boolean flags as defined above * @enable_timeout_us: maximum time to enable traffic through bridge (uSec) * @disable_timeout_us: maximum time to disable traffic through bridge (uSec) +* @config_complete_timeout_us: maximum time for FPGA to switch to operating +* status in the write_complete op. */ struct fpga_image_info {u32 flags;u32 enable_timeout_us;u32 disable_timeout_us; +u32 config_complete_timeout_us; };/**
Signature · 1 line
2.7.4
PATCH v6 2/4 fpga pr ip: Core driver support for Altera Partial Reconfiguration IP.
In reply to [email protected]From: Matthew Gerlach <[email protected]>
Adding the core functions necessary for a fpga-mgr driver for the Altera Partial IP component. It is intended for these functions to be used by the various bus implementations like the platform bus or the PCIe bus.
---
v6:
Suggestions from Anatolij Gustschin <[email protected]> s/pr_err/dev_err/g
Change for loop to do/while to handle config_complete_timeout_us == 0 move altera-pr-ip-core.h to include/linux/fpga
v5:
Fix comment as suggested by Rob Herring <[email protected]>
v4:
v3 patch set mistakenly sent out labeled as v4
v3:
s/alt_pr_probe/alt_pr_register/ s/alt_pr_remove/alt_pr_unregister/
--- drivers/fpga/Kconfig | 5 + drivers/fpga/Makefile | 1 + drivers/fpga/altera-pr-ip-core.c | 220 +++++++++++++++++++++++++++++++++ include/linux/fpga/altera-pr-ip-core.h | 29 +++++ 4 files changed, 255 insertions(+) create mode 100644 drivers/fpga/altera-pr-ip-core.c create mode 100644 include/linux/fpga/altera-pr-ip-core.h
drivers/fpga/Kconfig +5 -0
@@ -76,6 +76,11 @@ config ALTERA_FREEZE_BRIDGE isolate one region of the FPGA from the busses while that region is being reprogrammed. +config ALTERA_PR_IP_CORE + tristate "Altera Partial Reconfiguration IP Core" + help + Core driver support for Altera Partial Reconfiguration IP component + endif # FPGA endmenu
drivers/fpga/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_FPGA_MGR_SOCFPGA) += socfpga.o obj-$(CONFIG_FPGA_MGR_SOCFPGA_A10) += socfpga-a10.o obj-$(CONFIG_FPGA_MGR_TS73XX) += ts73xx-fpga.o obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o +obj-$(CONFIG_ALTERA_PR_IP_CORE) += altera-pr-ip-core.o # FPGA Bridge Drivers obj-$(CONFIG_FPGA_BRIDGE) += fpga-bridge.o
drivers/fpga/altera-pr-ip-core.c new file +220 -0
220 lines not on this page · raw message
include/linux/fpga/altera-pr-ip-core.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Driver for Altera Partial Reconfiguration IP Core +* +* Copyright (C) 2016 Intel Corporation +* +* Based on socfpga-a10.c Copyright (C) 2015-2016 Altera Corporation +* by Alan Tull <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _ALT_PR_IP_CORE_H +#define _ALT_PR_IP_CORE_H +#include <linux/io.h> + +int alt_pr_register (struct device *dev,void __iomem *reg_base); +int alt_pr_unregister (struct device *dev); + +#endif /* _ALT_PR_IP_CORE_H */
Signature · 1 line
2.7.4
Re: [PATCH v6 2/4] fpga pr ip: Core driver support for Altera Partial Reconfiguration IP.
Quoted 8 lines · On Tue, Mar 21, 2017 at 4:02 PM, <[email protected]> wrote:
From: Matthew Gerlach <[email protected]>
Adding the core functions necessary for a fpga-mgr driver for the Altera Partial IP component. It is intended for these functions to be used by the various bus implementations like the platform bus or the PCIe bus.
Signed-off-by Matthew Gerlach <[email protected]>
Quoted 14 lines
---
v6:
Suggestions from Anatolij Gustschin <[email protected]> s/pr_err/dev_err/g
Change for loop to do/while to handleconfig_complete_timeout_us== 0 movealtera-pr-ip-core.htoinclude/linux/fpga
v5:
Fix comment as suggested by Rob Herring <[email protected]>
v4:
v3 patch set mistakenly sent out labeled as v4
v3:
s/alt_pr_probe/alt_pr_register/ s/alt_pr_remove/alt_pr_unregister/
PATCH v6 3/4 fpga dt: bindings for Altera Partial Reconfiguration IP.
In reply to [email protected]From: Matthew Gerlach <[email protected]>
Device Tree bindings for Altera Partial Reconfiguration IP.
---
v5:
fix comment as suggested by Rob Herring <[email protected]> added Acked-by: Rob Herring <[email protected]>
v4: v3 patch set mistakenly sent out labeled as v4
v3: s/altr,pr-ip/altr,a10-pr-ip/
v2: s/Reconfiguraion/Reconfiguration/
--- Documentation/devicetree/bindings/fpga/altera-pr-ip.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Documentation/devicetree/bindings/fpga/altera-pr-ip.txt
Documentation/devicetree/bindings/fpga/altera-pr-ip.txt new file +12 -0
@@ -0,0 +1,12 @@ +Altera Arria10 Partial Reconfiguration IP + +Required properties: +- compatible : should contain "altr,a10-pr-ip" +- reg : base address and size for memory mapped io. + +Example: + + fpga_mgr: fpga-mgr@ff20c000 { + compatible = "altr,a10-pr-ip"; + reg = <0xff20c000 0x10>; + };
Signature · 1 line
2.7.4
Re: [PATCH v6 3/4] fpga dt: bindings for Altera Partial Reconfiguration IP.
Quoted 6 lines · On Tue, Mar 21, 2017 at 4:02 PM, <[email protected]> wrote:
From: Matthew Gerlach <[email protected]>
Device Tree bindings for Altera Partial Reconfiguration IP.
Signed-off-by Matthew Gerlach <[email protected]>Acked-by Rob Herring <[email protected]>
Acked-by: Alan Tull <[email protected]>
Quoted 11 lines
---
v5:
fix comment as suggested by Rob Herring <[email protected]> added Acked-by: Rob Herring <[email protected]>
v4: v3 patch set mistakenly sent out labeled as v4
v3: s/altr,pr-ip/altr,a10-pr-ip/
v2: s/Reconfiguraion/Reconfiguration/--- Documentation/devicetree/bindings/fpga/altera-pr-ip.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644
Documentation/devicetree/bindings/fpga/altera-pr-ip.txt
Review
Quoted 2 lines
(quoted diff) +0
-0
b/Documentation/devicetree/bindings/fpga/altera-pr-ip.txt
Quoted 20 lines
new file mode 100644
index 0000000..52a294cDocumentation/devicetree/bindings/fpga/altera-pr-ip.txt new file +12
-1@@ -0,0 +1,12 @@ +Altera Arria10 Partial Reconfiguration IP + +Required properties: +- compatible : should contain "altr,a10-pr-ip" +- reg : base address and size for memory mapped io. + +Example: + + fpga_mgr: fpga-mgr@ff20c000 { + compatible = "altr,a10-pr-ip"; + reg = <0xff20c000 0x10>; + }; --2.7.4
Re: [PATCH v6 3/4] fpga dt: bindings for Altera Partial Reconfiguration IP.
In reply to [email protected]Quoted 7 lines · On Tue, Mar 21, 2017 at 4:02 PM, <matthew.gerlach-VuQAYsv1563Yd54FQh9/CA@public…
From: Matthew Gerlach <matthew.gerlach-VuQAYsv1563Yd54FQh9/[email protected]>
Device Tree bindings for Altera Partial Reconfiguration IP.
Quoted 31 lines
---
v5:
fix comment as suggested by Rob Herring <[email protected]> added Acked-by: Rob Herring <[email protected]>
v4: v3 patch set mistakenly sent out labeled as v4
v3: s/altr,pr-ip/altr,a10-pr-ip/
v2: s/Reconfiguraion/Reconfiguration/--- Documentation/devicetree/bindings/fpga/altera-pr-ip.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Documentation/devicetree/bindings/fpga/altera-pr-ip.txtDocumentation/devicetree/bindings/fpga/altera-pr-ip.txt new file +12
-1@@ -0,0 +1,12 @@ +Altera Arria10 Partial Reconfiguration IP + +Required properties: +- compatible : should contain "altr,a10-pr-ip" +- reg : base address and size for memory mapped io. + +Example: + + fpga_mgr: fpga-mgr@ff20c000 { + compatible = "altr,a10-pr-ip"; + reg = <0xff20c000 0x10>; + }; --
Quoted 2 lines
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v6 4/4 fpga pr ip: Platform driver for Altera Partial Reconfiguration IP.
In reply to [email protected]From: Matthew Gerlach <matthew.gerlach-VuQAYsv1563Yd54FQh9/[email protected]>
This adds a platform bus driver for a fpga-mgr driver that uses the Altera Partial Reconfiguration IP component.
---
v6:
add MODULE_LICENSE/DESCRIPTION/AUTHOR as suggested by Anatolij Gustschin <[email protected]>
v5: fix comment as suggested by Rob Herring <[email protected]>
v4: v3 patch set mistakenly sent out labeled as v4
v3:
s/altr,pr-ip/altr,a10-pr-ip/
s/alt_pr_probe/alt_pr_register/
s/alt_pr_remove/alt_pr_unregister/
fix error found by kbuild robot with more precise Kconfig depends
v2: s/altr,pr-ip-core/altr,pr-ip/
--- drivers/fpga/Kconfig | 7 ++++ drivers/fpga/Makefile | 1 + drivers/fpga/altera-pr-ip-core-plat.c | 68 +++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 drivers/fpga/altera-pr-ip-core-plat.c
drivers/fpga/Kconfig +7 -0
@@ -81,6 +81,13 @@ config ALTERA_PR_IP_CORE help Core driver support for Altera Partial Reconfiguration IP component +config ALTERA_PR_IP_CORE_PLAT + tristate "Platform support of Altera Partial Reconfiguration IP Core" + depends on ALTERA_PR_IP_CORE && OF && HAS_IOMEM + help + Platform driver support for Altera Partial Reconfiguration IP + component + endif # FPGA endmenu
drivers/fpga/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_FPGA_MGR_SOCFPGA_A10) += socfpga-a10.o obj-$(CONFIG_FPGA_MGR_TS73XX) += ts73xx-fpga.o obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o obj-$(CONFIG_ALTERA_PR_IP_CORE) += altera-pr-ip-core.o +obj-$(CONFIG_ALTERA_PR_IP_CORE_PLAT) += altera-pr-ip-core-plat.o # FPGA Bridge Drivers obj-$(CONFIG_FPGA_BRIDGE) += fpga-bridge.o
drivers/fpga/altera-pr-ip-core-plat.c new file +68 -0
68 lines not on this page · raw message
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 4/4] fpga pr ip: Platform driver for Altera Partial Reconfiguration IP.
Quoted 6 lines · On Tue, Mar 21, 2017 at 4:02 PM, <matthew.gerlach-VuQAYsv1563Yd54FQh9/CA@publi…
From: Matthew Gerlach <matthew.gerlach-VuQAYsv1563Yd54FQh9/[email protected]>
This adds a platform bus driver for a fpga-mgr driver that uses the Altera Partial Reconfiguration IP component.
Quoted 126 lines
---
v6:
add MODULE_LICENSE/DESCRIPTION/AUTHOR as suggested by Anatolij Gustschin <[email protected]>v5: fix comment as suggested by Rob Herring <[email protected]>
v4: v3 patch set mistakenly sent out labeled as v4
v3:
s/altr,pr-ip/altr,a10-pr-ip/
s/alt_pr_probe/alt_pr_register/
s/alt_pr_remove/alt_pr_unregister/
fix error found by kbuild robot with more preciseKconfigdependsv2: s/altr,pr-ip-core/altr,pr-ip/
--- drivers/fpga/Kconfig | 7 ++++ drivers/fpga/Makefile | 1 + drivers/fpga/altera-pr-ip-core-plat.c | 68 +++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 drivers/fpga/altera-pr-ip-core-plat.cdrivers/fpga/Kconfig +7
-0@@ -81,6 +81,13 @@ config ALTERA_PR_IP_CORE help Core driver support for Altera Partial Reconfiguration IP component +config ALTERA_PR_IP_CORE_PLAT + tristate "Platform support of Altera Partial Reconfiguration IP Core" + depends on ALTERA_PR_IP_CORE && OF && HAS_IOMEM + help + Platform driver support for Altera Partial Reconfiguration IP + component + endif # FPGA endmenudrivers/fpga/Makefile +1
-0@@ -12,6 +12,7 @@ obj-$(CONFIG_FPGA_MGR_SOCFPGA_A10) += socfpga-a10.o obj-$(CONFIG_FPGA_MGR_TS73XX) += ts73xx-fpga.o obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o obj-$(CONFIG_ALTERA_PR_IP_CORE) += altera-pr-ip-core.o +obj-$(CONFIG_ALTERA_PR_IP_CORE_PLAT) += altera-pr-ip-core-plat.o # FPGA Bridge Drivers obj-$(CONFIG_FPGA_BRIDGE) += fpga-bridge.odrivers/fpga/altera-pr-ip-core-plat.c new file +68
-1@@ -0,0 +1,68 @@ +/* +* Driver for Altera Partial Reconfiguration IP Core +* +* Copyright (C) 2016-2017 Intel Corporation +* +* Based on socfpga-a10.c Copyright (C) 2015-2016 Altera Corporation +* by Alan Tull <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#include <linux/fpga/altera-pr-ip-core.h> +#include <linux/module.h> +#include <linux/of_device.h> + +static int alt_pr_platform_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +void __iomem *reg_base; +struct resource *res; + +/* First mmio base is for register access */ + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + + reg_base =devm_ioremap_resource (dev, res); + +if (IS_ERR (reg_base)) +return PTR_ERR (reg_base); + +return alt_pr_register (dev, reg_base); +} + +static int alt_pr_platform_remove (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; + +return alt_pr_unregister (dev); +} + +static const struct of_device_id alt_pr_of_match[] = { + { .compatible ="altr,a10-pr-ip" , }, + {}, +}; + +MODULE_DEVICE_TABLE (of, alt_pr_of_match); + +static struct platform_driver alt_pr_platform_driver = { + .probe = alt_pr_platform_probe, + .remove = alt_pr_platform_remove, + .driver = { + .name ="alt_a10_pr_ip" , + .of_match_table = alt_pr_of_match, + }, +}; + +module_platform_driver (alt_pr_platform_driver); +MODULE_AUTHOR ("Matthew Gerlach <matthew.gerlach-VuQAYsv1563Yd54FQh9/[email protected]>" ); +MODULE_DESCRIPTION ("Altera Partial Reconfiguration IP Platform Driver" ); +MODULE_LICENSE ("GPL v2" ); --
Quoted 2 lines
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html