projects/linux·commit c29aa153

Merge tag 'for-linus-20140405' of git://git.infradead.org/linux-mtd

c29aa153 · Linus Torvalds <[email protected]> · 2014-04-07 10:17:30 -07:00

Pull MTD updates from Brian Norris:
 - A few SPI NOR ID definitions
 - Kill the NAND "max pagesize" restriction
 - Fix some x16 bus-width NAND support
 - Add NAND JEDEC parameter page support
 - DT bindings for NAND ECC
 - GPMI NAND updates (subpage reads)
 - More OMAP NAND refactoring
 - New STMicro SPI NOR driver (now in 40 patches!)
 - A few other random bugfixes

* tag 'for-linus-20140405' of git://git.infradead.org/linux-mtd: (120 commits)
  Fix index regression in nand_read_subpage
  mtd: diskonchip: mem resource name is not optional
  mtd: nand: fix mention to CONFIG_MTD_NAND_ECC_BCH
  mtd: nand: fix GET/SET_FEATURES address on 16-bit devices
  mtd: omap2: Use devm_ioremap_resource()
  mtd: denali_dt: Use devm_ioremap_resource()
  mtd: devices: elm: update DRIVER_NAME as "omap-elm"
  mtd: devices: elm: configure parallel channels based on ecc_steps
  mtd: devices: elm: clean elm_load_syndrome
  mtd: devices: elm: check for hardware engine's design constraints
  mtd: st_spi_fsm: Succinctly reorganise .remove()
  mtd: st_spi_fsm: Allow loop to run at least once before giving up CPU
  mtd: st_spi_fsm: Correct vendor name spelling issue - missing "M"
  mtd: st_spi_fsm: Avoid duplicating MTD core code
  mtd: st_spi_fsm: Remove useless consts from function arguments
  mtd: st_spi_fsm: Convert ST SPI FSM (NOR) Flash driver to new DT partitions
  mtd: st_spi_fsm: Move runtime configurable msg sequences into device's struct
  mtd: st_spi_fsm: Supply the W25Qxxx chip specific configuration call-back
  mtd: st_spi_fsm: Supply the S25FLxxx chip specific configuration call-back
  mtd: st_spi_fsm: Supply the MX25xxx chip specific configuration call-back
  ...
Commit
c29aa153ef0469cddf0146d41ce6494bd76be78b
Parents
2b3a8fd7 · 4a4163ca

Merge commit. Changes below are compared with the first parent: 2b3a8fd7.

Changes

83 files changed · +3181 −647

