Lines Matching defs:spi
3 * au1550 psc spi controller driver
5 * will not work on au1000, au1100 and au1500 (no full spi controller there)
19 #include <linux/spi/spi.h>
20 #include <linux/spi/spi_bitbang.h>
54 int (*txrx_bufs)(struct spi_device *spi, struct spi_transfer *t);
76 /* we use an 8-bit memory device for dma transfers to/from spi fifo */
94 * compute BRG and DIV bits to setup spi clock based on main input clock rate
153 * dma transfers are used for the most common spi word size of 8-bits
156 * setup dma channels from scratch on each spi transfer, based on bits_per_word
157 * instead we have pre set up 8 bit dma channels supporting spi 4 to 8 bits
158 * transfers, and 9 to 24 bits spi transfers will be done in pio irq based mode
161 static void au1550_spi_chipsel(struct spi_device *spi, int value)
163 struct au1550_spi *hw = spi_master_get_devdata(spi->master);
164 unsigned cspol = spi->mode & SPI_CS_HIGH ? 1 : 0;
170 hw->pdata->deactivate_cs(hw->pdata, spi->chip_select,
175 au1550_spi_bits_handlers_set(hw, spi->bits_per_word);
182 if (spi->mode & SPI_CPOL)
186 if (spi->mode & SPI_CPHA)
191 if (spi->mode & SPI_LSB_FIRST)
196 if (hw->usedma && spi->bits_per_word <= 8)
201 cfg |= PSC_SPICFG_SET_LEN(spi->bits_per_word);
205 cfg |= au1550_spi_baudcfg(hw, spi->max_speed_hz);
215 hw->pdata->activate_cs(hw->pdata, spi->chip_select,
221 static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
223 struct au1550_spi *hw = spi_master_get_devdata(spi->master);
231 bpw = spi->bits_per_word;
232 hz = spi->max_speed_hz;
238 au1550_spi_bits_handlers_set(hw, spi->bits_per_word);
272 * for dma spi transfers, we have to setup rx channel, otherwise there is
273 * no reliable way how to recognize that spi transfer is done
274 * dma complete callbacks are called before real spi transfer is finished
276 * spi master done event irq is not generated unless rx fifo is empty (emptied)
305 static int au1550_spi_dma_txrxb(struct spi_device *spi, struct spi_transfer *t)
307 struct au1550_spi *hw = spi_master_get_devdata(spi->master);
429 * due to an spi error we consider transfer as done,
503 static int au1550_spi_pio_txrxb(struct spi_device *spi, struct spi_transfer *t)
506 struct au1550_spi *hw = spi_master_get_devdata(spi->master);
617 * By simply restarting the spi transfer on Tx Underflow Error,
618 * we assume that spi transfer was paused instead of zeroes
636 static int au1550_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
638 struct au1550_spi *hw = spi_master_get_devdata(spi->master);
639 return hw->txrx_bufs(spi, t);
736 /* the spi->mode bits understood by this driver: */
864 * precompute valid range for spi freq - from au1550 datasheet:
889 "spi master registered: bus_num=%d num_chipselect=%d\n",
928 dev_info(&pdev->dev, "spi master remove: bus_num=%d\n",
947 MODULE_ALIAS("platform:au1550-spi");
953 .name = "au1550-spi",
961 * needed for proper byte ordering to spi fifo
975 printk(KERN_ERR "au1550-spi: cannot add memory"