Skip to content

Commit a7c367b

Browse files
committed
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (58 commits) mtd: jedec_probe: add PSD4256G6V id mtd: OneNand support for Nomadik 8815 SoC (on NHK8815 board) mtd: nand: driver for Nomadik 8815 SoC (on NHK8815 board) m25p80: Add Spansion S25FL129P serial flashes jffs2: Use SLAB_HWCACHE_ALIGN for jffs2_raw_{dirent,inode} slabs mtd: sh_flctl: register sh_flctl using platform_driver_probe() mtd: nand: txx9ndfmc: transfer 512 byte at a time if possible mtd: nand: fix tmio_nand ecc correction mtd: nand: add __nand_correct_data helper function mtd: cfi_cmdset_0002: add 0xFF intolerance for M29W128G mtd: inftl: fix fold chain block number mtd: jedec: fix compilation problem with I28F640C3B definition mtd: nand: fix ECC Correction bug for SMC ordering for NDFC driver mtd: ofpart: Check availability of reg property instead of name property driver/Makefile: Initialize "mtd" and "spi" before "net" mtd: omap: adding DMA mode support in nand prefetch/post-write mtd: omap: add support for nand prefetch-read and post-write mtd: add nand support for w90p910 (v2) mtd: maps: add mtd-ram support to physmap_of mtd: pxa3xx_nand: add single-bit error corrections reporting ...
2 parents 15f964b + e107021 commit a7c367b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2795
-251
lines changed

Documentation/powerpc/dts-bindings/mtd-physmap.txt

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
CFI or JEDEC memory-mapped NOR flash
1+
CFI or JEDEC memory-mapped NOR flash, MTD-RAM (NVRAM...)
22

33
Flash chips (Memory Technology Devices) are often used for solid state
44
file systems on embedded devices.
55

6-
- compatible : should contain the specific model of flash chip(s)
7-
used, if known, followed by either "cfi-flash" or "jedec-flash"
8-
- reg : Address range(s) of the flash chip(s)
6+
- compatible : should contain the specific model of mtd chip(s)
7+
used, if known, followed by either "cfi-flash", "jedec-flash"
8+
or "mtd-ram".
9+
- reg : Address range(s) of the mtd chip(s)
910
It's possible to (optionally) define multiple "reg" tuples so that
10-
non-identical NOR chips can be described in one flash node.
11-
- bank-width : Width (in bytes) of the flash bank. Equal to the
11+
non-identical chips can be described in one node.
12+
- bank-width : Width (in bytes) of the bank. Equal to the
1213
device width times the number of interleaved chips.
13-
- device-width : (optional) Width of a single flash chip. If
14+
- device-width : (optional) Width of a single mtd chip. If
1415
omitted, assumed to be equal to 'bank-width'.
15-
- #address-cells, #size-cells : Must be present if the flash has
16+
- #address-cells, #size-cells : Must be present if the device has
1617
sub-nodes representing partitions (see below). In this case
1718
both #address-cells and #size-cells must be equal to 1.
1819

@@ -22,24 +23,24 @@ are defined:
2223
- vendor-id : Contains the flash chip's vendor id (1 byte).
2324
- device-id : Contains the flash chip's device id (1 byte).
2425

25-
In addition to the information on the flash bank itself, the
26+
In addition to the information on the mtd bank itself, the
2627
device tree may optionally contain additional information
27-
describing partitions of the flash address space. This can be
28+
describing partitions of the address space. This can be
2829
used on platforms which have strong conventions about which
29-
portions of the flash are used for what purposes, but which don't
30+
portions of a flash are used for what purposes, but which don't
3031
use an on-flash partition table such as RedBoot.
3132

32-
Each partition is represented as a sub-node of the flash device.
33+
Each partition is represented as a sub-node of the mtd device.
3334
Each node's name represents the name of the corresponding
34-
partition of the flash device.
35+
partition of the mtd device.
3536

3637
Flash partitions
37-
- reg : The partition's offset and size within the flash bank.
38-
- label : (optional) The label / name for this flash partition.
38+
- reg : The partition's offset and size within the mtd bank.
39+
- label : (optional) The label / name for this partition.
3940
If omitted, the label is taken from the node name (excluding
4041
the unit address).
4142
- read-only : (optional) This parameter, if present, is a hint to
42-
Linux that this flash partition should only be mounted
43+
Linux that this partition should only be mounted
4344
read-only. This is usually used for flash partitions
4445
containing early-boot firmware images or data which should not
4546
be clobbered.
@@ -78,3 +79,12 @@ Here an example with multiple "reg" tuples:
7879
reg = <0 0x04000000>;
7980
};
8081
};
82+
83+
An example using SRAM:
84+
85+
sram@2,0 {
86+
compatible = "samsung,k6f1616u6a", "mtd-ram";
87+
reg = <2 0 0x00200000>;
88+
bank-width = <2>;
89+
};
90+

