Skip to content

Commit c29aa15

Browse files
committed
Merge tag 'for-linus-20140405' of git://git.infradead.org/linux-mtd
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 ...
2 parents 2b3a8fd + 4a4163c commit c29aa15

83 files changed

Lines changed: 3181 additions & 647 deletions

Some content is hidden

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

‎Documentation/devicetree/bindings/mtd/nand.txt‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,17 @@
55
"soft_bch".
66
- nand-bus-width : 8 or 16 bus width if not present 8
77
- nand-on-flash-bbt: boolean to enable on flash bbt option if not present false
8+
9+
- nand-ecc-strength: integer representing the number of bits to correct
10+
per ECC step.
11+
12+
- nand-ecc-step-size: integer representing the number of data bytes
13+
that are covered by a single ECC step.
14+
15+
The ECC strength and ECC step size properties define the correction capability
16+
of a controller. Together, they say a controller can correct "{strength} bit
17+
errors per {size} bytes".
18+
19+
The interpretation of these parameters is implementation-defined, so not all
20+
implementations must support all possible combinations. However, implementations
21+
are encouraged to further specify the value(s) they support.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
* ST-Microelectronics SPI FSM Serial (NOR) Flash Controller
2+
3+
Required properties:
4+
- compatible : Should be "st,spi-fsm"
5+
- reg : Contains register's location and length.
6+
- reg-names : Should contain the reg names "spi-fsm"
7+
- interrupts : The interrupt number
8+
- pinctrl-0 : Standard Pinctrl phandle (see: pinctrl/pinctrl-bindings.txt)
9+
10+
Optional properties:
11+
- st,syscfg : Phandle to boot-device system configuration registers
12+
- st,boot-device-reg : Address of the aforementioned boot-device register(s)
13+
- st,boot-device-spi : Expected boot-device value if booted via this device
14+
15+
Example:
16+
spifsm: spifsm@fe902000{
17+
compatible = "st,spi-fsm";
18+
reg = <0xfe902000 0x1000>;
19+
reg-names = "spi-fsm";
20+
pinctrl-0 = <&pinctrl_fsm>;
21+
st,syscfg = <&syscfg_rear>;
22+
st,boot-device-reg = <0x958>;
23+
st,boot-device-spi = <0x1a>;
24+
status = "okay";
25+
};
26+

‎drivers/mtd/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ config MTD_BCM63XX_PARTS
150150

151151
config MTD_BCM47XX_PARTS
152152
tristate "BCM47XX partitioning support"
153-
depends on BCM47XX
153+
depends on BCM47XX || ARCH_BCM_5301X
154154
help
155155
This provides partitions parser for devices based on BCM47xx
156156
boards.

‎drivers/mtd/bcm47xxpart.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <linux/slab.h>
1515
#include <linux/mtd/mtd.h>
1616
#include <linux/mtd/partitions.h>
17-
#include <bcm47xx_nvram.h>
1817

