drivers/fpga/xilinx-spi.c

Source file repositories/reference/linux-study-clean/drivers/fpga/xilinx-spi.c

File Facts

System
Linux kernel
Corpus path
drivers/fpga/xilinx-spi.c
Extension
.c
Size
1983 bytes
Lines
90
Domain
Driver Families
Bucket
drivers/fpga
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (ret) {
			dev_err(core->dev, "SPI error in firmware write: %d\n",
				ret);
			return ret;
		}
		fw_data += stride;
	}

	return 0;
}

static int xilinx_spi_probe(struct spi_device *spi)
{
	struct xilinx_fpga_core *core;

	core = devm_kzalloc(&spi->dev, sizeof(*core), GFP_KERNEL);
	if (!core)
		return -ENOMEM;

	core->dev = &spi->dev;
	core->write = xilinx_spi_write;

	return xilinx_core_probe(core);
}

static const struct spi_device_id xilinx_spi_ids[] = {
	{ "fpga-slave-serial" },
	{ },
};
MODULE_DEVICE_TABLE(spi, xilinx_spi_ids);

#ifdef CONFIG_OF
static const struct of_device_id xlnx_spi_of_match[] = {
	{
		.compatible = "xlnx,fpga-slave-serial",
	},
	{}
};
MODULE_DEVICE_TABLE(of, xlnx_spi_of_match);
#endif

static struct spi_driver xilinx_slave_spi_driver = {
	.driver = {
		.name = "xlnx-slave-spi",
		.of_match_table = of_match_ptr(xlnx_spi_of_match),
	},
	.probe = xilinx_spi_probe,
	.id_table = xilinx_spi_ids,
};

module_spi_driver(xilinx_slave_spi_driver)

MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Anatolij Gustschin <agust@denx.de>");
MODULE_DESCRIPTION("Load Xilinx FPGA firmware over SPI");

Annotation

Implementation Notes