Lines Matching refs:bs

161 static inline u8 bcm_spi_readb(struct bcm63xx_spi *bs,  in bcm_spi_readb()  argument
164 return readb(bs->regs + bs->reg_offsets[offset]); in bcm_spi_readb()
167 static inline u16 bcm_spi_readw(struct bcm63xx_spi *bs, in bcm_spi_readw() argument
171 return ioread16be(bs->regs + bs->reg_offsets[offset]); in bcm_spi_readw()
173 return readw(bs->regs + bs->reg_offsets[offset]); in bcm_spi_readw()
177 static inline void bcm_spi_writeb(struct bcm63xx_spi *bs, in bcm_spi_writeb() argument
180 writeb(value, bs->regs + bs->reg_offsets[offset]); in bcm_spi_writeb()
183 static inline void bcm_spi_writew(struct bcm63xx_spi *bs, in bcm_spi_writew() argument
187 iowrite16be(value, bs->regs + bs->reg_offsets[offset]); in bcm_spi_writew()
189 writew(value, bs->regs + bs->reg_offsets[offset]); in bcm_spi_writew()
206 struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); in bcm63xx_spi_setup_transfer() local
223 reg = bcm_spi_readb(bs, SPI_CLK_CFG); in bcm63xx_spi_setup_transfer()
227 bcm_spi_writeb(bs, reg, SPI_CLK_CFG); in bcm63xx_spi_setup_transfer()
238 struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); in bcm63xx_txrx_bufs() local
247 bcm_spi_writeb(bs, 0, SPI_INT_MASK); in bcm63xx_txrx_bufs()
259 memcpy_toio(bs->tx_io + len, t->tx_buf, t->len); in bcm63xx_txrx_bufs()
279 reinit_completion(&bs->done); in bcm63xx_txrx_bufs()
285 msg_ctl |= (SPI_FD_RW << bs->msg_type_shift); in bcm63xx_txrx_bufs()
287 msg_ctl |= (SPI_HD_R << bs->msg_type_shift); in bcm63xx_txrx_bufs()
289 msg_ctl |= (SPI_HD_W << bs->msg_type_shift); in bcm63xx_txrx_bufs()
291 switch (bs->msg_ctl_width) { in bcm63xx_txrx_bufs()
293 bcm_spi_writeb(bs, msg_ctl, SPI_MSG_CTL); in bcm63xx_txrx_bufs()
296 bcm_spi_writew(bs, msg_ctl, SPI_MSG_CTL); in bcm63xx_txrx_bufs()
304 bcm_spi_writew(bs, cmd, SPI_CMD); in bcm63xx_txrx_bufs()
307 bcm_spi_writeb(bs, SPI_INTR_CMD_DONE, SPI_INT_MASK); in bcm63xx_txrx_bufs()
309 timeout = wait_for_completion_timeout(&bs->done, HZ); in bcm63xx_txrx_bufs()
321 memcpy_fromio(t->rx_buf, bs->rx_io + len, t->len); in bcm63xx_txrx_bufs()
336 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_transfer_one() local
364 total_len > (bs->fifo_size + BCM63XX_SPI_MAX_PREPEND)) || in bcm63xx_spi_transfer_one()
365 (!can_use_prepend && total_len > bs->fifo_size)) { in bcm63xx_spi_transfer_one()
367 total_len, bs->fifo_size); in bcm63xx_spi_transfer_one()
417 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_interrupt() local
421 intr = bcm_spi_readb(bs, SPI_INT_STATUS); in bcm63xx_spi_interrupt()
422 bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS); in bcm63xx_spi_interrupt()
423 bcm_spi_writeb(bs, 0, SPI_INT_MASK); in bcm63xx_spi_interrupt()
427 complete(&bs->done); in bcm63xx_spi_interrupt()
489 struct bcm63xx_spi *bs; in bcm63xx_spi_probe() local
509 master = spi_alloc_master(dev, sizeof(*bs)); in bcm63xx_spi_probe()
515 bs = spi_master_get_devdata(master); in bcm63xx_spi_probe()
516 init_completion(&bs->done); in bcm63xx_spi_probe()
519 bs->pdev = pdev; in bcm63xx_spi_probe()
522 bs->regs = devm_ioremap_resource(&pdev->dev, r); in bcm63xx_spi_probe()
523 if (IS_ERR(bs->regs)) { in bcm63xx_spi_probe()
524 ret = PTR_ERR(bs->regs); in bcm63xx_spi_probe()
528 bs->irq = irq; in bcm63xx_spi_probe()
529 bs->clk = clk; in bcm63xx_spi_probe()
530 bs->reg_offsets = bcm63xx_spireg; in bcm63xx_spi_probe()
531 bs->fifo_size = bs->reg_offsets[SPI_MSG_DATA_SIZE]; in bcm63xx_spi_probe()
546 bs->msg_type_shift = bs->reg_offsets[SPI_MSG_TYPE_SHIFT]; in bcm63xx_spi_probe()
547 bs->msg_ctl_width = bs->reg_offsets[SPI_MSG_CTL_WIDTH]; in bcm63xx_spi_probe()
548 bs->tx_io = (u8 *)(bs->regs + bs->reg_offsets[SPI_MSG_DATA]); in bcm63xx_spi_probe()
549 bs->rx_io = (const u8 *)(bs->regs + bs->reg_offsets[SPI_RX_DATA]); in bcm63xx_spi_probe()
552 ret = clk_prepare_enable(bs->clk); in bcm63xx_spi_probe()
556 bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS); in bcm63xx_spi_probe()
566 r, irq, bs->fifo_size); in bcm63xx_spi_probe()
580 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_remove() local
583 bcm_spi_writeb(bs, 0, SPI_INT_MASK); in bcm63xx_spi_remove()
586 clk_disable_unprepare(bs->clk); in bcm63xx_spi_remove()
595 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_suspend() local
599 clk_disable_unprepare(bs->clk); in bcm63xx_spi_suspend()
607 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_resume() local
610 ret = clk_prepare_enable(bs->clk); in bcm63xx_spi_resume()