104104#define ID_NACK BIT(4)
105105#define ID_EPROTO BIT(5)
106106/* persistent flags */
107+ #define ID_P_NOT_ATOMIC BIT(28)
107108#define ID_P_HOST_NOTIFY BIT(29)
108109#define ID_P_NO_RXDMA BIT(30) /* HW forbids RXDMA sometimes */
109110#define ID_P_PM_BLOCKED BIT(31)
110- #define ID_P_MASK GENMASK(31, 29 )
111+ #define ID_P_MASK GENMASK(31, 28 )
111112
112113enum rcar_i2c_type {
113114 I2C_RCAR_GEN1 ,
@@ -138,7 +139,6 @@ struct rcar_i2c_priv {
138139 enum dma_data_direction dma_direction ;
139140
140141 struct reset_control * rstc ;
141- bool atomic_xfer ;
142142 int irq ;
143143
144144 struct i2c_client * host_notify_client ;
@@ -350,7 +350,7 @@ static void rcar_i2c_prepare_msg(struct rcar_i2c_priv *priv)
350350 priv -> flags |= ID_LAST_MSG ;
351351
352352 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 )
354354 rcar_i2c_write (priv , ICMIER , read ? RCAR_IRQ_RECV : RCAR_IRQ_SEND );
355355
356356 if (rep_start )
@@ -420,7 +420,7 @@ static bool rcar_i2c_dma(struct rcar_i2c_priv *priv)
420420 int len ;
421421
422422 /* 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 ||
424424 !(msg -> flags & I2C_M_DMA_SAFE ) || (read && priv -> flags & ID_P_NO_RXDMA ))
425425 return false;
426426
@@ -670,7 +670,7 @@ static irqreturn_t rcar_i2c_irq(int irq, struct rcar_i2c_priv *priv, u32 msr)
670670 /* Nack */
671671 if (msr & MNR ) {
672672 /* HW automatically sends STOP after received NACK */
673- if (! priv -> atomic_xfer )
673+ if (priv -> flags & ID_P_NOT_ATOMIC )
674674 rcar_i2c_write (priv , ICMIER , RCAR_IRQ_STOP );
675675 priv -> flags |= ID_NACK ;
676676 goto out ;
@@ -692,7 +692,7 @@ static irqreturn_t rcar_i2c_irq(int irq, struct rcar_i2c_priv *priv, u32 msr)
692692 if (priv -> flags & ID_DONE ) {
693693 rcar_i2c_write (priv , ICMIER , 0 );
694694 rcar_i2c_write (priv , ICMSR , 0 );
695- if (! priv -> atomic_xfer )
695+ if (priv -> flags & ID_P_NOT_ATOMIC )
696696 wake_up (& priv -> wait );
697697 }
698698
@@ -710,7 +710,7 @@ static irqreturn_t rcar_i2c_gen2_irq(int irq, void *ptr)
710710
711711 /* Only handle interrupts that are currently enabled */
712712 msr = rcar_i2c_read (priv , ICMSR );
713- if (! priv -> atomic_xfer )
713+ if (priv -> flags & ID_P_NOT_ATOMIC )
714714 msr &= rcar_i2c_read (priv , ICMIER );
715715
716716 return rcar_i2c_irq (irq , priv , msr );
@@ -723,7 +723,7 @@ static irqreturn_t rcar_i2c_gen3_irq(int irq, void *ptr)
723723
724724 /* Only handle interrupts that are currently enabled */
725725 msr = rcar_i2c_read (priv , ICMSR );
726- if (! priv -> atomic_xfer )
726+ if (priv -> flags & ID_P_NOT_ATOMIC )
727727 msr &= rcar_i2c_read (priv , ICMIER );
728728
729729 /*
@@ -832,7 +832,7 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
832832 int i , ret ;
833833 long time_left ;
834834
835- priv -> atomic_xfer = false ;
835+ priv -> flags |= ID_P_NOT_ATOMIC ;
836836
837837 pm_runtime_get_sync (dev );
838838
@@ -896,7 +896,7 @@ static int rcar_i2c_master_xfer_atomic(struct i2c_adapter *adap,
896896 bool time_left ;
897897 int ret ;
898898
899- priv -> atomic_xfer = true ;
899+ priv -> flags &= ~ ID_P_NOT_ATOMIC ;
900900
901901 pm_runtime_get_sync (dev );
902902
0 commit comments