arch/arm/configs/nhk8815_defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ CONFIG_MTD_CFI_I2=y
498498
# CONFIG_MTD_DOC2001PLUS is not set
499499
CONFIG_MTD_NAND=y
500500
CONFIG_MTD_NAND_VERIFY_WRITE=y
501-
# CONFIG_MTD_NAND_ECC_SMC is not set
501+
CONFIG_MTD_NAND_ECC_SMC=y
502502
# CONFIG_MTD_NAND_MUSEUM_IDS is not set
503503
# CONFIG_MTD_NAND_GPIO is not set
504504
CONFIG_MTD_NAND_IDS=y

arch/arm/mach-nomadik/board-nhk8815.c

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,164 @@
1616
#include <linux/amba/bus.h>
1717
#include <linux/interrupt.h>
1818
#include <linux/gpio.h>
19+
#include <linux/mtd/mtd.h>
20+
#include <linux/mtd/nand.h>
21+
#include <linux/mtd/partitions.h>
22+
#include <linux/io.h>
23+
#include <asm/sizes.h>
1924
#include <asm/mach-types.h>
2025
#include <asm/mach/arch.h>
2126
#include <asm/mach/irq.h>
27+
#include <asm/mach/flash.h>
2228
#include <mach/setup.h>
29+
#include <mach/nand.h>
30+
#include <mach/fsmc.h>
2331
#include "clock.h"
2432

33+
/* These adresses span 16MB, so use three individual pages */
34+
static struct resource nhk8815_nand_resources[] = {
35+
{
36+
.name = "nand_addr",
37+
.start = NAND_IO_ADDR,
38+
.end = NAND_IO_ADDR + 0xfff,
39+
.flags = IORESOURCE_MEM,
40+
}, {
41+
.name = "nand_cmd",
42+
.start = NAND_IO_CMD,
43+
.end = NAND_IO_CMD + 0xfff,
44+
.flags = IORESOURCE_MEM,
45+
}, {
46+
.name = "nand_data",
47+
.start = NAND_IO_DATA,
48+
.end = NAND_IO_DATA + 0xfff,
49+
.flags = IORESOURCE_MEM,
50+
}
51+
};
52+
53+
static int nhk8815_nand_init(void)
54+
{
55+
/* FSMC setup for nand chip select (8-bit nand in 8815NHK) */
56+
writel(0x0000000E, FSMC_PCR(0));
57+
writel(0x000D0A00, FSMC_PMEM(0));
58+
writel(0x00100A00, FSMC_PATT(0));
59+
60+
/* enable access to the chip select area */
61+
writel(readl(FSMC_PCR(0)) | 0x04, FSMC_PCR(0));
62+
63+
return 0;
64+
}
65+
66+
/*
67+
* These partitions are the same as those used in the 2.6.20 release
68+
* shipped by the vendor; the first two partitions are mandated
69+
* by the boot ROM, and the bootloader area is somehow oversized...
70+
*/
71+
static struct mtd_partition nhk8815_partitions[] = {
72+
{
73+
.name = "X-Loader(NAND)",
74+
.offset = 0,
75+
.size = SZ_256K,
76+
}, {
77+
.name = "MemInit(NAND)",
78+
.offset = MTDPART_OFS_APPEND,
79+
.size = SZ_256K,
80+
}, {
81+
.name = "BootLoader(NAND)",
82+
.offset = MTDPART_OFS_APPEND,
83+
.size = SZ_2M,
84+
}, {
85+
.name = "Kernel zImage(NAND)",
86+
.offset = MTDPART_OFS_APPEND,
87+
.size = 3 * SZ_1M,
88+
}, {
89+
.name = "Root Filesystem(NAND)",
90+
.offset = MTDPART_OFS_APPEND,
91+
.size = 22 * SZ_1M,
92+
}, {
93+
.name = "User Filesystem(NAND)",
94+
.offset = MTDPART_OFS_APPEND,
95+
.size = MTDPART_SIZ_FULL,
96+
}
97+
};
98+
99+
static struct nomadik_nand_platform_data nhk8815_nand_data = {
100+
.parts = nhk8815_partitions,
101+
.nparts = ARRAY_SIZE(nhk8815_partitions),
102+
.options = NAND_COPYBACK | NAND_CACHEPRG | NAND_NO_PADDING \
103+
| NAND_NO_READRDY | NAND_NO_AUTOINCR,
104+
.init = nhk8815_nand_init,
105+
};
106+
107+
static struct platform_device nhk8815_nand_device = {
108+
.name = "nomadik_nand",
109+
.dev = {
110+
.platform_data = &nhk8815_nand_data,
111+
},
112+
.resource = nhk8815_nand_resources,
113+
.num_resources = ARRAY_SIZE(nhk8815_nand_resources),
114+
};
115+
116+
/* These are the partitions for the OneNand device, different from above */
117+
static struct mtd_partition nhk8815_onenand_partitions[] = {
118+
{
119+
.name = "X-Loader(OneNAND)",
120+
.offset = 0,
121+
.size = SZ_256K,
122+
}, {
123+
.name = "MemInit(OneNAND)",
124+
.offset = MTDPART_OFS_APPEND,
125+
.size = SZ_256K,
126+
}, {
127+
.name = "BootLoader(OneNAND)",
128+
.offset = MTDPART_OFS_APPEND,
129+
.size = SZ_2M-SZ_256K,
130+
}, {
131+
.name = "SysImage(OneNAND)",
132+
.offset = MTDPART_OFS_APPEND,
133+
.size = 4 * SZ_1M,
134+
}, {
135+
.name = "Root Filesystem(OneNAND)",
136+
.offset = MTDPART_OFS_APPEND,
137+
.size = 22 * SZ_1M,
138+
}, {
139+
.name = "User Filesystem(OneNAND)",
140+
.offset = MTDPART_OFS_APPEND,
141+
.size = MTDPART_SIZ_FULL,
142+
}
143+
};
144+
145+
static struct flash_platform_data nhk8815_onenand_data = {
146+
.parts = nhk8815_onenand_partitions,
147+
.nr_parts = ARRAY_SIZE(nhk8815_onenand_partitions),
148+
};
149+
150+
static struct resource nhk8815_onenand_resource[] = {
151+
{
152+
.start = 0x30000000,
153+
.end = 0x30000000 + SZ_128K - 1,
154+
.flags = IORESOURCE_MEM,
155+
},
156+
};
157+
158+
static struct platform_device nhk8815_onenand_device = {
159+
.name = "onenand",
160+
.id = -1,
161+
.dev = {
162+
.platform_data = &nhk8815_onenand_data,
163+
},
164+
.resource = nhk8815_onenand_resource,
165+
.num_resources = ARRAY_SIZE(nhk8815_onenand_resource),
166+
};
167+
168+
static void __init nhk8815_onenand_init(void)
169+
{
170+
#ifdef CONFIG_ONENAND
171+
/* Set up SMCS0 for OneNand */
172+
writel(0x000030db, FSMC_BCR0);
173+
writel(0x02100551, FSMC_BTR0);
174+
#endif
175+
}
176+
25177
#define __MEM_4K_RESOURCE(x) \
26178
.res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM}
27179

