aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2015-03-23 04:26:36 -0400
committerWolfram Sang <wsa@the-dreams.de>2015-03-27 11:53:38 -0400
commit5b77d162a3d7359a8a8d83776720da065bf4e77b (patch)
tree84c5ae531f925ddc961ee467736bb62553031b66 /drivers/i2c/busses
parent4a7a08226dd590a139e5f7835fe93f90b3beee90 (diff)
i2c: slave: rework the slave API
After more discussion, brave users, and additional datasheet evaluation, some API updates for the new I2C slave framework became imminent. The slave events now get some easier to understand naming. Also, the event handling has been simplified to only need a single call to the slave callback when an action by the backend is required. Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r--drivers/i2c/busses/i2c-rcar.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 71a6e07eb7ab..5a84bea5b845 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -382,11 +382,11 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)
382 if (ssr_filtered & SAR) { 382 if (ssr_filtered & SAR) {
383 /* read or write request */ 383 /* read or write request */
384 if (ssr_raw & STM) { 384 if (ssr_raw & STM) {
385 i2c_slave_event(priv->slave, I2C_SLAVE_REQ_READ_START, &value); 385 i2c_slave_event(priv->slave, I2C_SLAVE_READ_REQUESTED, &value);
386 rcar_i2c_write(priv, ICRXTX, value); 386 rcar_i2c_write(priv, ICRXTX, value);
387 rcar_i2c_write(priv, ICSIER, SDE | SSR | SAR); 387 rcar_i2c_write(priv, ICSIER, SDE | SSR | SAR);
388 } else { 388 } else {
389 i2c_slave_event(priv->slave, I2C_SLAVE_REQ_WRITE_START, &value); 389 i2c_slave_event(priv->slave, I2C_SLAVE_WRITE_REQUESTED, &value);
390 rcar_i2c_read(priv, ICRXTX); /* dummy read */ 390 rcar_i2c_read(priv, ICRXTX); /* dummy read */
391 rcar_i2c_write(priv, ICSIER, SDR | SSR | SAR); 391 rcar_i2c_write(priv, ICSIER, SDR | SSR | SAR);
392 } 392 }
@@ -406,17 +406,15 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)
406 int ret; 406 int ret;
407 407
408 value = rcar_i2c_read(priv, ICRXTX); 408 value = rcar_i2c_read(priv, ICRXTX);
409 ret = i2c_slave_event(priv->slave, I2C_SLAVE_REQ_WRITE_END, &value); 409 ret = i2c_slave_event(priv->slave, I2C_SLAVE_WRITE_RECEIVED, &value);
410 /* Send NACK in case of error */ 410 /* Send NACK in case of error */
411 rcar_i2c_write(priv, ICSCR, SIE | SDBS | (ret < 0 ? FNA : 0)); 411 rcar_i2c_write(priv, ICSCR, SIE | SDBS | (ret < 0 ? FNA : 0));
412 i2c_slave_event(priv->slave, I2C_SLAVE_REQ_WRITE_START, &value);
413 rcar_i2c_write(priv, ICSSR, ~SDR & 0xff); 412 rcar_i2c_write(priv, ICSSR, ~SDR & 0xff);
414 } 413 }
415 414
416 /* master wants to read from us */ 415 /* master wants to read from us */
417 if (ssr_filtered & SDE) { 416 if (ssr_filtered & SDE) {
418 i2c_slave_event(priv->slave, I2C_SLAVE_REQ_READ_END, &value); 417 i2c_slave_event(priv->slave, I2C_SLAVE_READ_PROCESSED, &value);
419 i2c_slave_event(priv->slave, I2C_SLAVE_REQ_READ_START, &value);
420 rcar_i2c_write(priv, ICRXTX, value); 418 rcar_i2c_write(priv, ICRXTX, value);
421 rcar_i2c_write(priv, ICSSR, ~SDE & 0xff); 419 rcar_i2c_write(priv, ICSSR, ~SDE & 0xff);
422 } 420 }