1918
/* 10 parts were found on sflash on Netgear WNDR4500 */
2019
#define BCM47XXPART_MAX_PARTS 12
@@ -30,6 +29,7 @@
3029
#define BOARD_DATA_MAGIC2 0xBD0D0BBD
3130
#define CFE_MAGIC 0x43464531 /* 1EFC */
3231
#define FACTORY_MAGIC 0x59544346 /* FCTY */
32+
#define NVRAM_HEADER 0x48534C46 /* FLSH */
3333
#define POT_MAGIC1 0x54544f50 /* POTT */
3434
#define POT_MAGIC2 0x504f /* OP */
3535
#define ML_MAGIC1 0x39685a42
@@ -91,7 +91,7 @@ static int bcm47xxpart_parse(struct mtd_info *master,
9191
if (offset >= 0x2000000)
9292
break;
9393

94-
if (curr_part > BCM47XXPART_MAX_PARTS) {
94+
if (curr_part >= BCM47XXPART_MAX_PARTS) {
9595
pr_warn("Reached maximum number of partitions, scanning stopped!\n");
9696
break;
9797
}
@@ -147,6 +147,11 @@ static int bcm47xxpart_parse(struct mtd_info *master,
147147

148148
/* TRX */
149149
if (buf[0x000 / 4] == TRX_MAGIC) {
150+
if (BCM47XXPART_MAX_PARTS - curr_part < 4) {
151+
pr_warn("Not enough partitions left to register trx, scanning stopped!\n");
152+
break;
153+
}
154+
150155
trx = (struct trx_header *)buf;
151156

152157
trx_part = curr_part;
@@ -212,7 +217,7 @@ static int bcm47xxpart_parse(struct mtd_info *master,
212217

213218
/* Look for NVRAM at the end of the last block. */
214219
for (i = 0; i < ARRAY_SIZE(possible_nvram_sizes); i++) {
215-
if (curr_part > BCM47XXPART_MAX_PARTS) {
220+
if (curr_part >= BCM47XXPART_MAX_PARTS) {
216221
pr_warn("Reached maximum number of partitions, scanning stopped!\n");
217222
break;
218223
}

‎drivers/mtd/chips/cfi_cmdset_0001.c‎

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <linux/types.h>
2222
#include <linux/kernel.h>
2323
#include <linux/sched.h>
24-
#include <linux/init.h>
2524
#include <asm/io.h>
2625
#include <asm/byteorder.h>
2726

@@ -69,10 +68,10 @@ static int cfi_intelext_read_fact_prot_reg (struct mtd_info *, loff_t, size_t, s
6968
static int cfi_intelext_read_user_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
7069
static int cfi_intelext_write_user_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
7170
static int cfi_intelext_lock_user_prot_reg (struct mtd_info *, loff_t, size_t);
72-
static int cfi_intelext_get_fact_prot_info (struct mtd_info *,
73-
struct otp_info *, size_t);
74-
static int cfi_intelext_get_user_prot_info (struct mtd_info *,
75-
struct otp_info *, size_t);
71+
static int cfi_intelext_get_fact_prot_info(struct mtd_info *, size_t,
72+
size_t *, struct otp_info *);
73+
static int cfi_intelext_get_user_prot_info(struct mtd_info *, size_t,
74+
size_t *, struct otp_info *);
7675
#endif
7776
static int cfi_intelext_suspend (struct mtd_info *);
7877
static void cfi_intelext_resume (struct mtd_info *);
@@ -435,10 +434,8 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
435434
int i;
436435

437436
mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
438-
if (!mtd) {
439-
printk(KERN_ERR "Failed to allocate memory for MTD device\n");
437+
if (!mtd)
440438
return NULL;
441-
}
442439
mtd->priv = map;
443440
mtd->type = MTD_NORFLASH;
444441

@@ -564,10 +561,8 @@ static struct mtd_info *cfi_intelext_setup(struct mtd_info *mtd)
564561
mtd->numeraseregions = cfi->cfiq->NumEraseRegions * cfi->numchips;
565562
mtd->eraseregions = kmalloc(sizeof(struct mtd_erase_region_info)
566563
* mtd->numeraseregions, GFP_KERNEL);
567-
if (!mtd->eraseregions) {
568-
printk(KERN_ERR "Failed to allocate memory for MTD erase region info\n");
564+
if (!mtd->eraseregions)
569565
goto setup_err;
570-
}
571566

572567
for (i=0; i<cfi->cfiq->NumEraseRegions; i++) {
573568
unsigned long ernum, ersize;
@@ -2399,24 +2394,19 @@ static int cfi_intelext_lock_user_prot_reg(struct mtd_info *mtd,
23992394
NULL, do_otp_lock, 1);
24002395
}
24012396

2402-
static int cfi_intelext_get_fact_prot_info(struct mtd_info *mtd,
2403-
struct otp_info *buf, size_t len)
2404-
{
2405-
size_t retlen;
2406-
int ret;
2397+
static int cfi_intelext_get_fact_prot_info(struct mtd_info *mtd, size_t len,
2398+
size_t *retlen, struct otp_info *buf)
24072399

2408-
ret = cfi_intelext_otp_walk(mtd, 0, len, &retlen, (u_char *)buf, NULL, 0);
2409-
return ret ? : retlen;
2400+
{
2401+
return cfi_intelext_otp_walk(mtd, 0, len, retlen, (u_char *)buf,
2402+
NULL, 0);
24102403
}
24112404

2412-
static int cfi_intelext_get_user_prot_info(struct mtd_info *mtd,
2413-
struct otp_info *buf, size_t len)
2405+
static int cfi_intelext_get_user_prot_info(struct mtd_info *mtd, size_t len,
2406+
size_t *retlen, struct otp_info *buf)
24142407
{
2415-
size_t retlen;
2416-
int ret;
2417-
2418-
ret = cfi_intelext_otp_walk(mtd, 0, len, &retlen, (u_char *)buf, NULL, 1);
2419-
return ret ? : retlen;
2408+
return cfi_intelext_otp_walk(mtd, 0, len, retlen, (u_char *)buf,
2409+
NULL, 1);
24202410
}
24212411

24222412
#endif

‎drivers/mtd/chips/cfi_cmdset_0002.c‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <linux/types.h>
2525
#include <linux/kernel.h>
2626
#include <linux/sched.h>
27-
#include <linux/init.h>
2827
#include <asm/io.h>
2928
#include <asm/byteorder.h>
3029

@@ -507,10 +506,8 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
507506
int i;
508507

509508
mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
510-
if (!mtd) {
511-
printk(KERN_WARNING "Failed to allocate memory for MTD device\n");
509+
if (!mtd)
512510
return NULL;
513-
}
514511
mtd->priv = map;
515512
mtd->type = MTD_NORFLASH;
516513

@@ -661,10 +658,8 @@ static struct mtd_info *cfi_amdstd_setup(struct mtd_info *mtd)
661658
mtd->numeraseregions = cfi->cfiq->NumEraseRegions * cfi->numchips;
662659
mtd->eraseregions = kmalloc(sizeof(struct mtd_erase_region_info)
663660
* mtd->numeraseregions, GFP_KERNEL);
664-
if (!mtd->eraseregions) {
665-
printk(KERN_WARNING "Failed to allocate memory for MTD erase region info\n");
661+
if (!mtd->eraseregions)
666662
goto setup_err;
667-
}
668663

669664
for (i=0; i<cfi->cfiq->NumEraseRegions; i++) {
670665
unsigned long ernum, ersize;

‎drivers/mtd/chips/cfi_cmdset_0020.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <linux/types.h>
2323
#include <linux/kernel.h>
2424
#include <linux/sched.h>
25-
#include <linux/init.h>
2625
#include <asm/io.h>
2726
#include <asm/byteorder.h>
2827

@@ -176,7 +175,6 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map)
176175
//printk(KERN_DEBUG "number of CFI chips: %d\n", cfi->numchips);
177176

178177
if (!mtd) {
179-
printk(KERN_ERR "Failed to allocate memory for MTD device\n");
180178
kfree(cfi->cmdset_priv);
181179
return NULL;
182180
}
@@ -189,7 +187,6 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map)
189187
mtd->eraseregions = kmalloc(sizeof(struct mtd_erase_region_info)
190188
* mtd->numeraseregions, GFP_KERNEL);
191189
if (!mtd->eraseregions) {
192-
printk(KERN_ERR "Failed to allocate memory for MTD erase region info\n");
193190
kfree(cfi->cmdset_priv);
194191
kfree(mtd);
195192
return NULL;

‎drivers/mtd/chips/cfi_probe.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,8 @@ static int __xipram cfi_chip_setup(struct map_info *map,
168168
return 0;
169169

170170
cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
171-
if (!cfi->cfiq) {
172-
printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name);
171+
if (!cfi->cfiq)
173172
return 0;
174-
}
175173

176174
memset(cfi->cfiq,0,sizeof(struct cfi_ident));
177175

‎drivers/mtd/chips/cfi_util.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,8 @@ __xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* n
116116
printk(KERN_INFO "%s Extended Query Table at 0x%4.4X\n", name, adr);
117117

118118
extp = kmalloc(size, GFP_KERNEL);
119-
if (!extp) {
120-
printk(KERN_ERR "Failed to allocate memory\n");
119+
if (!extp)
121120
goto out;
122-
}
123121

124122
#ifdef CONFIG_MTD_XIP
125123
local_irq_disable();

‎drivers/mtd/chips/gen_probe.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi
114114
mapsize = sizeof(long) * DIV_ROUND_UP(max_chips, BITS_PER_LONG);
115115
chip_map = kzalloc(mapsize, GFP_KERNEL);
116116
if (!chip_map) {
117-
printk(KERN_WARNING "%s: kmalloc failed for CFI chip map\n", map->name);
118117
kfree(cfi.cfiq);
119118
return NULL;
120119
}
@@ -139,7 +138,6 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi
139138
retcfi = kmalloc(sizeof(struct cfi_private) + cfi.numchips * sizeof(struct flchip), GFP_KERNEL);
140139

141140
if (!retcfi) {
142-
printk(KERN_WARNING "%s: kmalloc failed for CFI private structure\n", map->name);
143141
kfree(cfi.cfiq);
144142
kfree(chip_map);
145143
return NULL;

0 commit comments

Comments
 (0)