diff mbox

[4/9] i2c: brcmstb: enable ACK condition

Message ID 1445395021-4204-5-git-send-email-jaedon.shin@gmail.com
State Superseded
Headers show

Commit Message

Jaedon Shin Oct. 21, 2015, 2:36 a.m. UTC
Removes the condition of a message with under 32 bytes in length. The
messages that do not require an ACK are I2C_M_IGNORE_NAK flag.

Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com>
---
 drivers/i2c/busses/i2c-brcmstb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wolfram Sang Nov. 30, 2015, 3:37 p.m. UTC | #1
On Wed, Oct 21, 2015 at 11:36:56AM +0900, Jaedon Shin wrote:
> Removes the condition of a message with under 32 bytes in length. The
> messages that do not require an ACK are I2C_M_IGNORE_NAK flag.

Makes me wonder why it worked before? Kamal?

> 
> Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com>
> ---
>  drivers/i2c/busses/i2c-brcmstb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
> index 2d7d155029dc..53eb8b0c9bad 100644
> --- a/drivers/i2c/busses/i2c-brcmstb.c
> +++ b/drivers/i2c/busses/i2c-brcmstb.c
> @@ -330,7 +330,7 @@ static int brcmstb_i2c_xfer_bsc_data(struct brcmstb_i2c_dev *dev,
>  	int no_ack = pmsg->flags & I2C_M_IGNORE_NAK;
>  
>  	/* see if the transaction needs to check NACK conditions */
> -	if (no_ack || len <= N_DATA_BYTES) {
> +	if (no_ack) {
>  		cmd = (pmsg->flags & I2C_M_RD) ? CMD_RD_NOACK
>  			: CMD_WR_NOACK;
>  		pi2creg->ctlhi_reg |= BSC_CTLHI_REG_IGNORE_ACK_MASK;
> -- 
> 2.6.1
>
Jaedon Shin July 14, 2016, 4:15 a.m. UTC | #2
Hi Kamal,

On Dec 1, 2015, at 12:37 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
> 
> On Wed, Oct 21, 2015 at 11:36:56AM +0900, Jaedon Shin wrote:
>> Removes the condition of a message with under 32 bytes in length. The
>> messages that do not require an ACK are I2C_M_IGNORE_NAK flag.
> 
> Makes me wonder why it worked before? Kamal?
> 
>> 
>> Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com>
>> ---
>> drivers/i2c/busses/i2c-brcmstb.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
>> index 2d7d155029dc..53eb8b0c9bad 100644
>> --- a/drivers/i2c/busses/i2c-brcmstb.c
>> +++ b/drivers/i2c/busses/i2c-brcmstb.c
>> @@ -330,7 +330,7 @@ static int brcmstb_i2c_xfer_bsc_data(struct brcmstb_i2c_dev *dev,
>> 	int no_ack = pmsg->flags & I2C_M_IGNORE_NAK;
>> 
>> 	/* see if the transaction needs to check NACK conditions */
>> -	if (no_ack || len <= N_DATA_BYTES) {

Could you please explain why have NOACK with smaller transfer size? I don't find any 
reason about NOACK when smaller size, and the driver always operates NOACK by "len <= xfersz".

brcmstb_i2c_xfer(...)
{
	int xfersz = brcmstb_i2c_get_xfersz(dev);
	...
	bytes_to_xfer = min(len, xfersz);
	...
	brcmstb_i2c_xfer_bsc_data(..., bytes_to_xfer, ...);
	...

I have a plan for v2 that has for BMIPS_GENERIC and this patch with the latest driver.

Thanks!
--
Jaedon

>> +	if (no_ack) {
>> 		cmd = (pmsg->flags & I2C_M_RD) ? CMD_RD_NOACK
>> 			: CMD_WR_NOACK;
>> 		pi2creg->ctlhi_reg |= BSC_CTLHI_REG_IGNORE_ACK_MASK;
>> -- 
>> 2.6.1
>> 

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kamal Dasu July 14, 2016, 5:14 p.m. UTC | #3
Jaedon,

Your change looks good to me.  I agree that we do not need the size check.

Kamal

On Thu, Jul 14, 2016 at 12:15 AM, Jaedon Shin <jaedon.shin@gmail.com> wrote:
> Hi Kamal,
>
> On Dec 1, 2015, at 12:37 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
>>
>> On Wed, Oct 21, 2015 at 11:36:56AM +0900, Jaedon Shin wrote:
>>> Removes the condition of a message with under 32 bytes in length. The
>>> messages that do not require an ACK are I2C_M_IGNORE_NAK flag.
>>
>> Makes me wonder why it worked before? Kamal?
>>
>>>
>>> Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com>
>>> ---
>>> drivers/i2c/busses/i2c-brcmstb.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
>>> index 2d7d155029dc..53eb8b0c9bad 100644
>>> --- a/drivers/i2c/busses/i2c-brcmstb.c
>>> +++ b/drivers/i2c/busses/i2c-brcmstb.c
>>> @@ -330,7 +330,7 @@ static int brcmstb_i2c_xfer_bsc_data(struct brcmstb_i2c_dev *dev,
>>>      int no_ack = pmsg->flags & I2C_M_IGNORE_NAK;
>>>
>>>      /* see if the transaction needs to check NACK conditions */
>>> -    if (no_ack || len <= N_DATA_BYTES) {
>
> Could you please explain why have NOACK with smaller transfer size? I don't find any
> reason about NOACK when smaller size, and the driver always operates NOACK by "len <= xfersz".
>
> brcmstb_i2c_xfer(...)
> {
>         int xfersz = brcmstb_i2c_get_xfersz(dev);
>         ...
>         bytes_to_xfer = min(len, xfersz);
>         ...
>         brcmstb_i2c_xfer_bsc_data(..., bytes_to_xfer, ...);
>         ...
>
> I have a plan for v2 that has for BMIPS_GENERIC and this patch with the latest driver.
>
> Thanks!
> --
> Jaedon
>
>>> +    if (no_ack) {
>>>              cmd = (pmsg->flags & I2C_M_RD) ? CMD_RD_NOACK
>>>                      : CMD_WR_NOACK;
>>>              pi2creg->ctlhi_reg |= BSC_CTLHI_REG_IGNORE_ACK_MASK;
>>> --
>>> 2.6.1
>>>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang July 15, 2016, 5:57 a.m. UTC | #4
> Your change looks good to me.  I agree that we do not need the size check.

I read this as an ack, thanks. But how did it work before?
diff mbox

Patch

diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
index 2d7d155029dc..53eb8b0c9bad 100644
--- a/drivers/i2c/busses/i2c-brcmstb.c
+++ b/drivers/i2c/busses/i2c-brcmstb.c
@@ -330,7 +330,7 @@  static int brcmstb_i2c_xfer_bsc_data(struct brcmstb_i2c_dev *dev,
 	int no_ack = pmsg->flags & I2C_M_IGNORE_NAK;
 
 	/* see if the transaction needs to check NACK conditions */
-	if (no_ack || len <= N_DATA_BYTES) {
+	if (no_ack) {
 		cmd = (pmsg->flags & I2C_M_RD) ? CMD_RD_NOACK
 			: CMD_WR_NOACK;
 		pi2creg->ctlhi_reg |= BSC_CTLHI_REG_IGNORE_ACK_MASK;