Lines Matching +full:fpga +full:- +full:mgr

1 // SPDX-License-Identifier: GPL-2.0
5 * Manage Lattice FPGA firmware that is loaded over SPI using
12 #include <linux/fpga/fpga-mgr.h>
18 /* MachXO2 Programming Guide - sysCONFIG Programming Commands */
30 * Sheet' sysCONFIG Port Timing Specifications (3-36)
112 pr_debug("machxo2 status: 0x%08lX - done=%d, cfgena=%d, busy=%d, fail=%d, devver=%d, err=%s\n", in dump_status_reg()
129 return -EBUSY; in wait_until_not_busy()
135 static int machxo2_cleanup(struct fpga_manager *mgr) in machxo2_cleanup() argument
137 struct spi_device *spi = mgr->priv; in machxo2_cleanup()
169 dev_err(&mgr->dev, "Cleanup failed\n"); in machxo2_cleanup()
174 static enum fpga_mgr_states machxo2_spi_state(struct fpga_manager *mgr) in machxo2_spi_state() argument
176 struct spi_device *spi = mgr->priv; in machxo2_spi_state()
187 static int machxo2_write_init(struct fpga_manager *mgr, in machxo2_write_init() argument
191 struct spi_device *spi = mgr->priv; in machxo2_write_init()
200 if ((info->flags & FPGA_MGR_PARTIAL_RECONFIG)) { in machxo2_write_init()
201 dev_err(&mgr->dev, in machxo2_write_init()
203 return -ENOTSUPP; in machxo2_write_init()
229 ret = -EINVAL; in machxo2_write_init()
247 dev_err(&mgr->dev, "Error during FPGA init.\n"); in machxo2_write_init()
252 static int machxo2_write(struct fpga_manager *mgr, const char *buf, in machxo2_write() argument
255 struct spi_device *spi = mgr->priv; in machxo2_write()
264 dev_err(&mgr->dev, "Malformed payload.\n"); in machxo2_write()
265 return -EINVAL; in machxo2_write()
281 dev_err(&mgr->dev, "Error loading the bitstream.\n"); in machxo2_write()
291 static int machxo2_write_complete(struct fpga_manager *mgr, in machxo2_write_complete() argument
294 struct spi_device *spi = mgr->priv; in machxo2_write_complete()
317 machxo2_cleanup(mgr); in machxo2_write_complete()
318 ret = -EINVAL; in machxo2_write_complete()
340 machxo2_cleanup(mgr); in machxo2_write_complete()
341 ret = -EINVAL; in machxo2_write_complete()
351 dev_err(&mgr->dev, "Refresh failed.\n"); in machxo2_write_complete()
365 struct device *dev = &spi->dev; in machxo2_spi_probe()
366 struct fpga_manager *mgr; in machxo2_spi_probe() local
368 if (spi->max_speed_hz > MACHXO2_MAX_SPEED) { in machxo2_spi_probe()
370 return -EINVAL; in machxo2_spi_probe()
373 mgr = devm_fpga_mgr_register(dev, "Lattice MachXO2 SPI FPGA Manager", in machxo2_spi_probe()
375 return PTR_ERR_OR_ZERO(mgr); in machxo2_spi_probe()
380 { .compatible = "lattice,machxo2-slave-spi", },
387 { "machxo2-slave-spi", 0 },
394 .name = "machxo2-slave-spi",
404 MODULE_DESCRIPTION("Load Lattice FPGA firmware over SPI");