[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220923071638.45hylqvajn74j6mk@h-e2.ddg>
Date: Fri, 23 Sep 2022 10:16:38 +0300
From: Ivan Bornyakov <i.bornyakov@...rotek.ru>
To: Xu Yilun <yilun.xu@...el.com>
Cc: mdf@...nel.org, hao.wu@...el.com, trix@...hat.com, dg@...ix.com,
j.zink@...gutronix.de, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, linux-fpga@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel@...gutronix.de, system@...rotek.ru
Subject: Re: [PATCH v12 1/2] fpga: lattice-sysconfig-spi: add Lattice
sysCONFIG FPGA manager
On Fri, Sep 23, 2022 at 02:24:46PM +0800, Xu Yilun wrote:
> On 2022-09-19 at 16:47:49 +0300, Ivan Bornyakov wrote:
> > Add support to the FPGA manager for programming Lattice ECP5 FPGA over
> > slave SPI sysCONFIG interface.
> >
> > sysCONFIG interface core functionality is separate from both ECP5 and
> > SPI specifics, so support for other FPGAs with different port types can
> > be added in the future.
> >
> > Signed-off-by: Ivan Bornyakov <i.bornyakov@...rotek.ru>
> > ---
> > drivers/fpga/Kconfig | 11 +
> > drivers/fpga/Makefile | 2 +
> > drivers/fpga/lattice-sysconfig-spi.c | 153 ++++++++++
> > drivers/fpga/lattice-sysconfig.c | 408 +++++++++++++++++++++++++++
> > drivers/fpga/lattice-sysconfig.h | 40 +++
> > 5 files changed, 614 insertions(+)
> > create mode 100644 drivers/fpga/lattice-sysconfig-spi.c
> > create mode 100644 drivers/fpga/lattice-sysconfig.c
> > create mode 100644 drivers/fpga/lattice-sysconfig.h
> >
> > diff --git a/drivers/fpga/lattice-sysconfig-spi.c b/drivers/fpga/lattice-sysconfig-spi.c
> > new file mode 100644
> > index 000000000000..d015b796adf7
> > --- /dev/null
> > +++ b/drivers/fpga/lattice-sysconfig-spi.c
> >
> > ... snip ...
> >
> > +static int sysconfig_isc_enable(struct sysconfig_priv *priv)
> > +{
> > + u8 isc_enable[] = SYSCONFIG_ISC_ENABLE;
> > + u32 status;
> > + int ret;
> > +
> > + ret = sysconfig_cmd_write(priv, isc_enable, sizeof(isc_enable));
> > + if (ret)
> > + return ret;
> > +
> > + ret = sysconfig_poll_status(priv, &status);
> > + if (ret || (status & SYSCONFIG_STATUS_FAIL))
> > + return ret ? : -EFAULT;
>
> If (ret == 0 && status == SYSCONFIG_STATUS_FAIL), still return 0?
>
No, -EFAULT should be returned in that case. Am I overlooked something?
> > +
> > + return 0;
> > +}
> > +
> > +static int sysconfig_isc_erase(struct sysconfig_priv *priv)
> > +{
> > + u8 isc_erase[] = SYSCONFIG_ISC_ERASE;
> > + u32 status;
> > + int ret;
> > +
> > + ret = sysconfig_cmd_write(priv, isc_erase, sizeof(isc_erase));
> > + if (ret)
> > + return ret;
> > +
> > + ret = sysconfig_poll_status(priv, &status);
> > + if (ret || (status & SYSCONFIG_STATUS_FAIL))
>
> Same concern.
>
> > + return ret ? : -EFAULT;
> > +
> > + return 0;
> > +}
Powered by blists - more mailing lists