From 85aeb915b420f0995cc41389a8556b6992151821 Mon Sep 17 00:00:00 2001 From: Istvan Csomortani Date: Mon, 14 Sep 2020 17:45:50 +0100 Subject: [PATCH] spi_engine_offload: Start offload when DMA is ready --- .../spi_engine/spi_engine_offload/spi_engine_offload.v | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/library/spi_engine/spi_engine_offload/spi_engine_offload.v b/library/spi_engine/spi_engine_offload/spi_engine_offload.v index d44333d0e..701c23465 100644 --- a/library/spi_engine/spi_engine_offload/spi_engine_offload.v +++ b/library/spi_engine/spi_engine_offload/spi_engine_offload.v @@ -175,10 +175,10 @@ end assign cmd = (cmd_int_s[15:8] == 8'h30) ? {cmd_int_s[15:8], spi_sync_id_counter} : cmd_int_s; -/* - * Forwarded SYNC interface, this can be used to monitor the state of the +/* + * Forwarded SYNC interface, this can be used to monitor the state of the * offload command sequence through SPI Engine regmap - */ + */ assign status_sync_data = sync_data; assign status_sync_valid = sync_valid; @@ -256,7 +256,9 @@ always @(posedge spi_clk) begin spi_active <= 1'b0; end else begin if (spi_active == 1'b0) begin - if (trigger_s == 1'b1 && spi_enable == 1'b1) + // start offload when we have a valid trigger, offload is enabled and + // the DMA is enabled + if (trigger_s == 1'b1 && spi_enable == 1'b1 && offload_sdi_ready == 1'b1) spi_active <= 1'b1; end else if (cmd_ready == 1'b1 && spi_cmd_rd_addr_next == ctrl_cmd_wr_addr) begin spi_active <= 1'b0;