@@ -191,6 +191,7 @@ struct s3c64xx_spi_port_config {
191
191
* @tx_dma: Local transmit DMA data (e.g. chan and direction)
192
192
* @port_conf: Local SPI port configuration data
193
193
* @port_id: Port identification number
194
+ * @fifo_depth: depth of the FIFO.
194
195
* @rx_fifomask: SPI_STATUS.RX_FIFO_LVL mask. Shifted mask defining the field's
195
196
* length and position.
196
197
* @tx_fifomask: SPI_STATUS.TX_FIFO_LVL mask. Shifted mask defining the field's
@@ -214,6 +215,7 @@ struct s3c64xx_spi_driver_data {
214
215
struct s3c64xx_spi_dma_data tx_dma ;
215
216
const struct s3c64xx_spi_port_config * port_conf ;
216
217
unsigned int port_id ;
218
+ unsigned int fifo_depth ;
217
219
u32 rx_fifomask ;
218
220
u32 tx_fifomask ;
219
221
};
@@ -424,7 +426,7 @@ static bool s3c64xx_spi_can_dma(struct spi_controller *host,
424
426
struct s3c64xx_spi_driver_data * sdd = spi_controller_get_devdata (host );
425
427
426
428
if (sdd -> rx_dma .ch && sdd -> tx_dma .ch )
427
- return xfer -> len > FIFO_DEPTH ( sdd ) ;
429
+ return xfer -> len > sdd -> fifo_depth ;
428
430
429
431
return false;
430
432
}
@@ -548,7 +550,7 @@ static u32 s3c64xx_spi_wait_for_timeout(struct s3c64xx_spi_driver_data *sdd,
548
550
void __iomem * regs = sdd -> regs ;
549
551
unsigned long val = 1 ;
550
552
u32 status ;
551
- u32 max_fifo = FIFO_DEPTH ( sdd ) ;
553
+ u32 max_fifo = sdd -> fifo_depth ;
552
554
553
555
if (timeout_ms )
554
556
val = msecs_to_loops (timeout_ms );
@@ -655,7 +657,7 @@ static int s3c64xx_wait_for_pio(struct s3c64xx_spi_driver_data *sdd,
655
657
* For any size less than the fifo size the below code is
656
658
* executed atleast once.
657
659
*/
658
- loops = xfer -> len / FIFO_DEPTH ( sdd ) ;
660
+ loops = xfer -> len / sdd -> fifo_depth ;
659
661
buf = xfer -> rx_buf ;
660
662
do {
661
663
/* wait for data to be received in the fifo */
@@ -792,7 +794,7 @@ static int s3c64xx_spi_transfer_one(struct spi_controller *host,
792
794
struct spi_transfer * xfer )
793
795
{
794
796
struct s3c64xx_spi_driver_data * sdd = spi_controller_get_devdata (host );
795
- const unsigned int fifo_len = FIFO_DEPTH ( sdd ) ;
797
+ const unsigned int fifo_len = sdd -> fifo_depth ;
796
798
const void * tx_buf = NULL ;
797
799
void * rx_buf = NULL ;
798
800
int target_len = 0 , origin_len = 0 ;
@@ -1261,6 +1263,8 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
1261
1263
sdd -> port_id = pdev -> id ;
1262
1264
}
1263
1265
1266
+ sdd -> fifo_depth = FIFO_DEPTH (sdd );
1267
+
1264
1268
s3c64xx_spi_set_fifomask (sdd );
1265
1269
1266
1270
sdd -> cur_bpw = 8 ;
@@ -1352,7 +1356,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
1352
1356
dev_dbg (& pdev -> dev , "Samsung SoC SPI Driver loaded for Bus SPI-%d with %d Targets attached\n" ,
1353
1357
sdd -> port_id , host -> num_chipselect );
1354
1358
dev_dbg (& pdev -> dev , "\tIOmem=[%pR]\tFIFO %dbytes\n" ,
1355
- mem_res , FIFO_DEPTH ( sdd ) );
1359
+ mem_res , sdd -> fifo_depth );
1356
1360
1357
1361
pm_runtime_mark_last_busy (& pdev -> dev );
1358
1362
pm_runtime_put_autosuspend (& pdev -> dev );
0 commit comments