Lines Matching refs:bs

162 static inline u8 bcm_spi_readb(struct bcm63xx_spi *bs,  in bcm_spi_readb()  argument
165 return readb(bs->regs + bs->reg_offsets[offset]); in bcm_spi_readb()
168 static inline u16 bcm_spi_readw(struct bcm63xx_spi *bs, in bcm_spi_readw() argument
172 return ioread16be(bs->regs + bs->reg_offsets[offset]); in bcm_spi_readw()
174 return readw(bs->regs + bs->reg_offsets[offset]); in bcm_spi_readw()
178 static inline void bcm_spi_writeb(struct bcm63xx_spi *bs, in bcm_spi_writeb() argument
181 writeb(value, bs->regs + bs->reg_offsets[offset]); in bcm_spi_writeb()
184 static inline void bcm_spi_writew(struct bcm63xx_spi *bs, in bcm_spi_writew() argument
188 iowrite16be(value, bs->regs + bs->reg_offsets[offset]); in bcm_spi_writew()
190 writew(value, bs->regs + bs->reg_offsets[offset]); in bcm_spi_writew()
207 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()
434 struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); in bcm63xx_spi_max_length() local
436 return bs->fifo_size; in bcm63xx_spi_max_length()
502 struct bcm63xx_spi *bs; in bcm63xx_spi_probe() local
543 master = spi_alloc_master(dev, sizeof(*bs)); in bcm63xx_spi_probe()
549 bs = spi_master_get_devdata(master); in bcm63xx_spi_probe()
550 init_completion(&bs->done); in bcm63xx_spi_probe()
553 bs->pdev = pdev; in bcm63xx_spi_probe()
556 bs->regs = devm_ioremap_resource(&pdev->dev, r); in bcm63xx_spi_probe()
557 if (IS_ERR(bs->regs)) { in bcm63xx_spi_probe()
558 ret = PTR_ERR(bs->regs); in bcm63xx_spi_probe()
562 bs->irq = irq; in bcm63xx_spi_probe()
563 bs->clk = clk; in bcm63xx_spi_probe()
564 bs->reg_offsets = bcm63xx_spireg; in bcm63xx_spi_probe()
565 bs->fifo_size = bs->reg_offsets[SPI_MSG_DATA_SIZE]; in bcm63xx_spi_probe()
583 bs->msg_type_shift = bs->reg_offsets[SPI_MSG_TYPE_SHIFT]; in bcm63xx_spi_probe()
584 bs->msg_ctl_width = bs->reg_offsets[SPI_MSG_CTL_WIDTH]; in bcm63xx_spi_probe()
585 bs->tx_io = (u8 *)(bs->regs + bs->reg_offsets[SPI_MSG_DATA]); in bcm63xx_spi_probe()
586 bs->rx_io = (const u8 *)(bs->regs + bs->reg_offsets[SPI_RX_DATA]); in bcm63xx_spi_probe()
589 ret = clk_prepare_enable(bs->clk); in bcm63xx_spi_probe()
593 bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS); in bcm63xx_spi_probe()
603 r, irq, bs->fifo_size); in bcm63xx_spi_probe()
617 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_remove() local
620 bcm_spi_writeb(bs, 0, SPI_INT_MASK); in bcm63xx_spi_remove()
623 clk_disable_unprepare(bs->clk); in bcm63xx_spi_remove()
632 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_suspend() local
636 clk_disable_unprepare(bs->clk); in bcm63xx_spi_suspend()
644 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_resume() local
647 ret = clk_prepare_enable(bs->clk); in bcm63xx_spi_resume()