Lines Matching refs:mpc8xxx_spi
91 struct mpc8xxx_spi *mspi = spi_controller_get_devdata(spi->controller); in fsl_spi_change_mode()
150 struct mpc8xxx_spi *mpc8xxx_spi, in mspi_apply_cpu_mode_quirks() argument
166 if (mpc8xxx_spi->set_shifts) in mspi_apply_cpu_mode_quirks()
167 mpc8xxx_spi->set_shifts(&cs->rx_shift, &cs->tx_shift, in mspi_apply_cpu_mode_quirks()
171 mpc8xxx_spi->rx_shift = cs->rx_shift; in mspi_apply_cpu_mode_quirks()
172 mpc8xxx_spi->tx_shift = cs->tx_shift; in mspi_apply_cpu_mode_quirks()
173 mpc8xxx_spi->get_rx = cs->get_rx; in mspi_apply_cpu_mode_quirks()
174 mpc8xxx_spi->get_tx = cs->get_tx; in mspi_apply_cpu_mode_quirks()
180 struct mpc8xxx_spi *mpc8xxx_spi; in fsl_spi_setup_transfer() local
186 mpc8xxx_spi = spi_controller_get_devdata(spi->controller); in fsl_spi_setup_transfer()
200 if (!(mpc8xxx_spi->flags & SPI_CPM_MODE)) in fsl_spi_setup_transfer()
201 mspi_apply_cpu_mode_quirks(cs, spi, mpc8xxx_spi, bits_per_word); in fsl_spi_setup_transfer()
214 if ((mpc8xxx_spi->spibrg / hz) > 64) { in fsl_spi_setup_transfer()
216 pm = (mpc8xxx_spi->spibrg - 1) / (hz * 64) + 1; in fsl_spi_setup_transfer()
219 dev_name(&spi->dev), hz, mpc8xxx_spi->spibrg / 1024); in fsl_spi_setup_transfer()
223 pm = (mpc8xxx_spi->spibrg - 1) / (hz * 4) + 1; in fsl_spi_setup_transfer()
234 static int fsl_spi_cpu_bufs(struct mpc8xxx_spi *mspi, in fsl_spi_cpu_bufs()
254 struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(spi->controller); in fsl_spi_bufs() local
260 reg_base = mpc8xxx_spi->reg_base; in fsl_spi_bufs()
270 mpc8xxx_spi->tx = t->tx_buf; in fsl_spi_bufs()
271 mpc8xxx_spi->rx = t->rx_buf; in fsl_spi_bufs()
273 reinit_completion(&mpc8xxx_spi->done); in fsl_spi_bufs()
275 if (mpc8xxx_spi->flags & SPI_CPM_MODE) in fsl_spi_bufs()
276 ret = fsl_spi_cpm_bufs(mpc8xxx_spi, t); in fsl_spi_bufs()
278 ret = fsl_spi_cpu_bufs(mpc8xxx_spi, t, len); in fsl_spi_bufs()
282 wait_for_completion(&mpc8xxx_spi->done); in fsl_spi_bufs()
287 if (mpc8xxx_spi->flags & SPI_CPM_MODE) in fsl_spi_bufs()
288 fsl_spi_cpm_bufs_complete(mpc8xxx_spi); in fsl_spi_bufs()
290 return mpc8xxx_spi->count; in fsl_spi_bufs()
296 struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(ctlr); in fsl_spi_prepare_message() local
317 if (!(mpc8xxx_spi->flags & SPI_CPM_MODE)) { in fsl_spi_prepare_message()
338 (mpc8xxx_spi->flags & SPI_CPM1)) in fsl_spi_prepare_message()
370 struct mpc8xxx_spi *mpc8xxx_spi; in fsl_spi_setup() local
387 mpc8xxx_spi = spi_controller_get_devdata(spi->controller); in fsl_spi_setup()
389 reg_base = mpc8xxx_spi->reg_base; in fsl_spi_setup()
425 static void fsl_spi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) in fsl_spi_cpu_irq()
459 struct mpc8xxx_spi *mspi = context_data; in fsl_spi_irq()
481 struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(spi->controller); in fsl_spi_grlib_cs_control() local
482 struct fsl_spi_reg __iomem *reg_base = mpc8xxx_spi->reg_base; in fsl_spi_grlib_cs_control()
486 if (cs < mpc8xxx_spi->native_chipselects) { in fsl_spi_grlib_cs_control()
496 struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host); in fsl_spi_grlib_probe() local
497 struct fsl_spi_reg __iomem *reg_base = mpc8xxx_spi->reg_base; in fsl_spi_grlib_probe()
503 mpc8xxx_spi->set_shifts = fsl_spi_grlib_set_shifts; in fsl_spi_grlib_probe()
506 mpc8xxx_spi->max_bits_per_word = mbits + 1; in fsl_spi_grlib_probe()
508 mpc8xxx_spi->native_chipselects = 0; in fsl_spi_grlib_probe()
510 mpc8xxx_spi->native_chipselects = SPCAP_SSSZ(capabilities); in fsl_spi_grlib_probe()
513 host->num_chipselect = mpc8xxx_spi->native_chipselects; in fsl_spi_grlib_probe()
533 struct mpc8xxx_spi *mpc8xxx_spi; in fsl_spi_probe() local
538 host = spi_alloc_host(dev, sizeof(struct mpc8xxx_spi)); in fsl_spi_probe()
556 mpc8xxx_spi = spi_controller_get_devdata(host); in fsl_spi_probe()
557 mpc8xxx_spi->max_bits_per_word = 32; in fsl_spi_probe()
558 mpc8xxx_spi->type = fsl_spi_get_type(dev); in fsl_spi_probe()
560 ret = fsl_spi_cpm_init(mpc8xxx_spi); in fsl_spi_probe()
564 mpc8xxx_spi->reg_base = devm_ioremap_resource(dev, mem); in fsl_spi_probe()
565 if (IS_ERR(mpc8xxx_spi->reg_base)) { in fsl_spi_probe()
566 ret = PTR_ERR(mpc8xxx_spi->reg_base); in fsl_spi_probe()
570 if (mpc8xxx_spi->type == TYPE_GRLIB) in fsl_spi_probe()
573 if (mpc8xxx_spi->flags & SPI_CPM_MODE) in fsl_spi_probe()
581 SPI_BPW_RANGE_MASK(1, mpc8xxx_spi->max_bits_per_word); in fsl_spi_probe()
583 if (mpc8xxx_spi->flags & SPI_QE_CPU_MODE) in fsl_spi_probe()
584 mpc8xxx_spi->set_shifts = fsl_spi_qe_cpu_set_shifts; in fsl_spi_probe()
586 if (mpc8xxx_spi->set_shifts) in fsl_spi_probe()
588 mpc8xxx_spi->set_shifts(&mpc8xxx_spi->rx_shift, in fsl_spi_probe()
589 &mpc8xxx_spi->tx_shift, 8, 1); in fsl_spi_probe()
592 ret = devm_request_irq(dev, mpc8xxx_spi->irq, fsl_spi_irq, in fsl_spi_probe()
593 0, "fsl_spi", mpc8xxx_spi); in fsl_spi_probe()
598 reg_base = mpc8xxx_spi->reg_base; in fsl_spi_probe()
608 if (mpc8xxx_spi->max_bits_per_word < 8) { in fsl_spi_probe()
610 regval |= SPMODE_LEN(mpc8xxx_spi->max_bits_per_word - 1); in fsl_spi_probe()
612 if (mpc8xxx_spi->flags & SPI_QE_CPU_MODE) in fsl_spi_probe()
622 mpc8xxx_spi->irq, mpc8xxx_spi_strmode(mpc8xxx_spi->flags)); in fsl_spi_probe()
627 fsl_spi_cpm_free(mpc8xxx_spi); in fsl_spi_probe()
706 struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host); in of_fsl_spi_remove() local
708 fsl_spi_cpm_free(mpc8xxx_spi); in of_fsl_spi_remove()
752 struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host); in plat_mpc8xxx_spi_remove() local
754 fsl_spi_cpm_free(mpc8xxx_spi); in plat_mpc8xxx_spi_remove()