Lines Matching refs:bs

53 static inline u8 bcm_spi_readb(struct bcm63xx_spi *bs,  in bcm_spi_readb()  argument
56 return bcm_readb(bs->regs + bcm63xx_spireg(offset)); in bcm_spi_readb()
59 static inline u16 bcm_spi_readw(struct bcm63xx_spi *bs, in bcm_spi_readw() argument
62 return bcm_readw(bs->regs + bcm63xx_spireg(offset)); in bcm_spi_readw()
65 static inline void bcm_spi_writeb(struct bcm63xx_spi *bs, in bcm_spi_writeb() argument
68 bcm_writeb(value, bs->regs + bcm63xx_spireg(offset)); in bcm_spi_writeb()
71 static inline void bcm_spi_writew(struct bcm63xx_spi *bs, in bcm_spi_writew() argument
74 bcm_writew(value, bs->regs + bcm63xx_spireg(offset)); in bcm_spi_writew()
90 struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); in bcm63xx_spi_setup_transfer() local
107 reg = bcm_spi_readb(bs, SPI_CLK_CFG); in bcm63xx_spi_setup_transfer()
111 bcm_spi_writeb(bs, reg, SPI_CLK_CFG); in bcm63xx_spi_setup_transfer()
122 struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); in bcm63xx_txrx_bufs() local
132 bcm_spi_writeb(bs, 0, SPI_INT_MASK); in bcm63xx_txrx_bufs()
144 memcpy_toio(bs->tx_io + len, t->tx_buf, t->len); in bcm63xx_txrx_bufs()
164 reinit_completion(&bs->done); in bcm63xx_txrx_bufs()
170 msg_ctl |= (SPI_FD_RW << bs->msg_type_shift); in bcm63xx_txrx_bufs()
172 msg_ctl |= (SPI_HD_R << bs->msg_type_shift); in bcm63xx_txrx_bufs()
174 msg_ctl |= (SPI_HD_W << bs->msg_type_shift); in bcm63xx_txrx_bufs()
176 switch (bs->msg_ctl_width) { in bcm63xx_txrx_bufs()
178 bcm_spi_writeb(bs, msg_ctl, SPI_MSG_CTL); in bcm63xx_txrx_bufs()
181 bcm_spi_writew(bs, msg_ctl, SPI_MSG_CTL); in bcm63xx_txrx_bufs()
189 bcm_spi_writew(bs, cmd, SPI_CMD); in bcm63xx_txrx_bufs()
192 bcm_spi_writeb(bs, SPI_INTR_CMD_DONE, SPI_INT_MASK); in bcm63xx_txrx_bufs()
194 timeout = wait_for_completion_timeout(&bs->done, HZ); in bcm63xx_txrx_bufs()
206 memcpy_fromio(t->rx_buf, bs->rx_io + len, t->len); in bcm63xx_txrx_bufs()
221 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_transfer_one() local
249 total_len > (bs->fifo_size + BCM63XX_SPI_MAX_PREPEND)) || in bcm63xx_spi_transfer_one()
250 (!can_use_prepend && total_len > bs->fifo_size)) { in bcm63xx_spi_transfer_one()
252 total_len, bs->fifo_size); in bcm63xx_spi_transfer_one()
302 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_interrupt() local
306 intr = bcm_spi_readb(bs, SPI_INT_STATUS); in bcm63xx_spi_interrupt()
307 bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS); in bcm63xx_spi_interrupt()
308 bcm_spi_writeb(bs, 0, SPI_INT_MASK); in bcm63xx_spi_interrupt()
312 complete(&bs->done); in bcm63xx_spi_interrupt()
326 struct bcm63xx_spi *bs; in bcm63xx_spi_probe() local
341 master = spi_alloc_master(dev, sizeof(*bs)); in bcm63xx_spi_probe()
347 bs = spi_master_get_devdata(master); in bcm63xx_spi_probe()
348 init_completion(&bs->done); in bcm63xx_spi_probe()
351 bs->pdev = pdev; in bcm63xx_spi_probe()
354 bs->regs = devm_ioremap_resource(&pdev->dev, r); in bcm63xx_spi_probe()
355 if (IS_ERR(bs->regs)) { in bcm63xx_spi_probe()
356 ret = PTR_ERR(bs->regs); in bcm63xx_spi_probe()
360 bs->irq = irq; in bcm63xx_spi_probe()
361 bs->clk = clk; in bcm63xx_spi_probe()
362 bs->fifo_size = pdata->fifo_size; in bcm63xx_spi_probe()
377 bs->msg_type_shift = pdata->msg_type_shift; in bcm63xx_spi_probe()
378 bs->msg_ctl_width = pdata->msg_ctl_width; in bcm63xx_spi_probe()
379 bs->tx_io = (u8 *)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA)); in bcm63xx_spi_probe()
380 bs->rx_io = (const u8 *)(bs->regs + bcm63xx_spireg(SPI_RX_DATA)); in bcm63xx_spi_probe()
382 switch (bs->msg_ctl_width) { in bcm63xx_spi_probe()
388 bs->msg_ctl_width); in bcm63xx_spi_probe()
393 ret = clk_prepare_enable(bs->clk); in bcm63xx_spi_probe()
397 bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS); in bcm63xx_spi_probe()
407 r->start, irq, bs->fifo_size); in bcm63xx_spi_probe()
421 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_remove() local
424 bcm_spi_writeb(bs, 0, SPI_INT_MASK); in bcm63xx_spi_remove()
427 clk_disable_unprepare(bs->clk); in bcm63xx_spi_remove()
436 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_suspend() local
440 clk_disable_unprepare(bs->clk); in bcm63xx_spi_suspend()
448 struct bcm63xx_spi *bs = spi_master_get_devdata(master); in bcm63xx_spi_resume() local
451 ret = clk_prepare_enable(bs->clk); in bcm63xx_spi_resume()