Forum Discussion

dpeng's avatar
dpeng
Icon for New Contributor rankNew Contributor
4 months ago
Solved

enable bridge crashes Linux

Hi, We selected a Cyclone V SoC FPGA for our project. I started on Terasic demo boards (DE0 and ADC-SoC). On these boards, that both bear a Cyclone V (P/N 5CSEMA4U23C6N), I could, with a devicetree ...
  • dpeng's avatar
    3 months ago

    So, I think I made some progress.

    1. I enable the bridges in Barebox by setting the status and bridge-enable properties.
    2. In the Linux devicetree overlay, I only set the status property, not the bridge-enable property.

    The Barebox DT (the "0x1" syntax matters, it seems):

    &fpga_bridge0 {
    	status = "okay";
    	bridge-enable = <0x1>;
    };

    The Linux DT overlay:

    /dts-v1/;
    /plugin/;
    
    / {
    	fragment@0 {
    		target = <&base_fpga_region>;
    
    		__overlay__ {
    			#address-cells = <0x1>;
    			#size-cells = <0x1>;
    
    			// The .rbf file must be placed in /lib/firmware
    			firmware-name = "soc_firwmare.rbf";
    			fpga-bridges = <&fpga_bridge0 &fpga_bridge1>;
    		};
    	};
    
    	/* Enable the lightweight FPGA to HPS bridge (lwhps2fpga) */
    	fragment@1 {
    		target = <&fpga_bridge0>;
    
    		__overlay__ {
    			status = "okay";
    			// Don't set bridge-enable!
    			// bridge-enable = <1>;
    		};
    	};
    
    	/* Enable the HPS to FPGA bridge (hps2fpga) */
    	fragment@2 {
    		target = <&fpga_bridge1>;
    
    		__overlay__ {
    			status = "okay";
    			// Don't set bridge-enable!
    			// bridge-enable = <1>;
    		};
    	};
    };

    Then, I when I check the status of the bridges, I get what I expect:

    # for f in /proc/device-tree/soc/fpga?bridge*; do echo $(basename $f)":" $(cat $f/status); done
    fpga-bridge@ff600000: disabled
    fpga-bridge@ffc25080: disabled
    fpga_bridge@ff400000: okay
    fpga_bridge@ff500000: okay
    #

    I didn't try to communicate between the HPS and the FPGA yet, but it looks promising.