@@ -100,10 +100,15 @@ struct sh_msiof_spi_priv {
100
100
/* 0=MSIOF_SYNC, 1=MSIOF_SS1, 2=MSIOF_SS2 */
101
101
102
102
/* SITMDR2 and SIRMDR2 */
103
+ #define SIMDR2_GRP GENMASK(31, 30) /* Group Count */
103
104
#define SIMDR2_BITLEN1 GENMASK(28, 24) /* Data Size (8-32 bits) */
104
105
#define SIMDR2_WDLEN1 GENMASK(23, 16) /* Word Count (1-64/256 (SH, A1))) */
105
106
#define SIMDR2_GRPMASK GENMASK(3, 0) /* Group Output Mask 1-4 (SH, A1) */
106
107
108
+ /* SITMDR3 and SIRMDR3 */
109
+ #define SIMDR3_BITLEN2 GENMASK(28, 24) /* Data Size (8-32 bits) */
110
+ #define SIMDR3_WDLEN2 GENMASK(23, 16) /* Word Count (1-64/256 (SH, A1))) */
111
+
107
112
/* SITSCR and SIRSCR */
108
113
#define SISCR_BRPS GENMASK(12, 8) /* Prescaler Setting (1-32) */
109
114
#define SISCR_BRDV GENMASK(2, 0) /* Baud Rate Generator's Division Ratio */
@@ -392,10 +397,11 @@ static void sh_msiof_spi_set_pin_regs(struct sh_msiof_spi_priv *p, u32 ss,
392
397
393
398
static void sh_msiof_spi_set_mode_regs (struct sh_msiof_spi_priv * p ,
394
399
const void * tx_buf , void * rx_buf ,
395
- u32 bits , u32 words )
400
+ u32 bits , u32 words1 , u32 words2 )
396
401
{
397
- u32 dr2 = FIELD_PREP (SIMDR2_BITLEN1 , bits - 1 ) |
398
- FIELD_PREP (SIMDR2_WDLEN1 , words - 1 );
402
+ u32 dr2 = FIELD_PREP (SIMDR2_GRP , words2 ? 1 : 0 ) |
403
+ FIELD_PREP (SIMDR2_BITLEN1 , bits - 1 ) |
404
+ FIELD_PREP (SIMDR2_WDLEN1 , words1 - 1 );
399
405
400
406
if (tx_buf || (p -> ctlr -> flags & SPI_CONTROLLER_MUST_TX ))
401
407
sh_msiof_write (p , SITMDR2 , dr2 );
@@ -404,6 +410,15 @@ static void sh_msiof_spi_set_mode_regs(struct sh_msiof_spi_priv *p,
404
410
405
411
if (rx_buf )
406
412
sh_msiof_write (p , SIRMDR2 , dr2 );
413
+
414
+ if (words2 ) {
415
+ u32 dr3 = FIELD_PREP (SIMDR3_BITLEN2 , bits - 1 ) |
416
+ FIELD_PREP (SIMDR3_WDLEN2 , words2 - 1 );
417
+
418
+ sh_msiof_write (p , SITMDR3 , dr3 );
419
+ if (rx_buf )
420
+ sh_msiof_write (p , SIRMDR3 , dr3 );
421
+ }
407
422
}
408
423
409
424
static void sh_msiof_reset_str (struct sh_msiof_spi_priv * p )
@@ -712,7 +727,7 @@ static int sh_msiof_spi_txrx_once(struct sh_msiof_spi_priv *p,
712
727
sh_msiof_write (p , SIFCTR , 0 );
713
728
714
729
/* setup msiof transfer mode registers */
715
- sh_msiof_spi_set_mode_regs (p , tx_buf , rx_buf , bits , words );
730
+ sh_msiof_spi_set_mode_regs (p , tx_buf , rx_buf , bits , words , 0 );
716
731
sh_msiof_write (p , SIIER , SIIER_TEOFE | SIIER_REOFE );
717
732
718
733
/* write tx fifo */
@@ -812,7 +827,7 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
812
827
FIELD_PREP (SIFCTR_RFWM , SIFCTR_RFWM_1 ));
813
828
814
829
/* setup msiof transfer mode registers (32-bit words) */
815
- sh_msiof_spi_set_mode_regs (p , tx , rx , 32 , len / 4 );
830
+ sh_msiof_spi_set_mode_regs (p , tx , rx , 32 , len / 4 , 0 );
816
831
817
832
sh_msiof_write (p , SIIER , ier_bits );
818
833
0 commit comments