diff options
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/devicetree/bindings/mtd/fsl-quadspi.txt | 35 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/mtd/gpmc-nand.txt | 45 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/mtd/m25p80.txt | 4 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt | 8 | ||||
-rw-r--r-- | Documentation/mtd/spi-nor.txt | 62 |
5 files changed, 152 insertions, 2 deletions
diff --git a/Documentation/devicetree/bindings/mtd/fsl-quadspi.txt b/Documentation/devicetree/bindings/mtd/fsl-quadspi.txt new file mode 100644 index 000000000000..823d13412195 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/fsl-quadspi.txt | |||
@@ -0,0 +1,35 @@ | |||
1 | * Freescale Quad Serial Peripheral Interface(QuadSPI) | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : Should be "fsl,vf610-qspi" | ||
5 | - reg : the first contains the register location and length, | ||
6 | the second contains the memory mapping address and length | ||
7 | - reg-names: Should contain the reg names "QuadSPI" and "QuadSPI-memory" | ||
8 | - interrupts : Should contain the interrupt for the device | ||
9 | - clocks : The clocks needed by the QuadSPI controller | ||
10 | - clock-names : the name of the clocks | ||
11 | |||
12 | Optional properties: | ||
13 | - fsl,qspi-has-second-chip: The controller has two buses, bus A and bus B. | ||
14 | Each bus can be connected with two NOR flashes. | ||
15 | Most of the time, each bus only has one NOR flash | ||
16 | connected, this is the default case. | ||
17 | But if there are two NOR flashes connected to the | ||
18 | bus, you should enable this property. | ||
19 | (Please check the board's schematic.) | ||
20 | |||
21 | Example: | ||
22 | |||
23 | qspi0: quadspi@40044000 { | ||
24 | compatible = "fsl,vf610-qspi"; | ||
25 | reg = <0x40044000 0x1000>, <0x20000000 0x10000000>; | ||
26 | reg-names = "QuadSPI", "QuadSPI-memory"; | ||
27 | interrupts = <0 24 IRQ_TYPE_LEVEL_HIGH>; | ||
28 | clocks = <&clks VF610_CLK_QSPI0_EN>, | ||
29 | <&clks VF610_CLK_QSPI0>; | ||
30 | clock-names = "qspi_en", "qspi"; | ||
31 | |||
32 | flash0: s25fl128s@0 { | ||
33 | .... | ||
34 | }; | ||
35 | }; | ||
diff --git a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt index eb05255b6788..65f4f7c43136 100644 --- a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt +++ b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt | |||
@@ -28,6 +28,8 @@ Optional properties: | |||
28 | "ham1" 1-bit Hamming ecc code | 28 | "ham1" 1-bit Hamming ecc code |
29 | "bch4" 4-bit BCH ecc code | 29 | "bch4" 4-bit BCH ecc code |
30 | "bch8" 8-bit BCH ecc code | 30 | "bch8" 8-bit BCH ecc code |
31 | "bch16" 16-bit BCH ECC code | ||
32 | Refer below "How to select correct ECC scheme for your device ?" | ||
31 | 33 | ||
32 | - ti,nand-xfer-type: A string setting the data transfer type. One of: | 34 | - ti,nand-xfer-type: A string setting the data transfer type. One of: |
33 | 35 | ||
@@ -90,3 +92,46 @@ Example for an AM33xx board: | |||
90 | }; | 92 | }; |
91 | }; | 93 | }; |
92 | 94 | ||
95 | How to select correct ECC scheme for your device ? | ||
96 | -------------------------------------------------- | ||
97 | Higher ECC scheme usually means better protection against bit-flips and | ||
98 | increased system lifetime. However, selection of ECC scheme is dependent | ||
99 | on various other factors also like; | ||
100 | |||
101 | (1) support of built in hardware engines. | ||
102 | Some legacy OMAP SoC do not have ELM harware engine, so those SoC cannot | ||
103 | support ecc-schemes with hardware error-correction (BCHx_HW). However | ||
104 | such SoC can use ecc-schemes with software library for error-correction | ||
105 | (BCHx_HW_DETECTION_SW). The error correction capability with software | ||
106 | library remains equivalent to their hardware counter-part, but there is | ||
107 | slight CPU penalty when too many bit-flips are detected during reads. | ||
108 | |||
109 | (2) Device parameters like OOBSIZE. | ||
110 | Other factor which governs the selection of ecc-scheme is oob-size. | ||
111 | Higher ECC schemes require more OOB/Spare area to store ECC syndrome, | ||
112 | so the device should have enough free bytes available its OOB/Spare | ||
113 | area to accomodate ECC for entire page. In general following expression | ||
114 | helps in determining if given device can accomodate ECC syndrome: | ||
115 | "2 + (PAGESIZE / 512) * ECC_BYTES" >= OOBSIZE" | ||
116 | where | ||
117 | OOBSIZE number of bytes in OOB/spare area | ||
118 | PAGESIZE number of bytes in main-area of device page | ||
119 | ECC_BYTES number of ECC bytes generated to protect | ||
120 | 512 bytes of data, which is: | ||
121 | '3' for HAM1_xx ecc schemes | ||
122 | '7' for BCH4_xx ecc schemes | ||
123 | '14' for BCH8_xx ecc schemes | ||
124 | '26' for BCH16_xx ecc schemes | ||
125 | |||
126 | Example(a): For a device with PAGESIZE = 2048 and OOBSIZE = 64 and | ||
127 | trying to use BCH16 (ECC_BYTES=26) ecc-scheme. | ||
128 | Number of ECC bytes per page = (2 + (2048 / 512) * 26) = 106 B | ||
129 | which is greater than capacity of NAND device (OOBSIZE=64) | ||
130 | Hence, BCH16 cannot be supported on given device. But it can | ||
131 | probably use lower ecc-schemes like BCH8. | ||
132 | |||
133 | Example(b): For a device with PAGESIZE = 2048 and OOBSIZE = 128 and | ||
134 | trying to use BCH16 (ECC_BYTES=26) ecc-scheme. | ||
135 | Number of ECC bytes per page = (2 + (2048 / 512) * 26) = 106 B | ||
136 | which can be accomodate in the OOB/Spare area of this device | ||
137 | (OOBSIZE=128). So this device can use BCH16 ecc-scheme. | ||
diff --git a/Documentation/devicetree/bindings/mtd/m25p80.txt b/Documentation/devicetree/bindings/mtd/m25p80.txt index 6d3d57609470..4611aa83531b 100644 --- a/Documentation/devicetree/bindings/mtd/m25p80.txt +++ b/Documentation/devicetree/bindings/mtd/m25p80.txt | |||
@@ -5,8 +5,8 @@ Required properties: | |||
5 | representing partitions. | 5 | representing partitions. |
6 | - compatible : Should be the manufacturer and the name of the chip. Bear in mind | 6 | - compatible : Should be the manufacturer and the name of the chip. Bear in mind |
7 | the DT binding is not Linux-only, but in case of Linux, see the | 7 | the DT binding is not Linux-only, but in case of Linux, see the |
8 | "m25p_ids" table in drivers/mtd/devices/m25p80.c for the list of | 8 | "spi_nor_ids" table in drivers/mtd/spi-nor/spi-nor.c for the list |
9 | supported chips. | 9 | of supported chips. |
10 | - reg : Chip-Select number | 10 | - reg : Chip-Select number |
11 | - spi-max-frequency : Maximum frequency of the SPI bus the chip can operate at | 11 | - spi-max-frequency : Maximum frequency of the SPI bus the chip can operate at |
12 | 12 | ||
diff --git a/Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt b/Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt index 86e0a5601ff5..de8b517a5521 100644 --- a/Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt +++ b/Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt | |||
@@ -17,6 +17,14 @@ Optional properties: | |||
17 | - num-cs: Number of chipselect lines to usw | 17 | - num-cs: Number of chipselect lines to usw |
18 | - nand-on-flash-bbt: boolean to enable on flash bbt option if | 18 | - nand-on-flash-bbt: boolean to enable on flash bbt option if |
19 | not present false | 19 | not present false |
20 | - nand-ecc-strength: number of bits to correct per ECC step | ||
21 | - nand-ecc-step-size: number of data bytes covered by a single ECC step | ||
22 | |||
23 | The following ECC strength and step size are currently supported: | ||
24 | |||
25 | - nand-ecc-strength = <1>, nand-ecc-step-size = <512> | ||
26 | - nand-ecc-strength = <4>, nand-ecc-step-size = <512> | ||
27 | - nand-ecc-strength = <8>, nand-ecc-step-size = <512> | ||
20 | 28 | ||
21 | Example: | 29 | Example: |
22 | 30 | ||
diff --git a/Documentation/mtd/spi-nor.txt b/Documentation/mtd/spi-nor.txt new file mode 100644 index 000000000000..548d6306ebca --- /dev/null +++ b/Documentation/mtd/spi-nor.txt | |||
@@ -0,0 +1,62 @@ | |||
1 | SPI NOR framework | ||
2 | ============================================ | ||
3 | |||
4 | Part I - Why do we need this framework? | ||
5 | --------------------------------------- | ||
6 | |||
7 | SPI bus controllers (drivers/spi/) only deal with streams of bytes; the bus | ||
8 | controller operates agnostic of the specific device attached. However, some | ||
9 | controllers (such as Freescale's QuadSPI controller) cannot easily handle | ||
10 | arbitrary streams of bytes, but rather are designed specifically for SPI NOR. | ||
11 | |||
12 | In particular, Freescale's QuadSPI controller must know the NOR commands to | ||
13 | find the right LUT sequence. Unfortunately, the SPI subsystem has no notion of | ||
14 | opcodes, addresses, or data payloads; a SPI controller simply knows to send or | ||
15 | receive bytes (Tx and Rx). Therefore, we must define a new layering scheme under | ||
16 | which the controller driver is aware of the opcodes, addressing, and other | ||
17 | details of the SPI NOR protocol. | ||
18 | |||
19 | Part II - How does the framework work? | ||
20 | -------------------------------------- | ||
21 | |||
22 | This framework just adds a new layer between the MTD and the SPI bus driver. | ||
23 | With this new layer, the SPI NOR controller driver does not depend on the | ||
24 | m25p80 code anymore. | ||
25 | |||
26 | Before this framework, the layer is like: | ||
27 | |||
28 | MTD | ||
29 | ------------------------ | ||
30 | m25p80 | ||
31 | ------------------------ | ||
32 | SPI bus driver | ||
33 | ------------------------ | ||
34 | SPI NOR chip | ||
35 | |||
36 | After this framework, the layer is like: | ||
37 | MTD | ||
38 | ------------------------ | ||
39 | SPI NOR framework | ||
40 | ------------------------ | ||
41 | m25p80 | ||
42 | ------------------------ | ||
43 | SPI bus driver | ||
44 | ------------------------ | ||
45 | SPI NOR chip | ||
46 | |||
47 | With the SPI NOR controller driver (Freescale QuadSPI), it looks like: | ||
48 | MTD | ||
49 | ------------------------ | ||
50 | SPI NOR framework | ||
51 | ------------------------ | ||
52 | fsl-quadSPI | ||
53 | ------------------------ | ||
54 | SPI NOR chip | ||
55 | |||
56 | Part III - How can drivers use the framework? | ||
57 | --------------------------------------------- | ||
58 | |||
59 | The main API is spi_nor_scan(). Before you call the hook, a driver should | ||
60 | initialize the necessary fields for spi_nor{}. Please see | ||
61 | drivers/mtd/spi-nor/spi-nor.c for detail. Please also refer to fsl-quadspi.c | ||
62 | when you want to write a new driver for a SPI NOR controller. | ||