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 u16 bcm_spi_readw(struct bcm63xx_spi *bs, in bcm_spi_readw() argument
164 return ioread16be(bs->regs + bs->reg_offsets[offset]); in bcm_spi_readw()
166 return readw(bs->regs + bs->reg_offsets[offset]); in bcm_spi_readw()
170 static inline void bcm_spi_writeb(struct bcm63xx_spi *bs, in bcm_spi_writeb() argument
173 writeb(value, bs->regs + bs->reg_offsets[offset]); in bcm_spi_writeb()
176 static inline void bcm_spi_writew(struct bcm63xx_spi *bs, in bcm_spi_writew() argument
180 iowrite16be(value, bs->regs + bs->reg_offsets[offset]); in bcm_spi_writew()
182 writew(value, bs->regs + bs->reg_offsets[offset]); in bcm_spi_writew()
199 struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); in bcm63xx_spi_setup_transfer() local
215 reg = bcm_spi_readb(bs, SPI_CLK_CFG); in bcm63xx_spi_setup_transfer()
219 bcm_spi_writeb(bs, reg, SPI_CLK_CFG); in bcm63xx_spi_setup_transfer()
230 struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); in bcm63xx_txrx_bufs() local
239 bcm_spi_writeb(bs, 0, SPI_INT_MASK); in bcm63xx_txrx_bufs()
251 memcpy_toio(bs->tx_io + len, t->tx_buf, t->len); in bcm63xx_txrx_bufs()
271 reinit_completion(&bs->done); in bcm63xx_txrx_bufs()
277 msg_ctl |= (SPI_FD_RW << bs->msg_type_shift); in bcm63xx_txrx_bufs()
279 msg_ctl |= (SPI_HD_R << bs->msg_type_shift); in bcm63xx_txrx_bufs()
281 msg_ctl |= (SPI_HD_W << bs->msg_type_shift); in bcm63xx_txrx_bufs()
283 switch (bs->msg_ctl_width) { in bcm63xx_txrx_bufs()
285 bcm_spi_writeb(bs, msg_ctl, SPI_MSG_CTL); in bcm63xx_txrx_bufs()
288 bcm_spi_writew(bs, msg_ctl, SPI_MSG_CTL); in bcm63xx_txrx_bufs()
296 bcm_spi_writew(bs, cmd, SPI_CMD); in bcm63xx_txrx_bufs()
299 bcm_spi_writeb(bs, SPI_INTR_CMD_DONE, SPI_INT_MASK); in bcm63xx_txrx_bufs()
301 timeout = wait_for_completion_timeout(&bs->done, HZ); in bcm63xx_txrx_bufs()
313 memcpy_fromio(t->rx_buf, bs->rx_io + len, t->len); in bcm63xx_txrx_bufs()
328 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_transfer_one() local
356 total_len > (bs->fifo_size + BCM63XX_SPI_MAX_PREPEND)) || in bcm63xx_spi_transfer_one()
357 (!can_use_prepend && total_len > bs->fifo_size)) { in bcm63xx_spi_transfer_one()
359 total_len, bs->fifo_size); in bcm63xx_spi_transfer_one()
409 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_interrupt() local
413 intr = bcm_spi_readb(bs, SPI_INT_STATUS); in bcm63xx_spi_interrupt()
414 bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS); in bcm63xx_spi_interrupt()
415 bcm_spi_writeb(bs, 0, SPI_INT_MASK); in bcm63xx_spi_interrupt()
419 complete(&bs->done); in bcm63xx_spi_interrupt()
426 struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); in bcm63xx_spi_max_length() local
428 return bs->fifo_size; in bcm63xx_spi_max_length()
494 struct bcm63xx_spi *bs; in bcm63xx_spi_probe() local
538 master = spi_alloc_master(dev, sizeof(*bs)); in bcm63xx_spi_probe()
544 bs = spi_master_get_devdata(master); in bcm63xx_spi_probe()
545 init_completion(&bs->done); in bcm63xx_spi_probe()
548 bs->pdev = pdev; in bcm63xx_spi_probe()
551 bs->regs = devm_ioremap_resource(&pdev->dev, r); in bcm63xx_spi_probe()
552 if (IS_ERR(bs->regs)) { in bcm63xx_spi_probe()
553 ret = PTR_ERR(bs->regs); in bcm63xx_spi_probe()
557 bs->irq = irq; in bcm63xx_spi_probe()
558 bs->clk = clk; in bcm63xx_spi_probe()
559 bs->reg_offsets = bcm63xx_spireg; in bcm63xx_spi_probe()
560 bs->fifo_size = bs->reg_offsets[SPI_MSG_DATA_SIZE]; in bcm63xx_spi_probe()
578 bs->msg_type_shift = bs->reg_offsets[SPI_MSG_TYPE_SHIFT]; in bcm63xx_spi_probe()
579 bs->msg_ctl_width = bs->reg_offsets[SPI_MSG_CTL_WIDTH]; in bcm63xx_spi_probe()
580 bs->tx_io = (u8 *)(bs->regs + bs->reg_offsets[SPI_MSG_DATA]); in bcm63xx_spi_probe()
581 bs->rx_io = (const u8 *)(bs->regs + bs->reg_offsets[SPI_RX_DATA]); in bcm63xx_spi_probe()
584 ret = clk_prepare_enable(bs->clk); in bcm63xx_spi_probe()
594 bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS); in bcm63xx_spi_probe()
606 r, irq, bs->fifo_size); in bcm63xx_spi_probe()
622 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_remove() local
625 bcm_spi_writeb(bs, 0, SPI_INT_MASK); in bcm63xx_spi_remove()
628 clk_disable_unprepare(bs->clk); in bcm63xx_spi_remove()
637 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_suspend() local
641 clk_disable_unprepare(bs->clk); in bcm63xx_spi_suspend()
649 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_resume() local
652 ret = clk_prepare_enable(bs->clk); in bcm63xx_spi_resume()