@@ -56,12 +56,12 @@ void fsl_spi_cpm_reinit_txrx(struct mpc8xxx_spi *mspi)
5656 QE_CR_PROTOCOL_UNSPECIFIED , 0 );
5757 } else {
5858 if (mspi -> flags & SPI_CPM1 ) {
59- out_be32 ( & mspi -> pram -> rstate , 0 );
60- out_be16 ( & mspi -> pram -> rbptr ,
61- in_be16 ( & mspi -> pram -> rbase ) );
62- out_be32 ( & mspi -> pram -> tstate , 0 );
63- out_be16 ( & mspi -> pram -> tbptr ,
64- in_be16 ( & mspi -> pram -> tbase ) );
59+ iowrite32be ( 0 , & mspi -> pram -> rstate );
60+ iowrite16be ( ioread16be ( & mspi -> pram -> rbase ) ,
61+ & mspi -> pram -> rbptr );
62+ iowrite32be ( 0 , & mspi -> pram -> tstate );
63+ iowrite16be ( ioread16be ( & mspi -> pram -> tbase ) ,
64+ & mspi -> pram -> tbptr );
6565 } else {
6666 cpm_command (CPM_SPI_CMD , CPM_CR_INIT_TRX );
6767 }
@@ -75,24 +75,24 @@ static void fsl_spi_cpm_bufs_start(struct mpc8xxx_spi *mspi)
7575 struct cpm_buf_desc __iomem * rx_bd = mspi -> rx_bd ;
7676 unsigned int xfer_len = min (mspi -> count , SPI_MRBLR );
7777 unsigned int xfer_ofs ;
78- struct fsl_spi_reg * reg_base = mspi -> reg_base ;
78+ struct fsl_spi_reg __iomem * reg_base = mspi -> reg_base ;
7979
8080 xfer_ofs = mspi -> xfer_in_progress -> len - mspi -> count ;
8181
8282 if (mspi -> rx_dma == mspi -> dma_dummy_rx )
83- out_be32 ( & rx_bd -> cbd_bufaddr , mspi -> rx_dma );
83+ iowrite32be ( mspi -> rx_dma , & rx_bd -> cbd_bufaddr );
8484 else
85- out_be32 ( & rx_bd -> cbd_bufaddr , mspi -> rx_dma + xfer_ofs );
86- out_be16 ( & rx_bd -> cbd_datlen , 0 );
87- out_be16 ( & rx_bd -> cbd_sc , BD_SC_EMPTY | BD_SC_INTRPT | BD_SC_WRAP );
85+ iowrite32be ( mspi -> rx_dma + xfer_ofs , & rx_bd -> cbd_bufaddr );
86+ iowrite16be ( 0 , & rx_bd -> cbd_datlen );
87+ iowrite16be ( BD_SC_EMPTY | BD_SC_INTRPT | BD_SC_WRAP , & rx_bd -> cbd_sc );
8888
8989 if (mspi -> tx_dma == mspi -> dma_dummy_tx )
90- out_be32 ( & tx_bd -> cbd_bufaddr , mspi -> tx_dma );
90+ iowrite32be ( mspi -> tx_dma , & tx_bd -> cbd_bufaddr );
9191 else
92- out_be32 ( & tx_bd -> cbd_bufaddr , mspi -> tx_dma + xfer_ofs );
93- out_be16 ( & tx_bd -> cbd_datlen , xfer_len );
94- out_be16 ( & tx_bd -> cbd_sc , BD_SC_READY | BD_SC_INTRPT | BD_SC_WRAP |
95- BD_SC_LAST );
92+ iowrite32be ( mspi -> tx_dma + xfer_ofs , & tx_bd -> cbd_bufaddr );
93+ iowrite16be ( xfer_len , & tx_bd -> cbd_datlen );
94+ iowrite16be ( BD_SC_READY | BD_SC_INTRPT | BD_SC_WRAP | BD_SC_LAST ,
95+ & tx_bd -> cbd_sc );
9696
9797 /* start transfer */
9898 mpc8xxx_spi_write_reg (& reg_base -> command , SPCOM_STR );
@@ -102,7 +102,7 @@ int fsl_spi_cpm_bufs(struct mpc8xxx_spi *mspi,
102102 struct spi_transfer * t , bool is_dma_mapped )
103103{
104104 struct device * dev = mspi -> dev ;
105- struct fsl_spi_reg * reg_base = mspi -> reg_base ;
105+ struct fsl_spi_reg __iomem * reg_base = mspi -> reg_base ;
106106
107107 if (is_dma_mapped ) {
108108 mspi -> map_tx_dma = 0 ;
@@ -123,7 +123,7 @@ int fsl_spi_cpm_bufs(struct mpc8xxx_spi *mspi,
123123 }
124124 if (t -> bits_per_word == 16 && t -> tx_buf ) {
125125 const u16 * src = t -> tx_buf ;
126- u16 * dst ;
126+ __le16 * dst ;
127127 int i ;
128128
129129 dst = kmalloc (t -> len , GFP_KERNEL );
@@ -202,12 +202,12 @@ EXPORT_SYMBOL_GPL(fsl_spi_cpm_bufs_complete);
202202void fsl_spi_cpm_irq (struct mpc8xxx_spi * mspi , u32 events )
203203{
204204 u16 len ;
205- struct fsl_spi_reg * reg_base = mspi -> reg_base ;
205+ struct fsl_spi_reg __iomem * reg_base = mspi -> reg_base ;
206206
207207 dev_dbg (mspi -> dev , "%s: bd datlen %d, count %d\n" , __func__ ,
208- in_be16 (& mspi -> rx_bd -> cbd_datlen ), mspi -> count );
208+ ioread16be (& mspi -> rx_bd -> cbd_datlen ), mspi -> count );
209209
210- len = in_be16 (& mspi -> rx_bd -> cbd_datlen );
210+ len = ioread16be (& mspi -> rx_bd -> cbd_datlen );
211211 if (len > mspi -> count ) {
212212 WARN_ON (1 );
213213 len = mspi -> count ;
@@ -328,7 +328,7 @@ int fsl_spi_cpm_init(struct mpc8xxx_spi *mspi)
328328 }
329329
330330 if (mspi -> flags & SPI_CPM1 ) {
331- void * pram ;
331+ void __iomem * pram ;
332332
333333 pram = devm_platform_ioremap_resource (to_platform_device (dev ),
334334 1 );
@@ -374,21 +374,21 @@ int fsl_spi_cpm_init(struct mpc8xxx_spi *mspi)
374374 mspi -> rx_bd = cpm_muram_addr (bds_ofs + sizeof (* mspi -> tx_bd ));
375375
376376 /* Initialize parameter ram. */
377- out_be16 ( & mspi -> pram -> tbase , cpm_muram_offset ( mspi -> tx_bd ) );
378- out_be16 ( & mspi -> pram -> rbase , cpm_muram_offset ( mspi -> rx_bd ) );
379- out_8 ( & mspi -> pram -> tfcr , CPMFCR_EB | CPMFCR_GBL );
380- out_8 ( & mspi -> pram -> rfcr , CPMFCR_EB | CPMFCR_GBL );
381- out_be16 ( & mspi -> pram -> mrblr , SPI_MRBLR );
382- out_be32 ( & mspi -> pram -> rstate , 0 );
383- out_be32 ( & mspi -> pram -> rdp , 0 );
384- out_be16 ( & mspi -> pram -> rbptr , 0 );
385- out_be16 ( & mspi -> pram -> rbc , 0 );
386- out_be32 ( & mspi -> pram -> rxtmp , 0 );
387- out_be32 ( & mspi -> pram -> tstate , 0 );
388- out_be32 ( & mspi -> pram -> tdp , 0 );
389- out_be16 ( & mspi -> pram -> tbptr , 0 );
390- out_be16 ( & mspi -> pram -> tbc , 0 );
391- out_be32 ( & mspi -> pram -> txtmp , 0 );
377+ iowrite16be ( cpm_muram_offset ( mspi -> tx_bd ), & mspi -> pram -> tbase );
378+ iowrite16be ( cpm_muram_offset ( mspi -> rx_bd ), & mspi -> pram -> rbase );
379+ iowrite8 ( CPMFCR_EB | CPMFCR_GBL , & mspi -> pram -> tfcr );
380+ iowrite8 ( CPMFCR_EB | CPMFCR_GBL , & mspi -> pram -> rfcr );
381+ iowrite16be ( SPI_MRBLR , & mspi -> pram -> mrblr );
382+ iowrite32be ( 0 , & mspi -> pram -> rstate );
383+ iowrite32be ( 0 , & mspi -> pram -> rdp );
384+ iowrite16be ( 0 , & mspi -> pram -> rbptr );
385+ iowrite16be ( 0 , & mspi -> pram -> rbc );
386+ iowrite32be ( 0 , & mspi -> pram -> rxtmp );
387+ iowrite32be ( 0 , & mspi -> pram -> tstate );
388+ iowrite32be ( 0 , & mspi -> pram -> tdp );
389+ iowrite16be ( 0 , & mspi -> pram -> tbptr );
390+ iowrite16be ( 0 , & mspi -> pram -> tbc );
391+ iowrite32be ( 0 , & mspi -> pram -> txtmp );
392392
393393 return 0 ;
394394
0 commit comments