@@ -100,8 +100,8 @@ 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_BITLEN1 ( i ) (((i) - 1) << 24) /* Data Size (8-32 bits) */
104
- #define SIMDR2_WDLEN1 ( i ) (((i) - 1) << 16) /* Word Count (1-64/256 (SH, A1))) */
103
+ #define SIMDR2_BITLEN1 GENMASK(28, 24) /* Data Size (8-32 bits) */
104
+ #define SIMDR2_WDLEN1 GENMASK(23, 16) /* Word Count (1-64/256 (SH, A1))) */
105
105
#define SIMDR2_GRPMASK1 BIT(0) /* Group Output Mask 1 (SH, A1) */
106
106
107
107
/* SITSCR and SIRSCR */
@@ -397,7 +397,8 @@ static void sh_msiof_spi_set_mode_regs(struct sh_msiof_spi_priv *p,
397
397
const void * tx_buf , void * rx_buf ,
398
398
u32 bits , u32 words )
399
399
{
400
- u32 dr2 = SIMDR2_BITLEN1 (bits ) | SIMDR2_WDLEN1 (words );
400
+ u32 dr2 = FIELD_PREP (SIMDR2_BITLEN1 , bits - 1 ) |
401
+ FIELD_PREP (SIMDR2_WDLEN1 , words - 1 );
401
402
402
403
if (tx_buf || (p -> ctlr -> flags & SPI_CONTROLLER_MUST_TX ))
403
404
sh_msiof_write (p , SITMDR2 , dr2 );
@@ -931,6 +932,7 @@ static int sh_msiof_transfer_one(struct spi_controller *ctlr,
931
932
struct spi_transfer * t )
932
933
{
933
934
struct sh_msiof_spi_priv * p = spi_controller_get_devdata (ctlr );
935
+ unsigned int max_wdlen = FIELD_MAX (SIMDR2_WDLEN1 ) + 1 ;
934
936
void (* copy32 )(u32 * , const u32 * , unsigned int );
935
937
void (* tx_fifo )(struct sh_msiof_spi_priv * , const void * , unsigned int ,
936
938
unsigned int );
@@ -940,7 +942,6 @@ static int sh_msiof_transfer_one(struct spi_controller *ctlr,
940
942
void * rx_buf = t -> rx_buf ;
941
943
unsigned int len = t -> len ;
942
944
unsigned int bits = t -> bits_per_word ;
943
- unsigned int max_wdlen = 256 ;
944
945
unsigned int bytes_per_word ;
945
946
unsigned int words ;
946
947
int n ;
0 commit comments