diff --git a/.gitmodules b/.gitmodules index d4a68d8..bb998c3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,6 @@ path = plutosdr-fw url = https://github.com/analogdevicesinc/plutosdr-fw branch = "v0.38" +[submodule "maia-sdr"] + path = maia-sdr + url = https://github.com/maia-sdr/maia-sdr diff --git a/maia-sdr b/maia-sdr new file mode 160000 index 0000000..fe99068 --- /dev/null +++ b/maia-sdr @@ -0,0 +1 @@ +Subproject commit fe99068324c9f70c02840a8e56a15d0031c09632 diff --git a/patch/0002-add-maia-sdr-hdl-support-v0.38.patch b/patch/0002-add-maia-sdr-hdl-support-v0.38.patch new file mode 100644 index 0000000..fd92419 --- /dev/null +++ b/patch/0002-add-maia-sdr-hdl-support-v0.38.patch @@ -0,0 +1,307 @@ +From 3fc9ddf2ee20f3fbe0fecf198c6b8f38c27305ad Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= +Date: Thu, 14 Dec 2023 18:00:00 +0100 +Subject: [PATCH] add maia sdr hdl support + +--- + projects/ant/Makefile | 7 ++++ + projects/ant/system_bd.tcl | 76 ++++++++++++++++++++++++++++++------- + projects/e200/Makefile | 7 ++++ + projects/e200/system_bd.tcl | 75 +++++++++++++++++++++++++++++------- + 4 files changed, 137 insertions(+), 28 deletions(-) + +diff --git a/projects/ant/Makefile b/projects/ant/Makefile +index 4a1ad7e0f..147a9220b 100644 +--- a/projects/ant/Makefile ++++ b/projects/ant/Makefile +@@ -14,6 +14,8 @@ M_DEPS += ../../library/common/ad_iobuf.v + M_DEPS += ../../library/common/ad_bus_mux.v + M_DEPS += ../../library/axi_tdd/scripts/axi_tdd.tcl + M_DEPS += ../../library/axi_ad9361/axi_ad9361_delay.tcl ++# Maia SDR IP cores ++M_DEPS += ip_cores + + LIB_DEPS += axi_ad9361 + LIB_DEPS += axi_dmac +@@ -22,3 +24,8 @@ LIB_DEPS += util_pack/util_cpack2 + LIB_DEPS += util_pack/util_upack2 + + include ../scripts/project-xilinx.mk ++ ++ip_cores: ++ $(MAKE) -C ../../../../maia-sdr/maia-hdl/ip/ ++ ++.PHONY: ip_cores +diff --git a/projects/ant/system_bd.tcl b/projects/ant/system_bd.tcl +index ad924fcc1..4564f8d69 100644 +--- a/projects/ant/system_bd.tcl ++++ b/projects/ant/system_bd.tcl +@@ -1,9 +1,14 @@ + # create board design + ++# Add IP repo path for Maia SDR ++# ++# We need to do this here because adi_project_create overwrites whatever we had ++# set beforehand. ++set_property ip_repo_paths "../../../../maia-sdr/maia-hdl/ip/ $ad_hdl_dir/library" [current_fileset] ++update_ip_catalog ++ + source $ad_hdl_dir/projects/common/xilinx/adi_fir_filter_bd.tcl + source $ad_hdl_dir/library/axi_tdd/scripts/axi_tdd.tcl +-set_property ip_repo_paths $ad_hdl_dir/library/ [current_project] +-update_ip_catalog + + # default ports + +@@ -218,6 +223,35 @@ ad_add_decimation_filter "rx_fir_decimator" 8 2 1 {61.44} {61.44} \ + ad_ip_instance xlslice decim_slice + ad_ip_instance util_cpack2 cpack + ++# Maia SDR core ++ ++ad_ip_instance maia_sdr maia_sdr ++ ++ad_ip_instance xlslice adc_i_slice ++ad_ip_parameter adc_i_slice CONFIG.DIN_WIDTH 16 ++ad_ip_parameter adc_i_slice CONFIG.DOUT_WIDTH 12 ++ad_ip_parameter adc_i_slice CONFIG.DIN_FROM 11 ++ ++ad_ip_instance xlslice adc_q_slice ++ad_ip_parameter adc_q_slice CONFIG.DIN_TO 0 ++ad_ip_parameter adc_q_slice CONFIG.DIN_WIDTH 16 ++ad_ip_parameter adc_q_slice CONFIG.DOUT_WIDTH 12 ++ad_ip_parameter adc_q_slice CONFIG.DIN_FROM 11 ++ ++# Maia SDR clocking ++ ++create_bd_cell -type ip -vlnv xilinx.com:ip:clk_wiz:6.0 maia_sdr_clk ++set_property -dict [list CONFIG.USE_PHASE_ALIGNMENT {false} CONFIG.ENABLE_CLOCK_MONITOR {false} CONFIG.PRIM_SOURCE {Global_buffer} \ ++ CONFIG.CLKOUT2_USED {true} CONFIG.CLKOUT3_USED {true} CONFIG.NUM_OUT_CLKS {3} \ ++ CONFIG.CLKOUT1_REQUESTED_OUT_FREQ {62.500} CONFIG.CLKOUT2_REQUESTED_OUT_FREQ {125.000} \ ++ CONFIG.CLKOUT3_REQUESTED_OUT_FREQ {187.5} \ ++ CONFIG.PRIMITIVE {MMCM} CONFIG.MMCM_DIVCLK_DIVIDE {1} CONFIG.MMCM_CLKFBOUT_MULT_F {11.250} \ ++ CONFIG.MMCM_CLKOUT0_DIVIDE_F {18.000} CONFIG.MMCM_CLKOUT1_DIVIDE {9} \ ++ CONFIG.MMCM_CLKOUT3_DIVIDE {6} \ ++ CONFIG.CLKOUT1_JITTER {133.663} CONFIG.CLKOUT1_PHASE_ERROR {91.100} \ ++ CONFIG.CLKOUT2_JITTER {116.571} CONFIG.CLKOUT2_PHASE_ERROR {91.100} \ ++ CONFIG.CLKOUT3_JITTER {108.217} CONFIG.CLKOUT3_PHASE_ERROR {91.100}] [get_bd_cells maia_sdr_clk] ++ + # connections + + ad_connect rx_clk_in axi_ad9361/rx_clk_in +@@ -301,6 +335,22 @@ ad_connect axi_ad9361/l_clk axi_ad9361_adc_dma/fifo_wr_clk + ad_connect axi_ad9361/l_clk axi_ad9361_dac_dma/m_axis_aclk + ad_connect cpack/fifo_wr_overflow axi_ad9361/adc_dovf + ++# Maia SDR connections ++ ++ad_connect axi_ad9361/adc_data_i0 adc_i_slice/Din ++ad_connect axi_ad9361/adc_data_q0 adc_q_slice/Din ++ad_connect adc_i_slice/Dout maia_sdr/re_in ++ad_connect adc_q_slice/Dout maia_sdr/im_in ++ad_connect axi_ad9361/l_clk maia_sdr/sampling_clk ++ad_connect sys_cpu_clk maia_sdr/s_axi_lite_clk ++ad_connect sys_cpu_reset maia_sdr/s_axi_lite_rst ++ad_connect maia_sdr_clk/clk_out1 maia_sdr/clk ++ad_connect maia_sdr_clk/clk_out2 maia_sdr/clk2x_clk ++ad_connect maia_sdr_clk/clk_out3 maia_sdr/clk3x_clk ++ ++ad_connect sys_cpu_clk maia_sdr_clk/clk_in1 ++ad_connect sys_cpu_reset maia_sdr_clk/reset ++ + # External TDD + set TDD_CHANNEL_CNT 3 + set TDD_DEFAULT_POL 0b010 +@@ -344,28 +394,24 @@ ad_cpu_interconnect 0x79020000 axi_ad9361 + ad_cpu_interconnect 0x7C400000 axi_ad9361_adc_dma + ad_cpu_interconnect 0x7C420000 axi_ad9361_dac_dma + ad_cpu_interconnect 0x7C440000 axi_tdd_0 ++ad_cpu_interconnect 0x7C460000 maia_sdr + ad_cpu_interconnect 0x43C00000 axi_vcxo_ctrl + + ad_ip_parameter sys_ps7 CONFIG.PCW_USE_S_AXI_HP1 {1} +-ad_connect sys_cpu_clk sys_ps7/S_AXI_HP1_ACLK +-ad_connect axi_ad9361_adc_dma/m_dest_axi sys_ps7/S_AXI_HP1 ++ad_connect maia_sdr_clk/clk_out1 sys_ps7/S_AXI_HP1_ACLK ++ad_connect maia_sdr/m_axi_spectrometer sys_ps7/S_AXI_HP1 + + create_bd_addr_seg -range 0x40000000 -offset 0x00000000 \ +- [get_bd_addr_spaces axi_ad9361_adc_dma/m_dest_axi] \ ++ [get_bd_addr_spaces maia_sdr/m_axi_spectrometer] \ + [get_bd_addr_segs sys_ps7/S_AXI_HP1/HP1_DDR_LOWOCM] \ + SEG_sys_ps7_HP1_DDR_LOWOCM + + ad_ip_parameter sys_ps7 CONFIG.PCW_USE_S_AXI_HP2 {1} +-ad_connect sys_cpu_clk sys_ps7/S_AXI_HP2_ACLK +-ad_connect axi_ad9361_dac_dma/m_src_axi sys_ps7/S_AXI_HP2 ++ad_mem_hp2_interconnect sys_cpu_clk sys_ps7/S_AXI_HP2 ++ad_mem_hp2_interconnect sys_cpu_clk axi_ad9361_adc_dma/m_dest_axi ++ad_mem_hp2_interconnect sys_cpu_clk axi_ad9361_dac_dma/m_src_axi ++ad_mem_hp2_interconnect sys_cpu_clk maia_sdr/m_axi_recorder + +-create_bd_addr_seg -range 0x40000000 -offset 0x00000000 \ +- [get_bd_addr_spaces axi_ad9361_dac_dma/m_src_axi] \ +- [get_bd_addr_segs sys_ps7/S_AXI_HP2/HP2_DDR_LOWOCM] \ +- SEG_sys_ps7_HP2_DDR_LOWOCM +- +-ad_connect sys_cpu_clk axi_ad9361_dac_dma/m_src_axi_aclk +-ad_connect sys_cpu_clk axi_ad9361_adc_dma/m_dest_axi_aclk + ad_connect sys_cpu_resetn axi_ad9361_adc_dma/m_dest_axi_aresetn + ad_connect sys_cpu_resetn axi_ad9361_dac_dma/m_src_axi_aresetn + +@@ -373,4 +419,6 @@ ad_connect sys_cpu_resetn axi_ad9361_dac_dma/m_src_axi_aresetn + + ad_cpu_interrupt ps-13 mb-13 axi_ad9361_adc_dma/irq + ad_cpu_interrupt ps-12 mb-12 axi_ad9361_dac_dma/irq ++ad_cpu_interrupt ps-11 mb-11 maia_sdr/interrupt_out ++ + +diff --git a/projects/e200/Makefile b/projects/e200/Makefile +index 1c9b4f2f4..de002f2fa 100644 +--- a/projects/e200/Makefile ++++ b/projects/e200/Makefile +@@ -14,6 +14,8 @@ M_DEPS += ../../library/common/ad_iobuf.v + M_DEPS += ../../library/common/ad_bus_mux.v + M_DEPS += ../../library/axi_tdd/scripts/axi_tdd.tcl + M_DEPS += ../../library/axi_ad9361/axi_ad9361_delay.tcl ++# Maia SDR IP cores ++M_DEPS += ip_cores + + LIB_DEPS += axi_ad9361 + LIB_DEPS += axi_dmac +@@ -23,3 +25,8 @@ LIB_DEPS += util_pack/util_upack2 + + + include ../scripts/project-xilinx.mk ++ ++ip_cores: ++ $(MAKE) -C ../../../../maia-sdr/maia-hdl/ip/ ++ ++.PHONY: ip_cores +diff --git a/projects/e200/system_bd.tcl b/projects/e200/system_bd.tcl +index 9926d22a7..290fb3954 100644 +--- a/projects/e200/system_bd.tcl ++++ b/projects/e200/system_bd.tcl +@@ -1,9 +1,14 @@ + # create board design + ++# Add IP repo path for Maia SDR ++# ++# We need to do this here because adi_project_create overwrites whatever we had ++# set beforehand. ++set_property ip_repo_paths "../../../../maia-sdr/maia-hdl/ip/ $ad_hdl_dir/library" [current_fileset] ++update_ip_catalog ++ + source $ad_hdl_dir/projects/common/xilinx/adi_fir_filter_bd.tcl + source $ad_hdl_dir/library/axi_tdd/scripts/axi_tdd.tcl +-set_property ip_repo_paths $ad_hdl_dir/library/ [current_project] +-update_ip_catalog + + # default ports + +@@ -247,6 +252,35 @@ ad_add_decimation_filter "rx_fir_decimator" 8 2 1 {61.44} {61.44} \ + ad_ip_instance xlslice decim_slice + ad_ip_instance util_cpack2 cpack + ++# Maia SDR core ++ ++ad_ip_instance maia_sdr maia_sdr ++ ++ad_ip_instance xlslice adc_i_slice ++ad_ip_parameter adc_i_slice CONFIG.DIN_WIDTH 16 ++ad_ip_parameter adc_i_slice CONFIG.DOUT_WIDTH 12 ++ad_ip_parameter adc_i_slice CONFIG.DIN_FROM 11 ++ ++ad_ip_instance xlslice adc_q_slice ++ad_ip_parameter adc_q_slice CONFIG.DIN_TO 0 ++ad_ip_parameter adc_q_slice CONFIG.DIN_WIDTH 16 ++ad_ip_parameter adc_q_slice CONFIG.DOUT_WIDTH 12 ++ad_ip_parameter adc_q_slice CONFIG.DIN_FROM 11 ++ ++# Maia SDR clocking ++ ++create_bd_cell -type ip -vlnv xilinx.com:ip:clk_wiz:6.0 maia_sdr_clk ++set_property -dict [list CONFIG.USE_PHASE_ALIGNMENT {false} CONFIG.ENABLE_CLOCK_MONITOR {false} CONFIG.PRIM_SOURCE {Global_buffer} \ ++ CONFIG.CLKOUT2_USED {true} CONFIG.CLKOUT3_USED {true} CONFIG.NUM_OUT_CLKS {3} \ ++ CONFIG.CLKOUT1_REQUESTED_OUT_FREQ {62.500} CONFIG.CLKOUT2_REQUESTED_OUT_FREQ {125.000} \ ++ CONFIG.CLKOUT3_REQUESTED_OUT_FREQ {187.5} \ ++ CONFIG.PRIMITIVE {MMCM} CONFIG.MMCM_DIVCLK_DIVIDE {1} CONFIG.MMCM_CLKFBOUT_MULT_F {11.250} \ ++ CONFIG.MMCM_CLKOUT0_DIVIDE_F {18.000} CONFIG.MMCM_CLKOUT1_DIVIDE {9} \ ++ CONFIG.MMCM_CLKOUT3_DIVIDE {6} \ ++ CONFIG.CLKOUT1_JITTER {133.663} CONFIG.CLKOUT1_PHASE_ERROR {91.100} \ ++ CONFIG.CLKOUT2_JITTER {116.571} CONFIG.CLKOUT2_PHASE_ERROR {91.100} \ ++ CONFIG.CLKOUT3_JITTER {108.217} CONFIG.CLKOUT3_PHASE_ERROR {91.100}] [get_bd_cells maia_sdr_clk] ++ + # connections + + ad_connect rx_clk_in axi_ad9361/rx_clk_in +@@ -330,6 +364,22 @@ ad_connect axi_ad9361/l_clk axi_ad9361_adc_dma/fifo_wr_clk + ad_connect axi_ad9361/l_clk axi_ad9361_dac_dma/m_axis_aclk + ad_connect cpack/fifo_wr_overflow axi_ad9361/adc_dovf + ++# Maia SDR connections ++ ++ad_connect axi_ad9361/adc_data_i0 adc_i_slice/Din ++ad_connect axi_ad9361/adc_data_q0 adc_q_slice/Din ++ad_connect adc_i_slice/Dout maia_sdr/re_in ++ad_connect adc_q_slice/Dout maia_sdr/im_in ++ad_connect axi_ad9361/l_clk maia_sdr/sampling_clk ++ad_connect sys_cpu_clk maia_sdr/s_axi_lite_clk ++ad_connect sys_cpu_reset maia_sdr/s_axi_lite_rst ++ad_connect maia_sdr_clk/clk_out1 maia_sdr/clk ++ad_connect maia_sdr_clk/clk_out2 maia_sdr/clk2x_clk ++ad_connect maia_sdr_clk/clk_out3 maia_sdr/clk3x_clk ++ ++ad_connect sys_cpu_clk maia_sdr_clk/clk_in1 ++ad_connect sys_cpu_reset maia_sdr_clk/reset ++ + # External TDD + set TDD_CHANNEL_CNT 3 + set TDD_DEFAULT_POL 0b010 +@@ -373,28 +423,24 @@ ad_cpu_interconnect 0x79020000 axi_ad9361 + ad_cpu_interconnect 0x7C400000 axi_ad9361_adc_dma + ad_cpu_interconnect 0x7C420000 axi_ad9361_dac_dma + ad_cpu_interconnect 0x7C440000 axi_tdd_0 ++ad_cpu_interconnect 0x7C460000 maia_sdr + ad_cpu_interconnect 0x43C00000 axi_vcxo_ctrl + + ad_ip_parameter sys_ps7 CONFIG.PCW_USE_S_AXI_HP1 {1} +-ad_connect sys_cpu_clk sys_ps7/S_AXI_HP1_ACLK +-ad_connect axi_ad9361_adc_dma/m_dest_axi sys_ps7/S_AXI_HP1 ++ad_connect maia_sdr_clk/clk_out1 sys_ps7/S_AXI_HP1_ACLK ++ad_connect maia_sdr/m_axi_spectrometer sys_ps7/S_AXI_HP1 + + create_bd_addr_seg -range 0x20000000 -offset 0x00000000 \ +- [get_bd_addr_spaces axi_ad9361_adc_dma/m_dest_axi] \ ++ [get_bd_addr_spaces maia_sdr/m_axi_spectrometer] \ + [get_bd_addr_segs sys_ps7/S_AXI_HP1/HP1_DDR_LOWOCM] \ + SEG_sys_ps7_HP1_DDR_LOWOCM + + ad_ip_parameter sys_ps7 CONFIG.PCW_USE_S_AXI_HP2 {1} +-ad_connect sys_cpu_clk sys_ps7/S_AXI_HP2_ACLK +-ad_connect axi_ad9361_dac_dma/m_src_axi sys_ps7/S_AXI_HP2 +- +-create_bd_addr_seg -range 0x20000000 -offset 0x00000000 \ +- [get_bd_addr_spaces axi_ad9361_dac_dma/m_src_axi] \ +- [get_bd_addr_segs sys_ps7/S_AXI_HP2/HP2_DDR_LOWOCM] \ +- SEG_sys_ps7_HP2_DDR_LOWOCM ++ad_mem_hp2_interconnect sys_cpu_clk sys_ps7/S_AXI_HP2 ++ad_mem_hp2_interconnect sys_cpu_clk axi_ad9361_adc_dma/m_dest_axi ++ad_mem_hp2_interconnect sys_cpu_clk axi_ad9361_dac_dma/m_src_axi ++ad_mem_hp2_interconnect sys_cpu_clk maia_sdr/m_axi_recorder + +-ad_connect sys_cpu_clk axi_ad9361_dac_dma/m_src_axi_aclk +-ad_connect sys_cpu_clk axi_ad9361_adc_dma/m_dest_axi_aclk + ad_connect sys_cpu_resetn axi_ad9361_adc_dma/m_dest_axi_aresetn + ad_connect sys_cpu_resetn axi_ad9361_dac_dma/m_src_axi_aresetn + +@@ -402,5 +448,6 @@ ad_connect sys_cpu_resetn axi_ad9361_dac_dma/m_src_axi_aresetn + + ad_cpu_interrupt ps-13 mb-13 axi_ad9361_adc_dma/irq + ad_cpu_interrupt ps-12 mb-12 axi_ad9361_dac_dma/irq ++ad_cpu_interrupt ps-11 mb-11 maia_sdr/interrupt_out + + +-- +2.43.0 + diff --git a/patch/ant/0002-add-ant-maia-sdr-buildroot.patch b/patch/ant/0002-add-ant-maia-sdr-buildroot.patch new file mode 100644 index 0000000..1ccd98e --- /dev/null +++ b/patch/ant/0002-add-ant-maia-sdr-buildroot.patch @@ -0,0 +1,94 @@ +From 7c64b2eaeded20965b789800b3c905beba68d1d3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= +Date: Thu, 14 Dec 2023 18:00:00 +0100 +Subject: [PATCH] add ant maia sdr buildroot support + +--- + board/ant/S50maia-httpd | 26 ++++++++++++++++++++++++++ + board/ant/S50maia-kmod | 21 +++++++++++++++++++++ + board/ant/post-build.sh | 11 +++++++++++ + 3 files changed, 58 insertions(+) + create mode 100644 board/ant/S50maia-httpd + create mode 100644 board/ant/S50maia-kmod + +diff --git a/board/ant/S50maia-httpd b/board/ant/S50maia-httpd +new file mode 100644 +index 0000000000..c67614d65f +--- /dev/null ++++ b/board/ant/S50maia-httpd +@@ -0,0 +1,26 @@ ++#!/bin/sh ++ ++case "$1" in ++ start) ++ echo -n "Starting maia-httpd: " ++ cd /root ++ start-stop-daemon -S -b -q -m -p /var/run/maia-httpd.pid -x /root/maia-httpd ++ cd - > /dev/null ++ [ $? = 0 ] && echo "OK" || echo "FAIL" ++ ;; ++ stop) ++ echo -n "Stopping maia-httpd: " ++ start-stop-daemon -K -q -p /var/run/maia-httpd.pid 2>/dev/null ++ [ $? = 0 ] && echo "OK" || echo "FAIL" ++ ;; ++ restart|reload) ++ $0 stop ++ sleep 1 ++ $0 start ++ ;; ++ *) ++ echo "Usage: $0 {start|stop|restart}" ++ exit 1 ++esac ++ ++exit $? +diff --git a/board/ant/S50maia-kmod b/board/ant/S50maia-kmod +new file mode 100644 +index 0000000000..5610f4d77e +--- /dev/null ++++ b/board/ant/S50maia-kmod +@@ -0,0 +1,21 @@ ++#!/bin/sh ++# ++# Load maia-sdr kernel module ++# ++ ++case "$1" in ++ start) ++ echo -n "Loading maia-sdr.ko: " ++ insmod /lib/modules/maia-sdr.ko ++ [ $? = 0 ] && echo "OK" || echo "FAIL" ++ ;; ++ stop) ++ ;; ++ restart|reload) ++ ;; ++ *) ++ echo "Usage: $0 {start|stop|restart}" ++ exit 1 ++esac ++ ++exit $? +diff --git a/board/ant/post-build.sh b/board/ant/post-build.sh +index 03021a4918..111e744b30 100755 +--- a/board/ant/post-build.sh ++++ b/board/ant/post-build.sh +@@ -91,3 +91,14 @@ ln -sf ../../wpa_supplicant/ifupdown.sh ${TARGET_DIR}/etc/network/if-pre-up.d/wp + ln -sf ../../wpa_supplicant/ifupdown.sh ${TARGET_DIR}/etc/network/if-post-down.d/wpasupplicant + + ln -sf device_reboot ${TARGET_DIR}/usr/sbin/pluto_reboot ++ ++# Maia SDR specific files ++${INSTALL} -d ${TARGET_DIR}/lib/modules ++${INSTALL} -D -m 0644 ${BOARD_DIR}/maia-sdr.ko ${TARGET_DIR}/lib/modules/ ++${INSTALL} -D -m 0755 ${BOARD_DIR}/S50maia-kmod ${TARGET_DIR}/etc/init.d/ ++${INSTALL} -D -m 0755 ${BOARD_DIR}/S60maia-httpd ${TARGET_DIR}/etc/init.d/ ++# TODO: do not install maia-httpd and maia-wasm to /root ++${INSTALL} -D -m 0755 ${BOARD_DIR}/maia-httpd ${TARGET_DIR}/root/ ++${INSTALL} -D -m 0644 ${BOARD_DIR}/maia-wasm/assets/* ${TARGET_DIR}/root/ ++${INSTALL} -d ${TARGET_DIR}/root/pkg ++${INSTALL} -D -m 0644 ${BOARD_DIR}/maia-wasm/pkg/* ${TARGET_DIR}/root/pkg/ +-- +2.43.0 + diff --git a/patch/ant/0002-add-ant-maia-sdr-cache-export-linux.patch b/patch/ant/0002-add-ant-maia-sdr-cache-export-linux.patch new file mode 100644 index 0000000..ff7871a --- /dev/null +++ b/patch/ant/0002-add-ant-maia-sdr-cache-export-linux.patch @@ -0,0 +1,100 @@ +From 6bdd61dd6a2303e982d86b369a9565bd01f5ff06 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= +Date: Wed, 2 Nov 2022 14:15:50 +0100 +Subject: [PATCH] arch: arm: export Zynq cache invalidation functions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is needed for the Maia SDR kernel module, which calls +these functions directly rather than going through the DMA API. + +Signed-off-by: Daniel Estévez +--- + arch/arm/mm/Makefile | 2 ++ + arch/arm/mm/cache-v7-export.c | 14 ++++++++++++++ + arch/arm/mm/cache-v7.S | 2 +- + arch/arm/mm/outercache.c | 17 +++++++++++++++++ + 4 files changed, 34 insertions(+), 1 deletion(-) + create mode 100644 arch/arm/mm/cache-v7-export.c + create mode 100644 arch/arm/mm/outercache.c + +diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile +index 7cb1699fbfc4..096bebdeba9c 100644 +--- a/arch/arm/mm/Makefile ++++ b/arch/arm/mm/Makefile +@@ -5,6 +5,7 @@ + + obj-y := extable.o fault.o init.o iomap.o + obj-y += dma-mapping$(MMUEXT).o ++obj-y += outercache.o + obj-$(CONFIG_MMU) += fault-armv.o flush.o idmap.o ioremap.o \ + mmap.o pgd.o mmu.o pageattr.o + KASAN_SANITIZE_mmu.o := n +@@ -44,6 +45,7 @@ obj-$(CONFIG_CPU_CACHE_V4WT) += cache-v4wt.o + obj-$(CONFIG_CPU_CACHE_V4WB) += cache-v4wb.o + obj-$(CONFIG_CPU_CACHE_V6) += cache-v6.o + obj-$(CONFIG_CPU_CACHE_V7) += cache-v7.o ++obj-$(CONFIG_CPU_CACHE_V7) += cache-v7-export.o + obj-$(CONFIG_CPU_CACHE_FA) += cache-fa.o + obj-$(CONFIG_CPU_CACHE_NOP) += cache-nop.o + obj-$(CONFIG_CPU_CACHE_V7M) += cache-v7m.o +diff --git a/arch/arm/mm/cache-v7-export.c b/arch/arm/mm/cache-v7-export.c +new file mode 100644 +index 000000000000..6ff6e58c4340 +--- /dev/null ++++ b/arch/arm/mm/cache-v7-export.c +@@ -0,0 +1,14 @@ ++/* SPDX-License-Identifier: GPL-2.0-only */ ++/* ++ * linux/arch/arm/mm/cache-v7-export.c ++ * ++ * Copyright (C) 2022 Daniel Estevez ++ * ++ */ ++ ++#include ++ ++// implemented in cache-v7.S ++extern void v7_dma_inv_range(unsigned long start, unsigned long end); ++ ++EXPORT_SYMBOL(v7_dma_inv_range); +diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S +index dc8f152f3556..00b48df0a3e7 100644 +--- a/arch/arm/mm/cache-v7.S ++++ b/arch/arm/mm/cache-v7.S +@@ -363,7 +363,7 @@ ENDPROC(v7_flush_kern_dcache_area) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-v7_dma_inv_range: ++ENTRY(v7_dma_inv_range) + dcache_line_size r2, r3 + sub r3, r2, #1 + tst r0, r3 +diff --git a/arch/arm/mm/outercache.c b/arch/arm/mm/outercache.c +new file mode 100644 +index 000000000000..d4b16005764f +--- /dev/null ++++ b/arch/arm/mm/outercache.c +@@ -0,0 +1,17 @@ ++/* SPDX-License-Identifier: GPL-2.0-only */ ++/* ++ * arch/arm/mm/outercache.c ++ * ++ * Copyright (C) 2022 Daniel Estevez ++ */ ++ ++#include ++#include ++#include ++ ++void arm_cache_outer_inv_range(phys_addr_t start, phys_addr_t end) ++{ ++ outer_inv_range(start, end); ++} ++ ++EXPORT_SYMBOL(arm_cache_outer_inv_range); +-- +2.42.1 + diff --git a/patch/ant/0002-add-ant-maia-sdr-linux.patch b/patch/ant/0002-add-ant-maia-sdr-linux.patch new file mode 100644 index 0000000..d71cd7b --- /dev/null +++ b/patch/ant/0002-add-ant-maia-sdr-linux.patch @@ -0,0 +1,75 @@ +From 1c5767f323f4c1831a8fc4058d9ef3ff44a8590b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= +Date: Thu, 14 Dec 2023 18:00:00 +0100 +Subject: [PATCH] add ant maia sdr linux support + +--- + arch/arm/boot/dts/zynq-ant.dtsi | 38 ++++++++++++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + +diff --git a/arch/arm/boot/dts/zynq-ant.dtsi b/arch/arm/boot/dts/zynq-ant.dtsi +index f123605e5d90..daadc6e955ff 100644 +--- a/arch/arm/boot/dts/zynq-ant.dtsi ++++ b/arch/arm/boot/dts/zynq-ant.dtsi +@@ -2,6 +2,7 @@ + * ZYNQ Pluto SDR (Z7020/AD936x) + * + * Copyright (C) 2021 MicroPhase Inc. ++ * Copyright (C) 2022-2023 Daniel Estevez + * + * Licensed under the GPL-2. + */ +@@ -51,6 +52,35 @@ usb_phy0: phy0 { + mp5660 { + compatible = "microphase,ad5660"; + }; ++ ++ reserved-memory { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges; ++ ++ maia_sdr_spectrometer: maia_sdr_spectrometer@1a000000 { ++ no-map; ++ reg = <0x1a000000 0x40000>; ++ label = "maia_sdr_spectrometer"; ++ }; ++ ++ maia_sdr_recording: maia_sdr_recording@01000000 { ++ no-map; ++ reg = <0x01000000 0x19000000>; ++ label = "maia_sdr_recording"; ++ }; ++ }; ++ ++ maia-sdr-recording { ++ compatible = "maia-sdr,recording"; ++ memory-region = <&maia_sdr_recording>; ++ }; ++ ++ maia-sdr-spectrometer { ++ compatible = "maia-sdr,rxbuffer"; ++ memory-region = <&maia_sdr_spectrometer>; ++ buffer-size = <0x8000>; ++ }; + }; + + &sdhci0 { +@@ -181,6 +211,14 @@ dma-channel@0 { + }; + }; + ++ maia_sdr: maia-sdr@7C460000 { ++ compatible = "uio_pdrv_genirq"; ++ reg = <0x7c460000 0x1000>; ++ clocks = <&clkc 15>; ++ interrupt-parent = <&intc>; ++ interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>; ++ }; ++ + cf_ad9364_adc_core_0: cf-ad9361-lpc@79020000 { + compatible = "adi,axi-ad9361-6.00.a"; + reg = <0x79020000 0x6000>; +-- +2.43.0 + diff --git a/patch/ant/0002-add-ant-maia-sdr-makefile-scripts.patch b/patch/ant/0002-add-ant-maia-sdr-makefile-scripts.patch new file mode 100644 index 0000000..ad12692 --- /dev/null +++ b/patch/ant/0002-add-ant-maia-sdr-makefile-scripts.patch @@ -0,0 +1,68 @@ +From 306d274c260bdec168f3514d2125597bcbef2ac0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= +Date: Thu, 14 Dec 2023 18:00:00 +0100 +Subject: [PATCH] add ant maia sdr makefile support + +--- + Makefile | 43 ++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 42 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 12e7045..0d68db3 100644 +--- a/Makefile ++++ b/Makefile +@@ -113,9 +113,50 @@ linux/arch/arm/boot/dts/%.dtb: TOOLCHAIN linux/arch/arm/boot/dts/%.dts linux/ar + build/%.dtb: linux/arch/arm/boot/dts/%.dtb | build + dtc -q -@ -I dtb -O dts $< | sed 's/axi {/amba {/g' | dtc -q -@ -I dts -O dtb -o $@ + ++### maia-kmod ### ++../maia-sdr/maia-kmod/maia-sdr.ko: ++ $(TOOLS_PATH) make -C linux ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules_prepare ++ $(TOOLS_PATH) make -C ../maia-sdr/maia-kmod ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) KERNEL_SRC=../../plutosdr-fw/linux ++ ++.PHONY: ../maia-sdr/maia-kmod/maia-sdr.ko ++ ++buildroot/board/$(TARGET)/maia-sdr.ko: ../maia-sdr/maia-kmod/maia-sdr.ko | build ++ cp $< $@ ++ ++### maia-httpd ### ++../maia-sdr/maia-httpd/target/armv7-unknown-linux-gnueabihf/release/maia-httpd: ++ cd ../maia-sdr/maia-httpd && \ ++ $(TOOLS_PATH) cargo build --release --target armv7-unknown-linux-gnueabihf \ ++ --config target.armv7-unknown-linux-gnueabihf.linker=\"arm-linux-gnueabihf-gcc\" ++ ++.PHONY: ../maia-sdr/maia-httpd/target/armv7-unknown-linux-gnueabihf/release/maia-httpd ++ ++buildroot/board/$(TARGET)/maia-httpd: ../maia-sdr/maia-httpd/target/armv7-unknown-linux-gnueabihf/release/maia-httpd | build ++ cp $< $@ ++ ++### maia-wasm ### ++../maia-sdr/maia-wasm/pkg: ++ cd ../maia-sdr/maia-wasm && wasm-pack build --target web ++ ++.PHONY: ../maia-sdr/maia-wasm/pkg ++ ++buildroot/board/$(TARGET)/maia-wasm: ++ mkdir $@ ++ ++buildroot/board/$(TARGET)/maia-wasm/pkg: ../maia-sdr/maia-wasm/pkg | build buildroot/board/$(TARGET)/maia-wasm ++ cp -r $< buildroot/board/$(TARGET)/maia-wasm/ ++ ++buildroot/board/$(TARGET)/maia-wasm/assets: ../maia-sdr/maia-wasm/assets | build buildroot/board/$(TARGET)/maia-was ++ cp -r $< buildroot/board/$(TARGET)/maia-wasm/ ++ ++maia-wasm: buildroot/board/$(TARGET)/maia-wasm/pkg buildroot/board/$(TARGET)/maia-wasm/assets ++ ++.PHONY: maia-wasm ++ ++ + ### Buildroot ### + +-buildroot/output/images/rootfs.cpio.gz: ++buildroot/output/images/rootfs.cpio.gz: buildroot/board/$(TARGET)/maia-sdr.ko buildroot/board/$(TARGET)/maia-httpd maia-wasm + @echo device-fw $(VERSION)> $(CURDIR)/buildroot/board/$(TARGET)/VERSIONS + @$(foreach dir,$(VSUBDIRS),echo $(dir) $(shell cd $(dir) && git describe --abbrev=4 --dirty --always --tags) >> $(CURDIR)/buildroot/board/$(TARGET)/VERSIONS;) + make -C buildroot ARCH=arm zynq_$(TARGET)_defconfig +-- +2.43.0 + diff --git a/patch/ant/0002-add-ant-maia-sdr-uboot.patch b/patch/ant/0002-add-ant-maia-sdr-uboot.patch new file mode 100644 index 0000000..2efc946 --- /dev/null +++ b/patch/ant/0002-add-ant-maia-sdr-uboot.patch @@ -0,0 +1,42 @@ +From cdf73d3ab62da6bcdc94a0737278fc4618f53389 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= +Date: Sat, 16 Dec 2023 20:35:10 +0100 +Subject: [PATCH] add ant maia sdr uboot + +--- + include/configs/zynq-common.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h +index 3caaaecdba..5212b01162 100644 +--- a/include/configs/zynq-common.h ++++ b/include/configs/zynq-common.h +@@ -332,14 +332,14 @@ + "if run adi_loadvals; then " \ + "echo Loaded AD936x refclk frequency and model into devicetree; " \ + "fi; " \ +- "envversion;setenv bootargs console=ttyPS0,115200 maxcpus=${maxcpus} rootfstype=ramfs root=/dev/ram0 rw earlyprintk clk_ignore_unused uboot=\"${uboot-version}\" && " \ ++ "envversion;setenv bootargs console=ttyPS0,115200 maxcpus=${maxcpus} rootfstype=ramfs root=/dev/ram0 rw earlyprintk clk_ignore_unused uio_pdrv_genirq.of_id=uio_pdrv_genirq uboot=\"${uboot-version}\" && " \ + "bootm ${fit_load_address}#${fit_config}\0" \ + "qspiboot_verbose=adi_hwref;echo Copying Linux from QSPI flash to RAM... && " \ + "run read_sf && " \ + "if run adi_loadvals; then " \ + "echo Loaded AD936x refclk frequency and model into devicetree; " \ + "fi; " \ +- "envversion;setenv bootargs console=ttyPS0,115200 maxcpus=${maxcpus} rootfstype=ramfs root=/dev/ram0 rw earlyprintk clk_ignore_unused uboot=\"${uboot-version}\" && " \ ++ "envversion;setenv bootargs console=ttyPS0,115200 maxcpus=${maxcpus} rootfstype=ramfs root=/dev/ram0 rw earlyprintk clk_ignore_unused uio_pdrv_genirq.of_id=uio_pdrv_genirq uboot=\"${uboot-version}\" && " \ + "bootm ${fit_load_address}#${fit_config} || echo BOOT failed entering DFU mode ... && run dfu_sf \0" \ + "qspiboot=set stdout nulldev;adi_hwref;test -n $PlutoRevA || gpio input 14 && set stdout serial@e0001000 && sf probe && sf protect lock 0 100000 && run dfu_sf; " \ + "set stdout serial@e0001000;" \ +@@ -349,7 +349,7 @@ + "itest *f8000258 == 480002 && run clear_reset_cause && exit; " \ + "echo Booting silently && set stdout nulldev; " \ + "run read_sf && run adi_loadvals; " \ +- "envversion;setenv bootargs console=ttyPS0,115200 maxcpus=${maxcpus} rootfstype=ramfs root=/dev/ram0 rw quiet loglevel=4 clk_ignore_unused uboot=\"${uboot-version}\" && " \ ++ "envversion;setenv bootargs console=ttyPS0,115200 maxcpus=${maxcpus} rootfstype=ramfs root=/dev/ram0 rw quiet loglevel=4 clk_ignore_unused uio_pdrv_genirq.of_id=uio_pdrv_genirq uboot=\"${uboot-version}\" && " \ + "bootm ${fit_load_address}#${fit_config} || set stdout serial@e0001000;echo BOOT failed entering DFU mode ... && sf protect lock 0 100000 && run dfu_sf \0" \ + "jtagboot=env default -a;sf probe && sf protect unlock 0 100000 && run dfu_sf; \0" \ + "uenvboot=" \ +-- +2.43.0 + diff --git a/patch/e200/0002-add-e200-maia-sdr-buildroot.patch b/patch/e200/0002-add-e200-maia-sdr-buildroot.patch new file mode 100644 index 0000000..34a4121 --- /dev/null +++ b/patch/e200/0002-add-e200-maia-sdr-buildroot.patch @@ -0,0 +1,94 @@ +From 7c64b2eaeded20965b789800b3c905beba68d1d3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= +Date: Thu, 14 Dec 2023 18:00:00 +0100 +Subject: [PATCH] add e200 maia sdr buildroot support + +--- + board/e200/S50maia-httpd | 26 ++++++++++++++++++++++++++ + board/e200/S50maia-kmod | 21 +++++++++++++++++++++ + board/e200/post-build.sh | 11 +++++++++++ + 3 files changed, 58 insertions(+) + create mode 100644 board/e200/S50maia-httpd + create mode 100644 board/e200/S50maia-kmod + +diff --git a/board/e200/S50maia-httpd b/board/e200/S50maia-httpd +new file mode 100644 +index 0000000000..c67614d65f +--- /dev/null ++++ b/board/e200/S50maia-httpd +@@ -0,0 +1,26 @@ ++#!/bin/sh ++ ++case "$1" in ++ start) ++ echo -n "Starting maia-httpd: " ++ cd /root ++ start-stop-daemon -S -b -q -m -p /var/run/maia-httpd.pid -x /root/maia-httpd ++ cd - > /dev/null ++ [ $? = 0 ] && echo "OK" || echo "FAIL" ++ ;; ++ stop) ++ echo -n "Stopping maia-httpd: " ++ start-stop-daemon -K -q -p /var/run/maia-httpd.pid 2>/dev/null ++ [ $? = 0 ] && echo "OK" || echo "FAIL" ++ ;; ++ restart|reload) ++ $0 stop ++ sleep 1 ++ $0 start ++ ;; ++ *) ++ echo "Usage: $0 {start|stop|restart}" ++ exit 1 ++esac ++ ++exit $? +diff --git a/board/e200/S50maia-kmod b/board/e200/S50maia-kmod +new file mode 100644 +index 0000000000..5610f4d77e +--- /dev/null ++++ b/board/e200/S50maia-kmod +@@ -0,0 +1,21 @@ ++#!/bin/sh ++# ++# Load maia-sdr kernel module ++# ++ ++case "$1" in ++ start) ++ echo -n "Loading maia-sdr.ko: " ++ insmod /lib/modules/maia-sdr.ko ++ [ $? = 0 ] && echo "OK" || echo "FAIL" ++ ;; ++ stop) ++ ;; ++ restart|reload) ++ ;; ++ *) ++ echo "Usage: $0 {start|stop|restart}" ++ exit 1 ++esac ++ ++exit $? +diff --git a/board/e200/post-build.sh b/board/e200/post-build.sh +index 03021a4918..111e744b30 100755 +--- a/board/e200/post-build.sh ++++ b/board/e200/post-build.sh +@@ -91,3 +91,14 @@ ln -sf ../../wpa_supplicant/ifupdown.sh ${TARGET_DIR}/etc/network/if-pre-up.d/wp + ln -sf ../../wpa_supplicant/ifupdown.sh ${TARGET_DIR}/etc/network/if-post-down.d/wpasupplicant + + ln -sf device_reboot ${TARGET_DIR}/usr/sbin/pluto_reboot ++ ++# Maia SDR specific files ++${INSTALL} -d ${TARGET_DIR}/lib/modules ++${INSTALL} -D -m 0644 ${BOARD_DIR}/maia-sdr.ko ${TARGET_DIR}/lib/modules/ ++${INSTALL} -D -m 0755 ${BOARD_DIR}/S50maia-kmod ${TARGET_DIR}/etc/init.d/ ++${INSTALL} -D -m 0755 ${BOARD_DIR}/S60maia-httpd ${TARGET_DIR}/etc/init.d/ ++# TODO: do not install maia-httpd and maia-wasm to /root ++${INSTALL} -D -m 0755 ${BOARD_DIR}/maia-httpd ${TARGET_DIR}/root/ ++${INSTALL} -D -m 0644 ${BOARD_DIR}/maia-wasm/assets/* ${TARGET_DIR}/root/ ++${INSTALL} -d ${TARGET_DIR}/root/pkg ++${INSTALL} -D -m 0644 ${BOARD_DIR}/maia-wasm/pkg/* ${TARGET_DIR}/root/pkg/ +-- +2.43.0 + diff --git a/patch/e200/0002-add-e200-maia-sdr-cache-export-linux.patch b/patch/e200/0002-add-e200-maia-sdr-cache-export-linux.patch new file mode 100644 index 0000000..ff7871a --- /dev/null +++ b/patch/e200/0002-add-e200-maia-sdr-cache-export-linux.patch @@ -0,0 +1,100 @@ +From 6bdd61dd6a2303e982d86b369a9565bd01f5ff06 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= +Date: Wed, 2 Nov 2022 14:15:50 +0100 +Subject: [PATCH] arch: arm: export Zynq cache invalidation functions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is needed for the Maia SDR kernel module, which calls +these functions directly rather than going through the DMA API. + +Signed-off-by: Daniel Estévez +--- + arch/arm/mm/Makefile | 2 ++ + arch/arm/mm/cache-v7-export.c | 14 ++++++++++++++ + arch/arm/mm/cache-v7.S | 2 +- + arch/arm/mm/outercache.c | 17 +++++++++++++++++ + 4 files changed, 34 insertions(+), 1 deletion(-) + create mode 100644 arch/arm/mm/cache-v7-export.c + create mode 100644 arch/arm/mm/outercache.c + +diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile +index 7cb1699fbfc4..096bebdeba9c 100644 +--- a/arch/arm/mm/Makefile ++++ b/arch/arm/mm/Makefile +@@ -5,6 +5,7 @@ + + obj-y := extable.o fault.o init.o iomap.o + obj-y += dma-mapping$(MMUEXT).o ++obj-y += outercache.o + obj-$(CONFIG_MMU) += fault-armv.o flush.o idmap.o ioremap.o \ + mmap.o pgd.o mmu.o pageattr.o + KASAN_SANITIZE_mmu.o := n +@@ -44,6 +45,7 @@ obj-$(CONFIG_CPU_CACHE_V4WT) += cache-v4wt.o + obj-$(CONFIG_CPU_CACHE_V4WB) += cache-v4wb.o + obj-$(CONFIG_CPU_CACHE_V6) += cache-v6.o + obj-$(CONFIG_CPU_CACHE_V7) += cache-v7.o ++obj-$(CONFIG_CPU_CACHE_V7) += cache-v7-export.o + obj-$(CONFIG_CPU_CACHE_FA) += cache-fa.o + obj-$(CONFIG_CPU_CACHE_NOP) += cache-nop.o + obj-$(CONFIG_CPU_CACHE_V7M) += cache-v7m.o +diff --git a/arch/arm/mm/cache-v7-export.c b/arch/arm/mm/cache-v7-export.c +new file mode 100644 +index 000000000000..6ff6e58c4340 +--- /dev/null ++++ b/arch/arm/mm/cache-v7-export.c +@@ -0,0 +1,14 @@ ++/* SPDX-License-Identifier: GPL-2.0-only */ ++/* ++ * linux/arch/arm/mm/cache-v7-export.c ++ * ++ * Copyright (C) 2022 Daniel Estevez ++ * ++ */ ++ ++#include ++ ++// implemented in cache-v7.S ++extern void v7_dma_inv_range(unsigned long start, unsigned long end); ++ ++EXPORT_SYMBOL(v7_dma_inv_range); +diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S +index dc8f152f3556..00b48df0a3e7 100644 +--- a/arch/arm/mm/cache-v7.S ++++ b/arch/arm/mm/cache-v7.S +@@ -363,7 +363,7 @@ ENDPROC(v7_flush_kern_dcache_area) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-v7_dma_inv_range: ++ENTRY(v7_dma_inv_range) + dcache_line_size r2, r3 + sub r3, r2, #1 + tst r0, r3 +diff --git a/arch/arm/mm/outercache.c b/arch/arm/mm/outercache.c +new file mode 100644 +index 000000000000..d4b16005764f +--- /dev/null ++++ b/arch/arm/mm/outercache.c +@@ -0,0 +1,17 @@ ++/* SPDX-License-Identifier: GPL-2.0-only */ ++/* ++ * arch/arm/mm/outercache.c ++ * ++ * Copyright (C) 2022 Daniel Estevez ++ */ ++ ++#include ++#include ++#include ++ ++void arm_cache_outer_inv_range(phys_addr_t start, phys_addr_t end) ++{ ++ outer_inv_range(start, end); ++} ++ ++EXPORT_SYMBOL(arm_cache_outer_inv_range); +-- +2.42.1 + diff --git a/patch/e200/0002-add-e200-maia-sdr-linux.patch b/patch/e200/0002-add-e200-maia-sdr-linux.patch new file mode 100644 index 0000000..5bc49c4 --- /dev/null +++ b/patch/e200/0002-add-e200-maia-sdr-linux.patch @@ -0,0 +1,75 @@ +From 1c5767f323f4c1831a8fc4058d9ef3ff44a8590b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= +Date: Thu, 14 Dec 2023 18:00:00 +0100 +Subject: [PATCH] add e200 maia sdr linux support + +--- + arch/arm/boot/dts/zynq-e200.dtsi | 38 ++++++++++++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + +diff --git a/arch/arm/boot/dts/zynq-e200.dtsi b/arch/arm/boot/dts/zynq-e200.dtsi +index f123605e5d90..daadc6e955ff 100644 +--- a/arch/arm/boot/dts/zynq-e200.dtsi ++++ b/arch/arm/boot/dts/zynq-e200.dtsi +@@ -2,6 +2,7 @@ + * ZYNQ Pluto SDR (Z7020/AD936x) + * + * Copyright (C) 2021 MicroPhase Inc. ++ * Copyright (C) 2022-2023 Daniel Estevez + * + * Licensed under the GPL-2. + */ +@@ -51,6 +52,35 @@ usb_phy0: phy0 { + mp5660 { + compatible = "microphase,ad5660"; + }; ++ ++ reserved-memory { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges; ++ ++ maia_sdr_spectrometer: maia_sdr_spectrometer@1a000000 { ++ no-map; ++ reg = <0x1a000000 0x40000>; ++ label = "maia_sdr_spectrometer"; ++ }; ++ ++ maia_sdr_recording: maia_sdr_recording@01000000 { ++ no-map; ++ reg = <0x01000000 0x19000000>; ++ label = "maia_sdr_recording"; ++ }; ++ }; ++ ++ maia-sdr-recording { ++ compatible = "maia-sdr,recording"; ++ memory-region = <&maia_sdr_recording>; ++ }; ++ ++ maia-sdr-spectrometer { ++ compatible = "maia-sdr,rxbuffer"; ++ memory-region = <&maia_sdr_spectrometer>; ++ buffer-size = <0x8000>; ++ }; + }; + + &sdhci0 { +@@ -181,6 +211,14 @@ dma-channel@0 { + }; + }; + ++ maia_sdr: maia-sdr@7C460000 { ++ compatible = "uio_pdrv_genirq"; ++ reg = <0x7c460000 0x1000>; ++ clocks = <&clkc 15>; ++ interrupt-parent = <&intc>; ++ interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>; ++ }; ++ + cf_ad9364_adc_core_0: cf-ad9361-lpc@79020000 { + compatible = "adi,axi-ad9361-6.00.a"; + reg = <0x79020000 0x6000>; +-- +2.43.0 + diff --git a/patch/e200/0002-add-e200-maia-sdr-makefile-scripts.patch b/patch/e200/0002-add-e200-maia-sdr-makefile-scripts.patch new file mode 100644 index 0000000..1432c10 --- /dev/null +++ b/patch/e200/0002-add-e200-maia-sdr-makefile-scripts.patch @@ -0,0 +1,68 @@ +From 306d274c260bdec168f3514d2125597bcbef2ac0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= +Date: Thu, 14 Dec 2023 18:00:00 +0100 +Subject: [PATCH] add e200 maia sdr makefile support + +--- + Makefile | 43 ++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 42 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 12e7045..0d68db3 100644 +--- a/Makefile ++++ b/Makefile +@@ -113,9 +113,50 @@ linux/arch/arm/boot/dts/%.dtb: TOOLCHAIN linux/arch/arm/boot/dts/%.dts linux/ar + build/%.dtb: linux/arch/arm/boot/dts/%.dtb | build + dtc -q -@ -I dtb -O dts $< | sed 's/axi {/amba {/g' | dtc -q -@ -I dts -O dtb -o $@ + ++### maia-kmod ### ++../maia-sdr/maia-kmod/maia-sdr.ko: ++ $(TOOLS_PATH) make -C linux ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules_prepare ++ $(TOOLS_PATH) make -C ../maia-sdr/maia-kmod ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) KERNEL_SRC=../../plutosdr-fw/linux ++ ++.PHONY: ../maia-sdr/maia-kmod/maia-sdr.ko ++ ++buildroot/board/$(TARGET)/maia-sdr.ko: ../maia-sdr/maia-kmod/maia-sdr.ko | build ++ cp $< $@ ++ ++### maia-httpd ### ++../maia-sdr/maia-httpd/target/armv7-unknown-linux-gnueabihf/release/maia-httpd: ++ cd ../maia-sdr/maia-httpd && \ ++ $(TOOLS_PATH) cargo build --release --target armv7-unknown-linux-gnueabihf \ ++ --config target.armv7-unknown-linux-gnueabihf.linker=\"arm-linux-gnueabihf-gcc\" ++ ++.PHONY: ../maia-sdr/maia-httpd/target/armv7-unknown-linux-gnueabihf/release/maia-httpd ++ ++buildroot/board/$(TARGET)/maia-httpd: ../maia-sdr/maia-httpd/target/armv7-unknown-linux-gnueabihf/release/maia-httpd | build ++ cp $< $@ ++ ++### maia-wasm ### ++../maia-sdr/maia-wasm/pkg: ++ cd ../maia-sdr/maia-wasm && wasm-pack build --target web ++ ++.PHONY: ../maia-sdr/maia-wasm/pkg ++ ++buildroot/board/$(TARGET)/maia-wasm: ++ mkdir $@ ++ ++buildroot/board/$(TARGET)/maia-wasm/pkg: ../maia-sdr/maia-wasm/pkg | build buildroot/board/$(TARGET)/maia-wasm ++ cp -r $< buildroot/board/$(TARGET)/maia-wasm/ ++ ++buildroot/board/$(TARGET)/maia-wasm/assets: ../maia-sdr/maia-wasm/assets | build buildroot/board/$(TARGET)/maia-was ++ cp -r $< buildroot/board/$(TARGET)/maia-wasm/ ++ ++maia-wasm: buildroot/board/$(TARGET)/maia-wasm/pkg buildroot/board/$(TARGET)/maia-wasm/assets ++ ++.PHONY: maia-wasm ++ ++ + ### Buildroot ### + +-buildroot/output/images/rootfs.cpio.gz: ++buildroot/output/images/rootfs.cpio.gz: buildroot/board/$(TARGET)/maia-sdr.ko buildroot/board/$(TARGET)/maia-httpd maia-wasm + @echo device-fw $(VERSION)> $(CURDIR)/buildroot/board/$(TARGET)/VERSIONS + @$(foreach dir,$(VSUBDIRS),echo $(dir) $(shell cd $(dir) && git describe --abbrev=4 --dirty --always --tags) >> $(CURDIR)/buildroot/board/$(TARGET)/VERSIONS;) + make -C buildroot ARCH=arm zynq_$(TARGET)_defconfig +-- +2.43.0 + diff --git a/patch/e200/0002-add-e200-maia-sdr-uboot.patch b/patch/e200/0002-add-e200-maia-sdr-uboot.patch new file mode 100644 index 0000000..d5263e5 --- /dev/null +++ b/patch/e200/0002-add-e200-maia-sdr-uboot.patch @@ -0,0 +1,47 @@ +From b58dd0ba090d932f97d6f079fe08758fb2d3827b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= +Date: Thu, 14 Dec 2023 18:00:00 +0100 +Subject: [PATCH] add e200 maia sdr uboot support + +--- + include/configs/zynq-common.h | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h +index 32a7303813..ecb1611443 100644 +--- a/include/configs/zynq-common.h ++++ b/include/configs/zynq-common.h +@@ -332,14 +332,19 @@ + "if run adi_loadvals; then " \ + "echo Loaded AD936x refclk frequency and model into devicetree; " \ + "fi; " \ +- "envversion;setenv bootargs console=ttyPS0,115200 maxcpus=${maxcpus} rootfstype=ramfs root=/dev/ram0 rw earlyprintk clk_ignore_unused uboot=\"${uboot-version}\" && " \ ++ "envversion;setenv bootargs console=ttyPS0,115200 maxcpus=${maxcpus} rootfstype=ramfs root=/dev/ram0 rw earlyprintk clk_ignore_unused uio_pdrv_genirq.of_id=uio_pdrv_genirq uboot=\"${uboot-version}\" && " \ + "bootm ${fit_load_address}#${fit_config}\0" \ ++ "sdboot=if mmcinfo; then run uenvboot; echo Copying Linux from SD to RAM... && " \ ++ "load mmc 0 ${fit_load_address} ${kernel_image} && load mmc 0 ${devicetree_load_address} ${devicetree_image} && " \ ++ "load mmc 0 ${ramdisk_load_address} ${ramdisk_image} && " \ ++ "setenv bootargs console=ttyPS0,115200 maxcpus=${maxcpus} rootfstype=ramfs root=/dev/ram0 rw earlyprintk clk_ignore_unused uio_pdrv_genirq.of_id=uio_pdrv_genirq uboot=\"${uboot-version}\" && " \ ++ "bootm ${fit_load_address} ${ramdisk_load_address} ${devicetree_load_address}; fi\0" \ + "qspiboot_verbose=adi_hwref;echo Copying Linux from QSPI flash to RAM... && " \ + "run read_sf && " \ + "if run adi_loadvals; then " \ + "echo Loaded AD936x refclk frequency and model into devicetree; " \ + "fi; " \ +- "envversion;setenv bootargs console=ttyPS0,115200 maxcpus=${maxcpus} rootfstype=ramfs root=/dev/ram0 rw earlyprintk clk_ignore_unused uboot=\"${uboot-version}\" && " \ ++ "envversion;setenv bootargs console=ttyPS0,115200 maxcpus=${maxcpus} rootfstype=ramfs root=/dev/ram0 rw earlyprintk clk_ignore_unused uio_pdrv_genirq.of_id=uio_pdrv_genirq uboot=\"${uboot-version}\" && " \ + "bootm ${fit_load_address}#${fit_config} || echo BOOT failed entering DFU mode ... && run dfu_sf \0" \ + "qspiboot=set stdout nulldev;adi_hwref;test -n $PlutoRevA || gpio input 14 && set stdout serial@e0000000 && sf probe && sf protect lock 0 100000 && run dfu_sf; " \ + "set stdout serial@e0000000;" \ +@@ -349,7 +354,7 @@ + "itest *f8000258 == 480002 && run clear_reset_cause && exit; " \ + "echo Booting silently && set stdout nulldev; " \ + "run read_sf && run adi_loadvals; " \ +- "envversion;setenv bootargs console=ttyPS0,115200 maxcpus=${maxcpus} rootfstype=ramfs root=/dev/ram0 rw quiet loglevel=4 clk_ignore_unused uboot=\"${uboot-version}\" && " \ ++ "envversion;setenv bootargs console=ttyPS0,115200 maxcpus=${maxcpus} rootfstype=ramfs root=/dev/ram0 rw quiet loglevel=4 clk_ignore_unused uio_pdrv_genirq.of_id=uio_pdrv_genirq uboot=\"${uboot-version}\" && " \ + "bootm ${fit_load_address}#${fit_config} || set stdout serial@e0000000;echo BOOT failed entering DFU mode ... && sf protect lock 0 100000 && run dfu_sf \0" \ + "jtagboot=env default -a;sf probe && sf protect unlock 0 100000 && run dfu_sf; \0" \ + "uenvboot=" \ +-- +2.43.0 +