]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
drivers: xilinx_spi: Add xfer callback
authorMayuresh Chitale <mchitale@ventanamicro.com>
Thu, 16 Nov 2023 16:43:35 +0000 (22:13 +0530)
committerMichal Simek <michal.simek@amd.com>
Wed, 13 Dec 2023 07:58:06 +0000 (08:58 +0100)
Add the xfer callback which is used by the MMC_SPI driver and generally by
the dm_spi_xfer callback.

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Tested-by: Love Kumar <love.kumar@amd.com>
Link: https://lore.kernel.org/r/20231116164336.140171-3-mchitale@ventanamicro.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
drivers/spi/xilinx_spi.c

index d9faceec189bafac9e8e8a98ed5076ab11023a18..b63cda20912b3b07c089d1d8c1a788f2fd929680 100644 (file)
@@ -278,6 +278,18 @@ static void xilinx_spi_startup_block(struct udevice *dev)
        spi_cs_deactivate(dev);
 }
 
+static int xilinx_spi_xfer(struct udevice *dev, unsigned int bitlen,
+                          const void *dout, void *din, unsigned long flags)
+{
+       struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
+       int ret;
+
+       spi_cs_activate(dev, slave_plat->cs);
+       ret = start_transfer(dev, dout, din, bitlen / 8);
+       spi_cs_deactivate(dev);
+       return ret;
+}
+
 static int xilinx_spi_mem_exec_op(struct spi_slave *spi,
                                  const struct spi_mem_op *op)
 {
@@ -427,6 +439,7 @@ static const struct spi_controller_mem_ops xilinx_spi_mem_ops = {
 static const struct dm_spi_ops xilinx_spi_ops = {
        .claim_bus      = xilinx_spi_claim_bus,
        .release_bus    = xilinx_spi_release_bus,
+       .xfer           = xilinx_spi_xfer,
        .set_speed      = xilinx_spi_set_speed,
        .set_mode       = xilinx_spi_set_mode,
        .mem_ops        = &xilinx_spi_mem_ops,