]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/spi/spi-dw.h
spi: dw-mid: split dma_setup() from dma_transfer()
[karo-tx-linux.git] / drivers / spi / spi-dw.h
index 3d32be68c14210c93e0ae3a6c87e65c7e5c38759..7351692494ec2d9c02ff27eb23b9fba44567bc82 100644 (file)
@@ -91,12 +91,12 @@ struct dw_spi;
 struct dw_spi_dma_ops {
        int (*dma_init)(struct dw_spi *dws);
        void (*dma_exit)(struct dw_spi *dws);
-       int (*dma_transfer)(struct dw_spi *dws, int cs_change);
+       int (*dma_setup)(struct dw_spi *dws);
+       int (*dma_transfer)(struct dw_spi *dws);
 };
 
 struct dw_spi {
        struct spi_master       *master;
-       struct spi_device       *cur_dev;
        enum dw_ssi_type        type;
        char                    name[16];
 
@@ -109,14 +109,7 @@ struct dw_spi {
        u16                     bus_num;
        u16                     num_cs;         /* supported slave numbers */
 
-       /* Message Transfer pump */
-       struct tasklet_struct   pump_transfers;
-
        /* Current message transfer state info */
-       struct spi_message      *cur_msg;
-       struct spi_transfer     *cur_transfer;
-       struct chip_data        *cur_chip;
-       struct chip_data        *prev_chip;
        size_t                  len;
        void                    *tx;
        void                    *tx_end;
@@ -128,10 +121,8 @@ struct dw_spi {
        size_t                  rx_map_len;
        size_t                  tx_map_len;
        u8                      n_bytes;        /* current is a 1/2 bytes op */
-       u8                      max_bits_per_word;      /* maxim is 16b */
        u32                     dma_width;
        irqreturn_t             (*transfer_handler)(struct dw_spi *dws);
-       void                    (*cs_control)(u32 command);
 
        /* Dma info */
        int                     dma_inited;
@@ -182,22 +173,6 @@ static inline void spi_set_clk(struct dw_spi *dws, u16 div)
        dw_writel(dws, DW_SPI_BAUDR, div);
 }
 
-static inline void spi_chip_sel(struct dw_spi *dws, struct spi_device *spi,
-               int active)
-{
-       u16 cs = spi->chip_select;
-       int gpio_val = active ? (spi->mode & SPI_CS_HIGH) :
-               !(spi->mode & SPI_CS_HIGH);
-
-       if (dws->cs_control)
-               dws->cs_control(active);
-       if (gpio_is_valid(spi->cs_gpio))
-               gpio_set_value(spi->cs_gpio, gpio_val);
-
-       if (active)
-               dw_writel(dws, DW_SPI_SER, 1 << cs);
-}
-
 /* Disable IRQ bits */
 static inline void spi_mask_intr(struct dw_spi *dws, u32 mask)
 {
@@ -216,6 +191,18 @@ static inline void spi_umask_intr(struct dw_spi *dws, u32 mask)
        dw_writel(dws, DW_SPI_IMR, new_mask);
 }
 
+/*
+ * This does disable the SPI controller, interrupts, and re-enable the
+ * controller back. Transmit and receive FIFO buffers are cleared when the
+ * device is disabled.
+ */
+static inline void spi_reset_chip(struct dw_spi *dws)
+{
+       spi_enable_chip(dws, 0);
+       spi_mask_intr(dws, 0xff);
+       spi_enable_chip(dws, 1);
+}
+
 /*
  * Each SPI slave device to work with dw_api controller should
  * has such a structure claiming its working mode (PIO/DMA etc),
@@ -233,7 +220,6 @@ extern int dw_spi_add_host(struct device *dev, struct dw_spi *dws);
 extern void dw_spi_remove_host(struct dw_spi *dws);
 extern int dw_spi_suspend_host(struct dw_spi *dws);
 extern int dw_spi_resume_host(struct dw_spi *dws);
-extern void dw_spi_xfer_done(struct dw_spi *dws);
 
 /* platform related setup */
 extern int dw_spi_mid_init(struct dw_spi *dws); /* Intel MID platforms */