Commit a78f6a41 authored by Wolfram Sang's avatar Wolfram Sang Committed by Wolfram Sang

i2c: sh_mobile: replace magic hex values with constants

No functional change, binaries are identical.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 218e1496
...@@ -316,7 +316,7 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd, ...@@ -316,7 +316,7 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd,
switch (op) { switch (op) {
case OP_START: /* issue start and trigger DTE interrupt */ case OP_START: /* issue start and trigger DTE interrupt */
iic_wr(pd, ICCR, 0x94); iic_wr(pd, ICCR, ICCR_ICE | ICCR_TRS | ICCR_BBSY);
break; break;
case OP_TX_FIRST: /* disable DTE interrupt and write data */ case OP_TX_FIRST: /* disable DTE interrupt and write data */
iic_wr(pd, ICIC, ICIC_WAITE | ICIC_ALE | ICIC_TACKE); iic_wr(pd, ICIC, ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
...@@ -327,10 +327,11 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd, ...@@ -327,10 +327,11 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd,
break; break;
case OP_TX_STOP: /* write data and issue a stop afterwards */ case OP_TX_STOP: /* write data and issue a stop afterwards */
iic_wr(pd, ICDR, data); iic_wr(pd, ICDR, data);
iic_wr(pd, ICCR, pd->send_stop ? 0x90 : 0x94); iic_wr(pd, ICCR, pd->send_stop ? ICCR_ICE | ICCR_TRS
: ICCR_ICE | ICCR_TRS | ICCR_BBSY);
break; break;
case OP_TX_TO_RX: /* select read mode */ case OP_TX_TO_RX: /* select read mode */
iic_wr(pd, ICCR, 0x81); iic_wr(pd, ICCR, ICCR_ICE | ICCR_SCP);
break; break;
case OP_RX: /* just read data */ case OP_RX: /* just read data */
ret = iic_rd(pd, ICDR); ret = iic_rd(pd, ICDR);
...@@ -338,13 +339,13 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd, ...@@ -338,13 +339,13 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd,
case OP_RX_STOP: /* enable DTE interrupt, issue stop */ case OP_RX_STOP: /* enable DTE interrupt, issue stop */
iic_wr(pd, ICIC, iic_wr(pd, ICIC,
ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE); ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
iic_wr(pd, ICCR, 0xc0); iic_wr(pd, ICCR, ICCR_ICE | ICCR_RACK);
break; break;
case OP_RX_STOP_DATA: /* enable DTE interrupt, read data, issue stop */ case OP_RX_STOP_DATA: /* enable DTE interrupt, read data, issue stop */
iic_wr(pd, ICIC, iic_wr(pd, ICIC,
ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE); ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
ret = iic_rd(pd, ICDR); ret = iic_rd(pd, ICDR);
iic_wr(pd, ICCR, 0xc0); iic_wr(pd, ICCR, ICCR_ICE | ICCR_RACK);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment