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

Commit 48476df9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull MTD update from David Woodhouse:
 "Fairly unexciting MTD merge for 3.9:

   - misc clean-ups in the MTD command-line partitioning parser
     (cmdlinepart)
   - add flash locking support for STmicro chips serial flash chips, as
     well as for CFI command set 2 chips.
   - new driver for the ELM error correction HW module found in various
     TI chips, enable the OMAP NAND driver to use the ELM HW error
     correction
   - added number of new serial flash IDs
   - various fixes and improvements in the gpmi NAND driver
   - bcm47xx NAND driver improvements
   - make the mtdpart module actually removable"

* tag 'for-linus-20130301' of git://git.infradead.org/linux-mtd: (45 commits)
  mtd: map: BUG() in non handled cases
  mtd: bcm47xxnflash: use pr_fmt for module prefix in messages
  mtd: davinci_nand: Use managed resources
  mtd: mtd_torturetest can cause stack overflows
  mtd: physmap_of: Convert device allocation to managed devm_kzalloc()
  mtd: at91: atmel_nand: for PMECC, add code to check the ONFI parameter ECC requirement.
  mtd: atmel_nand: make pmecc-cap, pmecc-sector-size in dts is optional.
  mtd: atmel_nand: avoid to report an error when lookup table offset is 0.
  mtd: bcm47xxsflash: adjust names of bus-specific functions
  mtd: bcm47xxpart: improve probing of nvram partition
  mtd: bcm47xxpart: add support for other erase sizes
  mtd: bcm47xxnflash: register this as normal driver
  mtd: bcm47xxnflash: fix message
  mtd: bcm47xxsflash: register this as normal driver
  mtd: bcm47xxsflash: write number of written bytes
  mtd: gpmi: add sanity check for the ECC
  mtd: gpmi: set the Golois Field bit for mx6q's BCH
  mtd: devices: elm: Removes <xx> literals in elm DT node
  mtd: gpmi: fix a dereferencing freed memory error
  mtd: fix the wrong timeo for panic_nand_wait()
  ...
parents 37cae6ad 24dea0c9
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
Error location module

Required properties:
- compatible: Must be "ti,am33xx-elm"
- reg: physical base address and size of the registers map.
- interrupts: Interrupt number for the elm.

Optional properties:
- ti,hwmods: Name of the hwmod associated to the elm

Example:
elm: elm@0 {
	compatible = "ti,am3352-elm";
	reg = <0x48080000 0x2000>;
	interrupts = <4>;
};
+3 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,9 @@ file systems on embedded devices.
 - linux,mtd-name: allow to specify the mtd name for retro capability with
 - linux,mtd-name: allow to specify the mtd name for retro capability with
   physmap-flash drivers as boot loader pass the mtd partition via the old
   physmap-flash drivers as boot loader pass the mtd partition via the old
   device name physmap-flash.
   device name physmap-flash.
 - use-advanced-sector-protection: boolean to enable support for the
   advanced sector protection (Spansion: PPB - Persistent Protection
   Bits) locking.


For JEDEC compatible devices, the following additional properties
For JEDEC compatible devices, the following additional properties
are defined:
are defined:
+2 −2
Original line number Original line Diff line number Diff line
@@ -74,8 +74,8 @@ config MTD_REDBOOT_PARTS_READONLY
endif # MTD_REDBOOT_PARTS
endif # MTD_REDBOOT_PARTS


config MTD_CMDLINE_PARTS
config MTD_CMDLINE_PARTS
	bool "Command line partition table parsing"
	tristate "Command line partition table parsing"
	depends on MTD = "y"
	depends on MTD
	---help---
	---help---
	  Allow generic configuration of the MTD partition tables via the kernel
	  Allow generic configuration of the MTD partition tables via the kernel
	  command line. Multiple flash resources are supported for hardware where
	  command line. Multiple flash resources are supported for hardware where
+6 −0
Original line number Original line Diff line number Diff line
@@ -142,7 +142,13 @@ static int __init ar7_parser_init(void)
	return register_mtd_parser(&ar7_parser);
	return register_mtd_parser(&ar7_parser);
}
}


static void __exit ar7_parser_exit(void)
{
	deregister_mtd_parser(&ar7_parser);
}

module_init(ar7_parser_init);
module_init(ar7_parser_init);
module_exit(ar7_parser_exit);


