^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0+ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2018 Exceet Electronics GmbH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2018 Bootlin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Author: Boris Brezillon <boris.brezillon@bootlin.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Helpers needed by the spi or spi-mem logic. Should not be used outside of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * spi-mem.c and spi.c.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #ifndef __LINUX_SPI_INTERNALS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define __LINUX_SPI_INTERNALS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/dma-direction.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/scatterlist.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/spi/spi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) void spi_flush_queue(struct spi_controller *ctrl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #ifdef CONFIG_HAS_DMA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct sg_table *sgt, void *buf, size_t len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) enum dma_data_direction dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) void spi_unmap_buf(struct spi_controller *ctlr, struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct sg_table *sgt, enum dma_data_direction dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #else /* !CONFIG_HAS_DMA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) static inline int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct sg_table *sgt, void *buf, size_t len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) enum dma_data_direction dir)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) static inline void spi_unmap_buf(struct spi_controller *ctlr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) struct device *dev, struct sg_table *sgt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) enum dma_data_direction dir)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #endif /* CONFIG_HAS_DMA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #endif /* __LINUX_SPI_INTERNALS_H */