linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] SPI NAND for everyone
@ 2014-12-02 12:58 Ezequiel Garcia
  2014-12-02 12:58 ` [PATCH 1/6] mtd: nand: Check length of ID before reading bits per cell Ezequiel Garcia
                   ` (7 more replies)
  0 siblings, 8 replies; 33+ messages in thread
From: Ezequiel Garcia @ 2014-12-02 12:58 UTC (permalink / raw)
  To: Andrew Bresticker, Ionela Voinescu, James Hartley, Brian Norris,
	bpqw, arnaud.mouiche, frankliu
  Cc: Ezequiel Garcia, linux-mtd

During the discussion of Ionela Voinescu's patch to support GD5F SPI NAND
devices [1], it was decided that a proper SPI NAND framework was needed
to support the mt29f device (driver currently in staging area) and the new
gd5f.

This patchset is a first attempt to address this.

The SPI NAND framework allows devices to register as NAND drivers. This is
useful to take advantage of the bad block management code. Given the
SPI NAND and the bare NAND commands are different, the SPI NAND framework
implements its own .cmdfunc callback, which is in charge of calling
device-specific hooks for each of the flash operations (read, program, erase,
etc).

The SPI NAND framework does not deal with SPI transactions per-se. Instead,
the SPI messages should be prepared by the users of the SPI NAND framework
(those that implement the device-specific hooks).

The result can be expressed in the following hierarchy:

    Userspace
  ------------------
    MTD
  ------------------
    NAND core
  ------------------
    SPI NAND core
  ------------------
    SPI NAND device
  ------------------
    SPI core
  ------------------
    SPI master
  ------------------
    Hardware

Notice there was a previous attempt to propose an SPI NAND framework,
by Sourav Poddar and Mona Anonuevo. We didn't find this proposal suitable,
so this series is a completely new work.

This series is based on v3.18-rc7. Tests have been performed with a Gigadevice
GD5F 4 Gbit device, including nandtest runs and filesystem testing on top
of UBI. I don't have MT29F devices yet, but the amount of changes required to
support it should be fairly small.

I don't intend this first proposal to be complete, but I hope it's a good
starting point to support SPI NAND properly.

[1] http://lists.infradead.org/pipermail/linux-mtd/2014-November/056364.html
[2] https://lkml.org/lkml/2013/6/26/83

Ezequiel Garcia (6):
  mtd: nand: Check length of ID before reading bits per cell
  mtd: nand: Add JEDEC manufacturer ID for Gigadevice
  mtd: nand: Allow to set a per-device ECC layout
  mtd: Introduce SPI NAND framework
  mtd: spi-nand: Add devicetree binding
  mtd: spi-nand: Support common SPI NAND devices

 Documentation/devicetree/bindings/mtd/spi-nand.txt |  21 +
 drivers/mtd/Kconfig                                |   2 +
 drivers/mtd/Makefile                               |   1 +
 drivers/mtd/nand/nand_base.c                       |   4 +-
 drivers/mtd/nand/nand_ids.c                        |   1 +
 drivers/mtd/spi-nand/Kconfig                       |  18 +
 drivers/mtd/spi-nand/Makefile                      |   2 +
 drivers/mtd/spi-nand/spi-nand-base.c               | 530 +++++++++++++++++++++
 drivers/mtd/spi-nand/spi-nand-device.c             | 500 +++++++++++++++++++
 include/linux/mtd/nand.h                           |   3 +
 include/linux/mtd/spi-nand.h                       |  54 +++
 11 files changed, 1135 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.txt
 create mode 100644 drivers/mtd/spi-nand/Kconfig
 create mode 100644 drivers/mtd/spi-nand/Makefile
 create mode 100644 drivers/mtd/spi-nand/spi-nand-base.c
 create mode 100644 drivers/mtd/spi-nand/spi-nand-device.c
 create mode 100644 include/linux/mtd/spi-nand.h

-- 
2.1.0

