xspi 128 drivers/spi/spi-cadence.c static inline u32 cdns_spi_read(struct cdns_spi *xspi, u32 offset) xspi 130 drivers/spi/spi-cadence.c return readl_relaxed(xspi->regs + offset); xspi 133 drivers/spi/spi-cadence.c static inline void cdns_spi_write(struct cdns_spi *xspi, u32 offset, u32 val) xspi 135 drivers/spi/spi-cadence.c writel_relaxed(val, xspi->regs + offset); xspi 149 drivers/spi/spi-cadence.c static void cdns_spi_init_hw(struct cdns_spi *xspi) xspi 153 drivers/spi/spi-cadence.c if (xspi->is_decoded_cs) xspi 156 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE); xspi 157 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_IDR, CDNS_SPI_IXR_ALL); xspi 160 drivers/spi/spi-cadence.c while (cdns_spi_read(xspi, CDNS_SPI_ISR) & CDNS_SPI_IXR_RXNEMTY) xspi 161 drivers/spi/spi-cadence.c cdns_spi_read(xspi, CDNS_SPI_RXD); xspi 163 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_ISR, CDNS_SPI_IXR_ALL); xspi 164 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_CR, ctrl_reg); xspi 165 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_ENABLE); xspi 175 drivers/spi/spi-cadence.c struct cdns_spi *xspi = spi_master_get_devdata(spi->master); xspi 178 drivers/spi/spi-cadence.c ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR); xspi 186 drivers/spi/spi-cadence.c if (!(xspi->is_decoded_cs)) xspi 195 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_CR, ctrl_reg); xspi 206 drivers/spi/spi-cadence.c struct cdns_spi *xspi = spi_master_get_devdata(spi->master); xspi 209 drivers/spi/spi-cadence.c new_ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR); xspi 226 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE); xspi 227 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_CR, new_ctrl_reg); xspi 228 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_ENABLE); xspi 249 drivers/spi/spi-cadence.c struct cdns_spi *xspi = spi_master_get_devdata(spi->master); xspi 253 drivers/spi/spi-cadence.c frequency = clk_get_rate(xspi->ref_clk); xspi 255 drivers/spi/spi-cadence.c ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR); xspi 258 drivers/spi/spi-cadence.c if (xspi->speed_hz != transfer->speed_hz) { xspi 268 drivers/spi/spi-cadence.c xspi->speed_hz = frequency / (2 << baud_rate_val); xspi 270 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_CR, ctrl_reg); xspi 287 drivers/spi/spi-cadence.c struct cdns_spi *xspi = spi_master_get_devdata(spi->master); xspi 293 drivers/spi/spi-cadence.c xspi->speed_hz); xspi 302 drivers/spi/spi-cadence.c static void cdns_spi_fill_tx_fifo(struct cdns_spi *xspi) xspi 307 drivers/spi/spi-cadence.c (xspi->tx_bytes > 0)) { xspi 312 drivers/spi/spi-cadence.c if (cdns_spi_read(xspi, CDNS_SPI_ISR) & xspi 316 drivers/spi/spi-cadence.c if (xspi->txbuf) xspi 317 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_TXD, *xspi->txbuf++); xspi 319 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_TXD, 0); xspi 321 drivers/spi/spi-cadence.c xspi->tx_bytes--; xspi 343 drivers/spi/spi-cadence.c struct cdns_spi *xspi = spi_master_get_devdata(master); xspi 347 drivers/spi/spi-cadence.c intr_status = cdns_spi_read(xspi, CDNS_SPI_ISR); xspi 348 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_ISR, intr_status); xspi 355 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_IDR, CDNS_SPI_IXR_DEFAULT); xspi 361 drivers/spi/spi-cadence.c trans_cnt = xspi->rx_bytes - xspi->tx_bytes; xspi 367 drivers/spi/spi-cadence.c data = cdns_spi_read(xspi, CDNS_SPI_RXD); xspi 368 drivers/spi/spi-cadence.c if (xspi->rxbuf) xspi 369 drivers/spi/spi-cadence.c *xspi->rxbuf++ = data; xspi 371 drivers/spi/spi-cadence.c xspi->rx_bytes--; xspi 375 drivers/spi/spi-cadence.c if (xspi->tx_bytes) { xspi 377 drivers/spi/spi-cadence.c cdns_spi_fill_tx_fifo(xspi); xspi 380 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_IDR, xspi 413 drivers/spi/spi-cadence.c struct cdns_spi *xspi = spi_master_get_devdata(master); xspi 415 drivers/spi/spi-cadence.c xspi->txbuf = transfer->tx_buf; xspi 416 drivers/spi/spi-cadence.c xspi->rxbuf = transfer->rx_buf; xspi 417 drivers/spi/spi-cadence.c xspi->tx_bytes = transfer->len; xspi 418 drivers/spi/spi-cadence.c xspi->rx_bytes = transfer->len; xspi 422 drivers/spi/spi-cadence.c cdns_spi_fill_tx_fifo(xspi); xspi 424 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_IER, CDNS_SPI_IXR_DEFAULT); xspi 439 drivers/spi/spi-cadence.c struct cdns_spi *xspi = spi_master_get_devdata(master); xspi 441 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_ENABLE); xspi 457 drivers/spi/spi-cadence.c struct cdns_spi *xspi = spi_master_get_devdata(master); xspi 459 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE); xspi 476 drivers/spi/spi-cadence.c struct cdns_spi *xspi; xspi 479 drivers/spi/spi-cadence.c master = spi_alloc_master(&pdev->dev, sizeof(*xspi)); xspi 483 drivers/spi/spi-cadence.c xspi = spi_master_get_devdata(master); xspi 487 drivers/spi/spi-cadence.c xspi->regs = devm_platform_ioremap_resource(pdev, 0); xspi 488 drivers/spi/spi-cadence.c if (IS_ERR(xspi->regs)) { xspi 489 drivers/spi/spi-cadence.c ret = PTR_ERR(xspi->regs); xspi 493 drivers/spi/spi-cadence.c xspi->pclk = devm_clk_get(&pdev->dev, "pclk"); xspi 494 drivers/spi/spi-cadence.c if (IS_ERR(xspi->pclk)) { xspi 496 drivers/spi/spi-cadence.c ret = PTR_ERR(xspi->pclk); xspi 500 drivers/spi/spi-cadence.c xspi->ref_clk = devm_clk_get(&pdev->dev, "ref_clk"); xspi 501 drivers/spi/spi-cadence.c if (IS_ERR(xspi->ref_clk)) { xspi 503 drivers/spi/spi-cadence.c ret = PTR_ERR(xspi->ref_clk); xspi 507 drivers/spi/spi-cadence.c ret = clk_prepare_enable(xspi->pclk); xspi 513 drivers/spi/spi-cadence.c ret = clk_prepare_enable(xspi->ref_clk); xspi 526 drivers/spi/spi-cadence.c &xspi->is_decoded_cs); xspi 528 drivers/spi/spi-cadence.c xspi->is_decoded_cs = 0; xspi 531 drivers/spi/spi-cadence.c cdns_spi_init_hw(xspi); xspi 562 drivers/spi/spi-cadence.c master->max_speed_hz = clk_get_rate(xspi->ref_clk) / 4; xspi 563 drivers/spi/spi-cadence.c xspi->speed_hz = master->max_speed_hz; xspi 578 drivers/spi/spi-cadence.c clk_disable_unprepare(xspi->ref_clk); xspi 580 drivers/spi/spi-cadence.c clk_disable_unprepare(xspi->pclk); xspi 599 drivers/spi/spi-cadence.c struct cdns_spi *xspi = spi_master_get_devdata(master); xspi 601 drivers/spi/spi-cadence.c cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE); xspi 603 drivers/spi/spi-cadence.c clk_disable_unprepare(xspi->ref_clk); xspi 604 drivers/spi/spi-cadence.c clk_disable_unprepare(xspi->pclk); xspi 640 drivers/spi/spi-cadence.c struct cdns_spi *xspi = spi_master_get_devdata(master); xspi 642 drivers/spi/spi-cadence.c cdns_spi_init_hw(xspi); xspi 657 drivers/spi/spi-cadence.c struct cdns_spi *xspi = spi_master_get_devdata(master); xspi 660 drivers/spi/spi-cadence.c ret = clk_prepare_enable(xspi->pclk); xspi 666 drivers/spi/spi-cadence.c ret = clk_prepare_enable(xspi->ref_clk); xspi 669 drivers/spi/spi-cadence.c clk_disable_unprepare(xspi->pclk); xspi 686 drivers/spi/spi-cadence.c struct cdns_spi *xspi = spi_master_get_devdata(master); xspi 688 drivers/spi/spi-cadence.c clk_disable_unprepare(xspi->ref_clk); xspi 689 drivers/spi/spi-cadence.c clk_disable_unprepare(xspi->pclk); xspi 116 drivers/spi/spi-xilinx.c static void xilinx_spi_tx(struct xilinx_spi *xspi) xspi 120 drivers/spi/spi-xilinx.c if (!xspi->tx_ptr) { xspi 121 drivers/spi/spi-xilinx.c xspi->write_fn(0, xspi->regs + XSPI_TXD_OFFSET); xspi 125 drivers/spi/spi-xilinx.c switch (xspi->bytes_per_word) { xspi 127 drivers/spi/spi-xilinx.c data = *(u8 *)(xspi->tx_ptr); xspi 130 drivers/spi/spi-xilinx.c data = *(u16 *)(xspi->tx_ptr); xspi 133 drivers/spi/spi-xilinx.c data = *(u32 *)(xspi->tx_ptr); xspi 137 drivers/spi/spi-xilinx.c xspi->write_fn(data, xspi->regs + XSPI_TXD_OFFSET); xspi 138 drivers/spi/spi-xilinx.c xspi->tx_ptr += xspi->bytes_per_word; xspi 141 drivers/spi/spi-xilinx.c static void xilinx_spi_rx(struct xilinx_spi *xspi) xspi 143 drivers/spi/spi-xilinx.c u32 data = xspi->read_fn(xspi->regs + XSPI_RXD_OFFSET); xspi 145 drivers/spi/spi-xilinx.c if (!xspi->rx_ptr) xspi 148 drivers/spi/spi-xilinx.c switch (xspi->bytes_per_word) { xspi 150 drivers/spi/spi-xilinx.c *(u8 *)(xspi->rx_ptr) = data; xspi 153 drivers/spi/spi-xilinx.c *(u16 *)(xspi->rx_ptr) = data; xspi 156 drivers/spi/spi-xilinx.c *(u32 *)(xspi->rx_ptr) = data; xspi 160 drivers/spi/spi-xilinx.c xspi->rx_ptr += xspi->bytes_per_word; xspi 163 drivers/spi/spi-xilinx.c static void xspi_init_hw(struct xilinx_spi *xspi) xspi 165 drivers/spi/spi-xilinx.c void __iomem *regs_base = xspi->regs; xspi 168 drivers/spi/spi-xilinx.c xspi->write_fn(XIPIF_V123B_RESET_MASK, xspi 173 drivers/spi/spi-xilinx.c xspi->write_fn(XSPI_INTR_TX_EMPTY, xspi 176 drivers/spi/spi-xilinx.c xspi->write_fn(0, regs_base + XIPIF_V123B_DGIER_OFFSET); xspi 178 drivers/spi/spi-xilinx.c xspi->write_fn(0xffff, regs_base + XSPI_SSR_OFFSET); xspi 181 drivers/spi/spi-xilinx.c xspi->write_fn(XSPI_CR_MANUAL_SSELECT | XSPI_CR_MASTER_MODE | xspi 188 drivers/spi/spi-xilinx.c struct xilinx_spi *xspi = spi_master_get_devdata(spi->master); xspi 194 drivers/spi/spi-xilinx.c xspi->write_fn(xspi->cs_inactive, xspi->regs + XSPI_SSR_OFFSET); xspi 199 drivers/spi/spi-xilinx.c cr = xspi->read_fn(xspi->regs + XSPI_CR_OFFSET) & ~XSPI_CR_MODE_MASK; xspi 208 drivers/spi/spi-xilinx.c xspi->write_fn(cr, xspi->regs + XSPI_CR_OFFSET); xspi 215 drivers/spi/spi-xilinx.c cs = xspi->cs_inactive; xspi 219 drivers/spi/spi-xilinx.c xspi->write_fn(cs, xspi->regs + XSPI_SSR_OFFSET); xspi 228 drivers/spi/spi-xilinx.c struct xilinx_spi *xspi = spi_master_get_devdata(spi->master); xspi 231 drivers/spi/spi-xilinx.c xspi->cs_inactive &= ~BIT(spi->chip_select); xspi 233 drivers/spi/spi-xilinx.c xspi->cs_inactive |= BIT(spi->chip_select); xspi 240 drivers/spi/spi-xilinx.c struct xilinx_spi *xspi = spi_master_get_devdata(spi->master); xspi 247 drivers/spi/spi-xilinx.c xspi->tx_ptr = t->tx_buf; xspi 248 drivers/spi/spi-xilinx.c xspi->rx_ptr = t->rx_buf; xspi 249 drivers/spi/spi-xilinx.c remaining_words = t->len / xspi->bytes_per_word; xspi 251 drivers/spi/spi-xilinx.c if (xspi->irq >= 0 && remaining_words > xspi->buffer_size) { xspi 255 drivers/spi/spi-xilinx.c cr = xspi->read_fn(xspi->regs + XSPI_CR_OFFSET); xspi 256 drivers/spi/spi-xilinx.c xspi->write_fn(cr | XSPI_CR_TRANS_INHIBIT, xspi 257 drivers/spi/spi-xilinx.c xspi->regs + XSPI_CR_OFFSET); xspi 259 drivers/spi/spi-xilinx.c isr = xspi->read_fn(xspi->regs + XIPIF_V123B_IISR_OFFSET); xspi 261 drivers/spi/spi-xilinx.c xspi->write_fn(isr, xspi 262 drivers/spi/spi-xilinx.c xspi->regs + XIPIF_V123B_IISR_OFFSET); xspi 264 drivers/spi/spi-xilinx.c xspi->write_fn(XIPIF_V123B_GINTR_ENABLE, xspi 265 drivers/spi/spi-xilinx.c xspi->regs + XIPIF_V123B_DGIER_OFFSET); xspi 266 drivers/spi/spi-xilinx.c reinit_completion(&xspi->done); xspi 274 drivers/spi/spi-xilinx.c n_words = min(remaining_words, xspi->buffer_size); xspi 278 drivers/spi/spi-xilinx.c xilinx_spi_tx(xspi); xspi 285 drivers/spi/spi-xilinx.c xspi->write_fn(cr, xspi->regs + XSPI_CR_OFFSET); xspi 286 drivers/spi/spi-xilinx.c wait_for_completion(&xspi->done); xspi 293 drivers/spi/spi-xilinx.c xspi->write_fn(cr | XSPI_CR_TRANS_INHIBIT, xspi 294 drivers/spi/spi-xilinx.c xspi->regs + XSPI_CR_OFFSET); xspi 297 drivers/spi/spi-xilinx.c sr = xspi->read_fn(xspi->regs + XSPI_SR_OFFSET); xspi 308 drivers/spi/spi-xilinx.c xspi_init_hw(xspi); xspi 313 drivers/spi/spi-xilinx.c xilinx_spi_rx(xspi); xspi 318 drivers/spi/spi-xilinx.c sr = xspi->read_fn(xspi->regs + XSPI_SR_OFFSET); xspi 320 drivers/spi/spi-xilinx.c xilinx_spi_rx(xspi); xspi 329 drivers/spi/spi-xilinx.c xspi->write_fn(0, xspi->regs + XIPIF_V123B_DGIER_OFFSET); xspi 330 drivers/spi/spi-xilinx.c xspi->write_fn(cr, xspi->regs + XSPI_CR_OFFSET); xspi 344 drivers/spi/spi-xilinx.c struct xilinx_spi *xspi = dev_id; xspi 348 drivers/spi/spi-xilinx.c ipif_isr = xspi->read_fn(xspi->regs + XIPIF_V123B_IISR_OFFSET); xspi 349 drivers/spi/spi-xilinx.c xspi->write_fn(ipif_isr, xspi->regs + XIPIF_V123B_IISR_OFFSET); xspi 352 drivers/spi/spi-xilinx.c complete(&xspi->done); xspi 359 drivers/spi/spi-xilinx.c static int xilinx_spi_find_buffer_size(struct xilinx_spi *xspi) xspi 368 drivers/spi/spi-xilinx.c xspi->write_fn(XIPIF_V123B_RESET_MASK, xspi 369 drivers/spi/spi-xilinx.c xspi->regs + XIPIF_V123B_RESETR_OFFSET); xspi 373 drivers/spi/spi-xilinx.c xspi->write_fn(0, xspi->regs + XSPI_TXD_OFFSET); xspi 374 drivers/spi/spi-xilinx.c sr = xspi->read_fn(xspi->regs + XSPI_SR_OFFSET); xspi 391 drivers/spi/spi-xilinx.c struct xilinx_spi *xspi; xspi 427 drivers/spi/spi-xilinx.c xspi = spi_master_get_devdata(master); xspi 428 drivers/spi/spi-xilinx.c xspi->cs_inactive = 0xffffffff; xspi 429 drivers/spi/spi-xilinx.c xspi->bitbang.master = master; xspi 430 drivers/spi/spi-xilinx.c xspi->bitbang.chipselect = xilinx_spi_chipselect; xspi 431 drivers/spi/spi-xilinx.c xspi->bitbang.setup_transfer = xilinx_spi_setup_transfer; xspi 432 drivers/spi/spi-xilinx.c xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs; xspi 433 drivers/spi/spi-xilinx.c init_completion(&xspi->done); xspi 436 drivers/spi/spi-xilinx.c xspi->regs = devm_ioremap_resource(&pdev->dev, res); xspi 437 drivers/spi/spi-xilinx.c if (IS_ERR(xspi->regs)) { xspi 438 drivers/spi/spi-xilinx.c ret = PTR_ERR(xspi->regs); xspi 453 drivers/spi/spi-xilinx.c xspi->read_fn = xspi_read32; xspi 454 drivers/spi/spi-xilinx.c xspi->write_fn = xspi_write32; xspi 456 drivers/spi/spi-xilinx.c xspi->write_fn(XSPI_CR_LOOP, xspi->regs + XSPI_CR_OFFSET); xspi 457 drivers/spi/spi-xilinx.c tmp = xspi->read_fn(xspi->regs + XSPI_CR_OFFSET); xspi 460 drivers/spi/spi-xilinx.c xspi->read_fn = xspi_read32_be; xspi 461 drivers/spi/spi-xilinx.c xspi->write_fn = xspi_write32_be; xspi 465 drivers/spi/spi-xilinx.c xspi->bytes_per_word = bits_per_word / 8; xspi 466 drivers/spi/spi-xilinx.c xspi->buffer_size = xilinx_spi_find_buffer_size(xspi); xspi 468 drivers/spi/spi-xilinx.c xspi->irq = platform_get_irq(pdev, 0); xspi 469 drivers/spi/spi-xilinx.c if (xspi->irq < 0 && xspi->irq != -ENXIO) { xspi 470 drivers/spi/spi-xilinx.c ret = xspi->irq; xspi 472 drivers/spi/spi-xilinx.c } else if (xspi->irq >= 0) { xspi 474 drivers/spi/spi-xilinx.c ret = devm_request_irq(&pdev->dev, xspi->irq, xilinx_spi_irq, 0, xspi 475 drivers/spi/spi-xilinx.c dev_name(&pdev->dev), xspi); xspi 481 drivers/spi/spi-xilinx.c xspi_init_hw(xspi); xspi 483 drivers/spi/spi-xilinx.c ret = spi_bitbang_start(&xspi->bitbang); xspi 490 drivers/spi/spi-xilinx.c (unsigned long long)res->start, xspi->regs, xspi->irq); xspi 509 drivers/spi/spi-xilinx.c struct xilinx_spi *xspi = spi_master_get_devdata(master); xspi 510 drivers/spi/spi-xilinx.c void __iomem *regs_base = xspi->regs; xspi 512 drivers/spi/spi-xilinx.c spi_bitbang_stop(&xspi->bitbang); xspi 515 drivers/spi/spi-xilinx.c xspi->write_fn(0, regs_base + XIPIF_V123B_IIER_OFFSET); xspi 517 drivers/spi/spi-xilinx.c xspi->write_fn(0, regs_base + XIPIF_V123B_DGIER_OFFSET); xspi 519 drivers/spi/spi-xilinx.c spi_master_put(xspi->bitbang.master); xspi 126 drivers/spi/spi-xlp.c static void xlp_spi_sysctl_setup(struct xlp_spi_priv *xspi) xspi 131 drivers/spi/spi-xlp.c xlp_spi_sysctl_write(xspi, XLP_SPI_SYSCTRL, xspi 133 drivers/spi/spi-xlp.c xlp_spi_sysctl_write(xspi, XLP_SPI_SYSCTRL, XLP_SPI_SYS_PMEN); xspi 138 drivers/spi/spi-xlp.c struct xlp_spi_priv *xspi; xspi 142 drivers/spi/spi-xlp.c xspi = spi_master_get_devdata(spi->master); xspi 147 drivers/spi/spi-xlp.c fdiv = DIV_ROUND_UP(xspi->spi_clk, spi->max_speed_hz); xspi 153 drivers/spi/spi-xlp.c xlp_spi_reg_write(xspi, cs, XLP_SPI_FDIV, fdiv); xspi 154 drivers/spi/spi-xlp.c xlp_spi_reg_write(xspi, cs, XLP_SPI_FIFO_THRESH, XLP_SPI_TXRXTH); xspi 155 drivers/spi/spi-xlp.c cfg = xlp_spi_reg_read(xspi, cs, XLP_SPI_CONFIG); xspi 176 drivers/spi/spi-xlp.c xlp_spi_reg_write(xspi, cs, XLP_SPI_CONFIG, cfg); xspi 181 drivers/spi/spi-xlp.c static void xlp_spi_read_rxfifo(struct xlp_spi_priv *xspi) xspi 186 drivers/spi/spi-xlp.c rxfifo_cnt = xlp_spi_reg_read(xspi, xspi->cs, XLP_SPI_FIFO_WCNT); xspi 189 drivers/spi/spi-xlp.c rx_data = xlp_spi_reg_read(xspi, xspi->cs, XLP_SPI_RXDATA_FIFO); xspi 191 drivers/spi/spi-xlp.c nbytes = min(xspi->rx_len, 4); xspi 193 drivers/spi/spi-xlp.c xspi->rx_buf[i] = (rx_data >> (j * 8)) & 0xff; xspi 195 drivers/spi/spi-xlp.c xspi->rx_len -= nbytes; xspi 196 drivers/spi/spi-xlp.c xspi->rx_buf += nbytes; xspi 201 drivers/spi/spi-xlp.c static void xlp_spi_fill_txfifo(struct xlp_spi_priv *xspi) xspi 206 drivers/spi/spi-xlp.c txfifo_cnt = xlp_spi_reg_read(xspi, xspi->cs, XLP_SPI_FIFO_WCNT); xspi 209 drivers/spi/spi-xlp.c while (xspi->tx_len && (txfifo_cnt < XLP_SPI_FIFO_SIZE)) { xspi 212 drivers/spi/spi-xlp.c nbytes = min(xspi->tx_len, 4); xspi 214 drivers/spi/spi-xlp.c tx_data |= xspi->tx_buf[i] << (j * 8); xspi 216 drivers/spi/spi-xlp.c xlp_spi_reg_write(xspi, xspi->cs, XLP_SPI_TXDATA_FIFO, tx_data); xspi 217 drivers/spi/spi-xlp.c xspi->tx_len -= nbytes; xspi 218 drivers/spi/spi-xlp.c xspi->tx_buf += nbytes; xspi 225 drivers/spi/spi-xlp.c struct xlp_spi_priv *xspi = dev_id; xspi 228 drivers/spi/spi-xlp.c stat = xlp_spi_reg_read(xspi, xspi->cs, XLP_SPI_STATUS) & xspi 234 drivers/spi/spi-xlp.c if (xspi->tx_len) xspi 235 drivers/spi/spi-xlp.c xlp_spi_fill_txfifo(xspi); xspi 237 drivers/spi/spi-xlp.c xspi->txerrors++; xspi 241 drivers/spi/spi-xlp.c if (xspi->rx_len) xspi 242 drivers/spi/spi-xlp.c xlp_spi_read_rxfifo(xspi); xspi 244 drivers/spi/spi-xlp.c xspi->rxerrors++; xspi 248 drivers/spi/spi-xlp.c xlp_spi_reg_write(xspi, xspi->cs, XLP_SPI_STATUS, stat); xspi 250 drivers/spi/spi-xlp.c complete(&xspi->done); xspi 255 drivers/spi/spi-xlp.c static void xlp_spi_send_cmd(struct xlp_spi_priv *xspi, int xfer_len, xspi 260 drivers/spi/spi-xlp.c if (xspi->tx_buf) xspi 262 drivers/spi/spi-xlp.c if (xspi->rx_buf) xspi 267 drivers/spi/spi-xlp.c xlp_spi_reg_write(xspi, xspi->cs, XLP_SPI_CMD, cmd); xspi 351 drivers/spi/spi-xlp.c struct xlp_spi_priv *xspi = spi_master_get_devdata(master); xspi 354 drivers/spi/spi-xlp.c xspi->cs = spi->chip_select; xspi 355 drivers/spi/spi-xlp.c xspi->dev = spi->dev; xspi 358 drivers/spi/spi-xlp.c xspi->cmd_cont = 0; xspi 360 drivers/spi/spi-xlp.c xspi->cmd_cont = 1; xspi 362 drivers/spi/spi-xlp.c if (xlp_spi_txrx_bufs(xspi, t)) xspi 372 drivers/spi/spi-xlp.c struct xlp_spi_priv *xspi; xspi 376 drivers/spi/spi-xlp.c xspi = devm_kzalloc(&pdev->dev, sizeof(*xspi), GFP_KERNEL); xspi 377 drivers/spi/spi-xlp.c if (!xspi) xspi 380 drivers/spi/spi-xlp.c xspi->base = devm_platform_ioremap_resource(pdev, 0); xspi 381 drivers/spi/spi-xlp.c if (IS_ERR(xspi->base)) xspi 382 drivers/spi/spi-xlp.c return PTR_ERR(xspi->base); xspi 388 drivers/spi/spi-xlp.c pdev->name, xspi); xspi 400 drivers/spi/spi-xlp.c xspi->spi_clk = clk_get_rate(clk); xspi 415 drivers/spi/spi-xlp.c init_completion(&xspi->done); xspi 416 drivers/spi/spi-xlp.c spi_master_set_devdata(master, xspi); xspi 417 drivers/spi/spi-xlp.c xlp_spi_sysctl_setup(xspi); xspi 43 drivers/spi/spi-xtensa-xtfpga.c static inline void xtfpga_spi_wait_busy(struct xtfpga_spi *xspi) xspi 47 drivers/spi/spi-xtensa-xtfpga.c for (i = 0; xtfpga_spi_read32(xspi, XTFPGA_SPI_BUSY) && xspi 56 drivers/spi/spi-xtensa-xtfpga.c struct xtfpga_spi *xspi = spi_master_get_devdata(spi->master); xspi 58 drivers/spi/spi-xtensa-xtfpga.c xspi->data = (xspi->data << bits) | (v & GENMASK(bits - 1, 0)); xspi 59 drivers/spi/spi-xtensa-xtfpga.c xspi->data_sz += bits; xspi 60 drivers/spi/spi-xtensa-xtfpga.c if (xspi->data_sz >= 16) { xspi 61 drivers/spi/spi-xtensa-xtfpga.c xtfpga_spi_write32(xspi, XTFPGA_SPI_DATA, xspi 62 drivers/spi/spi-xtensa-xtfpga.c xspi->data >> (xspi->data_sz - 16)); xspi 63 drivers/spi/spi-xtensa-xtfpga.c xspi->data_sz -= 16; xspi 64 drivers/spi/spi-xtensa-xtfpga.c xtfpga_spi_write32(xspi, XTFPGA_SPI_START, 1); xspi 65 drivers/spi/spi-xtensa-xtfpga.c xtfpga_spi_wait_busy(xspi); xspi 66 drivers/spi/spi-xtensa-xtfpga.c xtfpga_spi_write32(xspi, XTFPGA_SPI_START, 0); xspi 74 drivers/spi/spi-xtensa-xtfpga.c struct xtfpga_spi *xspi = spi_master_get_devdata(spi->master); xspi 76 drivers/spi/spi-xtensa-xtfpga.c WARN_ON(xspi->data_sz != 0); xspi 77 drivers/spi/spi-xtensa-xtfpga.c xspi->data_sz = 0; xspi 82 drivers/spi/spi-xtensa-xtfpga.c struct xtfpga_spi *xspi; xspi 96 drivers/spi/spi-xtensa-xtfpga.c xspi = spi_master_get_devdata(master); xspi 97 drivers/spi/spi-xtensa-xtfpga.c xspi->bitbang.master = master; xspi 98 drivers/spi/spi-xtensa-xtfpga.c xspi->bitbang.chipselect = xtfpga_spi_chipselect; xspi 99 drivers/spi/spi-xtensa-xtfpga.c xspi->bitbang.txrx_word[SPI_MODE_0] = xtfpga_spi_txrx_word; xspi 107 drivers/spi/spi-xtensa-xtfpga.c xspi->regs = devm_ioremap_resource(&pdev->dev, mem); xspi 108 drivers/spi/spi-xtensa-xtfpga.c if (IS_ERR(xspi->regs)) { xspi 109 drivers/spi/spi-xtensa-xtfpga.c ret = PTR_ERR(xspi->regs); xspi 113 drivers/spi/spi-xtensa-xtfpga.c xtfpga_spi_write32(xspi, XTFPGA_SPI_START, 0); xspi 115 drivers/spi/spi-xtensa-xtfpga.c if (xtfpga_spi_read32(xspi, XTFPGA_SPI_BUSY)) { xspi 121 drivers/spi/spi-xtensa-xtfpga.c ret = spi_bitbang_start(&xspi->bitbang); xspi 137 drivers/spi/spi-xtensa-xtfpga.c struct xtfpga_spi *xspi = spi_master_get_devdata(master); xspi 139 drivers/spi/spi-xtensa-xtfpga.c spi_bitbang_stop(&xspi->bitbang);