i2c: mpc: add register documentation to Freescale I2C driver
Subsystems (2)
PATCH 1/1 i2c: mpc: add register documentation to Freescale I2C driver
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 <[email protected]>
drivers/i2c/busses/i2c-mpc.c +27 -22
@@ -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 (); }
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 1 line · Danielle Costantino
i2c: mpc: add register documentation to Freescale I2C driver
This should be in one patch.
Quoted 2 lines
return
-ETIMEDOUTfor all time-out error conditions
This should be in a seperate patch.
Quoted 1 line
and warn on arbitration lost.
And this should be dropped. "Arbitration lost" lost is not an error, it is specified behaviour of I2C.
drivers/i2c/busses/i2c-mpc.c line 166
Quoted 3 lines
if (!(cmd_err & CSR_MCF)) {drivers/i2c/busses/i2c-mpc.c +1
-1-dev_dbg (i2c->dev,"unfinished\n" ); +dev_warn (i2c->dev,"unfinished\n" );
Are you sure this helps a regular user?