Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1259280 > unrolled thread
| Started by | Jisheng Zhang <jszhang@marvell.com> |
|---|---|
| First post | 2015-10-30 08:50 +0100 |
| Last post | 2015-11-02 04:40 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] i2c: designware: Don't mask TX_EMPTY if write is in progress Jisheng Zhang <jszhang@marvell.com> - 2015-10-30 08:50 +0100
Re: [PATCH] i2c: designware: Don't mask TX_EMPTY if write is in progress Jarkko Nikula <jarkko.nikula@linux.intel.com> - 2015-10-30 13:10 +0100
Re: [PATCH] i2c: designware: Don't mask TX_EMPTY if write is in progress Jisheng Zhang <jszhang@marvell.com> - 2015-11-02 04:40 +0100
| From | Jisheng Zhang <jszhang@marvell.com> |
|---|---|
| Date | 2015-10-30 08:50 +0100 |
| Subject | [PATCH] i2c: designware: Don't mask TX_EMPTY if write is in progress |
| Message-ID | <qpcBI-30K-17@gated-at.bofh.it> |
Currently when i2c_msg index search is completed, TX_EMPTY interrupt will be masked. But if the size of i2c_msg data is longer than the size of the tx buffer, we still need TX_EMPTY interrupt, otherwise we will get "controller timed out" error. This patch fixes this issue by only masking TX_EMPTY if i2c_msg index search is completed and write is not in progress. Signed-off-by: Jisheng Zhang <jszhang@marvell.com> --- drivers/i2c/busses/i2c-designware-core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c index 7441cdc..a2eb212 100644 --- a/drivers/i2c/busses/i2c-designware-core.c +++ b/drivers/i2c/busses/i2c-designware-core.c @@ -542,10 +542,11 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev) } /* - * If i2c_msg index search is completed, we don't need TX_EMPTY - * interrupt any more. + * If i2c_msg index search is completed and writing is not in progress, + * we don't need TX_EMPTY interrupt any more. */ - if (dev->msg_write_idx == dev->msgs_num) + if (dev->msg_write_idx == dev->msgs_num && + !(dev->status & STATUS_WRITE_IN_PROGRESS)) intr_mask &= ~DW_IC_INTR_TX_EMPTY; if (dev->msg_err) -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Jarkko Nikula <jarkko.nikula@linux.intel.com> |
|---|---|
| Date | 2015-10-30 13:10 +0100 |
| Message-ID | <qpgFj-5Eg-3@gated-at.bofh.it> |
| In reply to | #1259280 |
Hi On 10/30/2015 09:37 AM, Jisheng Zhang wrote: > Currently when i2c_msg index search is completed, TX_EMPTY interrupt > will be masked. But if the size of i2c_msg data is longer than the size > of the tx buffer, we still need TX_EMPTY interrupt, otherwise we will > get "controller timed out" error. > > This patch fixes this issue by only masking TX_EMPTY if i2c_msg index > search is completed and write is not in progress. > > Signed-off-by: Jisheng Zhang <jszhang@marvell.com> > --- > drivers/i2c/busses/i2c-designware-core.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c > index 7441cdc..a2eb212 100644 > --- a/drivers/i2c/busses/i2c-designware-core.c > +++ b/drivers/i2c/busses/i2c-designware-core.c > @@ -542,10 +542,11 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev) > } > > /* > - * If i2c_msg index search is completed, we don't need TX_EMPTY > - * interrupt any more. > + * If i2c_msg index search is completed and writing is not in progress, > + * we don't need TX_EMPTY interrupt any more. > */ > - if (dev->msg_write_idx == dev->msgs_num) > + if (dev->msg_write_idx == dev->msgs_num && > + !(dev->status & STATUS_WRITE_IN_PROGRESS)) > intr_mask &= ~DW_IC_INTR_TX_EMPTY; > This looks a possible scenario here. What I'm wondering how is the transfer ending and what condition in i2c_dw_isr() causes the complete() call? Assuming we break the for loop in i2c_dw_xfer_msg() with buf_len > 0 and dev->msg_write_idx == dev->msgs_num how we get back inside the for loop for writing the remaining bytes and stop command? -- Jarkko -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jisheng Zhang <jszhang@marvell.com> |
|---|---|
| Date | 2015-11-02 04:40 +0100 |
| Subject | Re: [PATCH] i2c: designware: Don't mask TX_EMPTY if write is in progress |
| Message-ID | <qqe8p-fa-1@gated-at.bofh.it> |
| In reply to | #1259441 |
Dear Jarkko, On Fri, 30 Oct 2015 14:03:53 +0200 Jarkko Nikula wrote: > Hi > > On 10/30/2015 09:37 AM, Jisheng Zhang wrote: > > Currently when i2c_msg index search is completed, TX_EMPTY interrupt > > will be masked. But if the size of i2c_msg data is longer than the size > > of the tx buffer, we still need TX_EMPTY interrupt, otherwise we will > > get "controller timed out" error. > > > > This patch fixes this issue by only masking TX_EMPTY if i2c_msg index > > search is completed and write is not in progress. > > > > Signed-off-by: Jisheng Zhang <jszhang@marvell.com> > > --- > > drivers/i2c/busses/i2c-designware-core.c | 7 ++++--- > > 1 file changed, 4 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c > > index 7441cdc..a2eb212 100644 > > --- a/drivers/i2c/busses/i2c-designware-core.c > > +++ b/drivers/i2c/busses/i2c-designware-core.c > > @@ -542,10 +542,11 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev) > > } > > > > /* > > - * If i2c_msg index search is completed, we don't need TX_EMPTY > > - * interrupt any more. > > + * If i2c_msg index search is completed and writing is not in progress, > > + * we don't need TX_EMPTY interrupt any more. > > */ > > - if (dev->msg_write_idx == dev->msgs_num) > > + if (dev->msg_write_idx == dev->msgs_num && > > + !(dev->status & STATUS_WRITE_IN_PROGRESS)) > > intr_mask &= ~DW_IC_INTR_TX_EMPTY; > > > This looks a possible scenario here. What I'm wondering how is the > transfer ending and what condition in i2c_dw_isr() causes the complete() > call? > > Assuming we break the for loop in i2c_dw_xfer_msg() with buf_len > 0 and > dev->msg_write_idx == dev->msgs_num how we get back inside the for loop > for writing the remaining bytes and stop command? This is a good question. After more consideration, I think the following condition can't exist: (msg_write_idx == dev->msgs_num) && (dev->status & STATUS_WRITE_IN_PROGRESS) so this patch isn't necessary. Thanks for your review, Jisheng -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web