* [PATCH 1/7] i2c-eg20t: Fix bus-idle waiting issue
@ 2011-09-21 7:51 Tomoya MORINAGA
2011-09-21 7:51 ` [PATCH 2/7] i2c-eg20t: Modify returned value s32 to long Tomoya MORINAGA
` (5 more replies)
0 siblings, 6 replies; 14+ messages in thread
From: Tomoya MORINAGA @ 2011-09-21 7:51 UTC (permalink / raw)
To: Jean Delvare, Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Qi Wang, yong.y.wang-ral2JQCrhuEAvxtiuMwx3w,
joel.clark-ral2JQCrhuEAvxtiuMwx3w,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w,
toshiharu-linux-ECg8zkTtlr0C6LszWs/t0g, Tomoya MORINAGA
Currently, when checking whether bus is idle or not,
if timeout occurs,
this function always returns success(zero).
This patch fixes the issue.
Signed-off-by: Tomoya MORINAGA <tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
---
drivers/i2c/busses/i2c-eg20t.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index 6565009..6add59f 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -286,7 +286,7 @@ static s32 pch_i2c_wait_for_bus_idle(struct i2c_algo_pch_data *adap,
pch_dbg(adap, "I2CSR = %x\n", ioread32(p + PCH_I2CSR));
- if (timeout == 0) {
+ if (!ktime_lt(ktime_get(), ns_val)) {
pch_err(adap, "%s: Timeout Error.return%d\n", __func__, -ETIME);
return -ETIME;
}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/7] i2c-eg20t: Modify returned value s32 to long
2011-09-21 7:51 [PATCH 1/7] i2c-eg20t: Fix bus-idle waiting issue Tomoya MORINAGA
@ 2011-09-21 7:51 ` Tomoya MORINAGA
2011-09-21 7:51 ` [PATCH 3/7] i2c-eg20t: delete 10bit access processing Tomoya MORINAGA
` (4 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: Tomoya MORINAGA @ 2011-09-21 7:51 UTC (permalink / raw)
To: Jean Delvare, Ben Dooks, linux-i2c, linux-kernel
Cc: Qi Wang, yong.y.wang, joel.clark, kok.howg.ewe, toshiharu-linux,
Tomoya MORINAGA
Type of wait_event_timeout is long not s32.
This patch replaces s32 with long.
Additionally, delete negative processing(ret < 0).
Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
---
drivers/i2c/busses/i2c-eg20t.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index 6add59f..21ade63 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -313,13 +313,9 @@ static void pch_i2c_start(struct i2c_algo_pch_data *adap)
*/
static s32 pch_i2c_wait_for_xfer_complete(struct i2c_algo_pch_data *adap)
{
- s32 ret;
+ long ret;
ret = wait_event_timeout(pch_event,
(adap->pch_event_flag != 0), msecs_to_jiffies(50));
- if (ret < 0) {
- pch_err(adap, "timeout: %x\n", adap->pch_event_flag);
- return ret;
- }
if (ret == 0) {
pch_err(adap, "timeout: %x\n", adap->pch_event_flag);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/7] i2c-eg20t: delete 10bit access processing
2011-09-21 7:51 [PATCH 1/7] i2c-eg20t: Fix bus-idle waiting issue Tomoya MORINAGA
2011-09-21 7:51 ` [PATCH 2/7] i2c-eg20t: Modify returned value s32 to long Tomoya MORINAGA
@ 2011-09-21 7:51 ` Tomoya MORINAGA
[not found] ` <1316591509-4433-3-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2011-09-21 7:51 ` [PATCH 4/7] i2c-eg20t: Separate error processing Tomoya MORINAGA
` (3 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Tomoya MORINAGA @ 2011-09-21 7:51 UTC (permalink / raw)
To: Jean Delvare, Ben Dooks, linux-i2c, linux-kernel
Cc: Qi Wang, yong.y.wang, joel.clark, kok.howg.ewe, toshiharu-linux,
Tomoya MORINAGA
Linux I2C core doesn't support 10bit access formally.
Additionally, we can't test with 10bit mode.
This patch deletes the 10bit access processing.
Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
---
drivers/i2c/busses/i2c-eg20t.c | 27 +++++++--------------------
1 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index 21ade63..a87a878 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -389,8 +389,6 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
u8 *buf;
u32 length;
u32 addr;
- u32 addr_2_msb;
- u32 addr_8_lsb;
s32 wrcount;
void __iomem *p = adap->pch_base_address;
@@ -410,25 +408,16 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
}
if (msgs->flags & I2C_M_TEN) {
- addr_2_msb = ((addr & I2C_MSB_2B_MSK) >> 7);
- iowrite32(addr_2_msb | TEN_BIT_ADDR_MASK, p + PCH_I2CDR);
- if (first)
- pch_i2c_start(adap);
- if (pch_i2c_wait_for_xfer_complete(adap) == 0 &&
- pch_i2c_getack(adap) == 0) {
- addr_8_lsb = (addr & I2C_ADDR_MSK);
- iowrite32(addr_8_lsb, p + PCH_I2CDR);
- } else {
- pch_i2c_stop(adap);
- return -ETIME;
- }
+ pch_err(adap, "10Bit access is not supported\n");
+ return -EINVAL;
} else {
/* set 7 bit slave address and R/W bit as 0 */
iowrite32(addr << 1, p + PCH_I2CDR);
- if (first)
- pch_i2c_start(adap);
}
+ if (first)
+ pch_i2c_start(adap);
+
if ((pch_i2c_wait_for_xfer_complete(adap) == 0) &&
(pch_i2c_getack(adap) == 0)) {
for (wrcount = 0; wrcount < length; ++wrcount) {
@@ -497,7 +486,6 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
u32 count;
u32 length;
u32 addr;
- u32 addr_2_msb;
void __iomem *p = adap->pch_base_address;
length = msgs->len;
@@ -513,9 +501,8 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
}
if (msgs->flags & I2C_M_TEN) {
- addr_2_msb = (((addr & I2C_MSB_2B_MSK) >> 7) | (I2C_RD));
- iowrite32(addr_2_msb | TEN_BIT_ADDR_MASK, p + PCH_I2CDR);
-
+ pch_err(adap, "10Bit access is not supported\n");
+ return -EINVAL;
} else {
/* 7 address bits + R/W bit */
addr = (((addr) << 1) | (I2C_RD));
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/7] i2c-eg20t: Separate error processing
2011-09-21 7:51 [PATCH 1/7] i2c-eg20t: Fix bus-idle waiting issue Tomoya MORINAGA
2011-09-21 7:51 ` [PATCH 2/7] i2c-eg20t: Modify returned value s32 to long Tomoya MORINAGA
2011-09-21 7:51 ` [PATCH 3/7] i2c-eg20t: delete 10bit access processing Tomoya MORINAGA
@ 2011-09-21 7:51 ` Tomoya MORINAGA
2011-09-21 7:51 ` [PATCH 5/7] i2c-eg20t: add stop sequence in case wait-event timeout occurs Tomoya MORINAGA
` (2 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: Tomoya MORINAGA @ 2011-09-21 7:51 UTC (permalink / raw)
To: Jean Delvare, Ben Dooks, linux-i2c, linux-kernel
Cc: Qi Wang, yong.y.wang, joel.clark, kok.howg.ewe, toshiharu-linux,
Tomoya MORINAGA
Error processing for NACK or wait-event must be precessed separately.
So divide wait-event error processing into NACK-receiving and timeout.
Add arbitration lost processing.
Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
---
drivers/i2c/busses/i2c-eg20t.c | 154 +++++++++++++++++++++++++--------------
1 files changed, 99 insertions(+), 55 deletions(-)
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index a87a878..b6d910d 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -390,6 +390,7 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
u32 length;
u32 addr;
s32 wrcount;
+ s32 rtn;
void __iomem *p = adap->pch_base_address;
length = msgs->len;
@@ -418,30 +419,48 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
if (first)
pch_i2c_start(adap);
- if ((pch_i2c_wait_for_xfer_complete(adap) == 0) &&
- (pch_i2c_getack(adap) == 0)) {
- for (wrcount = 0; wrcount < length; ++wrcount) {
- /* write buffer value to I2C data register */
- iowrite32(buf[wrcount], p + PCH_I2CDR);
- pch_dbg(adap, "writing %x to Data register\n",
- buf[wrcount]);
+ rtn = pch_i2c_wait_for_xfer_complete(adap);
+ if (rtn == 0) {
+ if (pch_i2c_getack(adap) == 1) {
+ pch_err(adap, "Receive NACK for slave address\
+ setting\n");
+ return -EIO;
+ }
+ } else if (rtn == -EIO) { /* Arbitration Lost */
+ pch_err(adap, "Lost Arbitration\n");
+ pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMAL_BIT);
+ pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMIF_BIT);
+ return -EAGAIN;
+ } else { /* wait-event timeout */
+ return -ETIME;
+ }
- if (pch_i2c_wait_for_xfer_complete(adap) != 0)
- return -ETIME;
+ for (wrcount = 0; wrcount < length; ++wrcount) {
+ /* write buffer value to I2C data register */
+ iowrite32(buf[wrcount], p + PCH_I2CDR);
+ pch_dbg(adap, "writing %x to Data register\n", buf[wrcount]);
- if (pch_i2c_getack(adap))
+ rtn = pch_i2c_wait_for_xfer_complete(adap);
+ if (rtn == 0) {
+ if (pch_i2c_getack(adap) == 1) {
+ pch_err(adap, "Receive NACK for slave address\
+ setting\n");
return -EIO;
+ }
+ pch_clrbit(adap->pch_base_address, PCH_I2CSR,
+ I2CMCF_BIT);
+ pch_clrbit(adap->pch_base_address, PCH_I2CSR,
+ I2CMIF_BIT);
+ } else { /* wait-event timeout */
+ return -ETIME;
}
+ }
- /* check if this is the last message */
- if (last)
- pch_i2c_stop(adap);
- else
- pch_i2c_repstart(adap);
- } else {
+ /* check if this is the last message */
+ if (last)
pch_i2c_stop(adap);
- return -EIO;
- }
+ else
+ pch_i2c_repstart(adap);
pch_dbg(adap, "return=%d\n", wrcount);
@@ -487,6 +506,7 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
u32 length;
u32 addr;
void __iomem *p = adap->pch_base_address;
+ s32 rtn;
length = msgs->len;
buf = msgs->buf;
@@ -513,56 +533,80 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
if (first)
pch_i2c_start(adap);
- if ((pch_i2c_wait_for_xfer_complete(adap) == 0) &&
- (pch_i2c_getack(adap) == 0)) {
- pch_dbg(adap, "return %d\n", 0);
+ rtn = pch_i2c_wait_for_xfer_complete(adap);
+ if (rtn == 0) {
+ if (pch_i2c_getack(adap) == 1) {
+ pch_err(adap, "Receive NACK for slave address\
+ setting\n");
+ return -EIO;
+ }
+ } else if (rtn == -EIO) { /* Arbitration Lost */
+ pch_err(adap, "Lost Arbitration\n");
+ pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMAL_BIT);
+ pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMIF_BIT);
+ return -EAGAIN;
+ } else { /* wait-event timeout */
+ pch_i2c_stop(adap);
+ return -ETIME;
+ }
- if (length == 0) {
- pch_i2c_stop(adap);
- ioread32(p + PCH_I2CDR); /* Dummy read needs */
+ if (length == 0) {
+ pch_i2c_stop(adap);
+ ioread32(p + PCH_I2CDR); /* Dummy read needs */
- count = length;
- } else {
- int read_index;
- int loop;
- pch_i2c_sendack(adap);
+ count = length;
+ } else {
+ int read_index;
+ int loop;
+ pch_i2c_sendack(adap);
- /* Dummy read */
- for (loop = 1, read_index = 0; loop < length; loop++) {
- buf[read_index] = ioread32(p + PCH_I2CDR);
+ /* Dummy read */
+ for (loop = 1, read_index = 0; loop < length; loop++) {
+ buf[read_index] = ioread32(p + PCH_I2CDR);
- if (loop != 1)
- read_index++;
+ if (loop != 1)
+ read_index++;
- if (pch_i2c_wait_for_xfer_complete(adap) != 0) {
- pch_i2c_stop(adap);
- return -ETIME;
+ rtn = pch_i2c_wait_for_xfer_complete(adap);
+ if (rtn == 0) {
+ if (pch_i2c_getack(adap) == 1) {
+ pch_err(adap, "Receive NACK for slave\
+ address setting\n");
+ return -EIO;
}
- } /* end for */
+ } else { /* wait-event timeout */
+ pch_i2c_stop(adap);
+ return -ETIME;
+ }
- pch_i2c_sendnack(adap);
+ } /* end for */
- buf[read_index] = ioread32(p + PCH_I2CDR);
+ pch_i2c_sendnack(adap);
- if (length != 1)
- read_index++;
+ buf[read_index] = ioread32(p + PCH_I2CDR); /* Read final - 1 */
- if (pch_i2c_wait_for_xfer_complete(adap) == 0) {
- if (last)
- pch_i2c_stop(adap);
- else
- pch_i2c_repstart(adap);
+ if (length != 1)
+ read_index++;
- buf[read_index++] = ioread32(p + PCH_I2CDR);
- count = read_index;
- } else {
- count = -ETIME;
+ rtn = pch_i2c_wait_for_xfer_complete(adap);
+ if (rtn == 0) {
+ if (pch_i2c_getack(adap) == 1) {
+ pch_err(adap, "Receive NACK for slave\
+ address setting\n");
+ return -EIO;
}
-
+ } else { /* wait-event timeout */
+ pch_i2c_stop(adap);
+ return -ETIME;
}
- } else {
- count = -ETIME;
- pch_i2c_stop(adap);
+
+ if (last)
+ pch_i2c_stop(adap);
+ else
+ pch_i2c_repstart(adap);
+
+ buf[read_index++] = ioread32(p + PCH_I2CDR); /* Read Final */
+ count = read_index;
}
return count;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/7] i2c-eg20t: add stop sequence in case wait-event timeout occurs
2011-09-21 7:51 [PATCH 1/7] i2c-eg20t: Fix bus-idle waiting issue Tomoya MORINAGA
` (2 preceding siblings ...)
2011-09-21 7:51 ` [PATCH 4/7] i2c-eg20t: Separate error processing Tomoya MORINAGA
@ 2011-09-21 7:51 ` Tomoya MORINAGA
2011-09-21 7:51 ` [PATCH 6/7] i2c-eg20t: Fix flag setting issue Tomoya MORINAGA
[not found] ` <1316591509-4433-1-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
5 siblings, 0 replies; 14+ messages in thread
From: Tomoya MORINAGA @ 2011-09-21 7:51 UTC (permalink / raw)
To: Jean Delvare, Ben Dooks, linux-i2c, linux-kernel
Cc: Qi Wang, yong.y.wang, joel.clark, kok.howg.ewe, toshiharu-linux,
Tomoya MORINAGA
add stop sequence in case wait-event timeout in write processing.
(read processing already had it)
Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
---
drivers/i2c/busses/i2c-eg20t.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index b6d910d..ab93d73 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -432,6 +432,7 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMIF_BIT);
return -EAGAIN;
} else { /* wait-event timeout */
+ pch_i2c_stop(adap);
return -ETIME;
}
@@ -452,6 +453,7 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
pch_clrbit(adap->pch_base_address, PCH_I2CSR,
I2CMIF_BIT);
} else { /* wait-event timeout */
+ pch_i2c_stop(adap);
return -ETIME;
}
}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 6/7] i2c-eg20t: Fix flag setting issue
2011-09-21 7:51 [PATCH 1/7] i2c-eg20t: Fix bus-idle waiting issue Tomoya MORINAGA
` (3 preceding siblings ...)
2011-09-21 7:51 ` [PATCH 5/7] i2c-eg20t: add stop sequence in case wait-event timeout occurs Tomoya MORINAGA
@ 2011-09-21 7:51 ` Tomoya MORINAGA
[not found] ` <1316591509-4433-1-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
5 siblings, 0 replies; 14+ messages in thread
From: Tomoya MORINAGA @ 2011-09-21 7:51 UTC (permalink / raw)
To: Jean Delvare, Ben Dooks, linux-i2c, linux-kernel
Cc: Qi Wang, yong.y.wang, joel.clark, kok.howg.ewe, toshiharu-linux,
Tomoya MORINAGA
Currently, in case occurring abnormal event,
internal flag variable(=pch_event_flag) is not reset.
This patch fixes the issue.
Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
---
drivers/i2c/busses/i2c-eg20t.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index ab93d73..6d6baf0 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -319,11 +319,13 @@ static s32 pch_i2c_wait_for_xfer_complete(struct i2c_algo_pch_data *adap)
if (ret == 0) {
pch_err(adap, "timeout: %x\n", adap->pch_event_flag);
+ adap->pch_event_flag = 0;
return -ETIMEDOUT;
}
if (adap->pch_event_flag & I2C_ERROR_MASK) {
pch_err(adap, "error bits set: %x\n", adap->pch_event_flag);
+ adap->pch_event_flag = 0;
return -EIO;
}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 7/7] i2c-eg20t: Add initialize processing in case i2c-error occurs
[not found] ` <1316591509-4433-1-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
@ 2011-09-21 7:51 ` Tomoya MORINAGA
0 siblings, 0 replies; 14+ messages in thread
From: Tomoya MORINAGA @ 2011-09-21 7:51 UTC (permalink / raw)
To: Jean Delvare, Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Qi Wang, yong.y.wang-ral2JQCrhuEAvxtiuMwx3w,
joel.clark-ral2JQCrhuEAvxtiuMwx3w,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w,
toshiharu-linux-ECg8zkTtlr0C6LszWs/t0g, Tomoya MORINAGA
In case disconnecting physical connection,
need to initialize i2c device for retry access.
This patch adds initialize process in case bus-idle fails and Lost arbitration.
Signed-off-by: Tomoya MORINAGA <tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
---
drivers/i2c/busses/i2c-eg20t.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index 6d6baf0..b594378 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -288,6 +288,7 @@ static s32 pch_i2c_wait_for_bus_idle(struct i2c_algo_pch_data *adap,
if (!ktime_lt(ktime_get(), ns_val)) {
pch_err(adap, "%s: Timeout Error.return%d\n", __func__, -ETIME);
+ pch_i2c_init(adap);
return -ETIME;
}
@@ -432,6 +433,7 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
pch_err(adap, "Lost Arbitration\n");
pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMAL_BIT);
pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMIF_BIT);
+ pch_i2c_init(adap);
return -EAGAIN;
} else { /* wait-event timeout */
pch_i2c_stop(adap);
@@ -548,6 +550,7 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
pch_err(adap, "Lost Arbitration\n");
pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMAL_BIT);
pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMIF_BIT);
+ pch_i2c_init(adap);
return -EAGAIN;
} else { /* wait-event timeout */
pch_i2c_stop(adap);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* RE: [PATCH 3/7] i2c-eg20t: delete 10bit access processing
[not found] ` <1316591509-4433-3-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
@ 2011-09-21 15:42 ` Jeffrey (Sheng-Hui) Chu
[not found] ` <B6A520E9CD57404AAFC0831E4FB39541A98073AC7E-4wnuKdaqIVJdD26/7+am4baTQr+y5IJFqs7JOtOhHmkAvxtiuMwx3w@public.gmane.org>
2011-10-04 20:55 ` Ben Dooks
1 sibling, 1 reply; 14+ messages in thread
From: Jeffrey (Sheng-Hui) Chu @ 2011-09-21 15:42 UTC (permalink / raw)
To: Tomoya MORINAGA, Jean Delvare, Ben Dooks,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Qi Wang, yong.y.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
joel.clark-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
toshiharu-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org
There is i2c device coming out that uses 10-bit address.
Regards,
-Jeffrey
-----Original Message-----
From: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Tomoya MORINAGA
Sent: Wednesday, September 21, 2011 3:52 AM
To: Jean Delvare; Ben Dooks; linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Qi Wang; yong.y.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org; joel.clark-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org; kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org; toshiharu-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org; Tomoya MORINAGA
Subject: [PATCH 3/7] i2c-eg20t: delete 10bit access processing
Linux I2C core doesn't support 10bit access formally.
Additionally, we can't test with 10bit mode.
This patch deletes the 10bit access processing.
Signed-off-by: Tomoya MORINAGA <tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
---
drivers/i2c/busses/i2c-eg20t.c | 27 +++++++--------------------
1 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c index 21ade63..a87a878 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -389,8 +389,6 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
u8 *buf;
u32 length;
u32 addr;
- u32 addr_2_msb;
- u32 addr_8_lsb;
s32 wrcount;
void __iomem *p = adap->pch_base_address;
@@ -410,25 +408,16 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
}
if (msgs->flags & I2C_M_TEN) {
- addr_2_msb = ((addr & I2C_MSB_2B_MSK) >> 7);
- iowrite32(addr_2_msb | TEN_BIT_ADDR_MASK, p + PCH_I2CDR);
- if (first)
- pch_i2c_start(adap);
- if (pch_i2c_wait_for_xfer_complete(adap) == 0 &&
- pch_i2c_getack(adap) == 0) {
- addr_8_lsb = (addr & I2C_ADDR_MSK);
- iowrite32(addr_8_lsb, p + PCH_I2CDR);
- } else {
- pch_i2c_stop(adap);
- return -ETIME;
- }
+ pch_err(adap, "10Bit access is not supported\n");
+ return -EINVAL;
} else {
/* set 7 bit slave address and R/W bit as 0 */
iowrite32(addr << 1, p + PCH_I2CDR);
- if (first)
- pch_i2c_start(adap);
}
+ if (first)
+ pch_i2c_start(adap);
+
if ((pch_i2c_wait_for_xfer_complete(adap) == 0) &&
(pch_i2c_getack(adap) == 0)) {
for (wrcount = 0; wrcount < length; ++wrcount) { @@ -497,7 +486,6 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
u32 count;
u32 length;
u32 addr;
- u32 addr_2_msb;
void __iomem *p = adap->pch_base_address;
length = msgs->len;
@@ -513,9 +501,8 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
}
if (msgs->flags & I2C_M_TEN) {
- addr_2_msb = (((addr & I2C_MSB_2B_MSK) >> 7) | (I2C_RD));
- iowrite32(addr_2_msb | TEN_BIT_ADDR_MASK, p + PCH_I2CDR);
-
+ pch_err(adap, "10Bit access is not supported\n");
+ return -EINVAL;
} else {
/* 7 address bits + R/W bit */
addr = (((addr) << 1) | (I2C_RD));
--
1.7.4.4
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/7] i2c-eg20t: delete 10bit access processing
[not found] ` <B6A520E9CD57404AAFC0831E4FB39541A98073AC7E-4wnuKdaqIVJdD26/7+am4baTQr+y5IJFqs7JOtOhHmkAvxtiuMwx3w@public.gmane.org>
@ 2011-09-22 0:13 ` Tomoya MORINAGA
[not found] ` <4E7A7DBA.3020406-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
0 siblings, 1 reply; 14+ messages in thread
From: Tomoya MORINAGA @ 2011-09-22 0:13 UTC (permalink / raw)
To: Jeffrey (Sheng-Hui) Chu
Cc: Jean Delvare, Ben Dooks,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Qi Wang,
yong.y.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
joel.clark-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
toshiharu-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org
(2011/09/22 0:42), Jeffrey (Sheng-Hui) Chu wrote:
> There is i2c device coming out that uses 10-bit address.
Thank you for your information.
We want to test 10-bit mode using the device.
So let me know the device information ?
Anyway, Now, kernel i2c-core is EXPERIMENTAL stage for 10-bit mode like
below.
(Documentation/i2c/ten-bit-addresses)
WARNING! The current 10 bit address support is EXPERIMENTAL. There
are several places in the code that will cause SEVERE PROBLEMS with
10 bit addresses, even though there is some basic handling and
hooks. Also,
almost no supported adapter handles the 10 bit addresses correctly.
As soon as a real 10 bit address device is spotted 'in the wild', we
can and will add proper support. Right now, 10 bit address devices
are defined by the I2C protocol, but we have never seen a single
device which supports them.
After kernel supports 10bit-mode formally, we will add the function to
i2c-eg20t again.
Thanks,
tomoya
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH 3/7] i2c-eg20t: delete 10bit access processing
[not found] ` <4E7A7DBA.3020406-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
@ 2011-09-22 17:49 ` Jeffrey (Sheng-Hui) Chu
[not found] ` <B6A520E9CD57404AAFC0831E4FB39541A98073AF26-4wnuKdaqIVJdD26/7+am4baTQr+y5IJFqs7JOtOhHmkAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 14+ messages in thread
From: Jeffrey (Sheng-Hui) Chu @ 2011-09-22 17:49 UTC (permalink / raw)
To: Tomoya MORINAGA
Cc: Jean Delvare, Ben Dooks,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Qi Wang,
yong.y.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
joel.clark-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
toshiharu-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org,
Aaron Smith
The device is BCM20791. Please contact Aaron Smith (aarons@broadcom.com) for evaluation.
By the way, the existing handling of 10-bit address in the patch you intended to delete does not work. You'll need to fix that before you can test with the device successfully.
For the write operation, it's a easy fix:
@@ -410,25 +408,16 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
}
if (msgs->flags & I2C_M_TEN) {
- addr_2_msb = ((addr & I2C_MSB_2B_MSK) >> 7);
+ addr_2_msb = ((addr & I2C_MSB_2B_MSK) >> 7) & 0x06;
For the read operation, static s32 pch_i2c_readbytes(), you'll need to do a write followed by a restart and a read... please refer to the i2c spec...
Regards,
-Jeffrey
-----Original Message-----
From: Tomoya MORINAGA [mailto:tomoya-linux@dsn.okisemi.com]
Sent: Wednesday, September 21, 2011 8:14 PM
To: Jeffrey (Sheng-Hui) Chu
Cc: Jean Delvare; Ben Dooks; linux-i2c@vger.kernel.org; linux-kernel@vger.kernel.org; Qi Wang; yong.y.wang@intel.com; joel.clark@intel.com; kok.howg.ewe@intel.com; toshiharu-linux@dsn.okisemi.com
Subject: Re: [PATCH 3/7] i2c-eg20t: delete 10bit access processing
(2011/09/22 0:42), Jeffrey (Sheng-Hui) Chu wrote:
> There is i2c device coming out that uses 10-bit address.
Thank you for your information.
We want to test 10-bit mode using the device.
So let me know the device information ?
Anyway, Now, kernel i2c-core is EXPERIMENTAL stage for 10-bit mode like below.
(Documentation/i2c/ten-bit-addresses)
WARNING! The current 10 bit address support is EXPERIMENTAL. There
are several places in the code that will cause SEVERE PROBLEMS with
10 bit addresses, even though there is some basic handling and
hooks. Also,
almost no supported adapter handles the 10 bit addresses correctly.
As soon as a real 10 bit address device is spotted 'in the wild', we
can and will add proper support. Right now, 10 bit address devices
are defined by the I2C protocol, but we have never seen a single
device which supports them.
After kernel supports 10bit-mode formally, we will add the function to i2c-eg20t again.
Thanks,
tomoya
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/7] i2c-eg20t: delete 10bit access processing
[not found] ` <B6A520E9CD57404AAFC0831E4FB39541A98073AF26-4wnuKdaqIVJdD26/7+am4baTQr+y5IJFqs7JOtOhHmkAvxtiuMwx3w@public.gmane.org>
@ 2011-09-27 0:05 ` Tomoya MORINAGA
[not found] ` <4E811338.2030005-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
0 siblings, 1 reply; 14+ messages in thread
From: Tomoya MORINAGA @ 2011-09-27 0:05 UTC (permalink / raw)
To: Jeffrey (Sheng-Hui) Chu
Cc: Jean Delvare, Ben Dooks,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Qi Wang,
yong.y.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
joel.clark-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
toshiharu-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org,
Aaron Smith
(2011/09/23 2:49), Jeffrey (Sheng-Hui) Chu wrote:
> The device is BCM20791. Please contact Aaron Smith (aarons-dY08KVG/lbpWk0Htik3J/w@public.gmane.org) for evaluation.
Though googling the device, I can't find the device.
Broadcom website too.
>
> By the way, the existing handling of 10-bit address in the patch you intended to delete does not work. You'll need to fix that before you can test with the device successfully.
>
> For the write operation, it's a easy fix:
>
> @@ -410,25 +408,16 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
> }
>
> if (msgs->flags& I2C_M_TEN) {
> - addr_2_msb = ((addr& I2C_MSB_2B_MSK)>> 7);
> + addr_2_msb = ((addr& I2C_MSB_2B_MSK)>> 7)& 0x06;
>
>
> For the read operation, static s32 pch_i2c_readbytes(), you'll need to do a write followed by a restart and a read... please refer to the i2c spec...
>
> Regards,
Thank you for your indication.
We will update this after supporting 10bit access.
Thanks,
tomoya
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH 3/7] i2c-eg20t: delete 10bit access processing
[not found] ` <4E811338.2030005-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
@ 2011-09-27 13:06 ` Jeffrey (Sheng-Hui) Chu
0 siblings, 0 replies; 14+ messages in thread
From: Jeffrey (Sheng-Hui) Chu @ 2011-09-27 13:06 UTC (permalink / raw)
To: Tomoya MORINAGA
Cc: Jean Delvare, Ben Dooks,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Qi Wang,
yong.y.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
joel.clark-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
toshiharu-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org,
Aaron Smith
http://www.engadget.com/2011/09/26/broadcom-unveils-smaller-more-power-efficient-40nm-nfc-chips/
-----Original Message-----
From: Tomoya MORINAGA [mailto:tomoya-linux@dsn.okisemi.com]
Sent: Monday, September 26, 2011 8:05 PM
To: Jeffrey (Sheng-Hui) Chu
Cc: Jean Delvare; Ben Dooks; linux-i2c@vger.kernel.org; linux-kernel@vger.kernel.org; Qi Wang; yong.y.wang@intel.com; joel.clark@intel.com; kok.howg.ewe@intel.com; toshiharu-linux@dsn.okisemi.com; Aaron Smith
Subject: Re: [PATCH 3/7] i2c-eg20t: delete 10bit access processing
(2011/09/23 2:49), Jeffrey (Sheng-Hui) Chu wrote:
> The device is BCM20791. Please contact Aaron Smith (aarons@broadcom.com) for evaluation.
Though googling the device, I can't find the device.
Broadcom website too.
>
> By the way, the existing handling of 10-bit address in the patch you intended to delete does not work. You'll need to fix that before you can test with the device successfully.
>
> For the write operation, it's a easy fix:
>
> @@ -410,25 +408,16 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,
> }
>
> if (msgs->flags& I2C_M_TEN) {
> - addr_2_msb = ((addr& I2C_MSB_2B_MSK)>> 7);
> + addr_2_msb = ((addr& I2C_MSB_2B_MSK)>> 7)& 0x06;
>
>
> For the read operation, static s32 pch_i2c_readbytes(), you'll need to do a write followed by a restart and a read... please refer to the i2c spec...
>
> Regards,
Thank you for your indication.
We will update this after supporting 10bit access.
Thanks,
tomoya
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/7] i2c-eg20t: delete 10bit access processing
[not found] ` <1316591509-4433-3-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2011-09-21 15:42 ` Jeffrey (Sheng-Hui) Chu
@ 2011-10-04 20:55 ` Ben Dooks
[not found] ` <20111004205536.GA13323-RazCHl0VsYgkUSuvROHNpA@public.gmane.org>
1 sibling, 1 reply; 14+ messages in thread
From: Ben Dooks @ 2011-10-04 20:55 UTC (permalink / raw)
To: Tomoya MORINAGA
Cc: Jean Delvare, Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Qi Wang,
yong.y.wang-ral2JQCrhuEAvxtiuMwx3w,
joel.clark-ral2JQCrhuEAvxtiuMwx3w,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w,
toshiharu-linux-ECg8zkTtlr0C6LszWs/t0g
On Wed, Sep 21, 2011 at 04:51:45PM +0900, Tomoya MORINAGA wrote:
> Linux I2C core doesn't support 10bit access formally.
> Additionally, we can't test with 10bit mode.
> This patch deletes the 10bit access processing.
do we want to keep this patch in the series? if not, can
you post a new series with this dropped from it?
--
Ben
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/7] i2c-eg20t: delete 10bit access processing
[not found] ` <20111004205536.GA13323-RazCHl0VsYgkUSuvROHNpA@public.gmane.org>
@ 2011-10-05 1:59 ` Tomoya MORINAGA
0 siblings, 0 replies; 14+ messages in thread
From: Tomoya MORINAGA @ 2011-10-05 1:59 UTC (permalink / raw)
To: Ben Dooks
Cc: Jean Delvare, Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Qi Wang,
yong.y.wang-ral2JQCrhuEAvxtiuMwx3w,
joel.clark-ral2JQCrhuEAvxtiuMwx3w,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w
Hi Ben,
(2011/10/05 5:55), Ben Dooks wrote:
> On Wed, Sep 21, 2011 at 04:51:45PM +0900, Tomoya MORINAGA wrote:
>> Linux I2C core doesn't support 10bit access formally.
>> Additionally, we can't test with 10bit mode.
>> This patch deletes the 10bit access processing.
>
> do we want to keep this patch in the series? if not, can
> you post a new series with this dropped from it?
>
Yes, I want to delete 10bit access process.
Or do you want to keep the 10bit code in i2c-eg20t.c ?
If you want, I can obey your opinion.
BTW, we found previous patch series was unsatisfactory.
So, we will post v2 patch series by today.
Thanks,
--
tomoya
ROHM Co., Ltd.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2011-10-05 1:59 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-21 7:51 [PATCH 1/7] i2c-eg20t: Fix bus-idle waiting issue Tomoya MORINAGA
2011-09-21 7:51 ` [PATCH 2/7] i2c-eg20t: Modify returned value s32 to long Tomoya MORINAGA
2011-09-21 7:51 ` [PATCH 3/7] i2c-eg20t: delete 10bit access processing Tomoya MORINAGA
[not found] ` <1316591509-4433-3-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2011-09-21 15:42 ` Jeffrey (Sheng-Hui) Chu
[not found] ` <B6A520E9CD57404AAFC0831E4FB39541A98073AC7E-4wnuKdaqIVJdD26/7+am4baTQr+y5IJFqs7JOtOhHmkAvxtiuMwx3w@public.gmane.org>
2011-09-22 0:13 ` Tomoya MORINAGA
[not found] ` <4E7A7DBA.3020406-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2011-09-22 17:49 ` Jeffrey (Sheng-Hui) Chu
[not found] ` <B6A520E9CD57404AAFC0831E4FB39541A98073AF26-4wnuKdaqIVJdD26/7+am4baTQr+y5IJFqs7JOtOhHmkAvxtiuMwx3w@public.gmane.org>
2011-09-27 0:05 ` Tomoya MORINAGA
[not found] ` <4E811338.2030005-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2011-09-27 13:06 ` Jeffrey (Sheng-Hui) Chu
2011-10-04 20:55 ` Ben Dooks
[not found] ` <20111004205536.GA13323-RazCHl0VsYgkUSuvROHNpA@public.gmane.org>
2011-10-05 1:59 ` Tomoya MORINAGA
2011-09-21 7:51 ` [PATCH 4/7] i2c-eg20t: Separate error processing Tomoya MORINAGA
2011-09-21 7:51 ` [PATCH 5/7] i2c-eg20t: add stop sequence in case wait-event timeout occurs Tomoya MORINAGA
2011-09-21 7:51 ` [PATCH 6/7] i2c-eg20t: Fix flag setting issue Tomoya MORINAGA
[not found] ` <1316591509-4433-1-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2011-09-21 7:51 ` [PATCH 7/7] i2c-eg20t: Add initialize processing in case i2c-error occurs Tomoya MORINAGA
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).