MODULE_LICENSE("GPL");
MODULE_LICENSE("GPL");
MODULE_AUTHOR(	"Felix Fietkau <nbd@openwrt.org>, "
MODULE_AUTHOR(	"Felix Fietkau <nbd@openwrt.org>, "
+34 −15
Original line number Original line Diff line number Diff line
@@ -19,12 +19,6 @@
/* 10 parts were found on sflash on Netgear WNDR4500 */
/* 10 parts were found on sflash on Netgear WNDR4500 */
#define BCM47XXPART_MAX_PARTS		12
#define BCM47XXPART_MAX_PARTS		12


/*
 * Amount of bytes we read when analyzing each block of flash memory.
 * Set it big enough to allow detecting partition and reading important data.
 */
#define BCM47XXPART_BYTES_TO_READ	0x404

/* Magics */
/* Magics */
#define BOARD_DATA_MAGIC		0x5246504D	/* MPFR */
#define BOARD_DATA_MAGIC		0x5246504D	/* MPFR */
#define POT_MAGIC1			0x54544f50	/* POTT */
#define POT_MAGIC1			0x54544f50	/* POTT */
@@ -59,13 +53,21 @@ static int bcm47xxpart_parse(struct mtd_info *master,
	uint32_t *buf;
	uint32_t *buf;
	size_t bytes_read;
	size_t bytes_read;
	uint32_t offset;
	uint32_t offset;
	uint32_t blocksize = 0x10000;
	uint32_t blocksize = master->erasesize;
	struct trx_header *trx;
	struct trx_header *trx;
	int trx_part = -1;
	int last_trx_part = -1;
	int max_bytes_to_read = 0x8004;

	if (blocksize <= 0x10000)
		blocksize = 0x10000;
	if (blocksize == 0x20000)
		max_bytes_to_read = 0x18004;


	/* Alloc */
	/* Alloc */
	parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS,
	parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS,
			GFP_KERNEL);
			GFP_KERNEL);
	buf = kzalloc(BCM47XXPART_BYTES_TO_READ, GFP_KERNEL);
	buf = kzalloc(max_bytes_to_read, GFP_KERNEL);


	/* Parse block by block looking for magics */
	/* Parse block by block looking for magics */
	for (offset = 0; offset <= master->size - blocksize;
	for (offset = 0; offset <= master->size - blocksize;
@@ -80,7 +82,7 @@ static int bcm47xxpart_parse(struct mtd_info *master,
		}
		}


		/* Read beginning of the block */
		/* Read beginning of the block */
		if (mtd_read(master, offset, BCM47XXPART_BYTES_TO_READ,
		if (mtd_read(master, offset, max_bytes_to_read,
			     &bytes_read, (uint8_t *)buf) < 0) {
			     &bytes_read, (uint8_t *)buf) < 0) {
			pr_err("mtd_read error while parsing (offset: 0x%X)!\n",
			pr_err("mtd_read error while parsing (offset: 0x%X)!\n",
			       offset);
			       offset);
@@ -95,9 +97,16 @@ static int bcm47xxpart_parse(struct mtd_info *master,
		}
		}


		/* Standard NVRAM */
		/* Standard NVRAM */
		if (buf[0x000 / 4] == NVRAM_HEADER) {
		if (buf[0x000 / 4] == NVRAM_HEADER ||
		    buf[0x1000 / 4] == NVRAM_HEADER ||
		    buf[0x8000 / 4] == NVRAM_HEADER ||
		    (blocksize == 0x20000 && (
		      buf[0x10000 / 4] == NVRAM_HEADER ||
		      buf[0x11000 / 4] == NVRAM_HEADER ||
		      buf[0x18000 / 4] == NVRAM_HEADER))) {
			bcm47xxpart_add_part(&parts[curr_part++], "nvram",
			bcm47xxpart_add_part(&parts[curr_part++], "nvram",
					     offset, 0);
					     offset, 0);
			offset = rounddown(offset, blocksize);
			continue;
			continue;
		}
		}


@@ -131,6 +140,10 @@ static int bcm47xxpart_parse(struct mtd_info *master,
		if (buf[0x000 / 4] == TRX_MAGIC) {
		if (buf[0x000 / 4] == TRX_MAGIC) {
			trx = (struct trx_header *)buf;
			trx = (struct trx_header *)buf;


			trx_part = curr_part;
			bcm47xxpart_add_part(&parts[curr_part++], "firmware",
					     offset, 0);

			i = 0;
			i = 0;
			/* We have LZMA loader if offset[2] points to sth */
			/* We have LZMA loader if offset[2] points to sth */
			if (trx->offset[2]) {
			if (trx->offset[2]) {
@@ -154,6 +167,8 @@ static int bcm47xxpart_parse(struct mtd_info *master,
					     offset + trx->offset[i], 0);
					     offset + trx->offset[i], 0);
			i++;
			i++;


			last_trx_part = curr_part - 1;

			/*
			/*
			 * We have whole TRX scanned, skip to the next part. Use
			 * We have whole TRX scanned, skip to the next part. Use
			 * roundown (not roundup), as the loop will increase
			 * roundown (not roundup), as the loop will increase
@@ -169,11 +184,15 @@ static int bcm47xxpart_parse(struct mtd_info *master,
	 * Assume that partitions end at the beginning of the one they are
	 * Assume that partitions end at the beginning of the one they are
	 * followed by.
	 * followed by.
	 */
	 */
	for (i = 0; i < curr_part - 1; i++)
	for (i = 0; i < curr_part; i++) {
		parts[i].size = parts[i + 1].offset - parts[i].offset;
		u64 next_part_offset = (i < curr_part - 1) ?
	if (curr_part > 0)
				       parts[i + 1].offset : master->size;
		parts[curr_part - 1].size =

				master->size - parts[curr_part - 1].offset;
		parts[i].size = next_part_offset - parts[i].offset;
		if (i == last_trx_part && trx_part >= 0)
			parts[trx_part].size = next_part_offset -
					       parts[trx_part].offset;
	}


	*pparts = parts;
	*pparts = parts;
	return curr_part;
	return curr_part;
Loading