Lines Matching defs:spi
19 #include <linux/spi/spi.h>
20 #include <linux/spi/spi_bitbang.h>
21 #include <linux/spi/s3c24xx.h>
22 #include <linux/spi/s3c24xx-fiq.h>
27 #include "spi-s3c24xx-regs.h"
65 void (*set_cs)(struct s3c2410_spi_info *spi,
87 static void s3c24xx_spi_gpiocs(struct s3c2410_spi_info *spi, int cs, int pol)
89 gpio_set_value(spi->pin_cs, pol);
92 static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)
94 struct s3c24xx_spi_devstate *cs = spi->controller_state;
95 struct s3c24xx_spi *hw = to_hw(spi);
96 unsigned int cspol = spi->mode & SPI_CS_HIGH ? 1 : 0;
98 /* change the chipselect state and the state of the spi engine clock */
102 hw->set_cs(hw->pdata, spi->chip_select, cspol^1);
109 hw->set_cs(hw->pdata, spi->chip_select, cspol);
114 static int s3c24xx_spi_update_state(struct spi_device *spi,
117 struct s3c24xx_spi *hw = to_hw(spi);
118 struct s3c24xx_spi_devstate *cs = spi->controller_state;
123 hz = t ? t->speed_hz : spi->max_speed_hz;
126 hz = spi->max_speed_hz;
128 if (spi->mode != cs->mode) {
131 if (spi->mode & SPI_CPHA)
134 if (spi->mode & SPI_CPOL)
137 cs->mode = spi->mode;
148 dev_dbg(&spi->dev, "pre-scaler=%d (wanted %d, got %ld)\n",
158 static int s3c24xx_spi_setupxfer(struct spi_device *spi,
161 struct s3c24xx_spi_devstate *cs = spi->controller_state;
162 struct s3c24xx_spi *hw = to_hw(spi);
165 ret = s3c24xx_spi_update_state(spi, t);
172 static int s3c24xx_spi_setup(struct spi_device *spi)
174 struct s3c24xx_spi_devstate *cs = spi->controller_state;
175 struct s3c24xx_spi *hw = to_hw(spi);
180 cs = devm_kzalloc(&spi->dev,
188 spi->controller_state = cs;
192 ret = s3c24xx_spi_update_state(spi, NULL);
198 hw->bitbang.chipselect(spi, BITBANG_CS_INACTIVE);
360 * @spi: The hardware state.
365 static inline bool s3c24xx_spi_usingfiq(struct s3c24xx_spi *spi)
367 return spi->fiq_inuse;
378 static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t)
380 struct s3c24xx_spi *hw = to_hw(spi);
413 dev_dbg(hw->dev, "spi not ready for tx?\n");
499 /* the spi->mode bits understood by this driver: */
537 hw->clk = devm_clk_get(&pdev->dev, "spi");
567 /* register our spi controller */
632 MODULE_ALIAS("platform:s3c2410-spi");
637 .name = "s3c2410-spi",