RE: [PATCH v6 3/9] spi: Add a driver for the Freescale/NXP QuadSPI controller
From: Han Xu
Date: Mon Dec 03 2018 - 15:54:43 EST
> -----Original Message-----
> From: Schrempf Frieder <frieder.schrempf@xxxxxxxxxx>
> Sent: Thursday, November 29, 2018 11:36 AM
> To: Han Xu <han.xu@xxxxxxx>; Yogesh Narayan Gaur
> <yogeshnarayan.gaur@xxxxxxx>; linux-mtd@xxxxxxxxxxxxxxxxxxx;
> boris.brezillon@xxxxxxxxxxx; linux-spi@xxxxxxxxxxxxxxx; Marek Vasut
> <marek.vasut@xxxxxxxxx>; Mark Brown <broonie@xxxxxxxxxx>
> Cc: dwmw2@xxxxxxxxxxxxx; computersforpeace@xxxxxxxxx;
> richard@xxxxxx; miquel.raynal@xxxxxxxxxxx; David Wolfe
> <david.wolfe@xxxxxxx>; Fabio Estevam <fabio.estevam@xxxxxxx>;
> Prabhakar Kushwaha <prabhakar.kushwaha@xxxxxxx>;
> shawnguo@xxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH v6 3/9] spi: Add a driver for the Freescale/NXP QuadSPI
> controller
>
> Hi Han,
>
> On 29.11.18 17:30, Han Xu wrote:
> >
> >
> >> -----Original Message-----
> >> From: Schrempf Frieder <frieder.schrempf@xxxxxxxxxx>
> >> Sent: Thursday, November 29, 2018 5:54 AM
> >> To: Yogesh Narayan Gaur <yogeshnarayan.gaur@xxxxxxx>; linux-
> >> mtd@xxxxxxxxxxxxxxxxxxx; boris.brezillon@xxxxxxxxxxx; linux-
> >> spi@xxxxxxxxxxxxxxx; Marek Vasut <marek.vasut@xxxxxxxxx>; Mark
> Brown
> >> <broonie@xxxxxxxxxx>; Han Xu <han.xu@xxxxxxx>
> >> Cc: dwmw2@xxxxxxxxxxxxx; computersforpeace@xxxxxxxxx;
> richard@xxxxxx;
> >> miquel.raynal@xxxxxxxxxxx; David Wolfe <david.wolfe@xxxxxxx>; Fabio
> >> Estevam <fabio.estevam@xxxxxxx>; Prabhakar Kushwaha
> >> <prabhakar.kushwaha@xxxxxxx>; shawnguo@xxxxxxxxxx;
> >> linux-kernel@xxxxxxxxxxxxxxx
> >> Subject: Re: [PATCH v6 3/9] spi: Add a driver for the Freescale/NXP
> >> QuadSPI controller
> >>
> >> Hi Yogesh,
> >>
> >> On 29.11.18 12:38, Yogesh Narayan Gaur wrote:
> >>> Hi Frieder,
> >>>
> >>>> -----Original Message-----
> >>>> From: Schrempf Frieder [mailto:frieder.schrempf@xxxxxxxxxx]
> >>>> Sent: Wednesday, November 28, 2018 1:58 PM
> >>>> To: linux-mtd@xxxxxxxxxxxxxxxxxxx; boris.brezillon@xxxxxxxxxxx;
> >>>> linux- spi@xxxxxxxxxxxxxxx; Marek Vasut <marek.vasut@xxxxxxxxx>;
> >> Mark
> >>>> Brown <broonie@xxxxxxxxxx>; Han Xu <han.xu@xxxxxxx>
> >>>> Cc: dwmw2@xxxxxxxxxxxxx; computersforpeace@xxxxxxxxx;
> >> richard@xxxxxx;
> >>>> miquel.raynal@xxxxxxxxxxx; David Wolfe <david.wolfe@xxxxxxx>;
> Fabio
> >>>> Estevam <fabio.estevam@xxxxxxx>; Prabhakar Kushwaha
> >>>> <prabhakar.kushwaha@xxxxxxx>; Yogesh Narayan Gaur
> >>>> <yogeshnarayan.gaur@xxxxxxx>; shawnguo@xxxxxxxxxx; linux-
> >>>> kernel@xxxxxxxxxxxxxxx
> >>>> Subject: Re: [PATCH v6 3/9] spi: Add a driver for the Freescale/NXP
> >>>> QuadSPI controller
> >>>>
> >>>> On 27.11.18 11:24, Schrempf Frieder wrote:
> >>>>> This driver is derived from the SPI NOR driver at
> >>>>> mtd/spi-nor/fsl-quadspi.c. It uses the new SPI memory interface of
> >>>>> the SPI framework to issue flash memory operations to up to four
> >>>>> connected flash chips (2 buses with 2 CS each).
> >>>>>
> >>>>> The controller does not support generic SPI messages.
> >>>>>
> >>>>> This patch also disables the build of the "old" driver and reuses
> >>>>> its Kconfig option CONFIG_SPI_FSL_QUADSPI to replace it.
> >>>>>
> >>>>> Signed-off-by: Frieder Schrempf <frieder.schrempf@xxxxxxxxxx>
> >>>>> ---
> >>>>> drivers/mtd/spi-nor/Kconfig | 9 -
> >>>>> drivers/mtd/spi-nor/Makefile | 1 -
> >>>>> drivers/spi/Kconfig | 11 +
> >>>>> drivers/spi/Makefile | 1 +
> >>>>> drivers/spi/spi-fsl-qspi.c | 967
> >>>> ++++++++++++++++++++++++++++++++++++++
> >>>>> 5 files changed, 979 insertions(+), 10 deletions(-)
> >>>>>
> >>>>> diff --git a/drivers/mtd/spi-nor/Kconfig
> >>>>> b/drivers/mtd/spi-nor/Kconfig index 6cc9c92..d1ca307 100644
> >>>>> --- a/drivers/mtd/spi-nor/Kconfig
> >>>>> +++ b/drivers/mtd/spi-nor/Kconfig
> >>>>> @@ -59,15 +59,6 @@ config SPI_CADENCE_QUADSPI
> >>>>> device with a Cadence QSPI controller and want to access
> the
> >>>>> Flash as an MTD device.
> >>>>>
> >>>>> -config SPI_FSL_QUADSPI
> >>>>> - tristate "Freescale Quad SPI controller"
> >>>>> - depends on ARCH_MXC || SOC_LS1021A ||
> ARCH_LAYERSCAPE ||
> >>>> COMPILE_TEST
> >>>>> - depends on HAS_IOMEM
> >>>>> - help
> >>>>> - This enables support for the Quad SPI controller in master
> mode.
> >>>>> - This controller does not support generic SPI. It only supports
> >>>>> - SPI NOR.
> >>>>> -
> >>>>> config SPI_HISI_SFC
> >>>>> tristate "Hisilicon SPI-NOR Flash Controller(SFC)"
> >>>>> depends on ARCH_HISI || COMPILE_TEST diff --git
> >>>>> a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
> >>>>> index
> >>>>> f4c61d2..3f160c2e3 100644
> >>>>> --- a/drivers/mtd/spi-nor/Makefile
> >>>>> +++ b/drivers/mtd/spi-nor/Makefile
> >>>>> @@ -3,7 +3,6 @@ obj-$(CONFIG_MTD_SPI_NOR) += spi-nor.o
> >>>>> obj-$(CONFIG_SPI_ASPEED_SMC) += aspeed-smc.o
> >>>>> obj-$(CONFIG_SPI_ATMEL_QUADSPI) += atmel-quadspi.o
> >>>>> obj-$(CONFIG_SPI_CADENCE_QUADSPI) += cadence-
> quadspi.o
> >>>>> -obj-$(CONFIG_SPI_FSL_QUADSPI) += fsl-quadspi.o
> >>>>> obj-$(CONFIG_SPI_HISI_SFC) += hisi-sfc.o
> >>>>> obj-$(CONFIG_MTD_MT81xx_NOR) += mtk-quadspi.o
> >>>>> obj-$(CONFIG_SPI_NXP_SPIFI) += nxp-spifi.o
> >>>>> diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index
> >>>>> 7d3a5c9..8c84186 100644
> >>>>> --- a/drivers/spi/Kconfig
> >>>>> +++ b/drivers/spi/Kconfig
> >>>>> @@ -259,6 +259,17 @@ config SPI_FSL_LPSPI
> >>>>> help
> >>>>> This enables Freescale i.MX LPSPI controllers in master
> mode.
> >>>>>
> >>>>> +config SPI_FSL_QUADSPI
> >>>>> + tristate "Freescale QSPI controller"
> >>>>> + depends on ARCH_MXC || SOC_LS1021A ||
> ARCH_LAYERSCAPE ||
> >>>> COMPILE_TEST
> >>>>> + depends on HAS_IOMEM
> >>>>> + help
> >>>>> + This enables support for the Quad SPI controller in master
> mode.
> >>>>> + Up to four flash chips can be connected on two buses with
> two
> >>>>> + chipselects each.
> >>>>> + This controller does not support generic SPI messages. It
> only
> >>>>> + supports the high-level SPI memory interface.
> >>>>> +
> >>> [...]
> >>>>> +static void fsl_qspi_select_mem(struct fsl_qspi *q, struct
> >>>>> +spi_device *spi) {
> >>>>> + unsigned long rate = spi->max_speed_hz;
> >>>>> + int ret, i;
> >>>>> + u32 map_addr;
> >>>>
> >>>> Forgot to drop some unused vars here. I will remove them in the
> >>>> next version.
> >>>>
> >>>
> >>> Yes, below are the build warnings messages coming for this version
> >>> of the
> >> patch.
> >>>
> >>> drivers/spi/spi-fsl-qspi.c: In function âfsl_qspi_select_memâ:
> >>> drivers/spi/spi-fsl-qspi.c:500:6: warning: unused variable âmap_addrâ
> >> [-Wunused-variable]
> >>> u32 map_addr;
> >>> ^
> >>> drivers/spi/spi-fsl-qspi.c:499:11: warning: unused variable âiâ [-
> >> Wunused-variable]
> >>> int ret, i;
> >>>
> >>>>> +
> >>>>> + if (q->selected == spi->chip_select)
> >>> [...]
> >>>
> >>> Verified this patch series on LayerScape-2.x architecture boards.
> >>> LS1088ardb, is having two connected flash slave devices on CS0 and CS1.
> >>>
> >>> Verified with simple Read/Write/Erase operations along with JFFS2
> >> mounting and booting from flash MTD partition for both slave devices.
> >>
> >> Thank you for testing! Does this mean I can add your Tested-by tag?
> >> If you have done a review of any of the patches in this set, please
> >> also add a Reviewed-by tag.
> >
> > Hi Schrempf, I am reviewing and testing on some i.MX platforms, please
> hold on for a while for the result.
>
> Okay, thanks! I'm looking forward to see the results.
Hi Schrempf, I am good with the patch set(with warning fix) and it works fine on i.MX platforms. I will add review and test tags for next version.
I have one questions about the DDR mode support, it there any further plans for DDR mode support rather than SDR only?
>
> Regards,
> Frieder