FileStatusAddDelContent
Documentation/devicetree/bindings/mtd/nand.txtmodified+14−0View file
Documentation/devicetree/bindings/mtd/st-fsm.txtadded+26−0View file
drivers/mtd/Kconfigmodified+1−1View file
drivers/mtd/bcm47xxpart.cmodified+8−3View file
drivers/mtd/chips/cfi_cmdset_0001.cmodified+15−25View file
drivers/mtd/chips/cfi_cmdset_0002.cmodified+2−7View file
drivers/mtd/chips/cfi_cmdset_0020.cmodified+0−3View file
drivers/mtd/chips/cfi_probe.cmodified+1−3View file
drivers/mtd/chips/cfi_util.cmodified+1−3View file
drivers/mtd/chips/gen_probe.cmodified+0−2View file
drivers/mtd/devices/Kconfigmodified+8−0View file
drivers/mtd/devices/Makefilemodified+1−0View file
drivers/mtd/devices/block2mtd.cmodified+13−6View file
drivers/mtd/devices/elm.cmodified+33−16View file
drivers/mtd/devices/m25p80.cmodified+25−10View file
drivers/mtd/devices/mtd_dataflash.cmodified+14−10View file
drivers/mtd/devices/phram.cmodified+34−7View file
drivers/mtd/devices/pmc551.cmodified+1−6View file
drivers/mtd/devices/serial_flash_cmds.hadded+81−0View file
drivers/mtd/devices/spear_smi.cmodified+0−2View file
drivers/mtd/devices/sst25l.cmodified+0−1View file
drivers/mtd/devices/st_spi_fsm.cadded+2108−0View file
drivers/mtd/inftlmount.cmodified+0−1View file
drivers/mtd/lpddr/lpddr_cmds.cmodified+1−3View file
drivers/mtd/lpddr/qinfo_probe.cmodified+1−4View file
drivers/mtd/maps/Kconfigmodified+5−5View file
drivers/mtd/maps/bfin-async-flash.cmodified+0−1View file
drivers/mtd/maps/gpio-addr-flash.cmodified+0−1View file
drivers/mtd/maps/intel_vr_nor.cmodified+0−1View file
drivers/mtd/maps/ixp4xx.cmodified+0−1View file
drivers/mtd/maps/lantiq-flash.cmodified+0−1View file
drivers/mtd/maps/latch-addr-flash.cmodified+0−1View file
drivers/mtd/maps/pci.cmodified+0−1View file
drivers/mtd/maps/physmap_of.cmodified+0−1View file
drivers/mtd/maps/plat-ram.cmodified+0−2View file
drivers/mtd/maps/pxa2xx-flash.cmodified+0−1View file
drivers/mtd/maps/rbtx4939-flash.cmodified+0−1View file
drivers/mtd/maps/scb2_flash.cmodified+0−1View file
drivers/mtd/maps/sun_uflash.cmodified+0−1View file
drivers/mtd/mtd_blkdevs.cmodified+0−1View file
drivers/mtd/mtdchar.cmodified+15−5View file
drivers/mtd/mtdcore.cmodified+17−7View file
drivers/mtd/mtdpart.cmodified+8−6View file
drivers/mtd/nand/Kconfigmodified+2−0View file
drivers/mtd/nand/ams-delta.cmodified+0−1View file
drivers/mtd/nand/atmel_nand.cmodified+8−6View file
drivers/mtd/nand/au1550nd.cmodified+2−2View file
drivers/mtd/nand/bf5xx_nand.cmodified+0−1View file
drivers/mtd/nand/cafe_nand.cmodified+46−22View file
drivers/mtd/nand/davinci_nand.cmodified+0−1View file
drivers/mtd/nand/denali_dt.cmodified+8−31View file
drivers/mtd/nand/diskonchip.cmodified+3−2View file
drivers/mtd/nand/fsl_elbc_nand.cmodified+0−1View file
drivers/mtd/nand/fsl_ifc_nand.cmodified+0−1View file
drivers/mtd/nand/gpio.cmodified+0−1View file
drivers/mtd/nand/gpmi-nand/gpmi-nand.cmodified+99−3View file
drivers/mtd/nand/mpc5121_nfc.cmodified+0−1View file
drivers/mtd/nand/mxc_nand.cmodified+2−0View file
drivers/mtd/nand/nand_base.cmodified+132−33View file
drivers/mtd/nand/nand_ids.cmodified+3−0View file
drivers/mtd/nand/nuc900_nand.cmodified+3−3View file
drivers/mtd/nand/omap2.cmodified+218−294View file
drivers/mtd/nand/pasemi_nand.cmodified+0−1View file
drivers/mtd/nand/pxa3xx_nand.cmodified+1−2View file
drivers/mtd/nand/s3c2410.cmodified+0−1View file
drivers/mtd/onenand/generic.cmodified+0−1View file
drivers/mtd/onenand/omap2.cmodified+0−1View file
drivers/mtd/onenand/onenand_base.cmodified+13−25View file
drivers/mtd/onenand/samsung.cmodified+1−3View file
drivers/mtd/rfd_ftl.cmodified+3−6View file
drivers/mtd/sm_ftl.cmodified+4−7View file
drivers/mtd/tests/mtd_test.cmodified+0−1View file
drivers/mtd/ubi/ubi.hmodified+0−1View file
drivers/of/of_mtd.cmodified+34−0View file
fs/jffs2/compr_rtime.cmodified+2−2View file
fs/jffs2/fs.cmodified+6−3View file
fs/jffs2/nodelist.hmodified+1−1View file
fs/jffs2/nodemgmt.cmodified+10−4View file
include/linux/mtd/mtd.hmodified+8−8View file
include/linux/mtd/nand.hmodified+119−16View file
include/linux/of_mtd.hmodified+12−0View file
include/linux/platform_data/elm.hmodified+2−8View file
include/linux/platform_data/mtd-nand-s3c2410.hmodified+6−2View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/devicetree/bindings/mtd/nand.txt

