All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pramod Gurav" <gpramod@codeaurora.org>
Cc: gpramod@codeaurora.org, architt@codeaurora.org,
	linux-arm-msm@vger.kernel.org, ntelkar@codeaurora.org,
	linux-kernel@vger.kernel.org, andy.gross@linaro.org,
	linux-i2c@vger.kernel.org, agross@codeaurora.org,
	linux-arm-kernel@lists.infradead.org, wsa@the-dreams.de,
	sricharan@codeaurora.org
Subject: Re: [PATCH] drivers: i2c: Fix qup fifo handling
Date: Tue, 1 Mar 2016 11:21:26 +0530	[thread overview]
Message-ID: <88126e39f7b4d4e13df5b12b28f580c6.squirrel@us.codeaurora.org> (raw)
In-Reply-To: <1456502334-8687-1-git-send-email-sricharan@codeaurora.org>


On Fri, February 26, 2016 9:28 pm, Sricharan R wrote:
> After the addition of V2 support, there was a regression observed
> when testing it on MSM8996. The reason is driver puts the controller
> in to RUN state and writes the data to be 'tx' ed in fifo. But controller
> has to be put in to 'PAUSE' state and data has to written to fifo. Then
> should be put in to 'RUN' state separately.
>
> Signed-off-by: Sricharan R <sricharan@codeaurora.org>

Tested-by: Pramod Gurav <gpramod@codeaurora.org>

Regards,
Pramod
> ---
>  drivers/i2c/busses/i2c-qup.c | 46
> +++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 39 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
> index 30f3a2b..23eaabb 100644
> --- a/drivers/i2c/busses/i2c-qup.c
> +++ b/drivers/i2c/busses/i2c-qup.c
> @@ -372,6 +372,38 @@ static void qup_i2c_set_write_mode(struct qup_i2c_dev
> *qup, struct i2c_msg *msg)
>  	}
>  }
>
> +static int check_for_fifo_space(struct qup_i2c_dev *qup)
> +{
> +	int ret;
> +
> +	ret = qup_i2c_change_state(qup, QUP_PAUSE_STATE);
> +	if (ret)
> +		goto out;
> +
> +	ret = qup_i2c_wait_ready(qup, QUP_OUT_FULL,
> +				 RESET_BIT, 4 * ONE_BYTE);
> +	if (ret) {
> +		/* Fifo is full. Drain out the fifo */
> +		ret = qup_i2c_change_state(qup, QUP_RUN_STATE);
> +		if (ret)
> +			goto out;
> +
> +		ret = qup_i2c_wait_ready(qup, QUP_OUT_NOT_EMPTY,
> +					 RESET_BIT, 256 * ONE_BYTE);
> +		if (ret) {
> +			dev_err(qup->dev, "timeout for fifo out full");
> +			goto out;
> +		}
> +
> +		ret = qup_i2c_change_state(qup, QUP_PAUSE_STATE);
> +		if (ret)
> +			goto out;
> +	}
> +
> +out:
> +	return ret;
> +}
> +
>  static int qup_i2c_issue_write(struct qup_i2c_dev *qup, struct i2c_msg
> *msg)
>  {
>  	u32 addr = msg->addr << 1;
> @@ -390,8 +422,7 @@ static int qup_i2c_issue_write(struct qup_i2c_dev
> *qup, struct i2c_msg *msg)
>
>  	while (qup->pos < msg->len) {
>  		/* Check that there's space in the FIFO for our pair */
> -		ret = qup_i2c_wait_ready(qup, QUP_OUT_FULL, RESET_BIT,
> -					 4 * ONE_BYTE);
> +		ret = check_for_fifo_space(qup);
>  		if (ret)
>  			return ret;
>
> @@ -413,6 +444,8 @@ static int qup_i2c_issue_write(struct qup_i2c_dev
> *qup, struct i2c_msg *msg)
>  		idx++;
>  	}
>
> +	ret = qup_i2c_change_state(qup, QUP_RUN_STATE);
> +
>  	return ret;
>  }
>
> @@ -441,12 +474,9 @@ static int qup_i2c_send_data(struct qup_i2c_dev *qup,
> int tlen, u8 *tbuf,
>  	int ret = 0;
>
>  	while (len > 0) {
> -		ret = qup_i2c_wait_ready(qup, QUP_OUT_FULL,
> -					 RESET_BIT, 4 * ONE_BYTE);
> -		if (ret) {
> -			dev_err(qup->dev, "timeout for fifo out full");
> +		ret = check_for_fifo_space(qup);
> +		if (ret)
>  			return ret;
> -		}
>
>  		t = (len >= 4) ? 4 : len;
>
> @@ -465,6 +495,8 @@ static int qup_i2c_send_data(struct qup_i2c_dev *qup,
> int tlen, u8 *tbuf,
>  		len -= 4;
>  	}
>
> +	ret = qup_i2c_change_state(qup, QUP_RUN_STATE);
> +
>  	return ret;
>  }
>
> --
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>


Pramod
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

WARNING: multiple messages have this Message-ID (diff)
From: gpramod@codeaurora.org (Pramod Gurav)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] drivers: i2c: Fix qup fifo handling
Date: Tue, 1 Mar 2016 11:21:26 +0530	[thread overview]
Message-ID: <88126e39f7b4d4e13df5b12b28f580c6.squirrel@us.codeaurora.org> (raw)
In-Reply-To: <1456502334-8687-1-git-send-email-sricharan@codeaurora.org>


