SoCFPGA: Add HPS bridges
cover SoCFPGA: Add HPS bridges
Hi!
This series adds support for the SoCFPGA bridges.
Quoted 1 line
From the datasheet:
The HPS-FPGA bridges allow masters in the FPGA fabric to communicate with slaves in the HPS logic and vice versa. For example, you can instantiate additional memories or peripherals in the FPGA fabric, and master interfaces belonging to components in the HPS logic can access them. You can also instantiate components such as a NiosII processor in the FPGA fabric and their master interfaces can access memories or peripherals in the HPS logic
This does only work with the driver from my other series
SoCFPGA: L3 NIC driver
As the binding, although simple, is still in debate and the outcome may have impact on this series, this is a just an RFC for now.
Also, the drivers beg for the DT overlay series which is floating around, but this shouldn't have any effect on the current binding. The driver part can be changed later.
Lastly, the bridges have an optional dependency on the fpgamgr series from Alan Tull. I have added this to the binding, the drivers don't do anything with this yet.
My idea here would be:
1. probe bridge
2. check if fpgamgr phandle is given
2a. if yes: defer till fpgamgr is done
2b. if no: continue
3. probe subnodes with the help of DT overlays
I have only tested the HPS and LWHPS drivers, as I don't have any bitstreams that use the FPGA2HPS bridge; here be dragons.
Regards,
Steffen
Steffen Trumtrar (3):
devicetree: bindings: Add SoCFpga HPS bridges
ARM: socfpga: Add drivers for the SoC-to-FPGA bridges
ARM: dts: socfpga: Add AXI bridges
.../soc/socfpga/altr,fpga2hps-axi-bridge.txt | 32 +++ .../soc/socfpga/altr,hps2fpga-axi-bridge.txt | 54 +++++ .../soc/socfpga/altr,lwhps2fpga-axi-bridge.txt | 31 +++ arch/arm/boot/dts/socfpga.dtsi | 48 ++++ drivers/soc/socfpga/Kconfig | 43 ++++ drivers/soc/socfpga/Makefile | 4 + drivers/soc/socfpga/bridges-common.c | 84 +++++++ drivers/soc/socfpga/bridges-common.h | 28 +++ drivers/soc/socfpga/fpga2hps-bridge.c | 97 ++++++++ drivers/soc/socfpga/hps2fpga-bridge.c | 258 +++++++++++++++++++++ drivers/soc/socfpga/lwhps2fpga-bridge.c | 141 +++++++++++ drivers/soc/socfpga/lwhps2fpga.h | 31 +++ include/soc/socfpga/bridge.h | 65 ++++++ 13 files changed, 916 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/socfpga/altr,fpga2hps-axi-bridge.txt create mode 100644 Documentation/devicetree/bindings/soc/socfpga/altr,hps2fpga-axi-bridge.txt create mode 100644 Documentation/devicetree/bindings/soc/socfpga/altr,lwhps2fpga-axi-bridge.txt create mode 100644 drivers/soc/socfpga/Kconfig create mode 100644 drivers/soc/socfpga/Makefile create mode 100644 drivers/soc/socfpga/bridges-common.c create mode 100644 drivers/soc/socfpga/bridges-common.h create mode 100644 drivers/soc/socfpga/fpga2hps-bridge.c create mode 100644 drivers/soc/socfpga/hps2fpga-bridge.c create mode 100644 drivers/soc/socfpga/lwhps2fpga-bridge.c create mode 100644 drivers/soc/socfpga/lwhps2fpga.h create mode 100644 include/soc/socfpga/bridge.h
Signature · 1 line
2.1.3
RFC 1/3 devicetree: bindings: Add SoCFpga HPS bridges
Quoted 1 line
From the datasheet:
The HPS-FPGA bridges allow masters in the FPGA fabric to communicate with slaves in the HPS logic and vice versa. For example, you can instantiate additional memories or peripherals in the FPGA fabric, and master interfaces belonging to components in the HPS logic can access them. You can also instantiate components such as a NiosII processor in the FPGA fabric and their master interfaces can access memories or peripherals in the HPS logic
This patch adds bindings for the three bridges on SoCFPGA:
- hps2fpga (buswidths: 32, 64, 128 bits)
- fpga2hps (buswidths: 32, 64, 128 bits)
- lwhps2fpga (buswidth: 32 bits)
Two of the bridges have a configurable buswidth (via bitstream). The bridges depend on the L3 NIC to be able to set bus visibility.
--- .../soc/socfpga/altr,fpga2hps-axi-bridge.txt | 32 +++++++++++++ .../soc/socfpga/altr,hps2fpga-axi-bridge.txt | 54 ++++++++++++++++++++++ .../soc/socfpga/altr,lwhps2fpga-axi-bridge.txt | 31 +++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/socfpga/altr,fpga2hps-axi-bridge.txt create mode 100644 Documentation/devicetree/bindings/soc/socfpga/altr,hps2fpga-axi-bridge.txt create mode 100644 Documentation/devicetree/bindings/soc/socfpga/altr,lwhps2fpga-axi-bridge.txt
Documentation/devicetree/bindings/soc/socfpga/altr,fpga2hps-axi-bridge.txt new file +32 -0
@@ -0,0 +1,32 @@ +Altera SoCFPGA FPGA2HPS AXI Bridge +---------------------------------- + +Required properties: + - compatible : "altr,fpga2hps-axi-bridge" + - reg : Must contain one range: + - the register space for the bridge module configuration + - resets : The reset line for the module + - reset-names : Must include "fpga2hps" + - bus-width : the configured bus width of the bridge + - allowed values : 32, 64, 128 + +Optional properties: + - altr,bridge-gpv : a pointer to the GPV master for configuration purposes + - fpgamgr : A pointer to the FPGA-Manager. This is needed, if the FPGA + needs to be loaded before the bridges can be enabled. + +Example: + + fpga2hps: axibridge at ff600000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "altr,fpga2hps-axi-bridge", "simple-bus"; + reg = <0xff600000 0x100000>; + clocks = <&l4_mp_clk>, <&l3_main_clk>; + clock-names = "gpv_clk", "data_clk"; + resets = <&rst FPGA2HPS_RESET>; + reset-names = "fpga2hps"; + altr,bridge-gpv = <&lwhps2fpga>; + bus-width = <64>; + status = "disabled"; + };
Documentation/devicetree/bindings/soc/socfpga/altr,hps2fpga-axi-bridge.txt new file +54 -0
54 lines not on this page · raw message
Documentation/devicetree/bindings/soc/socfpga/altr,lwhps2fpga-axi-bridge.txt new file +31 -0
@@ -0,0 +1,31 @@ +Altera SoCFPGA LWHPS2FPGA AXI Bridge +------------------------------------ + +Required properties: + - compatible : "altr,lwhps2fpga-axi-bridge" + - reg : Must contain two ranges: + 1. the register space for the bridge module configuration + 2. the address space for the bridge domain + - resets : The reset line for the module + - reset-names : Must include "lwhps2fpga" + - altr,l3-gpv : A pointer to the L3 NIC used for configuration +Optional properties: + - fpgamgr : A pointer to the FPGA-Manager. This is needed, if the + FPGA needs to be loaded before the bridges can be + enabled. + +Example: + + lwhps2fpga: axibridge at ff400000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "altr,lwhps2fpga-axi-bridge", "simple-bus"; + reg = <0xff400000 0x100000>, + <0xff200000 0x200000>; + clocks = <&l4_mp_clk>; + resets = <&rst LWHPS2FPGA_RESET>; + reset-names = "lwhps2fpga"; + altr,l3-gpv = <&l3regs>; + status = "disabled"; + ranges; + };
Signature · 1 line
2.1.3
RFC 2/3 ARM: socfpga: Add drivers for the SoC-to-FPGA bridges
In reply to Steffen TrumtrarQuoted 1 line
From the datasheet:
The HPS-FPGA bridges allow masters in the FPGA fabric to communicate with slaves in the HPS logic and vice versa. For example, you can instantiate additional memories or peripherals in the FPGA fabric, and master interfaces belonging to components in the HPS logic can access them. You can also instantiate components such as a NiosII processor in the FPGA fabric and their master interfaces can access memories or peripherals in the HPS logic
This patch adds support for the three bridges on SoCFPGA.
--- drivers/soc/socfpga/Kconfig | 43 ++++++ drivers/soc/socfpga/Makefile | 4 + drivers/soc/socfpga/bridges-common.c | 84 +++++++++++ drivers/soc/socfpga/bridges-common.h | 28 ++++ drivers/soc/socfpga/fpga2hps-bridge.c | 97 ++++++++++++ drivers/soc/socfpga/hps2fpga-bridge.c | 258 ++++++++++++++++++++++++++++++++ drivers/soc/socfpga/lwhps2fpga-bridge.c | 141 +++++++++++++++++ drivers/soc/socfpga/lwhps2fpga.h | 31 ++++ include/soc/socfpga/bridge.h | 65 ++++++++ 9 files changed, 751 insertions(+) create mode 100644 drivers/soc/socfpga/Kconfig create mode 100644 drivers/soc/socfpga/Makefile create mode 100644 drivers/soc/socfpga/bridges-common.c create mode 100644 drivers/soc/socfpga/bridges-common.h create mode 100644 drivers/soc/socfpga/fpga2hps-bridge.c create mode 100644 drivers/soc/socfpga/hps2fpga-bridge.c create mode 100644 drivers/soc/socfpga/lwhps2fpga-bridge.c create mode 100644 drivers/soc/socfpga/lwhps2fpga.h create mode 100644 include/soc/socfpga/bridge.h
drivers/soc/socfpga/Kconfig new file +43 -0
@@ -0,0 +1,43 @@ +# +# SoCFPGA Soc drivers +# + +menuconfig SOCFPGA_BRIDGES + bool "SoCFPGA AXI bridges support" + depends on ARCH_SOCFPGA + select REGMAP_MMIO + select SOCFPGA_L3NIC + default m + help + Enable support for the SoCFPGA bridges that connect the HPS to the + FPGA. + +if SOCFPGA_BRIDGES + +config SOCFPGA_LWHPS2FPGA + tristate "SoCFPGA LWHPS2FPGA bridge support" + depends on ARCH_SOCFPGA + select REGMAP_MMIO + select SOCFPGA_L3NIC + default m + help + Enable support for the SoCFPGA LWHPS2FPGA bridge. + +config SOCFPGA_HPS2FPGA + tristate "SoCFPGA HPS2FPGA bridge support" + depends on ARCH_SOCFPGA + select REGMAP_MMIO + select SOCFPGA_L3NIC + default m + help + Enable support for the SoCFPGA HPS2FPGA bridge. + +config SOCFPGA_FPGA2HPS + tristate "SoCFPGA FPGA2HPS bridge support" + depends on ARCH_SOCFPGA + select REGMAP_MMIO + select SOCFPGA_L3NIC + default m + help + Enable support for the SoCFPGA FPGA2HPS bridge. +endif
drivers/soc/socfpga/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +obj-$(CONFIG_SOCFPGA_BRIDGES) += bridges-common.o +obj-$(CONFIG_SOCFPGA_LWHPS2FPGA) += lwhps2fpga-bridge.o +obj-$(CONFIG_SOCFPGA_HPS2FPGA) += hps2fpga-bridge.o +obj-$(CONFIG_SOCFPGA_FPGA2HPS) += fpga2hps-bridge.o
drivers/soc/socfpga/bridges-common.c new file +84 -0
84 lines not on this page · raw message
drivers/soc/socfpga/bridges-common.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Copyright (c) 2014 Steffen Trumtrar <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ + +#ifndef __SOC_SOCFPGA_BRIDGES_COMMON_H__ +#define __SOC_SOCFPGA_BRIDGES_COMMON_H__ + +struct socfpga_bridge ; +struct platform_device ; +struct platform_driver ; +struct device_node ; + +extern int socfpga_bridge_reset_probe (struct platform_device *pdev, +struct socfpga_bridge *priv, +const char *name); + +extern struct regmap *socfpga_bridge_regmap_by_phandle (struct device_node *np, +const char *name); + +extern int socfpga_bridge_probe (struct platform_device *pdev, +const struct of_device_id *dt_ids); + +#endif
drivers/soc/socfpga/fpga2hps-bridge.c new file +97 -0
97 lines not on this page · raw message
drivers/soc/socfpga/hps2fpga-bridge.c new file +258 -0
258 lines not on this page · raw message
drivers/soc/socfpga/lwhps2fpga-bridge.c new file +141 -0
141 lines not on this page · raw message
drivers/soc/socfpga/lwhps2fpga.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* Copyright (c) 2014 Steffen Trumtrar <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ + +#ifndef __SOC_SOCFPGA_LWHPS2FPGA_H__ +#define __SOC_SOCFPGA_LWHPS2FPGA_H__ + +#define LWHPS2FPGA_PERIPH_ID_4 0x1FD0 +#define LWHPS2FPGA_PERIPH_ID_0 0x1FE0 +#define LWHPS2FPGA_PERIPH_ID_1 0x1FE4 +#define LWHPS2FPGA_PERIPH_ID_2 0x1FE8 +#define LWHPS2FPGA_PERIPH_ID_3 0x1FEC +#define LWHPS2FPGA_COMP_ID_0 0x1FF0 +#define LWHPS2FPGA_COMP_ID_1 0x1FF4 +#define LWHPS2FPGA_COMP_ID_2 0x1FF8 +#define LWHPS2FPGA_COMP_ID_3 0x1FFC +#define LWHPS2FPGA_FPGA2HPS_FN_MOD_BM_ISS 0x2008 +#define LWHPS2FPGA_FPGA2HPS_AHB_CNTL 0x2044 +#define LWHPS2FPGA_HPS2FPGA_FN_MOD_BM_ISS 0x3008 +#define LWHPS2FPGA_HPS2FPGA_AHB_CNTL 0x3044 +#define LWHPS2FPGA_32BIT_MASTER_FN_MODE_BM_ISS 0x5008 +#define LWHPS2FPGA_32BIT_MASTER_WR_TIDEMARK 0x5048 +#define LWHPS2FPGA_32BIT_MASTER_FN_MOD 0x5108 +#define LWHPS2FPGA_L3_SLAVE_FN_MODE 0x45108 + +#endif
include/soc/socfpga/bridge.h new file +65 -0
65 lines not on this page · raw message
Signature · 1 line
2.1.3
RFC 3/3 ARM: dts: socfpga: Add AXI bridges
In reply to Steffen Trumtrar--- arch/arm/boot/dts/socfpga.dtsi | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
arch/arm/boot/dts/socfpga.dtsi +48 -0
@@ -67,6 +67,54 @@ interrupt-parent = <&intc>; ranges; + lwhps2fpga: axibridge at ff400000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "altr,lwhps2fpga-axi-bridge"; + reg = <0xff400000 0x100000>, + <0xff200000 0x200000>; + reg-names = "gpv", "data"; + clocks = <&l4_mp_clk>; + resets = <&rst LWHPS2FPGA_RESET>; + reset-names = "lwhps2fpga"; + altr,l3-gpv = <&l3regs>; + status = "disabled"; + ranges; + }; + + hps2fpga: axibridge at ff500000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "altr,hps2fpga-axi-bridge"; + reg = <0xff500000 0x100000>, + <0xc0000000 0x3c000000>; + reg-names = "gpv", "data"; + clocks = <&l4_mp_clk>, <&l3_main_clk>; + clock-names = "gpv_clk", "data_clk"; + resets = <&rst HPS2FPGA_RESET>; + reset-names = "hps2fpga"; + altr,bridge-gpv = <&lwhps2fpga>; + altr,l3-gpv = <&l3regs>; + bus-width = <64>; + status = "disabled"; + ranges; + }; + + fpga2hps: axibridge at ff600000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "altr,fpga2hps-axi-bridge"; + reg = <0xff600000 0x100000>; + reg-names = "gpv"; + clocks = <&l4_mp_clk>, <&l3_main_clk>; + clock-names = "gpv_clk", "data_clk"; + resets = <&rst FPGA2HPS_RESET>; + reset-names = "fpga2hps"; + altr,bridge-gpv = <&lwhps2fpga>; + bus-width = <64>; + status = "disabled"; + }; + amba { compatible = "arm,amba-bus"; #address-cells = <1>;
Signature · 1 line
2.1.3
cover SoCFPGA: Add HPS bridges
In reply to Steffen TrumtrarOn Thu, 11 Dec 2014, Steffen Trumtrar wrote:
CC Matthew Gerlach
Quoted 79 lines
Hi!
This series adds support for the SoCFPGA bridges.
From the datasheet:
The HPS-FPGA bridges allow masters in the FPGA fabric to communicate with slaves in the HPS logic and vice versa. For example, you can instantiate additional memories or peripherals in the FPGA fabric, and master interfaces belonging to components in the HPS logic can access them. You can also instantiate components such as a NiosII processor in the FPGA fabric and their master interfaces can access memories or peripherals in the HPS logic
This does only work with the driver from my other series
SoCFPGA: L3 NIC driver
As the binding, although simple, is still in debate and the outcome may have impact on this series, this is a just an RFC for now.
Also, the drivers beg for the DT overlay series which is floating around, but this shouldn't have any effect on the current binding. The driver part can be changed later.
Lastly, the bridges have an optional dependency on the fpgamgr series from Alan Tull. I have added this to the binding, the drivers don't do anything with this yet.
My idea here would be:
1. probe bridge
2. check if fpgamgr phandle is given
2a. if yes: defer till fpgamgr is done
2b. if no: continue
3. probe subnodes with the help of DT overlaysI have only tested the HPS and LWHPS drivers, as I don't have any bitstreams that use the FPGA2HPS bridge; here be dragons.
Regards,
SteffenSteffen Trumtrar (3):
devicetree: bindings: Add SoCFpga HPS bridges
ARM: socfpga: Add drivers for the SoC-to-FPGA bridges
ARM: dts: socfpga: Add AXI bridges.../soc/socfpga/altr,fpga2hps-axi-bridge.txt | 32 +++ .../soc/socfpga/altr,hps2fpga-axi-bridge.txt | 54 +++++ .../soc/socfpga/altr,lwhps2fpga-axi-bridge.txt | 31 +++ arch/arm/boot/dts/socfpga.dtsi | 48 ++++ drivers/soc/socfpga/Kconfig | 43 ++++ drivers/soc/socfpga/Makefile | 4 + drivers/soc/socfpga/bridges-common.c | 84 +++++++ drivers/soc/socfpga/bridges-common.h | 28 +++ drivers/soc/socfpga/fpga2hps-bridge.c | 97 ++++++++ drivers/soc/socfpga/hps2fpga-bridge.c | 258 +++++++++++++++++++++ drivers/soc/socfpga/lwhps2fpga-bridge.c | 141 +++++++++++ drivers/soc/socfpga/lwhps2fpga.h | 31 +++ include/soc/socfpga/bridge.h | 65 ++++++ 13 files changed, 916 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/socfpga/altr,fpga2hps-axi-bridge.txt create mode 100644 Documentation/devicetree/bindings/soc/socfpga/altr,hps2fpga-axi-bridge.txt create mode 100644 Documentation/devicetree/bindings/soc/socfpga/altr,lwhps2fpga-axi-bridge.txt create mode 100644 drivers/soc/socfpga/Kconfig create mode 100644 drivers/soc/socfpga/Makefile create mode 100644 drivers/soc/socfpga/bridges-common.c create mode 100644 drivers/soc/socfpga/bridges-common.h create mode 100644 drivers/soc/socfpga/fpga2hps-bridge.c create mode 100644 drivers/soc/socfpga/hps2fpga-bridge.c create mode 100644 drivers/soc/socfpga/lwhps2fpga-bridge.c create mode 100644 drivers/soc/socfpga/lwhps2fpga.h create mode 100644 include/soc/socfpga/bridge.hSignature · 1 line
2.1.3