Skip to content

Commit ef9a61b

Browse files
committed
Merge tag 'for-linus-20130909' of git://git.infradead.org/linux-mtd
Pull mtd updates from David Woodhouse: - factor out common code from MTD tests - nand-gpio cleanup and portability to non-ARM - m25p80 support for 4-byte addressing chips, other new chips - pxa3xx cleanup and support for new platforms - remove obsolete alauda, octagon-5066 drivers - erase/write support for bcm47xxsflash - improve detection of ECC requirements for NAND, controller setup - NFC acceleration support for atmel-nand, read/write via SRAM - etc * tag 'for-linus-20130909' of git://git.infradead.org/linux-mtd: (184 commits) mtd: chips: Add support for PMC SPI Flash chips in m25p80.c mtd: ofpart: use for_each_child_of_node() macro mtd: mtdswap: replace strict_strtoul() with kstrtoul() mtd cs553x_nand: use kzalloc() instead of memset mtd: atmel_nand: fix error return code in atmel_nand_probe() mtd: bcm47xxsflash: writing support mtd: bcm47xxsflash: implement erasing support mtd: bcm47xxsflash: convert to module_platform_driver instead of init/exit mtd: bcm47xxsflash: convert kzalloc to avoid invalid access mtd: remove alauda driver mtd: nand: mxc_nand: mark 'const' properly mtd: maps: cfi_flagadm: add missing __iomem annotation mtd: spear_smi: add missing __iomem annotation mtd: r852: Staticize local symbols mtd: nandsim: Staticize local symbols mtd: impa7: add missing __iomem annotation mtd: sm_ftl: Staticize local symbols mtd: m25p80: add support for mr25h10 mtd: m25p80: make CONFIG_M25PXX_USE_FAST_READ safe to enable mtd: m25p80: Pass flags through CAT25_INFO macro ...
2 parents b5f0998 + 6c3b889 commit ef9a61b

Some content is hidden

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

99 files changed

+2732
-3201
lines changed

Documentation/ABI/testing/sysfs-class-mtd

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@ KernelVersion: 3.4
128128
Contact: linux-mtd@lists.infradead.org
129129
Description:
130130
Maximum number of bit errors that the device is capable of
131-
correcting within each region covering an ecc step. This will
132-
always be a non-negative integer. Note that some devices will
133-
have multiple ecc steps within each writesize region.
131+
correcting within each region covering an ECC step (see
132+
ecc_step_size). This will always be a non-negative integer.
134133

135134
In the case of devices lacking any ECC capability, it is 0.
136135

@@ -173,3 +172,15 @@ Description:
173172
This is generally applicable only to NAND flash devices with ECC
174173
capability. It is ignored on devices lacking ECC capability;
175174
i.e., devices for which ecc_strength is zero.
175+
176+
What: /sys/class/mtd/mtdX/ecc_step_size
177+
Date: May 2013
178+
KernelVersion: 3.10
179+
Contact: linux-mtd@lists.infradead.org
180+
Description:
181+
The size of a single region covered by ECC, known as the ECC
182+
step. Devices may have several equally sized ECC steps within
183+
each writesize region.
184+
185+
It will always be a non-negative integer. In the case of
186+
devices lacking any ECC capability, it is 0.

Documentation/DocBook/mtdnand.tmpl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,8 +1224,6 @@ in this page</entry>
12241224
#define NAND_BBT_CREATE 0x00000200
12251225
/* Search good / bad pattern through all pages of a block */
12261226
#define NAND_BBT_SCANALLPAGES 0x00000400
1227-
/* Scan block empty during good / bad block scan */
1228-
#define NAND_BBT_SCANEMPTY 0x00000800
12291227
/* Write bbt if neccecary */
12301228
#define NAND_BBT_WRITE 0x00001000
12311229
/* Read and write back block contents when writing bbt */

Documentation/devicetree/bindings/mtd/atmel-nand.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Required properties:
1515
optional gpio and may be set to 0 if not present.
1616

1717
Optional properties:
18+
- atmel,nand-has-dma : boolean to support dma transfer for nand read/write.
1819
- nand-ecc-mode : String, operation mode of the NAND ecc mode, soft by default.
1920
Supported values are: "none", "soft", "hw", "hw_syndrome", "hw_oob_first",
2021
"soft_bch".
@@ -29,6 +30,14 @@ Optional properties:
2930
sector size 1024.
3031
- nand-bus-width : 8 or 16 bus width if not present 8
3132
- nand-on-flash-bbt: boolean to enable on flash bbt option if not present false
33+
- Nand Flash Controller(NFC) is a slave driver under Atmel nand flash
34+
- Required properties:
35+
- compatible : "atmel,sama5d3-nfc".
36+
- reg : should specify the address and size used for NFC command registers,
37+
NFC registers and NFC Sram. NFC Sram address and size can be absent
38+
if don't want to use it.
39+
- Optional properties:
40+
- atmel,write-by-sram: boolean to enable NFC write by sram.
3241

3342
Examples:
3443
nand0: nand@40000000,0 {
@@ -77,3 +86,22 @@ nand0: nand@40000000 {
7786
...
7887
};
7988
};
89+
90+
/* for NFC supported chips */
91+
nand0: nand@40000000 {
92+
compatible = "atmel,at91rm9200-nand";
93+
#address-cells = <1>;
94+
#size-cells = <1>;
95+
ranges;
96+
...
97+
nfc@70000000 {
98+
compatible = "atmel,sama5d3-nfc";
99+
#address-cells = <1>;
100+
#size-cells = <1>;
101+
reg = <
102+
0x70000000 0x10000000 /* NFC Command Registers */
103+
0xffffc000 0x00000070 /* NFC HSMC regs */
104+
0x00200000 0x00100000 /* NFC SRAM banks */
105+
>;
106+
};
107+
};

Documentation/devicetree/bindings/mtd/fsmc-nand.txt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
* FSMC NAND
1+
ST Microelectronics Flexible Static Memory Controller (FSMC)
2+
NAND Interface
23

34
Required properties:
45
- compatible : "st,spear600-fsmc-nand", "stericsson,fsmc-nand"
@@ -9,6 +10,26 @@ Optional properties:
910
- bank-width : Width (in bytes) of the device. If not present, the width
1011
defaults to 1 byte
1112
- nand-skip-bbtscan: Indicates the the BBT scanning should be skipped
13+
- timings: array of 6 bytes for NAND timings. The meanings of these bytes
14+
are:
15+
byte 0 TCLR : CLE to RE delay in number of AHB clock cycles, only 4 bits
16+
are valid. Zero means one clockcycle, 15 means 16 clock
17+
cycles.
18+
byte 1 TAR : ALE to RE delay, 4 bits are valid. Same format as TCLR.
19+
byte 2 THIZ : number of HCLK clock cycles during which the data bus is
20+
kept in Hi-Z (tristate) after the start of a write access.
21+
Only valid for write transactions. Zero means zero cycles,
22+
255 means 255 cycles.
23+
byte 3 THOLD : number of HCLK clock cycles to hold the address (and data
24+
when writing) after the command deassertation. Zero means
25+
one cycle, 255 means 256 cycles.
26+
byte 4 TWAIT : number of HCLK clock cycles to assert the command to the
27+
NAND flash in response to SMWAITn. Zero means 1 cycle,
28+
255 means 256 cycles.
29+
byte 5 TSET : number of HCLK clock cycles to assert the address before the
30+
command is asserted. Zero means one cycle, 255 means 256
31+
cycles.
32+
- bank: default NAND bank to use (0-3 are valid, 0 is the default).
1233

1334
Example:
1435

@@ -24,6 +45,8 @@ Example:
2445

2546
bank-width = <1>;
2647
nand-skip-bbtscan;
48+
timings = /bits/ 8 <0 0 0 2 3 0>;
49+
bank = <1>;
2750

2851
partition@0 {
2952
...

Documentation/devicetree/bindings/mtd/partition.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Partitions can be represented by sub-nodes of an mtd device. This can be used
44
on platforms which have strong conventions about which portions of a flash are
55
used for what purposes, but which don't use an on-flash partition table such
66
as RedBoot.
7+
NOTE: if the sub-node has a compatible string, then it is not a partition.
78

89
#address-cells & #size-cells must both be present in the mtd device. There are
910
two valid values for both:

arch/avr32/mach-at32ap/at32ap700x.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,6 +1983,9 @@ at32_add_device_nand(unsigned int id, struct atmel_nand_data *data)
19831983
ARRAY_SIZE(smc_cs3_resource)))
19841984
goto fail;
19851985

