Lines Matching refs:bs

154 static inline u8 bcm_spi_readb(struct bcm63xx_spi *bs,  in bcm_spi_readb()  argument
157 return readb(bs->regs + bs->reg_offsets[offset]); in bcm_spi_readb()
160 static inline void bcm_spi_writeb(struct bcm63xx_spi *bs, in bcm_spi_writeb() argument
163 writeb(value, bs->regs + bs->reg_offsets[offset]); in bcm_spi_writeb()
166 static inline void bcm_spi_writew(struct bcm63xx_spi *bs, in bcm_spi_writew() argument
170 iowrite16be(value, bs->regs + bs->reg_offsets[offset]); in bcm_spi_writew()
172 writew(value, bs->regs + bs->reg_offsets[offset]); in bcm_spi_writew()
189 struct bcm63xx_spi *bs = spi_controller_get_devdata(spi->controller); in bcm63xx_spi_setup_transfer() local
205 reg = bcm_spi_readb(bs, SPI_CLK_CFG); in bcm63xx_spi_setup_transfer()
209 bcm_spi_writeb(bs, reg, SPI_CLK_CFG); in bcm63xx_spi_setup_transfer()
220 struct bcm63xx_spi *bs = spi_controller_get_devdata(spi->controller); in bcm63xx_txrx_bufs() local
229 bcm_spi_writeb(bs, 0, SPI_INT_MASK); in bcm63xx_txrx_bufs()
241 memcpy_toio(bs->tx_io + len, t->tx_buf, t->len); in bcm63xx_txrx_bufs()
261 reinit_completion(&bs->done); in bcm63xx_txrx_bufs()
267 msg_ctl |= (SPI_FD_RW << bs->msg_type_shift); in bcm63xx_txrx_bufs()
269 msg_ctl |= (SPI_HD_R << bs->msg_type_shift); in bcm63xx_txrx_bufs()
271 msg_ctl |= (SPI_HD_W << bs->msg_type_shift); in bcm63xx_txrx_bufs()
273 switch (bs->msg_ctl_width) { in bcm63xx_txrx_bufs()
275 bcm_spi_writeb(bs, msg_ctl, SPI_MSG_CTL); in bcm63xx_txrx_bufs()
278 bcm_spi_writew(bs, msg_ctl, SPI_MSG_CTL); in bcm63xx_txrx_bufs()
286 bcm_spi_writew(bs, cmd, SPI_CMD); in bcm63xx_txrx_bufs()
289 bcm_spi_writeb(bs, SPI_INTR_CMD_DONE, SPI_INT_MASK); in bcm63xx_txrx_bufs()
291 timeout = wait_for_completion_timeout(&bs->done, HZ); in bcm63xx_txrx_bufs()
303 memcpy_fromio(t->rx_buf, bs->rx_io + len, t->len); in bcm63xx_txrx_bufs()
318 struct bcm63xx_spi *bs = spi_controller_get_devdata(host); in bcm63xx_spi_transfer_one() local
346 total_len > (bs->fifo_size + BCM63XX_SPI_MAX_PREPEND)) || in bcm63xx_spi_transfer_one()
347 (!can_use_prepend && total_len > bs->fifo_size)) { in bcm63xx_spi_transfer_one()
349 total_len, bs->fifo_size); in bcm63xx_spi_transfer_one()
399 struct bcm63xx_spi *bs = spi_controller_get_devdata(host); in bcm63xx_spi_interrupt() local
403 intr = bcm_spi_readb(bs, SPI_INT_STATUS); in bcm63xx_spi_interrupt()
404 bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS); in bcm63xx_spi_interrupt()
405 bcm_spi_writeb(bs, 0, SPI_INT_MASK); in bcm63xx_spi_interrupt()
409 complete(&bs->done); in bcm63xx_spi_interrupt()
416 struct bcm63xx_spi *bs = spi_controller_get_devdata(spi->controller); in bcm63xx_spi_max_length() local
418 return bs->fifo_size; in bcm63xx_spi_max_length()
484 struct bcm63xx_spi *bs; in bcm63xx_spi_probe() local
528 host = spi_alloc_host(dev, sizeof(*bs)); in bcm63xx_spi_probe()
534 bs = spi_controller_get_devdata(host); in bcm63xx_spi_probe()
535 init_completion(&bs->done); in bcm63xx_spi_probe()
538 bs->pdev = pdev; in bcm63xx_spi_probe()
540 bs->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &r); in bcm63xx_spi_probe()
541 if (IS_ERR(bs->regs)) { in bcm63xx_spi_probe()
542 ret = PTR_ERR(bs->regs); in bcm63xx_spi_probe()
546 bs->irq = irq; in bcm63xx_spi_probe()
547 bs->clk = clk; in bcm63xx_spi_probe()
548 bs->reg_offsets = bcm63xx_spireg; in bcm63xx_spi_probe()
549 bs->fifo_size = bs->reg_offsets[SPI_MSG_DATA_SIZE]; in bcm63xx_spi_probe()
567 bs->msg_type_shift = bs->reg_offsets[SPI_MSG_TYPE_SHIFT]; in bcm63xx_spi_probe()
568 bs->msg_ctl_width = bs->reg_offsets[SPI_MSG_CTL_WIDTH]; in bcm63xx_spi_probe()
569 bs->tx_io = (u8 *)(bs->regs + bs->reg_offsets[SPI_MSG_DATA]); in bcm63xx_spi_probe()
570 bs->rx_io = (const u8 *)(bs->regs + bs->reg_offsets[SPI_RX_DATA]); in bcm63xx_spi_probe()
573 ret = clk_prepare_enable(bs->clk); in bcm63xx_spi_probe()
583 bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS); in bcm63xx_spi_probe()
595 r, irq, bs->fifo_size); in bcm63xx_spi_probe()
611 struct bcm63xx_spi *bs = spi_controller_get_devdata(host); in bcm63xx_spi_remove() local
614 bcm_spi_writeb(bs, 0, SPI_INT_MASK); in bcm63xx_spi_remove()
617 clk_disable_unprepare(bs->clk); in bcm63xx_spi_remove()
623 struct bcm63xx_spi *bs = spi_controller_get_devdata(host); in bcm63xx_spi_suspend() local
627 clk_disable_unprepare(bs->clk); in bcm63xx_spi_suspend()
635 struct bcm63xx_spi *bs = spi_controller_get_devdata(host); in bcm63xx_spi_resume() local
638 ret = clk_prepare_enable(bs->clk); in bcm63xx_spi_resume()