* [PATCH] i2c: mpc: add register documentation to Freescale I2C driver
@ 2014-11-29 21:58 Danielle Costantino
2014-12-01 17:21 ` Wolfram Sang
0 siblings, 1 reply; 2+ messages in thread
From: Danielle Costantino @ 2014-11-29 21:58 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linuxppc-dev, linux-i2c
i2c: mpc: add register documentation to Freescale I2C driver
return -ETIMEDOUT for all time-out error conditions and warn on
arbitration lost.
Signed-off-by: Danielle Costantino <danielle.costantino@gmail.com>
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 4c5d7d9..28d9245 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -36,26 +36,31 @@
#define MPC_I2C_CLOCK_LEGACY 0
#define MPC_I2C_CLOCK_PRESERVE (~0U)
-#define MPC_I2C_FDR 0x04
-#define MPC_I2C_CR 0x08
-#define MPC_I2C_SR 0x0c
-#define MPC_I2C_DR 0x10
-#define MPC_I2C_DFSRR 0x14
+#define MPC_I2C_ADR 0x00 /* I2C address register */
+#define MPC_I2C_FDR 0x04 /* I2C frequency divider register */
+#define MPC_I2C_CR 0x08 /* I2C control register */
+#define MPC_I2C_SR 0x0C /* I2C status register */
+#define MPC_I2C_DR 0x10 /* I2C data register */
+#define MPC_I2C_DFSRR 0x14 /* I2C digital filter sampling rate
register */
-#define CCR_MEN 0x80
-#define CCR_MIEN 0x40
-#define CCR_MSTA 0x20
-#define CCR_MTX 0x10
-#define CCR_TXAK 0x08
-#define CCR_RSTA 0x04
+/* I2C Control Register (MPC_I2C_CR): */
+#define CCR_MEN 0x80 /* Module enable */
+#define CCR_MIEN 0x40 /* Module interrupt enable */
+#define CCR_MSTA 0x20 /* Master/slave mode START */
+#define CCR_MTX 0x10 /* Transmit/receive mode select */
+#define CCR_TXAK 0x08 /* Transfer acknowledge */
+#define CCR_RSTA 0x04 /* Repeated START */
+#define CCR_BCST 0x01 /* Broadcast */
-#define CSR_MCF 0x80
-#define CSR_MAAS 0x40
-#define CSR_MBB 0x20
-#define CSR_MAL 0x10
-#define CSR_SRW 0x04
-#define CSR_MIF 0x02
-#define CSR_RXAK 0x01
+/* I2C Status Register (MPC_I2C_SR): */
+#define CSR_MCF 0x80 /* Data transfer */
+#define CSR_MAAS 0x40 /* Addressed as a slave */
+#define CSR_MBB 0x20 /* Bus busy */
+#define CSR_MAL 0x10 /* Arbitration lost */
+#define CSR_BCSTM 0x08 /* Broadcast match */
+#define CSR_SRW 0x04 /* Slave read/write */
+#define CSR_MIF 0x02 /* Module interrupt */
+#define CSR_RXAK 0x01 /* Received acknowledge */
struct mpc_i2c {
struct device *dev;
@@ -158,12 +163,12 @@
return result;
if (!(cmd_err & CSR_MCF)) {
- dev_dbg(i2c->dev, "unfinished\n");
+ dev_warn(i2c->dev, "unfinished\n");
return -EIO;
}
if (cmd_err & CSR_MAL) {
- dev_dbg(i2c->dev, "MAL\n");
+ dev_err(i2c->dev, "Arbitration lost\n");
return -EAGAIN;
}
@@ -554,7 +559,7 @@
i2c->base + MPC_I2C_SR);
mpc_i2c_fixup(i2c);
}
- return -EIO;
+ return -ETIMEDOUT;
}
schedule();
}
@@ -590,7 +595,7 @@
i2c->base + MPC_I2C_SR);
mpc_i2c_fixup(i2c);
}
- return -EIO;
+ return -ETIMEDOUT;
}
cond_resched();
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] i2c: mpc: add register documentation to Freescale I2C driver
2014-11-29 21:58 [PATCH] i2c: mpc: add register documentation to Freescale I2C driver Danielle Costantino
@ 2014-12-01 17:21 ` Wolfram Sang
0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2014-12-01 17:21 UTC (permalink / raw)
To: Danielle Costantino; +Cc: linuxppc-dev, linux-i2c
[-- Attachment #1: Type: text/plain, Size: 586 bytes --]
On Sat, Nov 29, 2014 at 01:58:42PM -0800, Danielle Costantino wrote:
> i2c: mpc: add register documentation to Freescale I2C driver
This should be in one patch.
>
> return -ETIMEDOUT for all time-out error conditions
This should be in a seperate patch.
> and warn on arbitration lost.
And this should be dropped. "Arbitration lost" lost is not an error, it
is specified behaviour of I2C.
> if (!(cmd_err & CSR_MCF)) {
> - dev_dbg(i2c->dev, "unfinished\n");
> + dev_warn(i2c->dev, "unfinished\n");
Are you sure this helps a regular user?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-01 17:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-29 21:58 [PATCH] i2c: mpc: add register documentation to Freescale I2C driver Danielle Costantino
2014-12-01 17:21 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).