1986+
/* For at32ap7000, we use the reset workaround for nand driver */
1987+
data->need_reset_workaround = true;
1988+
19861989
if (platform_device_add_data(pdev, data,
19871990
sizeof(struct atmel_nand_data)))
19881991
goto fail;

arch/mips/bcm63xx/nvram.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ struct bcm963xx_nvram {
3535
u32 checksum_high;
3636
};
3737

38+
#define BCM63XX_DEFAULT_PSI_SIZE 64
39+
3840
static struct bcm963xx_nvram nvram;
3941
static int mac_addr_used;
4042

@@ -114,3 +116,12 @@ int bcm63xx_nvram_get_mac_address(u8 *mac)
114116
return 0;
115117
}
116118
EXPORT_SYMBOL(bcm63xx_nvram_get_mac_address);
119+
120+
int bcm63xx_nvram_get_psi_size(void)
121+
{
122+
if (nvram.psi_size > 0)
123+
return nvram.psi_size;
124+
125+
return BCM63XX_DEFAULT_PSI_SIZE;
126+
}
127+
EXPORT_SYMBOL(bcm63xx_nvram_get_psi_size);

arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ u8 *bcm63xx_nvram_get_name(void);
3030
*/
3131
int bcm63xx_nvram_get_mac_address(u8 *mac);
3232

33+
int bcm63xx_nvram_get_psi_size(void);
34+
3335
#endif /* BCM63XX_NVRAM_H */

drivers/mtd/bcm63xxpart.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Copyright © 2006-2008 Florian Fainelli <florian@openwrt.org>
55
* Mike Albon <malbon@openwrt.org>
66
* Copyright © 2009-2010 Daniel Dickinson <openwrt@cshore.neomailbox.net>
7-
* Copyright © 2011-2012 Jonas Gorski <jonas.gorski@gmail.com>
7+
* Copyright © 2011-2013 Jonas Gorski <jonas.gorski@gmail.com>
88
*
99
* This program is free software; you can redistribute it and/or modify
1010
* it under the terms of the GNU General Public License as published by
@@ -27,17 +27,19 @@
2727
#include <linux/crc32.h>
2828
#include <linux/module.h>
2929
#include <linux/kernel.h>
30+
#include <linux/sizes.h>
3031
#include <linux/slab.h>
3132
#include <linux/vmalloc.h>
3233
#include <linux/mtd/mtd.h>
3334
#include <linux/mtd/partitions.h>
3435

36+
#include <asm/mach-bcm63xx/bcm63xx_nvram.h>
3537
#include <asm/mach-bcm63xx/bcm963xx_tag.h>
3638
#include <asm/mach-bcm63xx/board_bcm963xx.h>
3739

3840
#define BCM63XX_EXTENDED_SIZE 0xBFC00000 /* Extended flash address */
3941

40-
#define BCM63XX_CFE_BLOCK_SIZE 0x10000 /* always at least 64KiB */
42+
#define BCM63XX_CFE_BLOCK_SIZE SZ_64K /* always at least 64KiB */
4143

4244
#define BCM63XX_CFE_MAGIC_OFFSET 0x4e0
4345

@@ -90,7 +92,8 @@ static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,
9092
BCM63XX_CFE_BLOCK_SIZE);
9193

9294
cfelen = cfe_erasesize;
93-
nvramlen = cfe_erasesize;
95+
nvramlen = bcm63xx_nvram_get_psi_size() * SZ_1K;
96+
nvramlen = roundup(nvramlen, cfe_erasesize);
9497

9598
/* Allocate memory for buffer */
9699
buf = vmalloc(sizeof(struct bcm_tag));

drivers/mtd/chips/cfi_cmdset_0002.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,8 +1571,8 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
15711571
xip_enable(map, chip, adr);
15721572
/* FIXME - should have reset delay before continuing */
15731573

1574-
printk(KERN_WARNING "MTD %s(): software timeout\n",
1575-
__func__ );
1574+
printk(KERN_WARNING "MTD %s(): software timeout, address:0x%.8lx.\n",
1575+
__func__, adr);
15761576

15771577
ret = -EIO;
15781578
op_done:

0 commit comments

Comments
 (0)