Lines Matching refs:spi_xcomm
33 struct spi_xcomm { struct
44 static int spi_xcomm_sync_config(struct spi_xcomm *spi_xcomm, unsigned int len) in spi_xcomm_sync_config() argument
47 uint8_t *buf = spi_xcomm->buf; in spi_xcomm_sync_config()
49 settings = spi_xcomm->settings; in spi_xcomm_sync_config()
54 put_unaligned_be16(spi_xcomm->chipselect, &buf[3]); in spi_xcomm_sync_config()
56 return i2c_master_send(spi_xcomm->i2c, buf, 5); in spi_xcomm_sync_config()
59 static void spi_xcomm_chipselect(struct spi_xcomm *spi_xcomm, in spi_xcomm_chipselect() argument
63 uint16_t chipselect = spi_xcomm->chipselect; in spi_xcomm_chipselect()
70 spi_xcomm->chipselect = chipselect; in spi_xcomm_chipselect()
73 static int spi_xcomm_setup_transfer(struct spi_xcomm *spi_xcomm, in spi_xcomm_setup_transfer() argument
79 if (t->speed_hz != spi_xcomm->current_speed) { in spi_xcomm_setup_transfer()
90 spi_xcomm->current_speed = t->speed_hz; in spi_xcomm_setup_transfer()
111 static int spi_xcomm_txrx_bufs(struct spi_xcomm *spi_xcomm, in spi_xcomm_txrx_bufs() argument
117 spi_xcomm->buf[0] = SPI_XCOMM_CMD_WRITE; in spi_xcomm_txrx_bufs()
118 memcpy(spi_xcomm->buf + 1, t->tx_buf, t->len); in spi_xcomm_txrx_bufs()
120 ret = i2c_master_send(spi_xcomm->i2c, spi_xcomm->buf, t->len + 1); in spi_xcomm_txrx_bufs()
126 ret = i2c_master_recv(spi_xcomm->i2c, t->rx_buf, t->len); in spi_xcomm_txrx_bufs()
139 struct spi_xcomm *spi_xcomm = spi_master_get_devdata(master); in spi_xcomm_transfer_one() local
140 unsigned int settings = spi_xcomm->settings; in spi_xcomm_transfer_one()
148 spi_xcomm_chipselect(spi_xcomm, spi, true); in spi_xcomm_transfer_one()
157 status = spi_xcomm_setup_transfer(spi_xcomm, spi, t, &settings); in spi_xcomm_transfer_one()
170 spi_xcomm->settings = settings; in spi_xcomm_transfer_one()
171 status = spi_xcomm_sync_config(spi_xcomm, t->len); in spi_xcomm_transfer_one()
174 } else if (settings != spi_xcomm->settings || is_first) { in spi_xcomm_transfer_one()
175 spi_xcomm->settings = settings; in spi_xcomm_transfer_one()
176 status = spi_xcomm_sync_config(spi_xcomm, 0); in spi_xcomm_transfer_one()
182 status = spi_xcomm_txrx_bufs(spi_xcomm, spi, t); in spi_xcomm_transfer_one()
199 spi_xcomm_chipselect(spi_xcomm, spi, false); in spi_xcomm_transfer_one()
210 struct spi_xcomm *spi_xcomm; in spi_xcomm_probe() local
214 master = spi_alloc_master(&i2c->dev, sizeof(*spi_xcomm)); in spi_xcomm_probe()
218 spi_xcomm = spi_master_get_devdata(master); in spi_xcomm_probe()
219 spi_xcomm->i2c = i2c; in spi_xcomm_probe()