Lines Matching refs:mps
37 #define psc_addr(mps, regname) ({ \ argument
39 switch (mps->type) { \
41 struct mpc52xx_psc __iomem *psc = mps->psc; \
46 struct mpc5125_psc __iomem *psc = mps->psc; \
94 struct mpc512x_psc_spi *mps = spi_master_get_devdata(spi->master); in mpc512x_psc_spi_activate_cs() local
100 sicr = in_be32(psc_addr(mps, sicr)); in mpc512x_psc_spi_activate_cs()
117 out_be32(psc_addr(mps, sicr), sicr); in mpc512x_psc_spi_activate_cs()
119 ccr = in_be32(psc_addr(mps, ccr)); in mpc512x_psc_spi_activate_cs()
124 bclkdiv = (mps->mclk_rate / speed) - 1; in mpc512x_psc_spi_activate_cs()
127 out_be32(psc_addr(mps, ccr), ccr); in mpc512x_psc_spi_activate_cs()
128 mps->bits_per_word = cs->bits_per_word; in mpc512x_psc_spi_activate_cs()
131 if (mps->cs_control) in mpc512x_psc_spi_activate_cs()
133 mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 1 : 0); in mpc512x_psc_spi_activate_cs()
142 struct mpc512x_psc_spi *mps = spi_master_get_devdata(spi->master); in mpc512x_psc_spi_deactivate_cs() local
145 if (mps->cs_control) in mpc512x_psc_spi_deactivate_cs()
147 mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 0 : 1); in mpc512x_psc_spi_deactivate_cs()
162 struct mpc512x_psc_spi *mps = spi_master_get_devdata(spi->master); in mpc512x_psc_spi_transfer_rxtx() local
163 struct mpc512x_psc_fifo __iomem *fifo = mps->fifo; in mpc512x_psc_spi_transfer_rxtx()
201 reinit_completion(&mps->txisrdone); in mpc512x_psc_spi_transfer_rxtx()
204 wait_for_completion(&mps->txisrdone); in mpc512x_psc_spi_transfer_rxtx()
345 struct mpc512x_psc_spi *mps = spi_master_get_devdata(master); in mpc512x_psc_spi_prep_xfer_hw() local
350 in_8(psc_addr(mps, mr2)); in mpc512x_psc_spi_prep_xfer_hw()
351 out_8(psc_addr(mps, mr2), 0x0); in mpc512x_psc_spi_prep_xfer_hw()
354 out_8(psc_addr(mps, command), MPC52xx_PSC_TX_ENABLE | MPC52xx_PSC_RX_ENABLE); in mpc512x_psc_spi_prep_xfer_hw()
361 struct mpc512x_psc_spi *mps = spi_master_get_devdata(master); in mpc512x_psc_spi_unprep_xfer_hw() local
362 struct mpc512x_psc_fifo __iomem *fifo = mps->fifo; in mpc512x_psc_spi_unprep_xfer_hw()
367 out_8(psc_addr(mps, command), MPC52xx_PSC_TX_DISABLE | MPC52xx_PSC_RX_DISABLE); in mpc512x_psc_spi_unprep_xfer_hw()
400 struct mpc512x_psc_spi *mps) in mpc512x_psc_spi_port_config() argument
402 struct mpc512x_psc_fifo __iomem *fifo = mps->fifo; in mpc512x_psc_spi_port_config()
409 out_8(psc_addr(mps, command), MPC52xx_PSC_RST_RX); in mpc512x_psc_spi_port_config()
410 out_8(psc_addr(mps, command), MPC52xx_PSC_RST_TX); in mpc512x_psc_spi_port_config()
411 out_8(psc_addr(mps, command), MPC52xx_PSC_TX_DISABLE | MPC52xx_PSC_RX_DISABLE); in mpc512x_psc_spi_port_config()
414 out_be16(psc_addr(mps, isr_imr.imr), 0); in mpc512x_psc_spi_port_config()
430 out_be32(psc_addr(mps, sicr), sicr); in mpc512x_psc_spi_port_config()
432 ccr = in_be32(psc_addr(mps, ccr)); in mpc512x_psc_spi_port_config()
435 bclkdiv = (mps->mclk_rate / speed) - 1; in mpc512x_psc_spi_port_config()
437 out_be32(psc_addr(mps, ccr), ccr); in mpc512x_psc_spi_port_config()
440 out_8(psc_addr(mps, ctur), 0x00); in mpc512x_psc_spi_port_config()
441 out_8(psc_addr(mps, ctlr), 0x82); in mpc512x_psc_spi_port_config()
453 mps->bits_per_word = 8; in mpc512x_psc_spi_port_config()
460 struct mpc512x_psc_spi *mps = (struct mpc512x_psc_spi *)dev_id; in mpc512x_psc_spi_isr() local
461 struct mpc512x_psc_fifo __iomem *fifo = mps->fifo; in mpc512x_psc_spi_isr()
468 complete(&mps->txisrdone); in mpc512x_psc_spi_isr()
478 struct mpc512x_psc_spi *mps; in mpc512x_psc_spi_do_probe() local
484 master = spi_alloc_master(dev, sizeof(*mps)); in mpc512x_psc_spi_do_probe()
489 mps = spi_master_get_devdata(master); in mpc512x_psc_spi_do_probe()
490 mps->type = (int)of_device_get_match_data(dev); in mpc512x_psc_spi_do_probe()
491 mps->irq = irq; in mpc512x_psc_spi_do_probe()
494 mps->cs_control = pdata->cs_control; in mpc512x_psc_spi_do_probe()
514 mps->psc = tempp; in mpc512x_psc_spi_do_probe()
515 mps->fifo = in mpc512x_psc_spi_do_probe()
517 ret = devm_request_irq(dev, mps->irq, mpc512x_psc_spi_isr, IRQF_SHARED, in mpc512x_psc_spi_do_probe()
518 "mpc512x-psc-spi", mps); in mpc512x_psc_spi_do_probe()
521 init_completion(&mps->txisrdone); in mpc512x_psc_spi_do_probe()
531 mps->clk_mclk = clk; in mpc512x_psc_spi_do_probe()
532 mps->mclk_rate = clk_get_rate(clk); in mpc512x_psc_spi_do_probe()
542 mps->clk_ipg = clk; in mpc512x_psc_spi_do_probe()
544 ret = mpc512x_psc_spi_port_config(master, mps); in mpc512x_psc_spi_do_probe()
555 clk_disable_unprepare(mps->clk_ipg); in mpc512x_psc_spi_do_probe()
557 clk_disable_unprepare(mps->clk_mclk); in mpc512x_psc_spi_do_probe()
567 struct mpc512x_psc_spi *mps = spi_master_get_devdata(master); in mpc512x_psc_spi_do_remove() local
569 clk_disable_unprepare(mps->clk_mclk); in mpc512x_psc_spi_do_remove()
570 clk_disable_unprepare(mps->clk_ipg); in mpc512x_psc_spi_do_remove()