i2c-eg20t: Modify MODULE_AUTHOR's email address
PATCH 1/3 i2c-eg20t: Modify MODULE_AUTHOR's email address
--- drivers/i2c/busses/i2c-eg20t.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-eg20t.c +1 -1
@@ -1063,6 +1063,6 @@ module_exit(pch_pci_exit);MODULE_DESCRIPTION ("Intel EG20T PCH/LAPIS Semico ML7213/ML7223/ML7831 IOH I2C" );MODULE_LICENSE ("GPL" ); -MODULE_AUTHOR ("Tomoya MORINAGA. <[email protected]>" ); +MODULE_AUTHOR ("Tomoya MORINAGA. <[email protected]>" );module_param (pch_i2c_speed, int, (S_IRUSR |S_IWUSR ));module_param (pch_clk, int, (S_IRUSR |S_IWUSR ));
Signature · 1 line
1.7.7.6
PATCH 2/3 i2c-eg20t: Call init() when wait-event timeout occurs
--- drivers/i2c/busses/i2c-eg20t.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
drivers/i2c/busses/i2c-eg20t.c +16 -0
@@ -445,7 +445,9 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,pch_i2c_init (adap);return -EAGAIN ; }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; } }else {
@@ -469,7 +471,9 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,pch_i2c_init (adap);return -EAGAIN ; }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; }
@@ -490,7 +494,9 @@ 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_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; } }
@@ -598,7 +604,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,pch_i2c_init (adap);return -EAGAIN ; }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; }pch_i2c_restart (adap);
@@ -621,7 +629,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,pch_i2c_init (adap);return -EAGAIN ; }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; } }else {
@@ -648,7 +658,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,pch_i2c_init (adap);return -EAGAIN ; }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; }
@@ -677,7 +689,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,return -EIO ; } }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; }
@@ -698,7 +712,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,return -EIO ; } }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; }
Signature · 1 line
1.7.7.6
PATCH 3/3 i2c-eg20t: change timeout value 50msec to 1000msec
In reply to Tomoya MORINAGACurrently, during i2c works alone, wait-event timeout is not occurred. However, as CPU load increases, timeout occurs frequently. So, I modified like this patch.
Modifying like this patch, I've never seen the timeout event with high load test.
--- drivers/i2c/busses/i2c-eg20t.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-eg20t.c +1 -1
@@ -324,7 +324,7 @@ static s32 pch_i2c_wait_for_xfer_complete(struct i2c_algo_pch_data *adap) {long ret; ret =wait_event_timeout (pch_event, - (adap->pch_event_flag !=0 ),msecs_to_jiffies (50 )); + (adap->pch_event_flag !=0 ),msecs_to_jiffies (1000 ));if (ret ==0 ) {pch_err (adap,"timeout: %x\n" , adap->pch_event_flag);
Signature · 1 line
1.7.7.6
PATCH v2 2/3 i2c-eg20t: Call init() when wait-event timeout occurs
In reply to Tomoya MORINAGAv1 had checkpatch warnings.
---
v2
- Updated for checkpatch
--- drivers/i2c/busses/i2c-eg20t.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-)
drivers/i2c/busses/i2c-eg20t.c +24 -0
@@ -445,7 +445,10 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,pch_i2c_init (adap);return -EAGAIN ; }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , + __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; } }else {
@@ -469,7 +472,10 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,pch_i2c_init (adap);return -EAGAIN ; }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , + __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; }
@@ -490,7 +496,10 @@ 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_err (adap,"%s(L.%d):wait-event timeout\n" , + __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; } }
@@ -598,7 +607,10 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,pch_i2c_init (adap);return -EAGAIN ; }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , + __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; }pch_i2c_restart (adap);
@@ -621,7 +633,10 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,pch_i2c_init (adap);return -EAGAIN ; }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , + __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; } }else {
@@ -648,7 +663,10 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,pch_i2c_init (adap);return -EAGAIN ; }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , + __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; }
@@ -677,7 +695,10 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,return -EIO ; } }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , + __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; }
@@ -698,7 +719,10 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,return -EIO ; } }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , + __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; }
Signature · 1 line
1.7.7.6
Wolfram Sang
AppliedQuoted 2 lines · Tomoya MORINAGA
Signed-off-by Tomoya MORINAGA <[email protected]>
Applied.
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Wolfram Sang
AppliedRe: [PATCH 3/3] i2c-eg20t: change timeout value 50msec to 1000msec
In reply to Tomoya MORINAGAQuoted 7 lines · Tomoya MORINAGA
Currently, during i2c works alone, wait-event timeout is not occurred. However, as CPU load increases, timeout occurs frequently. So, I modified like this patch.
Modifying like this patch, I've never seen the timeout event with high load test.Signed-off-by Tomoya MORINAGA <[email protected]>
Applied. (I think we need to clarify the timeouts in I2C, but for now this has to do.)
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH 2/3] i2c-eg20t: Call init() when wait-event timeout occurs
In reply to Tomoya MORINAGAQuoted 2 lines · Tomoya MORINAGA
Signed-off-by Tomoya MORINAGA <[email protected]>
Woha, that's copy&paste code all over. May I ask to refactor this? Something like:
rtn = pch_..._wait_for_checked_xfer(); if (rtn) return rtn; // All the things you have to do when rtn == 0
in that new function (the name was only a suugestion), you can do all the checks which are now copy-pasted, e.g.:
458 rtn = pch_i2c_wait_for_xfer_complete(adap);
459 if (rtn == 0) {
460 if (pch_i2c_getack(adap)) {
461 pch_dbg(adap, "Receive NACK for slave address"
462 "setting\n");
463 return -EIO;
464 }
465 } else if (rtn == -EIO) { /* Arbitration Lost */
466 pch_err(adap, "Lost Arbitration\n");
467 pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMAL_BIT);
468 pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMIF_BIT);
469 pch_i2c_init(adap);
470 return -EAGAIN;
471 } else { /* wait-event timeout */
472 pch_i2c_stop(adap);
// Your current fixes added here 473 return -ETIME;
474 }
return 0;
It is only pseudo-code, but I think it can be done and will help the driver.
Thanks,
Wolfram
Quoted 91 lines
--- drivers/i2c/busses/i2c-eg20t.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)drivers/i2c/busses/i2c-eg20t.c +16
-0@@ -445,7 +445,9 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,pch_i2c_init (adap);return -EAGAIN ; }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; } }else {@@ -469,7 +471,9 @@ static s32 pch_i2c_writebytes(struct i2c_adapter *i2c_adap,pch_i2c_init (adap);return -EAGAIN ; }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; }@@ -490,7 +494,9 @@ 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_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; } }@@ -598,7 +604,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,pch_i2c_init (adap);return -EAGAIN ; }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; }pch_i2c_restart (adap);@@ -621,7 +629,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,pch_i2c_init (adap);return -EAGAIN ; }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; } }else {@@ -648,7 +658,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,pch_i2c_init (adap);return -EAGAIN ; }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; }@@ -677,7 +689,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,return -EIO ; } }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; }@@ -698,7 +712,9 @@ static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,return -EIO ; } }else {/* wait-event timeout */ +pch_err (adap,"%s(L.%d):wait-event timeout\n" , __func__, __LINE__);pch_i2c_stop (adap); +pch_i2c_init (adap);return -ETIME ; }Signature · 1 line
1.7.7.6
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH 2/3] i2c-eg20t: Call init() when wait-event timeout occurs
Quoted 35 lines · Wolfram Sang
Quoted 2 lines · Tomoya MORINAGA
Signed-off-by Tomoya MORINAGA <[email protected]>Woha, that's copy&paste code all over. May I ask to refactor this? Something like:
rtn = pch_..._wait_for_checked_xfer(); if (rtn)
return rtn;
// All the things you have to do when rtn == 0in that new function (the name was only a suugestion), you can do all the checks which are now copy-pasted, e.g.:
458 rtn =
pch_i2c_wait_for_xfer_complete(adap);
459 if (rtn == 0) {
460 if (pch_i2c_getack(adap)) {
461 pch_dbg(adap, "Receive NACK for slave address" 462 "setting\n");
463 return-EIO;
464 }
465 } else if (rtn ==-EIO) { /* Arbitration Lost */
466pch_err(adap, "Lost Arbitration\n");
467pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMAL_BIT); 468pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMIF_BIT); 469pch_i2c_init(adap);
470 return-EAGAIN;
471 } else { /* wait-event timeout */
472pch_i2c_stop(adap);
// Your current fixes added here
473 return-ETIME;
474 }
return 0;
Quoted 2 lines
It is only pseudo-code, but I think it can be done and will help the driver.
OK.
I'm ready to submit new patch you are saying.
So, firstly, could you accept this patch ? After your accept, new patch series can be applicable.
thanks.
Signature · 2 lines
ROHM Co., Ltd. tomoya
Wolfram Sang
AppliedRe: [PATCH 2/3] i2c-eg20t: Call init() when wait-event timeout occurs
Quoted 36 lines · Tomoya MORINAGA
Quoted 35 lines · Wolfram Sang
Quoted 2 lines · Tomoya MORINAGA
Signed-off-by Tomoya MORINAGA <[email protected]>Woha, that's copy&paste code all over. May I ask to refactor this? Something like:
rtn = pch_..._wait_for_checked_xfer(); if (rtn)
return rtn;
// All the things you have to do when rtn == 0in that new function (the name was only a suugestion), you can do all the checks which are now copy-pasted, e.g.:
458 rtn =
pch_i2c_wait_for_xfer_complete(adap);
459 if (rtn == 0) {
460 if (pch_i2c_getack(adap)) {
461 pch_dbg(adap, "Receive NACK for slave address" 462 "setting\n");
463 return-EIO;
464 }
465 } else if (rtn ==-EIO) { /* Arbitration Lost */
466pch_err(adap, "Lost Arbitration\n");
467pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMAL_BIT); 468pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMIF_BIT); 469pch_i2c_init(adap);
470 return-EAGAIN;
471 } else { /* wait-event timeout */
472pch_i2c_stop(adap);
// Your current fixes added here
473 return-ETIME;
474 }
return 0;
Quoted 5 lines
Quoted 2 lines
It is only pseudo-code, but I think it can be done and will help the driver.
OK.
I'm ready to submit new patch you are saying.
Applied to next, thanks to the follow up patches :)
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |