Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a7c367b9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 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
  ...
parents 15f964be e1070211
Loading
Loading
Loading
Loading
+26 −16
Original line number Diff line number Diff line
CFI or JEDEC memory-mapped NOR flash
CFI or JEDEC memory-mapped NOR flash, MTD-RAM (NVRAM...)

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

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

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

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

Each partition is represented as a sub-node of the flash device.
Each partition is represented as a sub-node of the mtd device.
Each node's name represents the name of the corresponding
partition of the flash device.
partition of the mtd device.

Flash partitions
 - reg : The partition's offset and size within the flash bank.
 - label : (optional) The label / name for this flash partition.
 - reg : The partition's offset and size within the mtd bank.
 - label : (optional) The label / name for this partition.
   If omitted, the label is taken from the node name (excluding
   the unit address).
 - read-only : (optional) This parameter, if present, is a hint to
   Linux that this flash partition should only be mounted
   Linux that this partition should only be mounted
   read-only.  This is usually used for flash partitions
   containing early-boot firmware images or data which should not
   be clobbered.
@@ -78,3 +79,12 @@ Here an example with multiple "reg" tuples:
			reg = <0 0x04000000>;
		};
	};

An example using SRAM:

	sram@2,0 {
		compatible = "samsung,k6f1616u6a", "mtd-ram";
		reg = <2 0 0x00200000>;
		bank-width = <2>;
	};
+1 −1
Original line number Diff line number Diff line
@@ -498,7 +498,7 @@ CONFIG_MTD_CFI_I2=y
# CONFIG_MTD_DOC2001PLUS is not set
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_VERIFY_WRITE=y
# CONFIG_MTD_NAND_ECC_SMC is not set
CONFIG_MTD_NAND_ECC_SMC=y
# CONFIG_MTD_NAND_MUSEUM_IDS is not set
# CONFIG_MTD_NAND_GPIO is not set
CONFIG_MTD_NAND_IDS=y
+155 −0
Original line number Diff line number Diff line
@@ -16,12 +16,164 @@
#include <linux/amba/bus.h>
#include <linux/interrupt.h>
#include <linux/gpio.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <linux/io.h>
#include <asm/sizes.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/irq.h>
#include <asm/mach/flash.h>
#include <mach/setup.h>
#include <mach/nand.h>
#include <mach/fsmc.h>
#include "clock.h"

/* These adresses span 16MB, so use three individual pages */
static struct resource nhk8815_nand_resources[] = {
	{
		.name = "nand_addr",
		.start = NAND_IO_ADDR,
		.end = NAND_IO_ADDR + 0xfff,
		.flags = IORESOURCE_MEM,
	}, {
		.name = "nand_cmd",
		.start = NAND_IO_CMD,
		.end = NAND_IO_CMD + 0xfff,
		.flags = IORESOURCE_MEM,
	}, {
		.name = "nand_data",
		.start = NAND_IO_DATA,
		.end = NAND_IO_DATA + 0xfff,
		.flags = IORESOURCE_MEM,
	}
};

static int nhk8815_nand_init(void)
{
	/* FSMC setup for nand chip select (8-bit nand in 8815NHK) */
	writel(0x0000000E, FSMC_PCR(0));
	writel(0x000D0A00, FSMC_PMEM(0));
	writel(0x00100A00, FSMC_PATT(0));

	/* enable access to the chip select area */
	writel(readl(FSMC_PCR(0)) | 0x04, FSMC_PCR(0));

	return 0;
}

/*
 * These partitions are the same as those used in the 2.6.20 release
 * shipped by the vendor; the first two partitions are mandated
 * by the boot ROM, and the bootloader area is somehow oversized...
 */
static struct mtd_partition nhk8815_partitions[] = {
	{
		.name	= "X-Loader(NAND)",
		.offset = 0,
		.size	= SZ_256K,
	}, {
		.name	= "MemInit(NAND)",
		.offset	= MTDPART_OFS_APPEND,
		.size	= SZ_256K,
	}, {
		.name	= "BootLoader(NAND)",
		.offset	= MTDPART_OFS_APPEND,
		.size	= SZ_2M,
	}, {
		.name	= "Kernel zImage(NAND)",
		.offset	= MTDPART_OFS_APPEND,
		.size	= 3 * SZ_1M,
	}, {
		.name	= "Root Filesystem(NAND)",
		.offset	= MTDPART_OFS_APPEND,
		.size	= 22 * SZ_1M,
	}, {
		.name	= "User Filesystem(NAND)",
		.offset	= MTDPART_OFS_APPEND,
		.size	= MTDPART_SIZ_FULL,
	}
};

static struct nomadik_nand_platform_data nhk8815_nand_data = {
	.parts		= nhk8815_partitions,
	.nparts		= ARRAY_SIZE(nhk8815_partitions),
	.options	= NAND_COPYBACK | NAND_CACHEPRG | NAND_NO_PADDING \
			| NAND_NO_READRDY | NAND_NO_AUTOINCR,
	.init		= nhk8815_nand_init,
};

static struct platform_device nhk8815_nand_device = {
	.name		= "nomadik_nand",
	.dev		= {
		.platform_data = &nhk8815_nand_data,
	},
	.resource	= nhk8815_nand_resources,
	.num_resources	= ARRAY_SIZE(nhk8815_nand_resources),
};

/* These are the partitions for the OneNand device, different from above */
static struct mtd_partition nhk8815_onenand_partitions[] = {
	{
		.name	= "X-Loader(OneNAND)",
		.offset = 0,
		.size	= SZ_256K,
	}, {
		.name	= "MemInit(OneNAND)",
		.offset	= MTDPART_OFS_APPEND,
		.size	= SZ_256K,
	}, {
		.name	= "BootLoader(OneNAND)",
		.offset	= MTDPART_OFS_APPEND,
		.size	= SZ_2M-SZ_256K,
	}, {
		.name	= "SysImage(OneNAND)",
		.offset	= MTDPART_OFS_APPEND,
		.size	= 4 * SZ_1M,
	}, {
		.name	= "Root Filesystem(OneNAND)",
		.offset	= MTDPART_OFS_APPEND,
		.size	= 22 * SZ_1M,
	}, {
		.name	= "User Filesystem(OneNAND)",
		.offset	= MTDPART_OFS_APPEND,
		.size	= MTDPART_SIZ_FULL,
	}
};

static struct flash_platform_data nhk8815_onenand_data = {
	.parts		= nhk8815_onenand_partitions,
	.nr_parts	= ARRAY_SIZE(nhk8815_onenand_partitions),
};

static struct resource nhk8815_onenand_resource[] = {
	{
		.start		= 0x30000000,
		.end		= 0x30000000 + SZ_128K - 1,
		.flags		= IORESOURCE_MEM,
	},
};

static struct platform_device nhk8815_onenand_device = {
	.name		= "onenand",
	.id		= -1,
	.dev		= {
		.platform_data	= &nhk8815_onenand_data,
	},
	.resource	= nhk8815_onenand_resource,
	.num_resources	= ARRAY_SIZE(nhk8815_onenand_resource),
};

static void __init nhk8815_onenand_init(void)
{
#ifdef CONFIG_ONENAND
       /* Set up SMCS0 for OneNand */
       writel(0x000030db, FSMC_BCR0);
       writel(0x02100551, FSMC_BTR0);
#endif
}

#define __MEM_4K_RESOURCE(x) \
	.res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM}

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

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

	cpu8815_platform_init();
	nhk8815_onenand_init();
	platform_add_devices(nhk8815_platform_devices,
			     ARRAY_SIZE(nhk8815_platform_devices));

+29 −0
Original line number Diff line number Diff line

/* Definitions for the Nomadik FSMC "Flexible Static Memory controller" */

#ifndef __ASM_ARCH_FSMC_H
#define __ASM_ARCH_FSMC_H

#include <mach/hardware.h>
/*
 * Register list
 */

/* bus control reg. and bus timing reg. for CS0..CS3 */
#define FSMC_BCR(x)     (NOMADIK_FSMC_VA + (x << 3))
#define FSMC_BTR(x)     (NOMADIK_FSMC_VA + (x << 3) + 0x04)

/* PC-card and NAND:
 * PCR = control register
 * PMEM = memory timing
 * PATT = attribute timing
 * PIO = I/O timing
 * PECCR = ECC result
 */
#define FSMC_PCR(x)     (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x00)
#define FSMC_PMEM(x)    (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x08)
#define FSMC_PATT(x)    (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x0c)
#define FSMC_PIO(x)     (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x10)
#define FSMC_PECCR(x)   (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x14)

#endif /* __ASM_ARCH_FSMC_H */
+16 −0
Original line number Diff line number Diff line
#ifndef __ASM_ARCH_NAND_H
#define __ASM_ARCH_NAND_H

struct nomadik_nand_platform_data {
	struct mtd_partition *parts;
	int nparts;
	int options;
	int (*init) (void);
	int (*exit) (void);
};

#define NAND_IO_DATA	0x40000000
#define NAND_IO_CMD	0x40800000
#define NAND_IO_ADDR	0x41000000

#endif				/* __ASM_ARCH_NAND_H */
Loading