summaryrefslogtreecommitdiffstats
path: root/drivers/staging/sm750fb
diff options
context:
space:
mode:
authorMike Rapoport2016-02-10 17:34:21 +0100
committerGreg Kroah-Hartman2016-02-12 04:52:37 +0100
commit3e155b813406fbb4aed1a54eecd24a90cf13dd96 (patch)
treeb23f43c758ae3aca64a0767f55493cff68666e93 /drivers/staging/sm750fb
parentstaging: sm750fb: use BIT macro for I2C_CTRL fields (diff)
downloadkernel-qcow2-linux-3e155b813406fbb4aed1a54eecd24a90cf13dd96.tar.gz
kernel-qcow2-linux-3e155b813406fbb4aed1a54eecd24a90cf13dd96.tar.xz
kernel-qcow2-linux-3e155b813406fbb4aed1a54eecd24a90cf13dd96.zip
staging: sm750fb: use BIT macro for I2C_STATUS fields
Replace complex definition of I2C_STATUS register fields with BIT() macro and use open-coded implementation for register manipulation Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/sm750fb')
-rw-r--r--drivers/staging/sm750fb/ddk750_hwi2c.c4
-rw-r--r--drivers/staging/sm750fb/ddk750_reg.h18
2 files changed, 5 insertions, 17 deletions
diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c
index 1811c4bd007f..231c02114ed4 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.c
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.c
@@ -59,9 +59,7 @@ static long hw_i2c_wait_tx_done(void)
/* Wait until the transfer is completed. */
timeout = HWI2C_WAIT_TIMEOUT;
- while ((FIELD_GET(PEEK32(I2C_STATUS),
- I2C_STATUS, TX) != I2C_STATUS_TX_COMPLETED) &&
- (timeout != 0))
+ while (!(PEEK32(I2C_STATUS) & I2C_STATUS_TX) && (timeout != 0))
timeout--;
if (timeout == 0)
diff --git a/drivers/staging/sm750fb/ddk750_reg.h b/drivers/staging/sm750fb/ddk750_reg.h
index 2a8ad57e6311..63995995be14 100644
--- a/drivers/staging/sm750fb/ddk750_reg.h
+++ b/drivers/staging/sm750fb/ddk750_reg.h
@@ -1612,20 +1612,10 @@
#define I2C_CTRL_EN BIT(0)
#define I2C_STATUS 0x010042
-#define I2C_STATUS_TX 3:3
-#define I2C_STATUS_TX_PROGRESS 0
-#define I2C_STATUS_TX_COMPLETED 1
-#define I2C_TX_DONE 0x08
-#define I2C_STATUS_ERR 2:2
-#define I2C_STATUS_ERR_NORMAL 0
-#define I2C_STATUS_ERR_ERROR 1
-#define I2C_STATUS_ERR_CLEAR 0
-#define I2C_STATUS_ACK 1:1
-#define I2C_STATUS_ACK_RECEIVED 0
-#define I2C_STATUS_ACK_NOT 1
-#define I2C_STATUS_BSY 0:0
-#define I2C_STATUS_BSY_IDLE 0
-#define I2C_STATUS_BSY_BUSY 1
+#define I2C_STATUS_TX BIT(3)
+#define I2C_STATUS_ERR BIT(2)
+#define I2C_STATUS_ACK BIT(1)
+#define I2C_STATUS_BSY BIT(0)
#define I2C_RESET 0x010042
#define I2C_RESET_BUS_ERROR 2:2