From: Sricharan R <sricharan@codeaurora.org>
To: Abhishek Sahu <absahu@codeaurora.org>,
Andy Gross <andy.gross@linaro.org>,
Wolfram Sang <wsa@the-dreams.de>
Cc: David Brown <david.brown@linaro.org>,
Austin Christ <austinwc@codeaurora.org>,
linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 05/13] i2c: qup: schedule EOT and FLUSH tags at the end of transfer
Date: Thu, 15 Mar 2018 12:23:30 +0530 [thread overview]
Message-ID: <2411c3ca-5da2-de43-f2dc-a74930a49a22@codeaurora.org> (raw)
In-Reply-To: <1520860502-14886-6-git-send-email-absahu@codeaurora.org>
On 3/12/2018 6:44 PM, Abhishek Sahu wrote:
> The role of FLUSH and EOT tag is to flush already scheduled
> descriptors in BAM HW in case of error. EOT is required only
> when descriptors are scheduled in RX FIFO. If all the messages
> are WRITE, then only FLUSH tag will be used.
>
> A single BAM transfer can have multiple read and write messages.
> The EOT and FLUSH tags should be scheduled at the end of BAM HW
> descriptors. Since the READ and WRITE can be present in any order
> so for some of the cases, these tags are not being written
> correctly.
>
> Following is one of the example
>
> READ, READ, READ, READ
>
> Currently EOT and FLUSH tags are being written after each READ.
> If QUP gets NACK for first READ itself, then flush will be
> triggered. It will look for first FLUSH tag in TX FIFO and will
> stop there so only descriptors for first READ descriptors be
> flushed. All the scheduled descriptors should be cleared to
> generate BAM DMA completion.
>
> Now this patch is scheduling FLUSH and EOT only once after all the
> descriptors. So, flush will clear all the scheduled descriptors and
> BAM will generate the completion interrupt.
>
> Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
> ---
>
Reviewed-by: Sricharan R <sricharan@codeaurora.org>
Regards,
Sricharan
> * Changes from v1:
>
> 1. Modified commit message with more details
>
> drivers/i2c/busses/i2c-qup.c | 39 ++++++++++++++++++++++++---------------
> 1 file changed, 24 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
> index d970458..b2e8f57 100644
> --- a/drivers/i2c/busses/i2c-qup.c
> +++ b/drivers/i2c/busses/i2c-qup.c
> @@ -551,7 +551,7 @@ static int qup_i2c_set_tags_smb(u16 addr, u8 *tags, struct qup_i2c_dev *qup,
> }
>
> static int qup_i2c_set_tags(u8 *tags, struct qup_i2c_dev *qup,
> - struct i2c_msg *msg, int is_dma)
> + struct i2c_msg *msg)
> {
> u16 addr = i2c_8bit_addr_from_msg(msg);
> int len = 0;
> @@ -592,11 +592,6 @@ static int qup_i2c_set_tags(u8 *tags, struct qup_i2c_dev *qup,
> else
> tags[len++] = data_len;
>
> - if ((msg->flags & I2C_M_RD) && last && is_dma) {
> - tags[len++] = QUP_BAM_INPUT_EOT;
> - tags[len++] = QUP_BAM_FLUSH_STOP;
> - }
> -
> return len;
> }
>
> @@ -605,7 +600,7 @@ static int qup_i2c_issue_xfer_v2(struct qup_i2c_dev *qup, struct i2c_msg *msg)
> int data_len = 0, tag_len, index;
> int ret;
>
> - tag_len = qup_i2c_set_tags(qup->blk.tags, qup, msg, 0);
> + tag_len = qup_i2c_set_tags(qup->blk.tags, qup, msg);
> index = msg->len - qup->blk.data_len;
>
> /* only tags are written for read */
> @@ -701,7 +696,7 @@ static int qup_i2c_bam_do_xfer(struct qup_i2c_dev *qup, struct i2c_msg *msg,
> while (qup->blk.pos < blocks) {
> tlen = (i == (blocks - 1)) ? rem : limit;
> tags = &qup->start_tag.start[off + len];
> - len += qup_i2c_set_tags(tags, qup, msg, 1);
> + len += qup_i2c_set_tags(tags, qup, msg);
> qup->blk.data_len -= tlen;
>
> /* scratch buf to read the start and len tags */
> @@ -729,17 +724,11 @@ static int qup_i2c_bam_do_xfer(struct qup_i2c_dev *qup, struct i2c_msg *msg,
> return ret;
>
> off += len;
> - /* scratch buf to read the BAM EOT and FLUSH tags */
> - ret = qup_sg_set_buf(&qup->brx.sg[rx_cnt++],
> - &qup->brx.tag.start[0],
> - 2, qup, DMA_FROM_DEVICE);
> - if (ret)
> - return ret;
> } else {
> while (qup->blk.pos < blocks) {
> tlen = (i == (blocks - 1)) ? rem : limit;
> tags = &qup->start_tag.start[off + tx_len];
> - len = qup_i2c_set_tags(tags, qup, msg, 1);
> + len = qup_i2c_set_tags(tags, qup, msg);
> qup->blk.data_len -= tlen;
>
> ret = qup_sg_set_buf(&qup->btx.sg[tx_cnt++],
> @@ -779,6 +768,26 @@ static int qup_i2c_bam_do_xfer(struct qup_i2c_dev *qup, struct i2c_msg *msg,
> msg++;
> }
>
> + /* schedule the EOT and FLUSH I2C tags */
> + len = 1;
> + if (rx_cnt) {
> + qup->btx.tag.start[0] = QUP_BAM_INPUT_EOT;
> + len++;
> +
> + /* scratch buf to read the BAM EOT and FLUSH tags */
> + ret = qup_sg_set_buf(&qup->brx.sg[rx_cnt++],
> + &qup->brx.tag.start[0],
> + 2, qup, DMA_FROM_DEVICE);
> + if (ret)
> + return ret;
> + }
> +
> + qup->btx.tag.start[len - 1] = QUP_BAM_FLUSH_STOP;
> + ret = qup_sg_set_buf(&qup->btx.sg[tx_cnt++], &qup->btx.tag.start[0],
> + len, qup, DMA_TO_DEVICE);
> + if (ret)
> + return ret;
> +
> txd = dmaengine_prep_slave_sg(qup->btx.dma, qup->btx.sg, tx_cnt,
> DMA_MEM_TO_DEV,
> DMA_PREP_INTERRUPT | DMA_PREP_FENCE);
>
--
"QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
next prev parent reply other threads:[~2018-03-15 6:53 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-12 13:14 [PATCH v2 00/13] Major code reorganization to make all i2c transfers working Abhishek Sahu
2018-03-12 13:14 ` [PATCH v2 01/13] i2c: qup: fix copyrights and update to SPDX identifier Abhishek Sahu
2018-03-17 20:33 ` Wolfram Sang
2018-03-19 6:21 ` Abhishek Sahu
2018-03-24 12:17 ` Wolfram Sang
2018-03-12 13:14 ` [PATCH v2 02/13] i2c: qup: fixed releasing dma without flush operation completion Abhishek Sahu
2018-03-12 13:14 ` [PATCH v2 03/13] i2c: qup: minor code reorganization for use_dma Abhishek Sahu
2018-03-12 13:14 ` [PATCH v2 04/13] i2c: qup: remove redundant variables for BAM SG count Abhishek Sahu
2018-03-12 13:14 ` [PATCH v2 05/13] i2c: qup: schedule EOT and FLUSH tags at the end of transfer Abhishek Sahu
2018-03-15 6:53 ` Sricharan R [this message]
2018-03-12 13:14 ` [PATCH v2 06/13] i2c: qup: fix the transfer length for BAM RX EOT FLUSH tags Abhishek Sahu
2018-03-12 13:14 ` [PATCH v2 07/13] i2c: qup: proper error handling for i2c error in BAM mode Abhishek Sahu
2018-03-12 13:14 ` [PATCH v2 08/13] i2c: qup: use the complete transfer length to choose DMA mode Abhishek Sahu
2018-03-12 13:14 ` [PATCH v2 09/13] i2c: qup: change completion timeout according to transfer length Abhishek Sahu
2018-03-12 13:14 ` [PATCH v2 10/13] i2c: qup: fix buffer overflow for multiple msg of maximum xfer len Abhishek Sahu
2018-03-12 13:15 ` [PATCH v2 11/13] i2c: qup: send NACK for last read sub transfers Abhishek Sahu
2018-03-12 13:15 ` [PATCH v2 12/13] i2c: qup: reorganization of driver code to remove polling for qup v1 Abhishek Sahu
2018-03-13 7:28 ` Sricharan R
2018-03-12 13:15 ` [PATCH v2 13/13] i2c: qup: reorganization of driver code to remove polling for qup v2 Abhishek Sahu
2018-03-13 7:49 ` Sricharan R
2018-03-13 21:09 ` [PATCH v2 00/13] Major code reorganization to make all i2c transfers working Christ, Austin
2018-03-13 21:17 ` Wolfram Sang
2018-03-13 22:12 ` Christ, Austin
2018-03-15 12:46 ` Abhishek Sahu
2018-03-17 20:37 ` Wolfram Sang
2018-03-17 20:40 ` Wolfram Sang
2018-03-24 12:22 ` Wolfram Sang
2018-03-26 4:41 ` Abhishek Sahu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2411c3ca-5da2-de43-f2dc-a74930a49a22@codeaurora.org \
--to=sricharan@codeaurora.org \
--cc=absahu@codeaurora.org \
--cc=andy.gross@linaro.org \
--cc=austinwc@codeaurora.org \
--cc=david.brown@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-soc@vger.kernel.org \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®