hw/ssi: Fix Linux driver init issue with xilinx_spi
PATCH 1/1 hw/ssi: Fix Linux driver init issue with xilinx_spi
The problem is that the Linux driver expects the master transaction inhibit bit(R_SPICR_MTI) to be set during driver initialization so that it can detect the fifo size but QEMU defaults it to zero out of reset. The datasheet indicates this bit is active on reset.
See page 25, SPI Control Register section:
https://www.xilinx.com/content/dam/xilinx/support/documents/ip_documentation/axi_quad_spi/v3_2/pg153-axi-quad-spi.pdf
--- hw/ssi/xilinx_spi.c | 1 + 1 file changed, 1 insertion(+)
hw/ssi/xilinx_spi.c +1 -0
@@ -156,6 +156,7 @@ static void xlx_spi_do_reset(XilinxSPI *s)txfifo_reset (s); s->regs[R_SPISSR ] = ~0 ; + s->regs[R_SPICR ] =R_SPICR_MTI ;xlx_spi_update_irq (s);xlx_spi_update_cs (s); }
Signature · 1 line
2.40.0.348.gf938b09366-goog
Ping to the Xilinx folks, do you want to review this?
thanks
-- PMM
Quoted 29 lines · Chris Rauer
The problem is that the Linux driver expects the master transaction inhibit
bit(R_SPICR_MTI)to be set during driver initialization so that it can detect the fifo size but QEMU defaults it to zero out of reset. The datasheet indicates this bit is active on reset.See page 25, SPI Control Register section:
https://www.xilinx.com/content/dam/xilinx/support/documents/ip_documentation/axi_quad_spi/v3_2/pg153-axi-quad-spi.pdfSigned-off-by Chris Rauer <[email protected]>--- hw/ssi/xilinx_spi.c | 1 + 1 file changed, 1 insertion(+)hw/ssi/xilinx_spi.c +1
-1@@ -156,6 +156,7 @@ static void xlx_spi_do_reset(XilinxSPI *s)txfifo_reset (s); s->regs[R_SPISSR ] = ~0 ; + s->regs[R_SPICR ] =R_SPICR_MTI ;xlx_spi_update_irq (s);xlx_spi_update_cs (s); } --2.40.0.348.gf938b09366-goog
Quoted 10 lines · Chris Rauer
The problem is that the Linux driver expects the master transaction inhibit
bit(R_SPICR_MTI)to be set during driver initialization so that it can detect the fifo size but QEMU defaults it to zero out of reset. The datasheet indicates this bit is active on reset.See page 25, SPI Control Register section:
Yes, MTI should be set when the device comes out of reset.
Quoted 22 lines
Signed-off-by Chris Rauer <[email protected]>--- hw/ssi/xilinx_spi.c | 1 + 1 file changed, 1 insertion(+)hw/ssi/xilinx_spi.c +1
-1@@ -156,6 +156,7 @@ static void xlx_spi_do_reset(XilinxSPI *s)txfifo_reset (s); s->regs[R_SPISSR ] = ~0 ; + s->regs[R_SPICR ] =R_SPICR_MTI ;xlx_spi_update_irq (s);xlx_spi_update_cs (s); } --2.40.0.348.gf938b09366-goog
Quoted 9 lines · Edgar E. Iglesias
Quoted 6 lines · Chris Rauer
The problem is that the Linux driver expects the master transaction inhibit
bit(R_SPICR_MTI)to be set during driver initialization so that it can detect the fifo size but QEMU defaults it to zero out of reset. The datasheet indicates this bit is active on reset.
Quoted 7 lines
Quoted 3 lines
See page 25, SPI Control Register section:
https://www.xilinx.com/content/dam/xilinx/support/documents/ip_documentation/axi_quad_spi/v3_2/pg153-axi-quad-spi.pdfYes, MTI should be set when the device comes out of reset.
Reviewed-by Edgar E. Iglesias <[email protected]>
Thanks; applied to target-arm.next for 8.0.
-- PMM