* [PATCH v2] i2c: tegra: Add delay before reset the controller @ 2011-12-26 11:14 Alok Chauhan [not found] ` <1324898081-10308-1-git-send-email-alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2012-02-10 9:35 ` Shubhrajyoti Datta 0 siblings, 2 replies; 18+ messages in thread From: Alok Chauhan @ 2011-12-26 11:14 UTC (permalink / raw) To: khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg, swarren-DDmLM1+adcrQT0dZR+AlfA, olof-nZhT3qVonbNeoWH0uzbU5w, bones-s3s/WqlpOiPyB63q8FvJNQ, paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ, dgreid-hpIqsD4AKlfQT0dZR+AlfA, ldewangan-DDmLM1+adcrQT0dZR+AlfA Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Alok Chauhan From: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> In NACK error condition, I2C controller violates clock-to-data setup time before stop. In Software, because of this reset of controller is happening before I2C controller could complete STOP condition. Added delay of 2 clock period before reset the controller in case of NACK error. Signed-off-by: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> --- Instead of setting constant value for delay as was in previous patch, now in the current modification delay will be calculated based on clock frequency of the bus. drivers/i2c/busses/i2c-tegra.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 6381604..62e197c 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -517,6 +517,14 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) return 0; + /* + * In NACK error condition resetting of I2C controller happens + * before STOP condition is properly completed by I2C controller, + * so wait for 2 clock cycle to complete STOP condition. + */ + if (i2c_dev->msg_err == I2C_ERR_NO_ACK) + udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate)); + tegra_i2c_init(i2c_dev); if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { if (msg->flags & I2C_M_IGNORE_NAK) -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
[parent not found: <1324898081-10308-1-git-send-email-alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH v2] i2c: tegra: Add delay before reset the controller [not found] ` <1324898081-10308-1-git-send-email-alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2012-01-06 16:18 ` Ben Dooks 2012-01-10 4:12 ` Alok Chauhan 0 siblings, 1 reply; 18+ messages in thread From: Ben Dooks @ 2012-01-06 16:18 UTC (permalink / raw) To: Alok Chauhan Cc: khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg, swarren-DDmLM1+adcrQT0dZR+AlfA, olof-nZhT3qVonbNeoWH0uzbU5w, bones-s3s/WqlpOiPyB63q8FvJNQ, paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ, dgreid-hpIqsD4AKlfQT0dZR+AlfA, ldewangan-DDmLM1+adcrQT0dZR+AlfA, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Mon, Dec 26, 2011 at 04:44:41PM +0530, Alok Chauhan wrote: > From: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > In NACK error condition, I2C controller violates > clock-to-data setup time before stop. In Software, > because of this reset of controller is happening > before I2C controller could complete STOP condition. > > Added delay of 2 clock period before reset the > controller in case of NACK error. > > Signed-off-by: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > --- > Instead of setting constant value for delay as was in previous patch, now in > the current modification delay will be calculated based on clock frequency of the bus. > drivers/i2c/busses/i2c-tegra.c | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c > index 6381604..62e197c 100644 > --- a/drivers/i2c/busses/i2c-tegra.c > +++ b/drivers/i2c/busses/i2c-tegra.c > @@ -517,6 +517,14 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, > if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) > return 0; > > + /* > + * In NACK error condition resetting of I2C controller happens > + * before STOP condition is properly completed by I2C controller, > + * so wait for 2 clock cycle to complete STOP condition. > + */ > + if (i2c_dev->msg_err == I2C_ERR_NO_ACK) > + udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate)); > + Is a delay here good, would it be better to sleep so that some other process can gain cpu time? tegra_i2c_init(i2c_dev); > if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { > if (msg->flags & I2C_M_IGNORE_NAK) > -- > 1.7.4.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-i2c" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Ben Dooks, ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/ben/ Large Hadron Colada: A large Pina Colada that makes the universe disappear. ^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [PATCH v2] i2c: tegra: Add delay before reset the controller 2012-01-06 16:18 ` Ben Dooks @ 2012-01-10 4:12 ` Alok Chauhan [not found] ` <7A0BFCFE3DA5CD47B0FB7984326F201A134F2CD4F1-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org> 0 siblings, 1 reply; 18+ messages in thread From: Alok Chauhan @ 2012-01-10 4:12 UTC (permalink / raw) To: Ben Dooks Cc: khali@linux-fr.org, ben-linux@fluff.org, Stephen Warren, olof@lixom.net, bones@secretlab.ca, paul.gortmaker@windriver.com, dgreid@google.com, Laxman Dewangan, linux-tegra@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org On Mon, Dec 26, 2011 at 04:44:41PM +0530, Alok Chauhan wrote: > From: Alok Chauhan <alokc@nvidia.com> > > In NACK error condition, I2C controller violates clock-to-data setup > time before stop. In Software, because of this reset of controller is > happening before I2C controller could complete STOP condition. > > Added delay of 2 clock period before reset the controller in case of > NACK error. > > Signed-off-by: Alok Chauhan <alokc@nvidia.com> > --- > Instead of setting constant value for delay as was in previous patch, > now in the current modification delay will be calculated based on clock frequency of the bus. > drivers/i2c/busses/i2c-tegra.c | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-tegra.c > b/drivers/i2c/busses/i2c-tegra.c index 6381604..62e197c 100644 > --- a/drivers/i2c/busses/i2c-tegra.c > +++ b/drivers/i2c/busses/i2c-tegra.c > @@ -517,6 +517,14 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, > if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) > return 0; > > + /* > + * In NACK error condition resetting of I2C controller happens > + * before STOP condition is properly completed by I2C controller, > + * so wait for 2 clock cycle to complete STOP condition. > + */ > + if (i2c_dev->msg_err == I2C_ERR_NO_ACK) > + udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate)); > + >Is a delay here good, would it be better to sleep so that some other process can gain cpu time? We mostly used 100 khz i2c clock frequency and delay in that case will be 20 usec. Would it be ok to sleep for such a smaller time? Won't it increase any other overhead? tegra_i2c_init(i2c_dev); > if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { > if (msg->flags & I2C_M_IGNORE_NAK) > -- > 1.7.4.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 -- Ben Dooks, ben@fluff.org, http://www.fluff.org/ben/ Large Hadron Colada: A large Pina Colada that makes the universe disappear. ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <7A0BFCFE3DA5CD47B0FB7984326F201A134F2CD4F1-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org>]
* RE: [PATCH v2] i2c: tegra: Add delay before reset the controller [not found] ` <7A0BFCFE3DA5CD47B0FB7984326F201A134F2CD4F1-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org> @ 2012-02-10 9:20 ` Alok Chauhan 0 siblings, 0 replies; 18+ messages in thread From: Alok Chauhan @ 2012-02-10 9:20 UTC (permalink / raw) To: Alok Chauhan, Ben Dooks Cc: khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org, ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, Stephen Warren, olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org, bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org, dgreid-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, Laxman Dewangan, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > On Mon, Dec 26, 2011 at 04:44:41PM +0530, Alok Chauhan wrote: >> > + /* > + * In NACK error condition resetting of I2C controller happens > + * before STOP condition is properly completed by I2C controller, > + * so wait for 2 clock cycle to complete STOP condition. > + */ > + if (i2c_dev->msg_err == I2C_ERR_NO_ACK) > + udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate)); > + >Is a delay here good, would it be better to sleep so that some other process can gain cpu time? >>We mostly used 100 khz i2c clock frequency and delay in that case will be 20 usec. Would it be ok to sleep for such a smaller time? Won't it increase any other overhead? Please let me know if sleep is better option here instead of waiting. Thanks Alok -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2] i2c: tegra: Add delay before reset the controller 2011-12-26 11:14 [PATCH v2] i2c: tegra: Add delay before reset the controller Alok Chauhan [not found] ` <1324898081-10308-1-git-send-email-alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2012-02-10 9:35 ` Shubhrajyoti Datta [not found] ` <CAM=Q2cs+myCvph7OXvCDTG7y48oNTfRtjsDzQaKiEXzjdu3pzA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 1 sibling, 1 reply; 18+ messages in thread From: Shubhrajyoti Datta @ 2012-02-10 9:35 UTC (permalink / raw) To: Alok Chauhan Cc: khali, ben-linux, swarren, olof, bones, paul.gortmaker, dgreid, ldewangan, linux-tegra, linux-i2c, linux-kernel Hello Alok, On Mon, Dec 26, 2011 at 4:44 PM, Alok Chauhan <alokc@nvidia.com> wrote: > From: Alok Chauhan <alokc@nvidia.com> > > In NACK error condition, I2C controller violates > clock-to-data setup time before stop. In Software, > because of this reset of controller is happening > before I2C controller could complete STOP condition. > > Added delay of 2 clock period before reset the > controller in case of NACK error. > > Signed-off-by: Alok Chauhan <alokc@nvidia.com> > --- > Instead of setting constant value for delay as was in previous patch, now in > the current modification delay will be calculated based on clock frequency of the bus. > drivers/i2c/busses/i2c-tegra.c | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c > index 6381604..62e197c 100644 > --- a/drivers/i2c/busses/i2c-tegra.c > +++ b/drivers/i2c/busses/i2c-tegra.c > @@ -517,6 +517,14 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, > if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) > return 0; > > + /* > + * In NACK error condition resetting of I2C controller happens > + * before STOP condition is properly completed by I2C controller, > + * so wait for 2 clock cycle to complete STOP condition. > + */ Why do you need to reset the controller in case of a NACK. > + if (i2c_dev->msg_err == I2C_ERR_NO_ACK) > + udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate)); > + > tegra_i2c_init(i2c_dev); > if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { > if (msg->flags & I2C_M_IGNORE_NAK) > -- > 1.7.4.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 ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <CAM=Q2cs+myCvph7OXvCDTG7y48oNTfRtjsDzQaKiEXzjdu3pzA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* RE: [PATCH v2] i2c: tegra: Add delay before reset the controller [not found] ` <CAM=Q2cs+myCvph7OXvCDTG7y48oNTfRtjsDzQaKiEXzjdu3pzA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2012-02-14 5:49 ` Alok Chauhan [not found] ` <7A0BFCFE3DA5CD47B0FB7984326F201A13689D386F-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org> 0 siblings, 1 reply; 18+ messages in thread From: Alok Chauhan @ 2012-02-14 5:49 UTC (permalink / raw) To: Shubhrajyoti Datta Cc: khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org, ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, Stephen Warren, olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org, bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org, dgreid-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, Laxman Dewangan, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Hi Shubhrajyot, On Mon, Dec 26, 2011 at 4:44 PM, Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote: > From: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > In NACK error condition, I2C controller violates clock-to-data setup > time before stop. In Software, because of this reset of controller is > happening before I2C controller could complete STOP condition. > > Added delay of 2 clock period before reset the controller in case of > NACK error. > > Signed-off-by: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > --- > Instead of setting constant value for delay as was in previous patch, > now in the current modification delay will be calculated based on clock frequency of the bus. > drivers/i2c/busses/i2c-tegra.c | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-tegra.c > b/drivers/i2c/busses/i2c-tegra.c index 6381604..62e197c 100644 > --- a/drivers/i2c/busses/i2c-tegra.c > +++ b/drivers/i2c/busses/i2c-tegra.c > @@ -517,6 +517,14 @@ static int tegra_i2c_xfer_msg(struct > tegra_i2c_dev *i2c_dev, > if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) > return 0; > > + /* > + * In NACK error condition resetting of I2C controller happens > + * before STOP condition is properly completed by I2C > + controller, > + * so wait for 2 clock cycle to complete STOP condition. > + */ >>>>Why do you need to reset the controller in case of a NACK. This is required because of hardware limitations. Without reset we can't flus the internal hardware registers. > + if (i2c_dev->msg_err == I2C_ERR_NO_ACK) > + udelay(DIV_ROUND_UP(2 * 1000000, > + i2c_dev->bus_clk_rate)); > + > tegra_i2c_init(i2c_dev); > if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { > if (msg->flags & I2C_M_IGNORE_NAK) > -- > 1.7.4.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-i2c" > in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo > info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <7A0BFCFE3DA5CD47B0FB7984326F201A13689D386F-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org>]
* RE: [PATCH v2] i2c: tegra: Add delay before reset the controller [not found] ` <7A0BFCFE3DA5CD47B0FB7984326F201A13689D386F-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org> @ 2012-03-08 6:29 ` Alok Chauhan [not found] ` <7A0BFCFE3DA5CD47B0FB7984326F201A136B886672-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org> 0 siblings, 1 reply; 18+ messages in thread From: Alok Chauhan @ 2012-03-08 6:29 UTC (permalink / raw) To: Alok Chauhan, Shubhrajyoti Datta Cc: khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org, ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, Stephen Warren, olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org, bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org, dgreid-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, Laxman Dewangan, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Hi all, If there are no more concern then can we merge this patch to i2c tegra driver? Thanks Alok On Mon, Dec 26, 2011 at 4:44 PM, Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote: > From: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > In NACK error condition, I2C controller violates clock-to-data setup > time before stop. In Software, because of this reset of controller is > happening before I2C controller could complete STOP condition. > > Added delay of 2 clock period before reset the controller in case of > NACK error. > > Signed-off-by: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > --- > Instead of setting constant value for delay as was in previous patch, > now in the current modification delay will be calculated based on clock frequency of the bus. > drivers/i2c/busses/i2c-tegra.c | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-tegra.c > b/drivers/i2c/busses/i2c-tegra.c index 6381604..62e197c 100644 > --- a/drivers/i2c/busses/i2c-tegra.c > +++ b/drivers/i2c/busses/i2c-tegra.c > @@ -517,6 +517,14 @@ static int tegra_i2c_xfer_msg(struct > tegra_i2c_dev *i2c_dev, > if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) > return 0; > > + /* > + * In NACK error condition resetting of I2C controller happens > + * before STOP condition is properly completed by I2C > + controller, > + * so wait for 2 clock cycle to complete STOP condition. > + */ >>>>Why do you need to reset the controller in case of a NACK. >>>This is required because of hardware limitations. Without reset we can't flus the internal hardware registers. > + if (i2c_dev->msg_err == I2C_ERR_NO_ACK) > + udelay(DIV_ROUND_UP(2 * 1000000, > + i2c_dev->bus_clk_rate)); > + > tegra_i2c_init(i2c_dev); > if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { > if (msg->flags & I2C_M_IGNORE_NAK) > -- > 1.7.4.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-i2c" > in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo > info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <7A0BFCFE3DA5CD47B0FB7984326F201A136B886672-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org>]
* Re: [PATCH v2] i2c: tegra: Add delay before reset the controller [not found] ` <7A0BFCFE3DA5CD47B0FB7984326F201A136B886672-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org> @ 2012-03-08 16:30 ` Stephen Warren [not found] ` <4F58DEB8.9060103-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 0 siblings, 1 reply; 18+ messages in thread From: Stephen Warren @ 2012-03-08 16:30 UTC (permalink / raw) To: Alok Chauhan Cc: Shubhrajyoti Datta, ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org, Colin Cross, Laxman Dewangan, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Mon, Dec 26, 2011 at 4:44 PM, Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote: > From: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > In NACK error condition, I2C controller violates clock-to-data setup > time before stop. In Software, because of this reset of controller is > happening before I2C controller could complete STOP condition. > > Added delay of 2 clock period before reset the controller in case of > NACK error. (CC list cut down to people who were active in the original patch posting thread) On 03/07/2012 11:29 PM, Alok Chauhan wrote: > Hi all, > > If there are no more concern then can we merge this patch to i2c tegra driver? Alok, a couple comments: 1) The set of I2C maintainers has changed since you last posted this patch. You should resend the whole patch to make sure the new maintainers have a copy. I've CC'd Wolfram on this message, but you still need to repost since there's no way Wolfram can extract the patch from this email. 2) Wasn't there an outstanding question about the length of the delay here, and whether it negatively interfered with the TPM chips on some boards, since they always NACK the first transaction, which then needs to be retried quickly so the TPM doesn't go back to sleep? I don't recall you answering addressing that issue. There's no point reposting without addressing all the issues. Also, I'm not sure whether Shubhrajyot or Ben consider the answers you gave to their questions satisfactory or not. P.S. Top-posting makes for confusing emails. Thanks. >> Signed-off-by: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> >> --- >> Instead of setting constant value for delay as was in previous patch, >> now in the current modification delay will be calculated based on clock frequency of the bus. >> >> drivers/i2c/busses/i2c-tegra.c | 8 ++++++++ >> 1 files changed, 8 insertions(+), 0 deletions(-) >> >> diff --git a/drivers/i2c/busses/i2c-tegra.c >> b/drivers/i2c/busses/i2c-tegra.c index 6381604..62e197c 100644 >> --- a/drivers/i2c/busses/i2c-tegra.c >> +++ b/drivers/i2c/busses/i2c-tegra.c >> @@ -517,6 +517,14 @@ static int tegra_i2c_xfer_msg(struct >> tegra_i2c_dev *i2c_dev, >> if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) >> return 0; >> >> + /* >> + * In NACK error condition resetting of I2C controller happens >> + * before STOP condition is properly completed by I2C >> + controller, >> + * so wait for 2 clock cycle to complete STOP condition. >> + */ > >>>>> Why do you need to reset the controller in case of a NACK. >>>> This is required because of hardware limitations. Without reset we can't flus the internal hardware registers. > > >> + if (i2c_dev->msg_err == I2C_ERR_NO_ACK) >> + udelay(DIV_ROUND_UP(2 * 1000000, >> + i2c_dev->bus_clk_rate)); >> + >> tegra_i2c_init(i2c_dev); >> if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { >> if (msg->flags & I2C_M_IGNORE_NAK) >> -- >> 1.7.4.1 ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <4F58DEB8.9060103-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>]
* Re: [PATCH v2] i2c: tegra: Add delay before reset the controller [not found] ` <4F58DEB8.9060103-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> @ 2012-03-26 21:09 ` Dylan Reid 0 siblings, 0 replies; 18+ messages in thread From: Dylan Reid @ 2012-03-26 21:09 UTC (permalink / raw) To: Stephen Warren Cc: Alok Chauhan, Shubhrajyoti Datta, ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org, Colin Cross, Laxman Dewangan, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Thu, Mar 8, 2012 at 8:30 AM, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote: > On Mon, Dec 26, 2011 at 4:44 PM, Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote: >> From: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> >> >> In NACK error condition, I2C controller violates clock-to-data setup >> time before stop. In Software, because of this reset of controller is >> happening before I2C controller could complete STOP condition. >> >> Added delay of 2 clock period before reset the controller in case of >> NACK error. > > (CC list cut down to people who were active in the original patch > posting thread) > > On 03/07/2012 11:29 PM, Alok Chauhan wrote: >> Hi all, >> >> If there are no more concern then can we merge this patch to i2c tegra driver? > > Alok, a couple comments: > > 1) The set of I2C maintainers has changed since you last posted this > patch. You should resend the whole patch to make sure the new > maintainers have a copy. I've CC'd Wolfram on this message, but you > still need to repost since there's no way Wolfram can extract the patch > from this email. > > 2) Wasn't there an outstanding question about the length of the delay > here, and whether it negatively interfered with the TPM chips on some > boards, since they always NACK the first transaction, which then needs > to be retried quickly so the TPM doesn't go back to sleep? I don't > recall you answering addressing that issue. There's no point reposting > without addressing all the issues. Also, I'm not sure whether > Shubhrajyot or Ben consider the answers you gave to their questions > satisfactory or not. The TPM issue was from the inital patchset, this current patch works with those slow TPMs. The change to make the sleep duration dependent on the i2c clock rate fixed it. Sorry it took so long for me to test it. > > P.S. Top-posting makes for confusing emails. > > Thanks. > >>> Signed-off-by: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> >>> --- >>> Instead of setting constant value for delay as was in previous patch, >>> now in the current modification delay will be calculated based on clock frequency of the bus. >>> >>> drivers/i2c/busses/i2c-tegra.c | 8 ++++++++ >>> 1 files changed, 8 insertions(+), 0 deletions(-) >>> >>> diff --git a/drivers/i2c/busses/i2c-tegra.c >>> b/drivers/i2c/busses/i2c-tegra.c index 6381604..62e197c 100644 >>> --- a/drivers/i2c/busses/i2c-tegra.c >>> +++ b/drivers/i2c/busses/i2c-tegra.c >>> @@ -517,6 +517,14 @@ static int tegra_i2c_xfer_msg(struct >>> tegra_i2c_dev *i2c_dev, >>> if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) >>> return 0; >>> >>> + /* >>> + * In NACK error condition resetting of I2C controller happens >>> + * before STOP condition is properly completed by I2C >>> + controller, >>> + * so wait for 2 clock cycle to complete STOP condition. >>> + */ >> >>>>>> Why do you need to reset the controller in case of a NACK. >>>>> This is required because of hardware limitations. Without reset we can't flus the internal hardware registers. >> >> >>> + if (i2c_dev->msg_err == I2C_ERR_NO_ACK) >>> + udelay(DIV_ROUND_UP(2 * 1000000, >>> + i2c_dev->bus_clk_rate)); >>> + >>> tegra_i2c_init(i2c_dev); >>> if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { >>> if (msg->flags & I2C_M_IGNORE_NAK) >>> -- >>> 1.7.4.1 > -- > To unsubscribe from this list: send the line "unsubscribe linux-tegra" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v2] i2c: tegra: Add delay before reset the controller @ 2012-04-02 5:53 Alok Chauhan [not found] ` <1333345982-16595-1-git-send-email-alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 18+ messages in thread From: Alok Chauhan @ 2012-04-02 5:53 UTC (permalink / raw) To: swarren-3lzwWm7+Weoh9ZMKESR00Q, khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, swarren-DDmLM1+adcrQT0dZR+AlfA, olof-nZhT3qVonbNeoWH0uzbU5w, bones-s3s/WqlpOiPyB63q8FvJNQ, omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w, ccross-z5hGa2qSFaRBDgjK7y7TUQ, ldewangan-DDmLM1+adcrQT0dZR+AlfA, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-i2c-u79uwXL29TY76Z2rM5mHXA, dgreid-F7+t8E8rja9g9hUCZPvPmw Cc: alokc-DDmLM1+adcrQT0dZR+AlfA, linux-kernel-u79uwXL29TY76Z2rM5mHXA NACK interrupt generated before I2C controller generates the STOP condition on bus. In Software, because of this reset of controller is happening before I2C controller could complete STOP condition. So wait for some time before resetting the controller so that STOP condition has delivered properly on bus. Added delay of 2 clock period before reset the controller in case of NACK error. Signed-off-by: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> --- Added the more descriptive commit message about issue in case of NACK error condition. Changed the comment in code also drivers/i2c/busses/i2c-tegra.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index e978635..dfb850a8 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -516,6 +516,14 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) return 0; + /* + * NACK interrupt generated before I2C controller generates the STOP + * condition on bus. So wait for some time before reset the controller + * so that STOP condition has delivered properly on bus. + */ + if (i2c_dev->msg_err == I2C_ERR_NO_ACK) + udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate)); + tegra_i2c_init(i2c_dev); if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { if (msg->flags & I2C_M_IGNORE_NAK) -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
[parent not found: <1333345982-16595-1-git-send-email-alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* RE: [PATCH v2] i2c: tegra: Add delay before reset the controller [not found] ` <1333345982-16595-1-git-send-email-alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2012-04-02 5:59 ` Alok Chauhan [not found] ` <7A0BFCFE3DA5CD47B0FB7984326F201A136BDCC35E-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org> 2012-04-02 19:58 ` Stephen Warren 2012-04-18 14:27 ` Wolfram Sang 2 siblings, 1 reply; 18+ messages in thread From: Alok Chauhan @ 2012-04-02 5:59 UTC (permalink / raw) Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Alok Chauhan, swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org, khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org, ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org, Stephen Warren, olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org, bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org, Laxman Dewangan, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, dgreid-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org Stephen, I've updated the commit message and comment in the code as per your suggestion. Tegra I2C controller doesn't have idle bit so delay is required before reset the controller in case of NACK error. This delay is calculated purely based on clock period of that particular i2c bus and not passed as hardcoded value. I2C SCL clock-stretching won't affect this calculated delay. Thanks Alok -----Original Message----- From: Alok Chauhan [mailto:alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org] Sent: Monday, April 02, 2012 11:23 AM To: swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org; khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org; ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org; w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org; Stephen Warren; olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org; bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org; omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org; Laxman Dewangan; linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; dgreid-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org Cc: Alok Chauhan; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: [PATCH v2] i2c: tegra: Add delay before reset the controller NACK interrupt generated before I2C controller generates the STOP condition on bus. In Software, because of this reset of controller is happening before I2C controller could complete STOP condition. So wait for some time before resetting the controller so that STOP condition has delivered properly on bus. Added delay of 2 clock period before reset the controller in case of NACK error. Signed-off-by: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> --- Added the more descriptive commit message about issue in case of NACK error condition. Changed the comment in code also drivers/i2c/busses/i2c-tegra.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index e978635..dfb850a8 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -516,6 +516,14 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) return 0; + /* + * NACK interrupt generated before I2C controller generates the STOP + * condition on bus. So wait for some time before reset the controller + * so that STOP condition has delivered properly on bus. + */ + if (i2c_dev->msg_err == I2C_ERR_NO_ACK) + udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate)); + tegra_i2c_init(i2c_dev); if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { if (msg->flags & I2C_M_IGNORE_NAK) -- 1.7.4.1 ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <7A0BFCFE3DA5CD47B0FB7984326F201A136BDCC35E-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org>]
* Re: [PATCH v2] i2c: tegra: Add delay before reset the controller [not found] ` <7A0BFCFE3DA5CD47B0FB7984326F201A136BDCC35E-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org> @ 2012-04-02 10:19 ` Shubhrajyoti Datta [not found] ` <CAM=Q2cuN+qAjDsBNp5Sq_Xs9KGcOQJ+PwjSVW-F0QczxMpWZRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 18+ messages in thread From: Shubhrajyoti Datta @ 2012-04-02 10:19 UTC (permalink / raw) To: Alok Chauhan Cc: Stephen Warren, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org, ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org, Stephen Warren, olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org, bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org, Laxman Dewangan, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, dgreid-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org Hi Alok, Few / doubts /questions. On Mon, Apr 2, 2012 at 11:29 AM, Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote: > Stephen, > > I've updated the commit message and comment in the code as per your suggestion. Tegra I2C controller doesn't have idle bit so delay is required before reset the controller in case of NACK error. This delay is calculated purely based on clock period of that particular i2c bus and not passed as hardcoded value. I2C SCL clock-stretching won't affect this calculated delay. Why is it clock cycle dependent? Is it possible to poll if the stop is sent by controller ? > > Thanks > Alok > > > -----Original Message----- > From: Alok Chauhan [mailto:alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org] > Sent: Monday, April 02, 2012 11:23 AM > To: swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org; khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org; ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org; w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org; Stephen Warren; olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org; bones@secretlab.ca; omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org; Laxman Dewangan; linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; dgreid@chromium.org > Cc: Alok Chauhan; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > Subject: [PATCH v2] i2c: tegra: Add delay before reset the controller > > NACK interrupt generated before I2C controller generates the STOP condition on bus. In Software, because of this reset of controller is happening before I2C controller could complete STOP condition. So wait for some time before resetting the controller so that STOP condition has delivered properly on bus. > > Added delay of 2 clock period How did you calculate the 2 clock cycles? before reset the controller in case of NACK error. > > Signed-off-by: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > --- > Added the more descriptive commit message about issue in case of NACK error condition. Changed the comment in code also > > drivers/i2c/busses/i2c-tegra.c | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <CAM=Q2cuN+qAjDsBNp5Sq_Xs9KGcOQJ+PwjSVW-F0QczxMpWZRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* RE: [PATCH v2] i2c: tegra: Add delay before reset the controller [not found] ` <CAM=Q2cuN+qAjDsBNp5Sq_Xs9KGcOQJ+PwjSVW-F0QczxMpWZRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2012-04-02 12:06 ` Alok Chauhan 0 siblings, 0 replies; 18+ messages in thread From: Alok Chauhan @ 2012-04-02 12:06 UTC (permalink / raw) To: Shubhrajyoti Datta Cc: Stephen Warren, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org, ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org, Stephen Warren, olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org, bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org, Laxman Dewangan, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, dgreid-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org Hi Shubhrajyoti, > Why is it clock cycle dependent? I think you got me wrong. What I meant to say that delay is calculated based on clock period of that bus. So in this way I don't have to hardcode the delay value. > Is it possible to poll if the stop is sent by controller ? No, Tegra i2c controller doesn't have any register for STOP condition completion status bit. So delay is the only option here. Thanks Alok -----Original Message----- From: Shubhrajyoti Datta [mailto:omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] Sent: Monday, April 02, 2012 3:49 PM To: Alok Chauhan Cc: Stephen Warren; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org; ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org; w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org; Stephen Warren; olof@lixom.net; bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org; ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org; Laxman Dewangan; linux-tegra@vger.kernel.org; linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; dgreid-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org Subject: Re: [PATCH v2] i2c: tegra: Add delay before reset the controller Hi Alok, Few / doubts /questions. On Mon, Apr 2, 2012 at 11:29 AM, Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote: > Stephen, > > I've updated the commit message and comment in the code as per your suggestion. Tegra I2C controller doesn't have idle bit so delay is required before reset the controller in case of NACK error. This delay is calculated purely based on clock period of that particular i2c bus and not passed as hardcoded value. I2C SCL clock-stretching won't affect this calculated delay. Why is it clock cycle dependent? Is it possible to poll if the stop is sent by controller ? > > Thanks > Alok > > > -----Original Message----- > From: Alok Chauhan [mailto:alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org] > Sent: Monday, April 02, 2012 11:23 AM > To: swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org; khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org; ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org; w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org; Stephen Warren; olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org; bones@secretlab.ca; omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org; Laxman Dewangan; linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; dgreid@chromium.org > Cc: Alok Chauhan; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > Subject: [PATCH v2] i2c: tegra: Add delay before reset the controller > > NACK interrupt generated before I2C controller generates the STOP condition on bus. In Software, because of this reset of controller is happening before I2C controller could complete STOP condition. So wait for some time before resetting the controller so that STOP condition has delivered properly on bus. > > Added delay of 2 clock period How did you calculate the 2 clock cycles? before reset the controller in case of NACK error. > > Signed-off-by: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > --- > Added the more descriptive commit message about issue in case of NACK error condition. Changed the comment in code also > > drivers/i2c/busses/i2c-tegra.c | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2] i2c: tegra: Add delay before reset the controller [not found] ` <1333345982-16595-1-git-send-email-alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2012-04-02 5:59 ` Alok Chauhan @ 2012-04-02 19:58 ` Stephen Warren [not found] ` <4F7A0500.3060305-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 2012-04-18 14:27 ` Wolfram Sang 2 siblings, 1 reply; 18+ messages in thread From: Stephen Warren @ 2012-04-02 19:58 UTC (permalink / raw) To: Alok Chauhan Cc: khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, olof-nZhT3qVonbNeoWH0uzbU5w, bones-s3s/WqlpOiPyB63q8FvJNQ, omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w, ccross-z5hGa2qSFaRBDgjK7y7TUQ, ldewangan-DDmLM1+adcrQT0dZR+AlfA, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-i2c-u79uwXL29TY76Z2rM5mHXA, dgreid-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA On 04/01/2012 11:53 PM, Alok Chauhan wrote: > NACK interrupt generated before I2C controller generates > the STOP condition on bus. In Software, because of this > reset of controller is happening before I2C controller could > complete STOP condition. So wait for some time before resetting > the controller so that STOP condition has delivered properly on bus. > > Added delay of 2 clock period before reset the > controller in case of NACK error. > > Signed-off-by: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> Acked-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <4F7A0500.3060305-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>]
* Re: [PATCH v2] i2c: tegra: Add delay before reset the controller [not found] ` <4F7A0500.3060305-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> @ 2012-04-13 22:51 ` Stephen Warren 0 siblings, 0 replies; 18+ messages in thread From: Stephen Warren @ 2012-04-13 22:51 UTC (permalink / raw) To: ben-linux-elnMNo+KYs3YtjvyW6yDsg, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ Cc: Alok Chauhan, khali-PUYAD+kWke1g9hUCZPvPmw, olof-nZhT3qVonbNeoWH0uzbU5w, bones-s3s/WqlpOiPyB63q8FvJNQ, omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w, ccross-z5hGa2qSFaRBDgjK7y7TUQ, ldewangan-DDmLM1+adcrQT0dZR+AlfA, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-i2c-u79uwXL29TY76Z2rM5mHXA, dgreid-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA On 04/02/2012 01:58 PM, Stephen Warren wrote: > On 04/01/2012 11:53 PM, Alok Chauhan wrote: >> NACK interrupt generated before I2C controller generates >> the STOP condition on bus. In Software, because of this >> reset of controller is happening before I2C controller could >> complete STOP condition. So wait for some time before resetting >> the controller so that STOP condition has delivered properly on bus. >> >> Added delay of 2 clock period before reset the >> controller in case of NACK error. >> >> Signed-off-by: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > Acked-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> Wolfram, Ben, can this be picked up for 3.5? ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2] i2c: tegra: Add delay before reset the controller [not found] ` <1333345982-16595-1-git-send-email-alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2012-04-02 5:59 ` Alok Chauhan 2012-04-02 19:58 ` Stephen Warren @ 2012-04-18 14:27 ` Wolfram Sang 2012-04-18 20:02 ` Stephen Warren 2 siblings, 1 reply; 18+ messages in thread From: Wolfram Sang @ 2012-04-18 14:27 UTC (permalink / raw) To: Alok Chauhan Cc: swarren-3lzwWm7+Weoh9ZMKESR00Q, khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg, swarren-DDmLM1+adcrQT0dZR+AlfA, olof-nZhT3qVonbNeoWH0uzbU5w, bones-s3s/WqlpOiPyB63q8FvJNQ, omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w, ccross-z5hGa2qSFaRBDgjK7y7TUQ, ldewangan-DDmLM1+adcrQT0dZR+AlfA, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-i2c-u79uwXL29TY76Z2rM5mHXA, dgreid-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 880 bytes --] On Mon, Apr 02, 2012 at 11:23:02AM +0530, Alok Chauhan wrote: > NACK interrupt generated before I2C controller generates > the STOP condition on bus. In Software, because of this > reset of controller is happening before I2C controller could > complete STOP condition. So wait for some time before resetting > the controller so that STOP condition has delivered properly on bus. > > Added delay of 2 clock period before reset the > controller in case of NACK error. > > Signed-off-by: Alok Chauhan <alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> Applied with Stephen's ACK and slightly reworded comment and commit msg. Wondering a bit that you want it for 3.5, not for 3.4. Looks like a bugfix to me. -- Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2] i2c: tegra: Add delay before reset the controller 2012-04-18 14:27 ` Wolfram Sang @ 2012-04-18 20:02 ` Stephen Warren [not found] ` <4F8F1DBD.8000009-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 0 siblings, 1 reply; 18+ messages in thread From: Stephen Warren @ 2012-04-18 20:02 UTC (permalink / raw) To: Wolfram Sang Cc: Alok Chauhan, khali, ben-linux, swarren, olof, bones, omaplinuxkernel, ccross, ldewangan, linux-tegra, linux-i2c, dgreid, linux-kernel On 04/18/2012 08:27 AM, Wolfram Sang wrote: > On Mon, Apr 02, 2012 at 11:23:02AM +0530, Alok Chauhan wrote: >> NACK interrupt generated before I2C controller generates >> the STOP condition on bus. In Software, because of this >> reset of controller is happening before I2C controller could >> complete STOP condition. So wait for some time before resetting >> the controller so that STOP condition has delivered properly on bus. >> >> Added delay of 2 clock period before reset the >> controller in case of NACK error. >> >> Signed-off-by: Alok Chauhan <alokc@nvidia.com> > > Applied with Stephen's ACK and slightly reworded comment and commit msg. > > Wondering a bit that you want it for 3.5, not for 3.4. Looks like a > bugfix to me. Yes, applying this to 3.4 would make sense. When I said "for 3.5" earlier, I meant I'd like it to at least get into 3.5 not later. Thanks. ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <4F8F1DBD.8000009-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>]
* Re: [PATCH v2] i2c: tegra: Add delay before reset the controller [not found] ` <4F8F1DBD.8000009-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> @ 2012-04-18 20:20 ` Wolfram Sang 0 siblings, 0 replies; 18+ messages in thread From: Wolfram Sang @ 2012-04-18 20:20 UTC (permalink / raw) To: Stephen Warren Cc: Alok Chauhan, khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg, swarren-DDmLM1+adcrQT0dZR+AlfA, olof-nZhT3qVonbNeoWH0uzbU5w, bones-s3s/WqlpOiPyB63q8FvJNQ, omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w, ccross-z5hGa2qSFaRBDgjK7y7TUQ, ldewangan-DDmLM1+adcrQT0dZR+AlfA, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-i2c-u79uwXL29TY76Z2rM5mHXA, dgreid-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 510 bytes --] > > Applied with Stephen's ACK and slightly reworded comment and commit msg. > > > > Wondering a bit that you want it for 3.5, not for 3.4. Looks like a > > bugfix to me. > > Yes, applying this to 3.4 would make sense. When I said "for 3.5" > earlier, I meant I'd like it to at least get into 3.5 not later. Done, thanks for clarifying. -- Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2012-04-18 20:20 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-12-26 11:14 [PATCH v2] i2c: tegra: Add delay before reset the controller Alok Chauhan [not found] ` <1324898081-10308-1-git-send-email-alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2012-01-06 16:18 ` Ben Dooks 2012-01-10 4:12 ` Alok Chauhan [not found] ` <7A0BFCFE3DA5CD47B0FB7984326F201A134F2CD4F1-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org> 2012-02-10 9:20 ` Alok Chauhan 2012-02-10 9:35 ` Shubhrajyoti Datta [not found] ` <CAM=Q2cs+myCvph7OXvCDTG7y48oNTfRtjsDzQaKiEXzjdu3pzA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2012-02-14 5:49 ` Alok Chauhan [not found] ` <7A0BFCFE3DA5CD47B0FB7984326F201A13689D386F-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org> 2012-03-08 6:29 ` Alok Chauhan [not found] ` <7A0BFCFE3DA5CD47B0FB7984326F201A136B886672-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org> 2012-03-08 16:30 ` Stephen Warren [not found] ` <4F58DEB8.9060103-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 2012-03-26 21:09 ` Dylan Reid -- strict thread matches above, loose matches on Subject: below -- 2012-04-02 5:53 Alok Chauhan [not found] ` <1333345982-16595-1-git-send-email-alokc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2012-04-02 5:59 ` Alok Chauhan [not found] ` <7A0BFCFE3DA5CD47B0FB7984326F201A136BDCC35E-kdsAE/FnitNDw2glCA4ptUEOCMrvLtNR@public.gmane.org> 2012-04-02 10:19 ` Shubhrajyoti Datta [not found] ` <CAM=Q2cuN+qAjDsBNp5Sq_Xs9KGcOQJ+PwjSVW-F0QczxMpWZRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2012-04-02 12:06 ` Alok Chauhan 2012-04-02 19:58 ` Stephen Warren [not found] ` <4F7A0500.3060305-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 2012-04-13 22:51 ` Stephen Warren 2012-04-18 14:27 ` Wolfram Sang 2012-04-18 20:02 ` Stephen Warren [not found] ` <4F8F1DBD.8000009-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 2012-04-18 20:20 ` Wolfram Sang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).