On Fri, February 26, 2016 9:28 pm, Sricharan R wrote:
> After the addition of V2 support, there was a regression observed
> when testing it on MSM8996. The reason is driver puts the controller
> in to RUN state and writes the data to be 'tx' ed in fifo. But controller
> has to be put in to 'PAUSE' state and data has to written to fifo. Then
> should be put in to 'RUN' state separately.
>
> Signed-off-by: Sricharan R <sricharan@codeaurora.org>

Tested-by: Pramod Gurav <gpramod@codeaurora.org>

Regards,
Pramod
> ---
>  drivers/i2c/busses/i2c-qup.c | 46
> +++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 39 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
> index 30f3a2b..23eaabb 100644
> --- a/drivers/i2c/busses/i2c-qup.c
> +++ b/drivers/i2c/busses/i2c-qup.c
> @@ -372,6 +372,38 @@ static void qup_i2c_set_write_mode(struct qup_i2c_dev
> *qup, struct i2c_msg *msg)
>  	}
>  }
>
> +static int check_for_fifo_space(struct qup_i2c_dev *qup)
> +{
> +	int ret;
> +
> +	ret = qup_i2c_change_state(qup, QUP_PAUSE_STATE);
> +	if (ret)
> +		goto out;
> +
> +	ret = qup_i2c_wait_ready(qup, QUP_OUT_FULL,
> +				 RESET_BIT, 4 * ONE_BYTE);
> +	if (ret) {
> +		/* Fifo is full. Drain out the fifo */
> +		ret = qup_i2c_change_state(qup, QUP_RUN_STATE);
> +		if (ret)
> +			goto out;
> +
> +		ret = qup_i2c_wait_ready(qup, QUP_OUT_NOT_EMPTY,
> +					 RESET_BIT, 256 * ONE_BYTE);
> +		if (ret) {
> +			dev_err(qup->dev, "timeout for fifo out full");
> +			goto out;
> +		}
> +
> +		ret = qup_i2c_change_state(qup, QUP_PAUSE_STATE);
> +		if (ret)
> +			goto out;
> +	}
> +
> +out:
> +	return ret;
> +}
> +
>  static int qup_i2c_issue_write(struct qup_i2c_dev *qup, struct i2c_msg
> *msg)
>  {
>  	u32 addr = msg->addr << 1;
> @@ -390,8 +422,7 @@ static int qup_i2c_issue_write(struct qup_i2c_dev
> *qup, struct i2c_msg *msg)
>
>  	while (qup->pos < msg->len) {
>  		/* Check that there's space in the FIFO for our pair */
> -		ret = qup_i2c_wait_ready(qup, QUP_OUT_FULL, RESET_BIT,
> -					 4 * ONE_BYTE);
> +		ret = check_for_fifo_space(qup);
>  		if (ret)
>  			return ret;
>
> @@ -413,6 +444,8 @@ static int qup_i2c_issue_write(struct qup_i2c_dev
> *qup, struct i2c_msg *msg)
>  		idx++;
>  	}
>
> +	ret = qup_i2c_change_state(qup, QUP_RUN_STATE);
> +
>  	return ret;
>  }
>
> @@ -441,12 +474,9 @@ static int qup_i2c_send_data(struct qup_i2c_dev *qup,
> int tlen, u8 *tbuf,
>  	int ret = 0;
>
>  	while (len > 0) {
> -		ret = qup_i2c_wait_ready(qup, QUP_OUT_FULL,
> -					 RESET_BIT, 4 * ONE_BYTE);
> -		if (ret) {
> -			dev_err(qup->dev, "timeout for fifo out full");
> +		ret = check_for_fifo_space(qup);
> +		if (ret)
>  			return ret;
> -		}
>
>  		t = (len >= 4) ? 4 : len;
>
> @@ -465,6 +495,8 @@ static int qup_i2c_send_data(struct qup_i2c_dev *qup,
> int tlen, u8 *tbuf,
>  		len -= 4;
>  	}
>
> +	ret = qup_i2c_change_state(qup, QUP_RUN_STATE);
> +
>  	return ret;
>  }
>
> --
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>


Pramod
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

WARNING: multiple messages have this Message-ID (diff)
From: "Pramod Gurav" <gpramod@codeaurora.org>
To: "Sricharan R" <sricharan@codeaurora.org>
Cc: gpramod@codeaurora.org, architt@codeaurora.org,
	linux-arm-msm@vger.kernel.org, ntelkar@codeaurora.org,
	linux-kernel@vger.kernel.org, andy.gross@linaro.org,
	linux-i2c@vger.kernel.org, agross@codeaurora.org,
	linux-arm-kernel@lists.infradead.org, wsa@the-dreams.de,
	sricharan@codeaurora.org
Subject: Re: [PATCH] drivers: i2c: Fix qup fifo handling
Date: Tue, 1 Mar 2016 11:21:26 +0530	[thread overview]
Message-ID: <88126e39f7b4d4e13df5b12b28f580c6.squirrel@us.codeaurora.org> (raw)
In-Reply-To: <1456502334-8687-1-git-send-email-sricharan@codeaurora.org>


On Fri, February 26, 2016 9:28 pm, Sricharan R wrote:
> After the addition of V2 support, there was a regression observed
> when testing it on MSM8996. The reason is driver puts the controller
> in to RUN state and writes the data to be 'tx' ed in fifo. But controller
> has to be put in to 'PAUSE' state and data has to written to fifo. Then
> should be put in to 'RUN' state separately.
>
> Signed-off-by: Sricharan R <sricharan@codeaurora.org>

Tested-by: Pramod Gurav <gpramod@codeaurora.org>

Regards,
Pramod
> ---
>  drivers/i2c/busses/i2c-qup.c | 46
> +++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 39 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
> index 30f3a2b..23eaabb 100644
> --- a/drivers/i2c/busses/i2c-qup.c
> +++ b/drivers/i2c/busses/i2c-qup.c
> @@ -372,6 +372,38 @@ static void qup_i2c_set_write_mode(struct qup_i2c_dev
> *qup, struct i2c_msg *msg)
>  	}
>  }
>
> +static int check_for_fifo_space(struct qup_i2c_dev *qup)
> +{
> +	int ret;
> +
> +	ret = qup_i2c_change_state(qup, QUP_PAUSE_STATE);
> +	if (ret)
> +		goto out;
> +
> +	ret = qup_i2c_wait_ready(qup, QUP_OUT_FULL,
> +				 RESET_BIT, 4 * ONE_BYTE);
> +	if (ret) {
> +		/* Fifo is full. Drain out the fifo */
> +		ret = qup_i2c_change_state(qup, QUP_RUN_STATE);
> +		if (ret)
> +			goto out;
> +
> +		ret = qup_i2c_wait_ready(qup, QUP_OUT_NOT_EMPTY,
> +					 RESET_BIT, 256 * ONE_BYTE);
> +		if (ret) {
> +			dev_err(qup->dev, "timeout for fifo out full");
> +			goto out;
> +		}
> +
> +		ret = qup_i2c_change_state(qup, QUP_PAUSE_STATE);
> +		if (ret)
> +			goto out;
> +	}
> +
> +out:
> +	return ret;
> +}
> +
>  static int qup_i2c_issue_write(struct qup_i2c_dev *qup, struct i2c_msg
> *msg)
>  {
>  	u32 addr = msg->addr << 1;
> @@ -390,8 +422,7 @@ static int qup_i2c_issue_write(struct qup_i2c_dev
> *qup, struct i2c_msg *msg)
>
>  	while (qup->pos < msg->len) {
>  		/* Check that there's space in the FIFO for our pair */
> -		ret = qup_i2c_wait_ready(qup, QUP_OUT_FULL, RESET_BIT,
> -					 4 * ONE_BYTE);
> +		ret = check_for_fifo_space(qup);
>  		if (ret)
>  			return ret;
>
> @@ -413,6 +444,8 @@ static int qup_i2c_issue_write(struct qup_i2c_dev
> *qup, struct i2c_msg *msg)
>  		idx++;
>  	}
>
> +	ret = qup_i2c_change_state(qup, QUP_RUN_STATE);
> +
>  	return ret;
>  }
>
> @@ -441,12 +474,9 @@ static int qup_i2c_send_data(struct qup_i2c_dev *qup,
> int tlen, u8 *tbuf,
>  	int ret = 0;
>
>  	while (len > 0) {
> -		ret = qup_i2c_wait_ready(qup, QUP_OUT_FULL,
> -					 RESET_BIT, 4 * ONE_BYTE);
> -		if (ret) {
> -			dev_err(qup->dev, "timeout for fifo out full");
> +		ret = check_for_fifo_space(qup);
> +		if (ret)
>  			return ret;
> -		}
>
>  		t = (len >= 4) ? 4 : len;
>
> @@ -465,6 +495,8 @@ static int qup_i2c_send_data(struct qup_i2c_dev *qup,
> int tlen, u8 *tbuf,
>  		len -= 4;
>  	}
>
> +	ret = qup_i2c_change_state(qup, QUP_RUN_STATE);
> +
>  	return ret;
>  }
>
> --
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>


Pramod
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2016-03-01  5:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26 15:58 [PATCH] drivers: i2c: Fix qup fifo handling Sricharan R
2016-02-26 15:58 ` Sricharan R
2016-03-01  5:51 ` Pramod Gurav [this message]
2016-03-01  5:51   ` Pramod Gurav
2016-03-01  5:51   ` Pramod Gurav
2016-03-03 21:14 ` Wolfram Sang
2016-03-03 21:14   ` Wolfram Sang

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=88126e39f7b4d4e13df5b12b28f580c6.squirrel@us.codeaurora.org \
    --to=gpramod@codeaurora.org \
    --cc=agross@codeaurora.org \
    --cc=andy.gross@linaro.org \
    --cc=architt@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntelkar@codeaurora.org \
    --cc=sricharan@codeaurora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.