aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/spi/mpc52xx_psc_spi.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index 253ed5682a6d..a86315a0c5b8 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -42,6 +42,7 @@ struct mpc52xx_psc_spi {
42 42
43 /* driver internal data */ 43 /* driver internal data */
44 struct mpc52xx_psc __iomem *psc; 44 struct mpc52xx_psc __iomem *psc;
45 struct mpc52xx_psc_fifo __iomem *fifo;
45 unsigned int irq; 46 unsigned int irq;
46 u8 bits_per_word; 47 u8 bits_per_word;
47 u8 busy; 48 u8 busy;
@@ -139,6 +140,7 @@ static int mpc52xx_psc_spi_transfer_rxtx(struct spi_device *spi,
139{ 140{
140 struct mpc52xx_psc_spi *mps = spi_master_get_devdata(spi->master); 141 struct mpc52xx_psc_spi *mps = spi_master_get_devdata(spi->master);
141 struct mpc52xx_psc __iomem *psc = mps->psc; 142 struct mpc52xx_psc __iomem *psc = mps->psc;
143 struct mpc52xx_psc_fifo __iomem *fifo = mps->fifo;
142 unsigned rb = 0; /* number of bytes receieved */ 144 unsigned rb = 0; /* number of bytes receieved */
143 unsigned sb = 0; /* number of bytes sent */ 145 unsigned sb = 0; /* number of bytes sent */
144 unsigned char *rx_buf = (unsigned char *)t->rx_buf; 146 unsigned char *rx_buf = (unsigned char *)t->rx_buf;
@@ -190,11 +192,11 @@ static int mpc52xx_psc_spi_transfer_rxtx(struct spi_device *spi,
190 out_8(&psc->mode, 0); 192 out_8(&psc->mode, 0);
191 } else { 193 } else {
192 out_8(&psc->mode, MPC52xx_PSC_MODE_FFULL); 194 out_8(&psc->mode, MPC52xx_PSC_MODE_FFULL);
193 out_be16(&psc->rfalarm, rfalarm); 195 out_be16(&fifo->rfalarm, rfalarm);
194 } 196 }
195 out_be16(&psc->mpc52xx_psc_imr, MPC52xx_PSC_IMR_RXRDY); 197 out_be16(&psc->mpc52xx_psc_imr, MPC52xx_PSC_IMR_RXRDY);
196 wait_for_completion(&mps->done); 198 wait_for_completion(&mps->done);
197 recv_at_once = in_be16(&psc->rfnum); 199 recv_at_once = in_be16(&fifo->rfnum);
198 dev_dbg(&spi->dev, "%d bytes received\n", recv_at_once); 200 dev_dbg(&spi->dev, "%d bytes received\n", recv_at_once);
199 201
200 send_at_once = recv_at_once; 202 send_at_once = recv_at_once;
@@ -331,6 +333,7 @@ static void mpc52xx_psc_spi_cleanup(struct spi_device *spi)
331static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps) 333static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)
332{ 334{
333 struct mpc52xx_psc __iomem *psc = mps->psc; 335 struct mpc52xx_psc __iomem *psc = mps->psc;
336 struct mpc52xx_psc_fifo __iomem *fifo = mps->fifo;
334 u32 mclken_div; 337 u32 mclken_div;
335 int ret = 0; 338 int ret = 0;
336 339
@@ -346,7 +349,7 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)
346 /* Disable interrupts, interrupts are based on alarm level */ 349 /* Disable interrupts, interrupts are based on alarm level */
347 out_be16(&psc->mpc52xx_psc_imr, 0); 350 out_be16(&psc->mpc52xx_psc_imr, 0);
348 out_8(&psc->command, MPC52xx_PSC_SEL_MODE_REG_1); 351 out_8(&psc->command, MPC52xx_PSC_SEL_MODE_REG_1);
349 out_8(&psc->rfcntl, 0); 352 out_8(&fifo->rfcntl, 0);
350 out_8(&psc->mode, MPC52xx_PSC_MODE_FFULL); 353 out_8(&psc->mode, MPC52xx_PSC_MODE_FFULL);
351 354
352 /* Configure 8bit codec mode as a SPI master and use EOF flags */ 355 /* Configure 8bit codec mode as a SPI master and use EOF flags */
@@ -419,6 +422,8 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr,
419 ret = -EFAULT; 422 ret = -EFAULT;
420 goto free_master; 423 goto free_master;
421 } 424 }
425 /* On the 5200, fifo regs are immediately ajacent to the psc regs */
426 mps->fifo = ((void __iomem *)mps->psc) + sizeof(struct mpc52xx_psc);
422 427
423 ret = request_irq(mps->irq, mpc52xx_psc_spi_isr, 0, "mpc52xx-psc-spi", 428 ret = request_irq(mps->irq, mpc52xx_psc_spi_isr, 0, "mpc52xx-psc-spi",
424 mps); 429 mps);