104
104
#define ID_NACK BIT(4)
105
105
#define ID_EPROTO BIT(5)
106
106
/* persistent flags */
107
+ #define ID_P_NOT_ATOMIC BIT(28)
107
108
#define ID_P_HOST_NOTIFY BIT(29)
108
109
#define ID_P_NO_RXDMA BIT(30) /* HW forbids RXDMA sometimes */
109
110
#define ID_P_PM_BLOCKED BIT(31)
110
- #define ID_P_MASK GENMASK(31, 29 )
111
+ #define ID_P_MASK GENMASK(31, 28 )
111
112
112
113
enum rcar_i2c_type {
113
114
I2C_RCAR_GEN1 ,
@@ -138,7 +139,6 @@ struct rcar_i2c_priv {
138
139
enum dma_data_direction dma_direction ;
139
140
140
141
struct reset_control * rstc ;
141
- bool atomic_xfer ;
142
142
int irq ;
143
143
144
144
struct i2c_client * host_notify_client ;
@@ -350,7 +350,7 @@ static void rcar_i2c_prepare_msg(struct rcar_i2c_priv *priv)
350
350
priv -> flags |= ID_LAST_MSG ;
351
351
352
352
rcar_i2c_write (priv , ICMAR , i2c_8bit_addr_from_msg (priv -> msg ));
353
- if (! priv -> atomic_xfer )
353
+ if (priv -> flags & ID_P_NOT_ATOMIC )
354
354
rcar_i2c_write (priv , ICMIER , read ? RCAR_IRQ_RECV : RCAR_IRQ_SEND );
355
355
356
356
if (rep_start )
@@ -420,7 +420,7 @@ static bool rcar_i2c_dma(struct rcar_i2c_priv *priv)
420
420
int len ;
421
421
422
422
/* Do various checks to see if DMA is feasible at all */
423
- if (priv -> atomic_xfer || IS_ERR (chan ) || msg -> len < RCAR_MIN_DMA_LEN ||
423
+ if (!( priv -> flags & ID_P_NOT_ATOMIC ) || IS_ERR (chan ) || msg -> len < RCAR_MIN_DMA_LEN ||
424
424
!(msg -> flags & I2C_M_DMA_SAFE ) || (read && priv -> flags & ID_P_NO_RXDMA ))
425
425
return false;
426
426
@@ -670,7 +670,7 @@ static irqreturn_t rcar_i2c_irq(int irq, struct rcar_i2c_priv *priv, u32 msr)
670
670
/* Nack */
671
671
if (msr & MNR ) {
672
672
/* HW automatically sends STOP after received NACK */
673
- if (! priv -> atomic_xfer )
673
+ if (priv -> flags & ID_P_NOT_ATOMIC )
674
674
rcar_i2c_write (priv , ICMIER , RCAR_IRQ_STOP );
675
675
priv -> flags |= ID_NACK ;
676
676
goto out ;
@@ -692,7 +692,7 @@ static irqreturn_t rcar_i2c_irq(int irq, struct rcar_i2c_priv *priv, u32 msr)
692
692
if (priv -> flags & ID_DONE ) {
693
693
rcar_i2c_write (priv , ICMIER , 0 );
694
694
rcar_i2c_write (priv , ICMSR , 0 );
695
- if (! priv -> atomic_xfer )
695
+ if (priv -> flags & ID_P_NOT_ATOMIC )
696
696
wake_up (& priv -> wait );
697
697
}
698
698
@@ -710,7 +710,7 @@ static irqreturn_t rcar_i2c_gen2_irq(int irq, void *ptr)
710
710
711
711
/* Only handle interrupts that are currently enabled */
712
712
msr = rcar_i2c_read (priv , ICMSR );
713
- if (! priv -> atomic_xfer )
713
+ if (priv -> flags & ID_P_NOT_ATOMIC )
714
714
msr &= rcar_i2c_read (priv , ICMIER );
715
715
716
716
return rcar_i2c_irq (irq , priv , msr );
@@ -723,7 +723,7 @@ static irqreturn_t rcar_i2c_gen3_irq(int irq, void *ptr)
723
723
724
724
/* Only handle interrupts that are currently enabled */
725
725
msr = rcar_i2c_read (priv , ICMSR );
726
- if (! priv -> atomic_xfer )
726
+ if (priv -> flags & ID_P_NOT_ATOMIC )
727
727
msr &= rcar_i2c_read (priv , ICMIER );
728
728
729
729
/*
@@ -832,7 +832,7 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
832
832
int i , ret ;
833
833
long time_left ;
834
834
835
- priv -> atomic_xfer = false ;
835
+ priv -> flags |= ID_P_NOT_ATOMIC ;
836
836
837
837
pm_runtime_get_sync (dev );
838
838
@@ -896,7 +896,7 @@ static int rcar_i2c_master_xfer_atomic(struct i2c_adapter *adap,
896
896
bool time_left ;
897
897
int ret ;
898
898
899
- priv -> atomic_xfer = true ;
899
+ priv -> flags &= ~ ID_P_NOT_ATOMIC ;
900
900
901
901
pm_runtime_get_sync (dev );
902
902
0 commit comments