[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DM6PR13MB3451CA7C440D0E2F94AAF1C597030@DM6PR13MB3451.namprd13.prod.outlook.com>
Date: Fri, 16 Oct 2020 04:23:31 +0000
From: Sagar Kadam <sagar.kadam@...nfive.com>
To: Peter Korsgaard <peter@...sgaard.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
"andrew@...n.ch" <andrew@...n.ch>,
"Paul Walmsley ( Sifive)" <paul.walmsley@...ive.com>,
"palmer@...belt.com" <palmer@...belt.com>,
"aou@...s.berkeley.edu" <aou@...s.berkeley.edu>
Subject: RE: [PATCH v3 1/1] i2c: ocores: fix polling mode workaround on
FU540-C000 SoC
Hello Peter,
> -----Original Message-----
> From: Peter Korsgaard <jacmet@...il.com> On Behalf Of Peter Korsgaard
> Sent: Thursday, October 15, 2020 8:19 PM
> To: Sagar Kadam <sagar.kadam@...nfive.com>
> Cc: linux-kernel@...r.kernel.org; linux-riscv@...ts.infradead.org; linux-
> i2c@...r.kernel.org; andrew@...n.ch; Paul Walmsley ( Sifive)
> <paul.walmsley@...ive.com>; palmer@...belt.com;
> aou@...s.berkeley.edu
> Subject: Re: [PATCH v3 1/1] i2c: ocores: fix polling mode workaround on
> FU540-C000 SoC
>
> [External Email] Do not click links or attachments unless you recognize the
> sender and know the content is safe
>
> >>>>> "Sagar" == Sagar Shrikant Kadam <sagar.kadam@...ive.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@...ive.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.:
>
Sorry for the confusing wordings here.
> /*
> * 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.
> */
>
I will replace mine with your suggested one.
> > + * 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;
> }
>
Yeah..
This is a better alternative implementation.
I will push v4 with this.
Thanks & BR,
Sagar
> if (irq == -ENXIO) {
> ..
>
> --
> Bye, Peter Korsgaard
Powered by blists - more mailing lists