mtd: spi-nor: add driver for NXP SPI Flash Interface (SPIFI)
Subsystems (2)
PATCH v5 1/1 mtd: spi-nor: add driver for NXP SPI Flash Interface (SPIFI)
Add SPI-NOR driver for the SPI Flash Interface (SPIFI) controller that is found on newer NXP MCU devices.
The controller supports serial SPI Flash devices with 1-, 2- and 4-bit width in either SPI mode 0 or 3. The controller can operate in either command or memory mode. In memory mode the Flash is exposed as normal memory and can be directly accessed by the CPU.
---
Hi Brian,
I skipped the cover letter since you already applied the 2nd of patch of the original set and using a cover letter for just one patch seemed a bit useless. Cover letter for v4 can be found here: http://marc.info/?l=devicetree&m=143647330431908&w=2
This version address all comments from Brian Norris except for two things noted below.
If the line below is removed the kernel opses on jffs2 mount. spifi->mtd.priv = &spifi->nor;
It seems like spi-nor.c doesn't setup this field. fsl-quadspi also assigns this field, btw.
The read/wait ordering in nxp_spifi_read_reg is correct. I don't really have a good explaination for the ordering. The user manual doesn't document the SPIFI in detail, but the offcial NXP spifilib has the same ordering.
Changes since v4:
- spifi: always autodetect SPI Flash
- s/spi/SPI on dev_* output
- add parentheses to SPIFI_CMD_DATALEN macro
- rebase on mtd-master
Changes since v3:
- fix bug in write function
- rebase on 4.2-rc1
Changes since v2:
- default to auto detection unless chip is specified
- update doc with reference to jedec,spi-nor.txt
Test on the following boards.
Hitex board boots on SPIFI Flash with JFFS2.
Hitex LPC4350 Eval board:
[ 2.093956] nxp-spifi 40003000.spifi: s25sl064p (8192 Kbytes)
Embedded Artists' LPC4357 Developer's Kit:
[ 3.051627] nxp-spifi 40003000.spifi: s25fl016k (2048 Kbytes)
Both s25fl016k and s25sl064p support dual/quad mode, but this is not flagged in spi-nor.c. I have sent a patch for s25fl016k and will send a patch s25sl064p please apply when you get them.
drivers/mtd/spi-nor/Kconfig | 11 + drivers/mtd/spi-nor/Makefile | 1 + drivers/mtd/spi-nor/nxp-spifi.c | 482 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 494 insertions(+) create mode 100644 drivers/mtd/spi-nor/nxp-spifi.c
drivers/mtd/spi-nor/Kconfig +11 -0
@@ -28,4 +28,15 @@ config SPI_FSL_QUADSPI This enables support for the Quad SPI controller in master mode. We only connect the NOR to this controller now. +config SPI_NXP_SPIFI + tristate "NXP SPI Flash Interface (SPIFI)" + depends on OF && (ARCH_LPC18XX || COMPILE_TEST) + depends on HAS_IOMEM + help + Enable support for the NXP LPC SPI Flash Interface controller. + + SPIFI is a specialized controller for connecting serial SPI + Flash. Enable this option if you have a device with a SPIFI + controller and want to access the Flash as a mtd device. + endif # MTD_SPI_NOR
drivers/mtd/spi-nor/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_MTD_SPI_NOR) += spi-nor.o obj-$(CONFIG_SPI_FSL_QUADSPI) += fsl-quadspi.o +obj-$(CONFIG_SPI_NXP_SPIFI) += nxp-spifi.o
drivers/mtd/spi-nor/nxp-spifi.c new file +482 -0
482 lines not on this page · raw message
Signature · 1 line
1.8.0
Brian Norris
AppliedPATCH v5 1/1 mtd: spi-nor: add driver for NXP SPI Flash Interface (SPIFI)
Quoted 19 lines · Joachim Eastwood
Add SPI-NOR driver for the SPI Flash Interface (SPIFI) controller that is found on newer NXP MCU devices.
The controller supports serial SPI Flash devices with 1-, 2- and 4-bit width in either SPI mode 0 or 3. The controller can operate in either command or memory mode. In memory mode the Flash is exposed as normal memory and can be directly accessed by the CPU.
Signed-off-by Joachim Eastwood <[email protected]>Reviewed-by Ezequiel Garcia <[email protected]>---
Hi Brian,I skipped the cover letter since you already applied the 2nd of patch of the original set and using a cover letter for just one patch seemed a bit useless. Cover letter for v4 can be found here: http://marc.info/?l=devicetree&m=143647330431908&w=2
Quoted 7 lines
This version address all comments from Brian Norris except for two things noted below.
If the line below is removed the kernel opses on jffs2 mount.
spifi->mtd.priv=&spifi->nor;
It seems likespi-nor.cdoesn't setup this field. fsl-quadspi also assigns this field, btw.
Sorry, I overlooked that. But that code's pretty dumb. I'll take yours as-is, but I'll send a patch to fix both.
Quoted 4 lines
The read/wait ordering in
nxp_spifi_read_regis correct. I don't really have a good explaination for the ordering. The user manual doesn't document the SPIFI in detail, but the offcial NXP spifilib has the same ordering.
OK, no problem.
Quoted 14 lines
Changes since v4:
- spifi: always autodetect SPI Flash
- s/spi/SPI on dev_* output
- add parentheses toSPIFI_CMD_DATALENmacro
- rebase on mtd-masterChanges since v3:
- fix bug in write function
- rebase on 4.2-rc1Changes since v2:
- default to auto detection unless chip is specified
- update doc with reference to jedec,spi-nor.txt
Quoted 8 lines
Test on the following boards.
Hitex board boots on SPIFI Flash with JFFS2.Hitex LPC4350 Eval board:
[ 2.093956] nxp-spifi 40003000.spifi: s25sl064p (8192 Kbytes)Embedded Artists' LPC4357 Developer's Kit:
[ 3.051627] nxp-spifi 40003000.spifi: s25fl016k (2048 Kbytes)
Applied to l2-mtd.git, thanks!
BTW, is this driver worth a MAINTAINERS entry? It's nice to always have someone on CC that has the hardware. The git history should probably pick you up anyway when running get_maintainers.pl, so it may not be absolutely necessary.
Quoted 3 lines
Both s25fl016k and s25sl064p support dual/quad mode, but this is not flagged in
spi-nor.c. I have sent a patch for s25fl016k and will send a patch s25sl064p please apply when you get them.
I'll see if I can dig these out of the mailing list eventually. I have a sizable backlog.
Brian
PATCH v5 1/1 mtd: spi-nor: add driver for NXP SPI Flash Interface (SPIFI)
Hi Brian,
Quoted 23 lines · Brian Norris
Quoted 22 lines · Joachim Eastwood
Add SPI-NOR driver for the SPI Flash Interface (SPIFI) controller that is found on newer NXP MCU devices.
The controller supports serial SPI Flash devices with 1-, 2- and 4-bit width in either SPI mode 0 or 3. The controller can operate in either command or memory mode. In memory mode the Flash is exposed as normal memory and can be directly accessed by the CPU.
Signed-off-by Joachim Eastwood <[email protected]>Reviewed-by Ezequiel Garcia <[email protected]>---
Hi Brian,I skipped the cover letter since you already applied the 2nd of patch of the original set and using a cover letter for just one patch seemed a bit useless. Cover letter for v4 can be found here: http://marc.info/?l=devicetree&m=143647330431908&w=2
This version address all comments from Brian Norris except for two things noted below.
Quoted 7 lines
Quoted 4 lines
If the line below is removed the kernel opses on jffs2 mount.
spifi->mtd.priv=&spifi->nor;
It seems likespi-nor.cdoesn't setup this field. fsl-quadspi also assigns this field, btw.Sorry, I overlooked that. But that code's pretty dumb. I'll take yours as-is, but I'll send a patch to fix both.
OK.
Quoted 24 lines
Quoted 4 lines
The read/wait ordering in
nxp_spifi_read_regis correct. I don't really have a good explaination for the ordering. The user manual doesn't document the SPIFI in detail, but the offcial NXP spifilib has the same ordering.OK, no problem.
Quoted 17 lines
Changes since v4:
- spifi: always autodetect SPI Flash
- s/spi/SPI on dev_* output
- add parentheses toSPIFI_CMD_DATALENmacro
- rebase on mtd-masterChanges since v3:
- fix bug in write function
- rebase on 4.2-rc1Changes since v2:
- default to auto detection unless chip is specified
- update doc with reference to jedec,spi-nor.txtTest on the following boards.
Hitex board boots on SPIFI Flash with JFFS2.
Quoted 7 lines
Quoted 5 lines
Hitex LPC4350 Eval board:
[ 2.093956] nxp-spifi 40003000.spifi: s25sl064p (8192 Kbytes)Embedded Artists' LPC4357 Developer's Kit:
[ 3.051627] nxp-spifi 40003000.spifi: s25fl016k (2048 Kbytes)Applied to l2-mtd.git, thanks!
Excellent. Thanks Brian.
Quoted 4 lines
BTW, is this driver worth a
MAINTAINERSentry? It's nice to always have someone on CC that has the hardware. The git history should probably pick you up anyway when running get_maintainers.pl, so it may not be absolutely necessary.
Sure. I can add it under the main lpc18xx platform entry in MAINTAINERS. I'll queue up a patch for arm-soc.
Quoted 6 lines
Quoted 3 lines
Both s25fl016k and s25sl064p support dual/quad mode, but this is not flagged in
spi-nor.c. I have sent a patch for s25fl016k and will send a patch s25sl064p please apply when you get them.I'll see if I can dig these out of the mailing list eventually. I have a sizable backlog.
Ok, thanks.
regards,
Joachim Eastwood
PATCH v5 1/1 mtd: spi-nor: add driver for NXP SPI Flash Interface (SPIFI)
Quoted 8 lines · Joachim Eastwood
Quoted 4 lines · Brian Norris
BTW, is this driver worth a
MAINTAINERSentry? It's nice to always have someone on CC that has the hardware. The git history should probably pick you up anyway when running get_maintainers.pl, so it may not be absolutely necessary.Sure. I can add it under the main lpc18xx platform entry in
MAINTAINERS. I'll queue up a patch for arm-soc.
Sounds good.