summaryrefslogtreecommitdiffstats
path: root/drivers/fpga/microchip-spi.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* fpga: Explicitly include correct DT includesRob Herring2023-07-171-1/+1
| | | | | | | | | | | | | | | | The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Signed-off-by: Rob Herring <robh@kernel.org> Acked-by: Xu Yilun <yilun.xu@intel.com> Link: https://lore.kernel.org/r/20230714174449.4055156-1-robh@kernel.org Signed-off-by: Xu Yilun <yilun.xu@intel.com>
* fpga: microchip-spi: separate data frame write routineIvan Bornyakov2023-01-281-13/+23
| | | | | | | | | | | | | | mpf_ops_write() function writes bitstream data to the FPGA by a smaller frames. Introduce mpf_spi_frame_write() function which is for writing a single data frame and use it in mpf_ops_write(). No functional changes intended. Signed-off-by: Ivan Bornyakov <i.bornyakov@metrotek.ru> Acked-by: Conor Dooley <conor.dooley@microchip.com> Acked-by: Xu Yilun <yilun.xu@intel.com> Link: https://lore.kernel.org/r/20221230092922.18822-4-i.bornyakov@metrotek.ru Signed-off-by: Xu Yilun <yilun.xu@intel.com>
* fpga: microchip-spi: rewrite status polling in a time measurable wayIvan Bornyakov2023-01-281-15/+17
| | | | | | | | | | | | | | | | | | | | Original busy loop with retries count in mpf_poll_status() is not too reliable, as it takes different times on different systems. Replace it with read_poll_timeout() macro. While at it, fix polling stop condition to met function's original intention declared in the comment. The issue with original polling stop condition is that it stops if any of mask bits is set, while intention was to stop if all mask bits is set. This was not noticible because only MPF_STATUS_READY is passed as mask argument and it is BIT(1). Fixes: 5f8d4a900830 ("fpga: microchip-spi: add Microchip MPF FPGA manager") Signed-off-by: Ivan Bornyakov <i.bornyakov@metrotek.ru> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Acked-by: Conor Dooley <conor.dooley@microchip.com> Acked-by: Xu Yilun <yilun.xu@intel.com> Link: https://lore.kernel.org/r/20221230092922.18822-3-i.bornyakov@metrotek.ru Signed-off-by: Xu Yilun <yilun.xu@intel.com>
* fpga: microchip-spi: move SPI I/O buffers out of stackIvan Bornyakov2023-01-281-46/+47
| | | | | | | | | | | | | | | | | | | | | As spi-summary doc says: > I/O buffers use the usual Linux rules, and must be DMA-safe. > You'd normally allocate them from the heap or free page pool. > Don't use the stack, or anything that's declared "static". Replace spi_write() with spi_write_then_read(), which is dma-safe for on-stack buffers. Use cacheline aligned buffers for transfers used in spi_sync_transfer(). Although everything works OK with stack-located I/O buffers, better follow the doc to be safe. Fixes: 5f8d4a900830 ("fpga: microchip-spi: add Microchip MPF FPGA manager") Signed-off-by: Ivan Bornyakov <i.bornyakov@metrotek.ru> Acked-by: Conor Dooley <conor.dooley@microchip.com> Acked-by: Xu Yilun <yilun.xu@intel.com> Link: https://lore.kernel.org/r/20221230092922.18822-2-i.bornyakov@metrotek.ru Signed-off-by: Xu Yilun <yilun.xu@intel.com>
* fpga: microchip-spi: add missing module author entryConor Dooley2022-08-151-0/+1
| | | | | | | | | | | | Add the missing MODULE_AUTHOR entry for the Microchip spi-slave FPGA programming driver. Signed-off-by: Conor Dooley <conor.dooley@microchip.com> Acked-by: Ivan Bornyakov <i.bornyakov@metrotek.ru> Reviewed-by: Tom Rix <trix@redhat.com> Acked-by: Xu Yilun <yilun.xu@intel.com> Link: https://lore.kernel.org/r/20220728075012.3136914-1-conor.dooley@microchip.com Signed-off-by: Xu Yilun <yilun.xu@intel.com>
* fpga: microchip-spi: add Microchip MPF FPGA managerIvan Bornyakov2022-06-241-0/+398
Add support to the FPGA manager for programming Microchip Polarfire FPGAs over slave SPI interface with .dat formatted bitsream image. Signed-off-by: Ivan Bornyakov <i.bornyakov@metrotek.ru> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Tested-by: Conor Dooley <conor.dooley@microchip.com> Acked-by: Xu Yilun <yilun.xu@intel.com> Link: https://lore.kernel.org/r/20220623163248.3672-4-i.bornyakov@metrotek.ru Signed-off-by: Xu Yilun <yilun.xu@intel.com>