View file
diff --git a/Documentation/devicetree/bindings/mtd/nand.txt b/Documentation/devicetree/bindings/mtd/nand.txt
index 03855c8..b53f92e 100644
--- a/Documentation/devicetree/bindings/mtd/nand.txt
+++ b/Documentation/devicetree/bindings/mtd/nand.txt
@@ -5,3 +5,17 @@
"soft_bch".
- nand-bus-width : 8 or 16 bus width if not present 8
- nand-on-flash-bbt: boolean to enable on flash bbt option if not present false
+
+- nand-ecc-strength: integer representing the number of bits to correct
+ per ECC step.
+
+- nand-ecc-step-size: integer representing the number of data bytes
+ that are covered by a single ECC step.
+
+The ECC strength and ECC step size properties define the correction capability
+of a controller. Together, they say a controller can correct "{strength} bit
+errors per {size} bytes".
+
+The interpretation of these parameters is implementation-defined, so not all
+implementations must support all possible combinations. However, implementations
+are encouraged to further specify the value(s) they support.

Documentation/devicetree/bindings/mtd/st-fsm.txt

View file
diff --git a/Documentation/devicetree/bindings/mtd/st-fsm.txt b/Documentation/devicetree/bindings/mtd/st-fsm.txt
new file mode 100644
index 0000000..c248939
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/st-fsm.txt
@@ -0,0 +1,26 @@
+* ST-Microelectronics SPI FSM Serial (NOR) Flash Controller
+
+Required properties:
+ - compatible : Should be "st,spi-fsm"
+ - reg : Contains register's location and length.
+ - reg-names : Should contain the reg names "spi-fsm"
+ - interrupts : The interrupt number
+ - pinctrl-0 : Standard Pinctrl phandle (see: pinctrl/pinctrl-bindings.txt)
+
+Optional properties:
+ - st,syscfg : Phandle to boot-device system configuration registers
+ - st,boot-device-reg : Address of the aforementioned boot-device register(s)
+ - st,boot-device-spi : Expected boot-device value if booted via this device
+
+Example:
+ spifsm: spifsm@fe902000{
+ compatible = "st,spi-fsm";
+ reg = <0xfe902000 0x1000>;
+ reg-names = "spi-fsm";
+ pinctrl-0 = <&pinctrl_fsm>;
+ st,syscfg = <&syscfg_rear>;
+ st,boot-device-reg = <0x958>;
+ st,boot-device-spi = <0x1a>;
+ status = "okay";
+ };
+

drivers/mtd/Kconfig

View file
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index 5ebcda3..5d49a21 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -150,7 +150,7 @@ config MTD_BCM63XX_PARTS
config MTD_BCM47XX_PARTS
tristate "BCM47XX partitioning support"
- depends on BCM47XX
+ depends on BCM47XX || ARCH_BCM_5301X
help
This provides partitions parser for devices based on BCM47xx
boards.

drivers/mtd/bcm47xxpart.c