@@ -81,6 +233,8 @@ static int __init nhk8815_eth_init(void)
81233
device_initcall(nhk8815_eth_init);
82234

83235
static struct platform_device *nhk8815_platform_devices[] __initdata = {
236+
&nhk8815_nand_device,
237+
&nhk8815_onenand_device,
84238
&nhk8815_eth_device,
85239
/* will add more devices */
86240
};
@@ -90,6 +244,7 @@ static void __init nhk8815_platform_init(void)
90244
int i;
91245

92246
cpu8815_platform_init();
247+
nhk8815_onenand_init();
93248
platform_add_devices(nhk8815_platform_devices,
94249
ARRAY_SIZE(nhk8815_platform_devices));
95250

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
/* Definitions for the Nomadik FSMC "Flexible Static Memory controller" */
3+
4+
#ifndef __ASM_ARCH_FSMC_H
5+
#define __ASM_ARCH_FSMC_H
6+
7+
#include <mach/hardware.h>
8+
/*
9+
* Register list
10+
*/
11+
12+
/* bus control reg. and bus timing reg. for CS0..CS3 */
13+
#define FSMC_BCR(x) (NOMADIK_FSMC_VA + (x << 3))
14+
#define FSMC_BTR(x) (NOMADIK_FSMC_VA + (x << 3) + 0x04)
15+
16+
/* PC-card and NAND:
17+
* PCR = control register
18+
* PMEM = memory timing
19+
* PATT = attribute timing
20+
* PIO = I/O timing
21+
* PECCR = ECC result
22+
*/
23+
#define FSMC_PCR(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x00)
24+
#define FSMC_PMEM(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x08)
25+
#define FSMC_PATT(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x0c)
26+
#define FSMC_PIO(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x10)
27+
#define FSMC_PECCR(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x14)
28+
29+
#endif /* __ASM_ARCH_FSMC_H */
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef __ASM_ARCH_NAND_H
2+
#define __ASM_ARCH_NAND_H
3+
4+
struct nomadik_nand_platform_data {
5+
struct mtd_partition *parts;
6+
int nparts;
7+
int options;
8+
int (*init) (void);
9+
int (*exit) (void);
10+
};
11+
12+
#define NAND_IO_DATA 0x40000000
13+
#define NAND_IO_CMD 0x40800000
14+
#define NAND_IO_ADDR 0x41000000
15+
16+
#endif /* __ASM_ARCH_NAND_H */

arch/arm/mach-omap2/board-apollon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static struct mtd_partition apollon_partitions[] = {
8787
},
8888
};
8989

90-
static struct flash_platform_data apollon_flash_data = {
90+
static struct onenand_platform_data apollon_flash_data = {
9191
.parts = apollon_partitions,
9292
.nr_parts = ARRAY_SIZE(apollon_partitions),
9393
};
@@ -99,7 +99,7 @@ static struct resource apollon_flash_resource[] = {
9999
};
100100

101101
static struct platform_device apollon_onenand_device = {
102-
.name = "onenand",
102+
.name = "onenand-flash",
103103
.id = -1,
104104
.dev = {
105105
.platform_data = &apollon_flash_data,

0 commit comments

Comments
 (0)