Lines Matching +full:fpga +full:- +full:1

1 // SPDX-License-Identifier: GPL-2.0-or-later
16 #define FIRMWARE_NAME "lattice-ecp3.bit"
19 * The JTAG ID's of the supported FPGA's. The ID is 32bit wide
25 /* FPGA commands */
41 #define FPGA_CLEAR_TIMEOUT 5000 /* max. 5000ms for FPGA clear */
57 .name = "Lattice ECP3-17",
61 .name = "Lattice ECP3-35",
78 dev_err(&spi->dev, "Cannot load firmware, aborting\n"); in firmware_load()
82 if (fw->size == 0) { in firmware_load()
83 dev_err(&spi->dev, "Error: Firmware size is 0!\n"); in firmware_load()
88 txbuf[1] = 0x00; in firmware_load()
92 /* Trying to speak with the FPGA via SPI... */ in firmware_load()
96 dev_dbg(&spi->dev, "FPGA JTAG ID=%08x\n", jedec_id); in firmware_load()
103 dev_err(&spi->dev, in firmware_load()
104 "Error: No supported FPGA detected (JEDEC_ID=%08x)!\n", in firmware_load()
109 dev_info(&spi->dev, "FPGA %s detected\n", ecp3_dev[i].name); in firmware_load()
114 dev_dbg(&spi->dev, "FPGA Status=%08x\n", status); in firmware_load()
116 buffer = kzalloc(fw->size + 8, GFP_KERNEL); in firmware_load()
118 dev_err(&spi->dev, "Error: Can't allocate memory!\n"); in firmware_load()
126 buffer[1] = 0xff; in firmware_load()
129 memcpy(buffer + 4, fw->data, fw->size); in firmware_load()
141 * Wait for FPGA memory to become cleared in firmware_load()
154 dev_err(&spi->dev, in firmware_load()
155 "Error: Timeout waiting for FPGA to clear (status=%08x)!\n", in firmware_load()
161 dev_info(&spi->dev, "Configuring the FPGA...\n"); in firmware_load()
162 spi_write(spi, buffer, fw->size + 8); in firmware_load()
170 dev_dbg(&spi->dev, "FPGA Status=%08x\n", status); in firmware_load()
174 dev_info(&spi->dev, "FPGA successfully configured!\n"); in firmware_load()
176 dev_info(&spi->dev, "FPGA not configured (DONE not set)\n"); in firmware_load()
185 complete(&data->fw_loaded); in firmware_load()
193 data = devm_kzalloc(&spi->dev, sizeof(*data), GFP_KERNEL); in lattice_ecp3_probe()
195 dev_err(&spi->dev, "Memory allocation for fpga_data failed\n"); in lattice_ecp3_probe()
196 return -ENOMEM; in lattice_ecp3_probe()
200 init_completion(&data->fw_loaded); in lattice_ecp3_probe()
202 FIRMWARE_NAME, &spi->dev, in lattice_ecp3_probe()
205 dev_err(&spi->dev, "Firmware loading failed with %d!\n", err); in lattice_ecp3_probe()
209 dev_info(&spi->dev, "FPGA bitstream configuration driver registered\n"); in lattice_ecp3_probe()
218 wait_for_completion(&data->fw_loaded); in lattice_ecp3_remove()
222 { "ecp3-17", 0 },
223 { "ecp3-35", 0 },
230 .name = "lattice-ecp3",
240 MODULE_DESCRIPTION("Lattice ECP3 FPGA configuration via SPI");