Skip to contentSkip to conversation

Altera Partial Reconfiguration IP

PATCH Superseded [email protected] 2 participants 6 messages Mar 2, 2017 – Mar 3, 2017

Subsystems (2)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 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              |  65 ++++++
 drivers/fpga/altera-pr-ip-core.c                   | 217 +++++++++++++++++++++
 drivers/fpga/altera-pr-ip-core.h                   |  29 +++
 drivers/fpga/fpga-region.c                         |   3 +
 include/linux/fpga/fpga-mgr.h                      |   3 +
 8 files changed, 343 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 drivers/fpga/altera-pr-ip-core.h
Signature · 1 line
2.7.4
#1 lore raw

PATCH v4 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
index 3222fdb..28401cb 100644
@@ -381,6 +381,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
index 57beb5d..fd3f083 100644
@@ -76,11 +76,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
#2 lore raw

PATCH v4 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.

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 | 217 +++++++++++++++++++++++++++++++++++++++
 drivers/fpga/altera-pr-ip-core.h |  29 ++++++
 4 files changed, 252 insertions(+)
 create mode 100644 drivers/fpga/altera-pr-ip-core.c
 create mode 100644 drivers/fpga/altera-pr-ip-core.h
drivers/fpga/Kconfig +5 -0
index ce861a2..a46c173 100644
@@ -63,6 +63,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
index 8df07bc..82693d2 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_FPGA)			+= fpga-mgr.o
 obj-$(CONFIG_FPGA_MGR_SOCFPGA)		+= socfpga.o
 obj-$(CONFIG_FPGA_MGR_SOCFPGA_A10)	+= socfpga-a10.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 +217 -0

217 lines not on this page · raw message

drivers/fpga/altera-pr-ip-core.h new file +29 -0
new file mode 100644
index 0000000..3810a90
@@ -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
#3 lore raw

PATCH v4 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.

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
new file mode 100644
index 0000000..52a294c
@@ -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
maintainer Acked-by on v4 3/4
#4 lore raw

Re: [PATCH v4 3/4] fpga dt: bindings for Altera Partial Reconfiguration IP.

Quoted 7 lines · On Thu, Mar 02, 2017 at 07:57:11AM -0800, [email protected] wrote:

From: Matthew Gerlach <[email protected]>

Device Tree bindings for Altera Partial Reconfiguration IP.

v3: s/altr,pr-ip/altr,a10-pr-ip/
v2: s/Reconfiguraion/Reconfiguration/
====================

The version info should go after the '---'. Otherwise,

Quoted 28 lines
---
 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
new file mode 100644
index 0000000..52a294c
@@ -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
#5 lore raw

PATCH v4 4/4 fpga pr ip: Platform driver for Altera Partial Reconfiguration IP.

In reply to [email protected]

From: Matthew Gerlach <[email protected]>

This adds a platform bus driver for a fpga-mgr driver that uses the Altera Partial Reconfiguration IP component.

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 | 65 +++++++++++++++++++++++++++++++++++
 3 files changed, 73 insertions(+)
 create mode 100644 drivers/fpga/altera-pr-ip-core-plat.c
drivers/fpga/Kconfig +7 -0
index a46c173..0c51427 100644
@@ -68,6 +68,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
index 82693d2..5b8ae2b 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_FPGA_MGR_SOCFPGA)		+= socfpga.o
 obj-$(CONFIG_FPGA_MGR_SOCFPGA_A10)	+= socfpga-a10.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 +65 -0

65 lines not on this page · raw message

Signature · 1 line
2.7.4