All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter@korsgaard.com>
To: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
	linux-i2c@vger.kernel.org, andrew@lunn.ch,
	paul.walmsley@sifive.com, palmer@dabbelt.com,
	aou@eecs.berkeley.edu
Subject: Re: [PATCH v3 1/1] i2c: ocores: fix polling mode workaround on FU540-C000 SoC
Date: Thu, 15 Oct 2020 16:49:06 +0200	[thread overview]
Message-ID: <87mu0nr1ct.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <1602770907-61852-2-git-send-email-sagar.kadam@sifive.com> (Sagar Shrikant Kadam's message of "Thu, 15 Oct 2020 07:08:27 -0700")

>>>>> "Sagar" == Sagar Shrikant Kadam <sagar.kadam@sifive.com> writes:

 > The FU540-C000 has a broken IRQ and support was added earlier
 > so that it will operate in polling mode, but seems to work only
 > in case interrupts property is missing from the i2c0 dt-node.
 > This should not be the case and the driver should handle polling
 > mode with the interrupt property present in i2c0 node of the
 > device tree.
 > So check if it's the FU540-C000 soc and enable polling mode master
 > xfers, as the IRQ for this chip is broken.

 > Fixes commit c45d4ba86731 ("i2c: ocores: add polling mode workaround
 > for Sifive FU540-C000 SoC")

 > Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
 > ---
 >  drivers/i2c/busses/i2c-ocores.c | 22 +++++++++++++---------
 >  1 file changed, 13 insertions(+), 9 deletions(-)

 > diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
 > index f5fc75b..1dab02d 100644
 > --- a/drivers/i2c/busses/i2c-ocores.c
 > +++ b/drivers/i2c/busses/i2c-ocores.c
 > @@ -686,17 +686,21 @@ static int ocores_i2c_probe(struct platform_device *pdev)
 
 >  	init_waitqueue_head(&i2c->wait);
 
 > +	/*
 > +	 * Set OCORES_FLAG_BROKEN_IRQ to enable workaround for
 > +	 * FU540-C000 SoC in polling mode.
 > +	 * Since the SoC does have interrupt its dt has the interrupt
 > +	 * defined but it should be bypassed in driver as this SoC has

NIT: Looks like there some commas missing and the wording sounds a bit
odd to me. What about E.G.:

     /*
      * Since the SoC does have an interrupt, its DT has an interrupt
      * property - But this should be bypassed as the IRQ logic in this
      * SoC is broken.
      */

 > +	 * a broken IRQ, hence update the master_xfer to use polling
 > +	 * transfers.
 > +	 */
 > +	if (of_device_is_compatible(pdev->dev.of_node,
 > +				    "sifive,fu540-c000-i2c"))
 > +		i2c->flags |= OCORES_FLAG_BROKEN_IRQ;
 > +
 >  	irq = platform_get_irq(pdev, 0);
 > -	if (irq == -ENXIO) {
 > +	if (i2c->flags & OCORES_FLAG_BROKEN_IRQ || irq == -ENXIO) {


Alternatively you can move it after the irq = platform_get_irq(pdev, 0)
line and just clear irq, E.G.:

irq = platform_get_irq(pdev, 0);

if (of_device_is_compatible(..)) {
   i2c->flags |= OCORES_FLAG_BROKEN_IRQ;
   irq = -ENXIO;
}

if (irq == -ENXIO) {
..

-- 
Bye, Peter Korsgaard

WARNING: multiple messages have this Message-ID (diff)
From: Peter Korsgaard <peter@korsgaard.com>
To: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
Cc: andrew@lunn.ch, aou@eecs.berkeley.edu,
	linux-kernel@vger.kernel.org, palmer@dabbelt.com,
	linux-i2c@vger.kernel.org, paul.walmsley@sifive.com,
	linux-riscv@lists.infradead.org
Subject: Re: [PATCH v3 1/1] i2c: ocores: fix polling mode workaround on FU540-C000 SoC
Date: Thu, 15 Oct 2020 16:49:06 +0200	[thread overview]
Message-ID: <87mu0nr1ct.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <1602770907-61852-2-git-send-email-sagar.kadam@sifive.com> (Sagar Shrikant Kadam's message of "Thu, 15 Oct 2020 07:08:27 -0700")

>>>>> "Sagar" == Sagar Shrikant Kadam <sagar.kadam@sifive.com> writes:

 > The FU540-C000 has a broken IRQ and support was added earlier
 > so that it will operate in polling mode, but seems to work only
 > in case interrupts property is missing from the i2c0 dt-node.
 > This should not be the case and the driver should handle polling
 > mode with the interrupt property present in i2c0 node of the
 > device tree.
 > So check if it's the FU540-C000 soc and enable polling mode master
 > xfers, as the IRQ for this chip is broken.

 > Fixes commit c45d4ba86731 ("i2c: ocores: add polling mode workaround
 > for Sifive FU540-C000 SoC")

 > Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
 > ---
 >  drivers/i2c/busses/i2c-ocores.c | 22 +++++++++++++---------
 >  1 file changed, 13 insertions(+), 9 deletions(-)

 > diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
 > index f5fc75b..1dab02d 100644
 > --- a/drivers/i2c/busses/i2c-ocores.c
 > +++ b/drivers/i2c/busses/i2c-ocores.c
 > @@ -686,17 +686,21 @@ static int ocores_i2c_probe(struct platform_device *pdev)
 
 >  	init_waitqueue_head(&i2c->wait);
 
 > +	/*
 > +	 * Set OCORES_FLAG_BROKEN_IRQ to enable workaround for
 > +	 * FU540-C000 SoC in polling mode.
 > +	 * Since the SoC does have interrupt its dt has the interrupt
 > +	 * defined but it should be bypassed in driver as this SoC has

NIT: Looks like there some commas missing and the wording sounds a bit
odd to me. What about E.G.:

     /*
      * Since the SoC does have an interrupt, its DT has an interrupt
      * property - But this should be bypassed as the IRQ logic in this
      * SoC is broken.
      */

 > +	 * a broken IRQ, hence update the master_xfer to use polling
 > +	 * transfers.
 > +	 */
 > +	if (of_device_is_compatible(pdev->dev.of_node,
 > +				    "sifive,fu540-c000-i2c"))
 > +		i2c->flags |= OCORES_FLAG_BROKEN_IRQ;
 > +
 >  	irq = platform_get_irq(pdev, 0);
 > -	if (irq == -ENXIO) {
 > +	if (i2c->flags & OCORES_FLAG_BROKEN_IRQ || irq == -ENXIO) {


Alternatively you can move it after the irq = platform_get_irq(pdev, 0)
line and just clear irq, E.G.:

irq = platform_get_irq(pdev, 0);

if (of_device_is_compatible(..)) {
   i2c->flags |= OCORES_FLAG_BROKEN_IRQ;
   irq = -ENXIO;
}

if (irq == -ENXIO) {
..

-- 
Bye, Peter Korsgaard

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2020-10-15 14:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15 14:08 [PATCH v3 0/1] fix i2c polling mode workaround for FU540-C000 SoC Sagar Shrikant Kadam
2020-10-15 14:08 ` Sagar Shrikant Kadam
2020-10-15 14:08 ` [PATCH v3 1/1] i2c: ocores: fix polling mode workaround on " Sagar Shrikant Kadam
2020-10-15 14:08   ` Sagar Shrikant Kadam
2020-10-15 14:49   ` Peter Korsgaard [this message]
2020-10-15 14:49     ` Peter Korsgaard
2020-10-16  4:23     ` Sagar Kadam
2020-10-16  4:23       ` Sagar Kadam

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=87mu0nr1ct.fsf@dell.be.48ers.dk \
    --to=peter@korsgaard.com \
    --cc=andrew@lunn.ch \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=sagar.kadam@sifive.com \
    /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.