Lines Matching refs:spi
148 struct spi_device *spi, struct spi_transfer *t) in spi_st_transfer_one() argument
157 if (spi->bits_per_word > 8) { in spi_st_transfer_one()
165 } else if (spi->bits_per_word == 8 && !(t->len & 0x1)) { in spi_st_transfer_one()
197 spi_finalize_current_transfer(spi->master); in spi_st_transfer_one()
202 static void spi_st_cleanup(struct spi_device *spi) in spi_st_cleanup() argument
204 int cs = spi->cs_gpio; in spi_st_cleanup()
207 devm_gpio_free(&spi->dev, cs); in spi_st_cleanup()
212 static int spi_st_setup(struct spi_device *spi) in spi_st_setup() argument
214 struct spi_st *spi_st = spi_master_get_devdata(spi->master); in spi_st_setup()
216 u32 hz = spi->max_speed_hz; in spi_st_setup()
217 int cs = spi->cs_gpio; in spi_st_setup()
221 dev_err(&spi->dev, "max_speed_hz unspecified\n"); in spi_st_setup()
226 dev_err(&spi->dev, "%d is not a valid gpio\n", cs); in spi_st_setup()
230 if (devm_gpio_request(&spi->dev, cs, dev_name(&spi->dev))) { in spi_st_setup()
231 dev_err(&spi->dev, "could not request gpio:%d\n", cs); in spi_st_setup()
235 ret = gpio_direction_output(cs, spi->mode & SPI_CS_HIGH); in spi_st_setup()
244 dev_err(&spi->dev, in spi_st_setup()
255 dev_dbg(&spi->dev, in spi_st_setup()
263 if (spi->mode & SPI_CPOL) in spi_st_setup()
268 if (spi->mode & SPI_CPHA) in spi_st_setup()
273 if ((spi->mode & SPI_LSB_FIRST) == 0) in spi_st_setup()
278 if (spi->mode & SPI_LOOP) in spi_st_setup()
284 var |= (spi->bits_per_word - 1); in spi_st_setup()