View file
diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
index de1eb92..adfa74c 100644
--- a/drivers/mtd/bcm47xxpart.c
+++ b/drivers/mtd/bcm47xxpart.c
@@ -14,7 +14,6 @@
#include <linux/slab.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <bcm47xx_nvram.h>
/* 10 parts were found on sflash on Netgear WNDR4500 */
#define BCM47XXPART_MAX_PARTS 12
@@ -30,6 +29,7 @@
#define BOARD_DATA_MAGIC2 0xBD0D0BBD
#define CFE_MAGIC 0x43464531 /* 1EFC */
#define FACTORY_MAGIC 0x59544346 /* FCTY */
+#define NVRAM_HEADER 0x48534C46 /* FLSH */
#define POT_MAGIC1 0x54544f50 /* POTT */
#define POT_MAGIC2 0x504f /* OP */
#define ML_MAGIC1 0x39685a42
@@ -91,7 +91,7 @@ static int bcm47xxpart_parse(struct mtd_info *master,
if (offset >= 0x2000000)
break;
- if (curr_part > BCM47XXPART_MAX_PARTS) {
+ if (curr_part >= BCM47XXPART_MAX_PARTS) {
pr_warn("Reached maximum number of partitions, scanning stopped!\n");
break;
}
@@ -147,6 +147,11 @@ static int bcm47xxpart_parse(struct mtd_info *master,
/* TRX */
if (buf[0x000 / 4] == TRX_MAGIC) {
+ if (BCM47XXPART_MAX_PARTS - curr_part < 4) {
+ pr_warn("Not enough partitions left to register trx, scanning stopped!\n");
+ break;
+ }
+
trx = (struct trx_header *)buf;
trx_part = curr_part;
@@ -212,7 +217,7 @@ static int bcm47xxpart_parse(struct mtd_info *master,
/* Look for NVRAM at the end of the last block. */
for (i = 0; i < ARRAY_SIZE(possible_nvram_sizes); i++) {
- if (curr_part > BCM47XXPART_MAX_PARTS) {
+ if (curr_part >= BCM47XXPART_MAX_PARTS) {
pr_warn("Reached maximum number of partitions, scanning stopped!\n");
break;
}

drivers/mtd/chips/cfi_cmdset_0001.c

View file
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index 7751443..e4ec355 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -21,7 +21,6 @@
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
-#include <linux/init.h>
#include <asm/io.h>
#include <asm/byteorder.h>
@@ -69,10 +68,10 @@ static int cfi_intelext_read_fact_prot_reg (struct mtd_info *, loff_t, size_t, s
static int cfi_intelext_read_user_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
static int cfi_intelext_write_user_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
static int cfi_intelext_lock_user_prot_reg (struct mtd_info *, loff_t, size_t);
-static int cfi_intelext_get_fact_prot_info (struct mtd_info *,
- struct otp_info *, size_t);
-static int cfi_intelext_get_user_prot_info (struct mtd_info *,
- struct otp_info *, size_t);
+static int cfi_intelext_get_fact_prot_info(struct mtd_info *, size_t,
+ size_t *, struct otp_info *);
+static int cfi_intelext_get_user_prot_info(struct mtd_info *, size_t,
+ size_t *, struct otp_info *);
#endif
static int cfi_intelext_suspend (struct mtd_info *);
static void cfi_intelext_resume (struct mtd_info *);
@@ -435,10 +434,8 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
int i;
mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
- if (!mtd) {
- printk(KERN_ERR "Failed to allocate memory for MTD device\n");
+ if (!mtd)
return NULL;
- }
mtd->priv = map;
mtd->type = MTD_NORFLASH;
@@ -564,10 +561,8 @@ static struct mtd_info *cfi_intelext_setup(struct mtd_info *mtd)
mtd->numeraseregions = cfi->cfiq->NumEraseRegions * cfi->numchips;
mtd->eraseregions = kmalloc(sizeof(struct mtd_erase_region_info)
* mtd->numeraseregions, GFP_KERNEL);
- if (!mtd->eraseregions) {
- printk(KERN_ERR "Failed to allocate memory for MTD erase region info\n");
+ if (!mtd->eraseregions)
goto setup_err;
- }
for (i=0; i<cfi->cfiq->NumEraseRegions; i++) {
unsigned long ernum, ersize;
@@ -2399,24 +2394,19 @@ static int cfi_intelext_lock_user_prot_reg(struct mtd_info *mtd,
NULL, do_otp_lock, 1);
}
-static int cfi_intelext_get_fact_prot_info(struct mtd_info *mtd,
- struct otp_info *buf, size_t len)
-{
- size_t retlen;
- int ret;
+static int cfi_intelext_get_fact_prot_info(struct mtd_info *mtd, size_t len,
+ size_t *retlen, struct otp_info *buf)
- ret = cfi_intelext_otp_walk(mtd, 0, len, &retlen, (u_char *)buf, NULL, 0);
- return ret ? : retlen;
+{
+ return cfi_intelext_otp_walk(mtd, 0, len, retlen, (u_char *)buf,
+ NULL, 0);
}
-static int cfi_intelext_get_user_prot_info(struct mtd_info *mtd,
- struct otp_info *buf, size_t len)
+static int cfi_intelext_get_user_prot_info(struct mtd_info *mtd, size_t len,
+ size_t *retlen, struct otp_info *buf)
{
- size_t retlen;
- int ret;
-
- ret = cfi_intelext_otp_walk(mtd, 0, len, &retlen, (u_char *)buf, NULL, 1);
- return ret ? : retlen;
+ return cfi_intelext_otp_walk(mtd, 0, len, retlen, (u_char *)buf,
+ NULL, 1);
}
#endif

drivers/mtd/chips/cfi_cmdset_0002.c

View file
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index 89b9d68..e21fde9 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -24,7 +24,6 @@
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
-#include <linux/init.h>
#include <asm/io.h>
#include <asm/byteorder.h>
@@ -507,10 +506,8 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
int i;
mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
- if (!mtd) {
- printk(KERN_WARNING "Failed to allocate memory for MTD device\n");
+ if (!mtd)
return NULL;
- }
mtd->priv = map;
mtd->type = MTD_NORFLASH;
@@ -661,10 +658,8 @@ static struct mtd_info *cfi_amdstd_setup(struct mtd_info *mtd)
mtd->numeraseregions = cfi->cfiq->NumEraseRegions * cfi->numchips;
mtd->eraseregions = kmalloc(sizeof(struct mtd_erase_region_info)
* mtd->numeraseregions, GFP_KERNEL);
- if (!mtd->eraseregions) {
- printk(KERN_WARNING "Failed to allocate memory for MTD erase region info\n");
+ if (!mtd->eraseregions)
goto setup_err;
- }
for (i=0; i<cfi->cfiq->NumEraseRegions; i++) {
unsigned long ernum, ersize;

drivers/mtd/chips/cfi_cmdset_0020.c

View file
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
index 096993f..6293855 100644
--- a/drivers/mtd/chips/cfi_cmdset_0020.c
+++ b/drivers/mtd/chips/cfi_cmdset_0020.c
@@ -22,7 +22,6 @@
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
-#include <linux/init.h>
#include <asm/io.h>
#include <asm/byteorder.h>
@@ -176,7 +175,6 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map)
//printk(KERN_DEBUG "number of CFI chips: %d\n", cfi->numchips);
if (!mtd) {
- printk(KERN_ERR "Failed to allocate memory for MTD device\n");
kfree(cfi->cmdset_priv);
return NULL;
}
@@ -189,7 +187,6 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map)
mtd->eraseregions = kmalloc(sizeof(struct mtd_erase_region_info)
* mtd->numeraseregions, GFP_KERNEL);
if (!mtd->eraseregions) {
- printk(KERN_ERR "Failed to allocate memory for MTD erase region info\n");
kfree(cfi->cmdset_priv);
kfree(mtd);
return NULL;

drivers/mtd/chips/cfi_probe.c

View file
diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c
index d255352..e8d0164 100644
--- a/drivers/mtd/chips/cfi_probe.c
+++ b/drivers/mtd/chips/cfi_probe.c
@@ -168,10 +168,8 @@ static int __xipram cfi_chip_setup(struct map_info *map,
return 0;
cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
- if (!cfi->cfiq) {
- printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name);
+ if (!cfi->cfiq)
return 0;
- }
memset(cfi->cfiq,0,sizeof(struct cfi_ident));

drivers/mtd/chips/cfi_util.c

View file
diff --git a/drivers/mtd/chips/cfi_util.c b/drivers/mtd/chips/cfi_util.c
index f992418..08049f6 100644
--- a/drivers/mtd/chips/cfi_util.c
+++ b/drivers/mtd/chips/cfi_util.c
@@ -116,10 +116,8 @@ __xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* n
printk(KERN_INFO "%s Extended Query Table at 0x%4.4X\n", name, adr);
extp = kmalloc(size, GFP_KERNEL);
- if (!extp) {
- printk(KERN_ERR "Failed to allocate memory\n");
+ if (!extp)
goto out;
- }
#ifdef CONFIG_MTD_XIP
local_irq_disable();

drivers/mtd/chips/gen_probe.c

View file
diff --git a/drivers/mtd/chips/gen_probe.c b/drivers/mtd/chips/gen_probe.c
index ffb36ba..b57ceea 100644
--- a/drivers/mtd/chips/gen_probe.c
+++ b/drivers/mtd/chips/gen_probe.c
@@ -114,7 +114,6 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi
mapsize = sizeof(long) * DIV_ROUND_UP(max_chips, BITS_PER_LONG);
chip_map = kzalloc(mapsize, GFP_KERNEL);
if (!chip_map) {
- printk(KERN_WARNING "%s: kmalloc failed for CFI chip map\n", map->name);
kfree(cfi.cfiq);
return NULL;
}
@@ -139,7 +138,6 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi
retcfi = kmalloc(sizeof(struct cfi_private) + cfi.numchips * sizeof(struct flchip), GFP_KERNEL);
if (!retcfi) {
- printk(KERN_WARNING "%s: kmalloc failed for CFI private structure\n", map->name);
kfree(cfi.cfiq);
kfree(chip_map);
return NULL;

drivers/mtd/devices/Kconfig

View file
diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig
index 0128138..1210bc2 100644
--- a/drivers/mtd/devices/Kconfig
+++ b/drivers/mtd/devices/Kconfig
@@ -210,6 +210,14 @@ config MTD_DOCG3
M-Systems and now Sandisk. The support is very experimental,
and doesn't give access to any write operations.
+config MTD_ST_SPI_FSM
+ tristate "ST Microelectronics SPI FSM Serial Flash Controller"
+ depends on ARM || SH
+ help
+ This provides an MTD device driver for the ST Microelectronics
+ SPI Fast Sequence Mode (FSM) Serial Flash Controller and support
+ for a subset of connected Serial Flash devices.
+
if MTD_DOCG3
config BCH_CONST_M
default 14

drivers/mtd/devices/Makefile

View file
diff --git a/drivers/mtd/devices/Makefile b/drivers/mtd/devices/Makefile
index d83bd73..c68868f 100644
--- a/drivers/mtd/devices/Makefile
+++ b/drivers/mtd/devices/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_MTD_NAND_OMAP_BCH) += elm.o
obj-$(CONFIG_MTD_SPEAR_SMI) += spear_smi.o
obj-$(CONFIG_MTD_SST25L) += sst25l.o
obj-$(CONFIG_MTD_BCM47XXSFLASH) += bcm47xxsflash.o
+obj-$(CONFIG_MTD_ST_SPI_FSM) += st_spi_fsm.o
CFLAGS_docg3.o += -I$(src)

drivers/mtd/devices/block2mtd.c

View file
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index d9fd87a..66f0405 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -209,7 +209,6 @@ static void block2mtd_free_device(struct block2mtd_dev *dev)
}
-/* FIXME: ensure that mtd->size % erase_size == 0 */
static struct block2mtd_dev *add_device(char *devname, int erase_size)
{
const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
@@ -240,13 +239,18 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
if (IS_ERR(bdev)) {
pr_err("error: cannot open device %s\n", devname);
- goto devinit_err;
+ goto err_free_block2mtd;
}
dev->blkdev = bdev;
if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
pr_err("attempting to use an MTD device as a block device\n");
- goto devinit_err;
+ goto err_free_block2mtd;
+ }
+
+ if ((long)dev->blkdev->bd_inode->i_size % erase_size) {
+ pr_err("erasesize must be a divisor of device size\n");
+ goto err_free_block2mtd;
}
mutex_init(&dev->write_mutex);
@@ -255,7 +259,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
/* make the name contain the block device in */
name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname);
if (!name)
- goto devinit_err;
+ goto err_destroy_mutex;
dev->mtd.name = name;
@@ -274,7 +278,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
if (mtd_device_register(&dev->mtd, NULL, 0)) {
/* Device didn't get added, so free the entry */
- goto devinit_err;
+ goto err_destroy_mutex;
}
list_add(&dev->list, &blkmtd_device_list);
pr_info("mtd%d: [%s] erase_size = %dKiB [%d]\n",
@@ -283,7 +287,9 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
dev->mtd.erasesize >> 10, dev->mtd.erasesize);
return dev;
-devinit_err:
+err_destroy_mutex:
+ mutex_destroy(&dev->write_mutex);
+err_free_block2mtd:
block2mtd_free_device(dev);
return NULL;
}
@@ -448,6 +454,7 @@ static void block2mtd_exit(void)
struct block2mtd_dev *dev = list_entry(pos, typeof(*dev), list);
block2mtd_sync(&dev->mtd);
mtd_device_unregister(&dev->mtd);
+ mutex_destroy(&dev->write_mutex);
pr_info("mtd%d: [%s] removed\n",
dev->mtd.index,
dev->mtd.name + strlen("block2mtd: "));

drivers/mtd/devices/elm.c

View file
diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c
index d1dd6a3..1fd4a0f 100644
--- a/drivers/mtd/devices/elm.c
+++ b/drivers/mtd/devices/elm.c
@@ -15,6 +15,8 @@
*
*/
+#define DRIVER_NAME "omap-elm"
+
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/interrupt.h>
@@ -84,6 +86,8 @@ struct elm_info {
struct list_head list;
enum bch_ecc bch_type;
struct elm_registers elm_regs;
+ int ecc_steps;
+ int ecc_syndrome_size;
};
static LIST_HEAD(elm_devices);
@@ -103,7 +107,8 @@ static u32 elm_read_reg(struct elm_info *info, int offset)
* @dev: ELM device
* @bch_type: Type of BCH ecc
*/
-int elm_config(struct device *dev, enum bch_ecc bch_type)
+int elm_config(struct device *dev, enum bch_ecc bch_type,
+ int ecc_steps, int ecc_step_size, int ecc_syndrome_size)
{
u32 reg_val;
struct elm_info *info = dev_get_drvdata(dev);
@@ -112,10 +117,22 @@ int elm_config(struct device *dev, enum bch_ecc bch_type)
dev_err(dev, "Unable to configure elm - device not probed?\n");
return -ENODEV;
}
+ /* ELM cannot detect ECC errors for chunks > 1KB */
+ if (ecc_step_size > ((ELM_ECC_SIZE + 1) / 2)) {
+ dev_err(dev, "unsupported config ecc-size=%d\n", ecc_step_size);
+ return -EINVAL;
+ }
+ /* ELM support 8 error syndrome process */
+ if (ecc_steps > ERROR_VECTOR_MAX) {
+ dev_err(dev, "unsupported config ecc-step=%d\n", ecc_steps);
+ return -EINVAL;
+ }
reg_val = (bch_type & ECC_BCH_LEVEL_MASK) | (ELM_ECC_SIZE << 16);
elm_write_reg(info, ELM_LOCATION_CONFIG, reg_val);
- info->bch_type = bch_type;
+ info->bch_type = bch_type;
+ info->ecc_steps = ecc_steps;
+ info->ecc_syndrome_size = ecc_syndrome_size;
return 0;
}
@@ -157,17 +174,15 @@ static void elm_load_syndrome(struct elm_info *info,
int i, offset;
u32 val;
- for (i = 0; i < ERROR_VECTOR_MAX; i++) {
+ for (i = 0; i < info->ecc_steps; i++) {
/* Check error reported */
if (err_vec[i].error_reported) {
elm_configure_page_mode(info, i, true);
offset = ELM_SYNDROME_FRAGMENT_0 +
SYNDROME_FRAGMENT_REG_SIZE * i;
-
- /* BCH8 */
- if (info->bch_type) {
-
+ switch (info->bch_type) {
+ case BCH8_ECC:
/* syndrome fragment 0 = ecc[9-12B] */
val = cpu_to_be32(*(u32 *) &ecc[9]);
elm_write_reg(info, offset, val);
@@ -186,7 +201,8 @@ static void elm_load_syndrome(struct elm_info *info,
offset += 4;
val = ecc[0];
elm_write_reg(info, offset, val);
- } else {
+ break;
+ case BCH4_ECC:
/* syndrome fragment 0 = ecc[20-52b] bits */
val = (cpu_to_be32(*(u32 *) &ecc[3]) >> 4) |
((ecc[2] & 0xf) << 28);
@@ -196,11 +212,14 @@ static void elm_load_syndrome(struct elm_info *info,
offset += 4;
val = cpu_to_be32(*(u32 *) &ecc[0]) >> 12;
elm_write_reg(info, offset, val);
+ break;
+ default:
+ pr_err("invalid config bch_type\n");
}
}
/* Update ecc pointer with ecc byte size */
- ecc += info->bch_type ? BCH8_SIZE : BCH4_SIZE;
+ ecc += info->ecc_syndrome_size;
}
}
@@ -223,7 +242,7 @@ static void elm_start_processing(struct elm_info *info,
* Set syndrome vector valid, so that ELM module
* will process it for vectors error is reported
*/
- for (i = 0; i < ERROR_VECTOR_MAX; i++) {
+ for (i = 0; i < info->ecc_steps; i++) {
if (err_vec[i].error_reported) {
offset = ELM_SYNDROME_FRAGMENT_6 +
SYNDROME_FRAGMENT_REG_SIZE * i;
@@ -252,7 +271,7 @@ static void elm_error_correction(struct elm_info *info,
int offset;
u32 reg_val;
- for (i = 0; i < ERROR_VECTOR_MAX; i++) {
+ for (i = 0; i < info->ecc_steps; i++) {
/* Check error reported */
if (err_vec[i].error_reported) {
@@ -354,10 +373,8 @@ static int elm_probe(struct platform_device *pdev)
struct elm_info *info;
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
- if (!info) {
- dev_err(&pdev->dev, "failed to allocate memory\n");
+ if (!info)
return -ENOMEM;
- }
info->dev = &pdev->dev;
@@ -380,7 +397,7 @@ static int elm_probe(struct platform_device *pdev)
}
pm_runtime_enable(&pdev->dev);
- if (pm_runtime_get_sync(&pdev->dev)) {
+ if (pm_runtime_get_sync(&pdev->dev) < 0) {
ret = -EINVAL;
pm_runtime_disable(&pdev->dev);
dev_err(&pdev->dev, "can't enable clock\n");
@@ -505,7 +522,7 @@ MODULE_DEVICE_TABLE(of, elm_of_match);
static struct platform_driver elm_driver = {
.driver = {
- .name = "elm",
+ .name = DRIVER_NAME,
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(elm_of_match),
.pm = &elm_pm_ops,

drivers/mtd/devices/m25p80.c

View file
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index ad19139..524dab3 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -15,7 +15,6 @@
*
*/
-#include <linux/init.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/module.h>
@@ -41,7 +40,8 @@
#define OPCODE_WRSR 0x01 /* Write status register 1 byte */
#define OPCODE_NORM_READ 0x03 /* Read data bytes (low frequency) */
#define OPCODE_FAST_READ 0x0b /* Read data bytes (high frequency) */
-#define OPCODE_QUAD_READ 0x6b /* Read data bytes */
+#define OPCODE_DUAL_READ 0x3b /* Read data bytes (Dual SPI) */
+#define OPCODE_QUAD_READ 0x6b /* Read data bytes (Quad SPI) */
#define OPCODE_PP 0x02 /* Page program (up to 256 bytes) */
#define OPCODE_BE_4K 0x20 /* Erase 4KiB block */
#define OPCODE_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips */
@@ -54,7 +54,8 @@
/* 4-byte address opcodes - used on Spansion and some Macronix flashes. */
#define OPCODE_NORM_READ_4B 0x13 /* Read data bytes (low frequency) */
#define OPCODE_FAST_READ_4B 0x0c /* Read data bytes (high frequency) */
-#define OPCODE_QUAD_READ_4B 0x6c /* Read data bytes */
+#define OPCODE_DUAL_READ_4B 0x3c /* Read data bytes (Dual SPI) */
+#define OPCODE_QUAD_READ_4B 0x6c /* Read data bytes (Quad SPI) */
#define OPCODE_PP_4B 0x12 /* Page program (up to 256 bytes) */

This diff is incomplete. Download the complete patch.

drivers/mtd/devices/mtd_dataflash.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/devices/phram.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/devices/pmc551.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/devices/serial_flash_cmds.h

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/devices/spear_smi.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/devices/sst25l.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/devices/st_spi_fsm.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/inftlmount.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/lpddr/lpddr_cmds.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/lpddr/qinfo_probe.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/maps/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/maps/bfin-async-flash.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/maps/gpio-addr-flash.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/maps/intel_vr_nor.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/maps/ixp4xx.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/maps/lantiq-flash.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/maps/latch-addr-flash.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/maps/pci.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/maps/physmap_of.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/maps/plat-ram.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/maps/pxa2xx-flash.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/maps/rbtx4939-flash.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/maps/scb2_flash.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/maps/sun_uflash.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/mtd_blkdevs.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/mtdchar.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/mtdcore.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/mtdpart.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/ams-delta.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/atmel_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/au1550nd.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/bf5xx_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/cafe_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/davinci_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/denali_dt.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/diskonchip.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/fsl_elbc_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/fsl_ifc_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/gpio.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/gpmi-nand/gpmi-nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/mpc5121_nfc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/mxc_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/nand_base.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/nand_ids.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/nuc900_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/omap2.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/pasemi_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/pxa3xx_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/s3c2410.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/onenand/generic.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/onenand/omap2.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/onenand/onenand_base.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/onenand/samsung.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/rfd_ftl.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/sm_ftl.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/tests/mtd_test.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/ubi/ubi.h

View file

This diff is incomplete. Download the complete patch.

drivers/of/of_mtd.c

View file

This diff is incomplete. Download the complete patch.

fs/jffs2/compr_rtime.c

View file

This diff is incomplete. Download the complete patch.

fs/jffs2/fs.c

View file

This diff is incomplete. Download the complete patch.

fs/jffs2/nodelist.h

View file

This diff is incomplete. Download the complete patch.

fs/jffs2/nodemgmt.c

View file

This diff is incomplete. Download the complete patch.

include/linux/mtd/mtd.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mtd/nand.h

View file

This diff is incomplete. Download the complete patch.

include/linux/of_mtd.h

View file

This diff is incomplete. Download the complete patch.

include/linux/platform_data/elm.h

View file

This diff is incomplete. Download the complete patch.

include/linux/platform_data/mtd-nand-s3c2410.h

View file

This diff is incomplete. Download the complete patch.