^ permalink raw reply	[flat|nested] 33+ messages in thread
* [PATCH 6/6] mtd: spi-nand: Support common SPI NAND devices
@ 2014-12-03  9:52 Qi Wang 王起 (qiwang)
  2014-12-03 11:13 ` Ezequiel Garcia
  0 siblings, 1 reply; 33+ messages in thread
From: Qi Wang 王起 (qiwang) @ 2014-12-03  9:52 UTC (permalink / raw)
  To: ezequiel.garcia@imgtec.com, Brian Norris, abrestic@chromium.org,
	ionela.voinescu@imgtec.com, James Hartley,
	arnaud.mouiche@invoxia.com, linux-mtd@lists.infradead.org
  Cc: Frank Liu 刘群 (frankliu),
	Peter Pan 潘栋 (peterpandong)

Hi Ezequiel, Brian

> +
> +static struct nand_ecclayout ecc_layout_gd5f = {
> +	.eccbytes = 128,
> +	.eccpos = {
> +		128, 129, 130, 131, 132, 133, 134, 135,
> +		136, 137, 138, 139, 140, 141, 142, 143,
> +		144, 145, 146, 147, 148, 149, 150, 151,
> +		152, 153, 154, 155, 156, 157, 158, 159,
> +		160, 161, 162, 163, 164, 165, 166, 167,
> +		168, 169, 170, 171, 172, 173, 174, 175,
> +		176, 177, 178, 179, 180, 181, 182, 183,
> +		184, 185, 186, 187, 188, 189, 190, 191,
> +		192, 193, 194, 195, 196, 197, 198, 199,
> +		200, 201, 202, 203, 204, 205, 206, 207,
> +		208, 209, 210, 211, 212, 213, 214, 215,
> +		216, 217, 218, 219, 220, 221, 222, 223,
> +		224, 225, 226, 227, 228, 229, 230, 231,
> +		232, 233, 234, 235, 236, 237, 238, 239,
> +		240, 241, 242, 243, 244, 245, 246, 247,
> +		248, 249, 250, 251, 252, 253, 254, 255
> +	},
> +	.oobfree = { {1, 127} }
> +};
> +
> +static struct nand_ecclayout ecc_layout_mt29f = {
> +	.eccbytes = 32,
> +	.eccpos = {
> +		8, 9, 10, 11, 12, 13, 14, 15,
> +		24, 25, 26, 27, 28, 29, 30, 31,
> +		40, 41, 42, 43, 44, 45, 46, 47,
> +		56, 57, 58, 59, 60, 61, 62, 63,
> +	 },
> +};
> +

As they are using On die ecc, oob layout definition is defined by SPI NAND vendors. 
Part of oob is protected by ecc, and the rest is unprotect.
I am thinking if we can define a variable to indicate the range, what is protect, 
and what is unprotect. 
This would be very useful for filesystem, which want to write data into OOB.

For example, Jffs2 program clean marker data to oob first when format operation, 
then will program main data into NAND flash main area when normal write operation. 
That mean JFFS2 can only store clean marker into unprotect area of oob. 
But for YAFFS2, it program main data and spare area data together into NAND flash, then
YAFFS2 can store data into protect area of OOB.
How do you think?

Thanks
 






^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2015-04-22 17:47 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-02 12:58 [PATCH 0/6] SPI NAND for everyone Ezequiel Garcia
2014-12-02 12:58 ` [PATCH 1/6] mtd: nand: Check length of ID before reading bits per cell Ezequiel Garcia
2014-12-13  0:51   ` Daniel Ehrenberg
2015-01-05 20:38   ` Brian Norris
2014-12-02 12:58 ` [PATCH 2/6] mtd: nand: Add JEDEC manufacturer ID for Gigadevice Ezequiel Garcia
2014-12-13  0:49   ` Daniel Ehrenberg
2015-04-21 23:04     ` Ezequiel Garcia
2015-04-22 17:47       ` Brian Norris
2014-12-02 12:58 ` [PATCH 3/6] mtd: nand: Allow to set a per-device ECC layout Ezequiel Garcia
2014-12-13  0:34   ` Daniel Ehrenberg
2014-12-02 12:58 ` [PATCH 4/6] mtd: Introduce SPI NAND framework Ezequiel Garcia
2014-12-15 21:18   ` Daniel Ehrenberg
2014-12-16  0:08     ` Ezequiel Garcia
     [not found]   ` <87F60714EC601C4C83DFF1D2E3D390A049EE77@NTXXIAMBX02.xacn.micron.com>
2014-12-22  4:34     ` Qi Wang 王起 (qiwang)
2014-12-22 15:44       ` Ezequiel Garcia
2015-01-05 20:47         ` Brian Norris
2014-12-02 12:58 ` [PATCH 5/6] mtd: spi-nand: Add devicetree binding Ezequiel Garcia
2014-12-13  1:27   ` Daniel Ehrenberg
2014-12-02 12:58 ` [PATCH 6/6] mtd: spi-nand: Support common SPI NAND devices Ezequiel Garcia
2014-12-13  1:27   ` Daniel Ehrenberg
2014-12-15 19:36     ` Ezequiel Garcia
2014-12-15 20:17       ` Daniel Ehrenberg
     [not found]   ` <87F60714EC601C4C83DFF1D2E3D390A049EE65@NTXXIAMBX02.xacn.micron.com>
2014-12-22  4:34     ` Qi Wang 王起 (qiwang)
2014-12-22 16:16       ` Ezequiel Garcia
2014-12-10 17:41 ` [PATCH 0/6] SPI NAND for everyone Ezequiel Garcia
2015-01-06  3:30 ` Brian Norris
2015-01-06 21:03   ` Ezequiel Garcia
2015-01-07  0:55     ` Qi Wang 王起 (qiwang)
2015-01-07 12:13       ` Ezequiel Garcia
  -- strict thread matches above, loose matches on Subject: below --
2014-12-03  9:52 [PATCH 6/6] mtd: spi-nand: Support common SPI NAND devices Qi Wang 王起 (qiwang)
2014-12-03 11:13 ` Ezequiel Garcia
2014-12-03 12:08   ` Qi Wang 王起 (qiwang)
2014-12-03 20:18     ` Ezequiel Garcia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).