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

Commit 82cb6ace authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull MTD changes from Brian Norris:
 - Unify some compile-time differences so that we have fewer uses of
   #ifdef CONFIG_OF in atmel_nand
 - Other general cleanups (removing unused functions, options,
   variables, fields; use correct interfaces)
 - Fix BUG() for new odd-sized NAND, which report non-power-of-2
   dimensions via ONFI
 - Miscellaneous driver fixes (SPI NOR flash; BCM47xx NAND flash; etc.)
 - Improve differentiation between SLC and MLC NAND -- this clarifies an
   ABI issue regarding the MTD "type" (in sysfs and in the MEMGETINFO
   ioctl), where the MTD_MLCNANDFLASH type was present but
   inconsistently used
 - Extend GPMI NAND to support multi-chip-select NAND for some platforms
 - Many improvements to the OMAP2/3 NAND driver, including an expanded
   DT binding to bring us closer to mainline support for some OMAP
   systems
 - Fix a deadlock in the error path of the Atmel NAND driver probe
 - Correct the error codes from MTD mmap() to conform to POSIX and the
   Linux Programmer's Manual.  This is an acknowledged change in the MTD
   ABI, but I can't imagine somebody relying on the non-standard -ENOSYS
   error code specifically.  Am I just being unimaginative? :)
 - Fix a few important GPMI NAND bugs (one regression from 3.12 and one
   long-standing race condition)
 - More? Read the log!

* tag 'for-linus-20131112' of git://git.infradead.org/linux-mtd: (98 commits)
  mtd: gpmi: fix the NULL pointer
  mtd: gpmi: fix kernel BUG due to racing DMA operations
  mtd: mtdchar: return expected errors on mmap() call
  mtd: gpmi: only scan two chips for imx6
  mtd: gpmi: Use devm_kzalloc()
  mtd: atmel_nand: fix bug driver will in a dead lock if no nand detected
  mtd: nand: use a local variable to simplify the nand_scan_tail
  mtd: nand: remove deprecated IRQF_DISABLED
  mtd: dataflash: Say if we find a device we don't support
  mtd: nand: omap: fix error return code in omap_nand_probe()
  mtd: nand_bbt: kill NAND_BBT_SCANALLPAGES
  mtd: m25p80: fixup device removal failure path
  mtd: mxc_nand: Include linux/of.h header
  mtd: remove duplicated include from mtdcore.c
  mtd: m25p80: add support for Macronix mx25l3255e
  mtd: nand: omap: remove selection of BCH ecc-scheme via KConfig
  mtd: nand: omap: updated devm_xx for all resource allocation and free calls
  mtd: nand: omap: use drivers/mtd/nand/nand_bch.c wrapper for BCH ECC instead of lib/bch.c
  mtd: nand: omap: clean-up ecc layout for BCH ecc schemes
  mtd: nand: omap2: clean-up BCHx_HW and BCHx_SW ECC configurations in device_probe
  ...
parents 0d522ee7 885d71e5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ Description:
		One of the following ASCII strings, representing the device
		type:

		absent, ram, rom, nor, nand, dataflash, ubi, unknown
		absent, ram, rom, nor, nand, mlc-nand, dataflash, ubi, unknown

What:		/sys/class/mtd/mtdX/writesize
Date:		April 2009
+0 −2
Original line number Diff line number Diff line
@@ -1222,8 +1222,6 @@ in this page</entry>
#define NAND_BBT_VERSION	0x00000100
/* Create a bbt if none axists */
#define NAND_BBT_CREATE		0x00000200
/* Search good / bad pattern through all pages of a block */
#define NAND_BBT_SCANALLPAGES	0x00000400
/* Write bbt if neccecary */
#define NAND_BBT_WRITE		0x00001000
/* Read and write back block contents when writing bbt */
+10 −6
Original line number Diff line number Diff line
@@ -22,10 +22,10 @@ Optional properties:
				width of 8 is assumed.

 - ti,nand-ecc-opt:		A string setting the ECC layout to use. One of:

		"sw"		Software method (default)
		"hw"		Hardware method
		"hw-romcode"	gpmc hamming mode method & romcode layout
		"sw"		<deprecated> use "ham1" instead
		"hw"		<deprecated> use "ham1" instead
		"hw-romcode"	<deprecated> use "ham1" instead
		"ham1"		1-bit Hamming ecc code
		"bch4"		4-bit BCH ecc code
		"bch8"		8-bit BCH ecc code

@@ -36,8 +36,12 @@ Optional properties:
		"prefetch-dma"		Prefetch enabled sDMA mode
		"prefetch-irq"		Prefetch enabled irq mode

 - elm_id:	Specifies elm device node. This is required to support BCH
 		error correction using ELM module.
 - elm_id:	<deprecated> use "ti,elm-id" instead
 - ti,elm-id:	Specifies phandle of the ELM devicetree node.
		ELM is an on-chip hardware engine on TI SoC which is used for
		locating ECC errors for BCHx algorithms. SoC devices which have
		ELM hardware engines should specify this device node in .dtsi
		Using ELM for ECC error correction frees some CPU cycles.

For inline partiton table parsing (optional):

+1 −1
Original line number Diff line number Diff line
@@ -142,7 +142,7 @@ __init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs,
	board_nand_data.nr_parts	= nr_parts;
	board_nand_data.devsize		= nand_type;

	board_nand_data.ecc_opt = OMAP_ECC_HAMMING_CODE_DEFAULT;
	board_nand_data.ecc_opt = OMAP_ECC_BCH8_CODE_HW;
	gpmc_nand_init(&board_nand_data, gpmc_t);
}
#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
+34 −14
Original line number Diff line number Diff line
@@ -1341,14 +1341,6 @@ static void __maybe_unused gpmc_read_timings_dt(struct device_node *np,

#ifdef CONFIG_MTD_NAND

static const char * const nand_ecc_opts[] = {
	[OMAP_ECC_HAMMING_CODE_DEFAULT]		= "sw",
	[OMAP_ECC_HAMMING_CODE_HW]		= "hw",
	[OMAP_ECC_HAMMING_CODE_HW_ROMCODE]	= "hw-romcode",
	[OMAP_ECC_BCH4_CODE_HW]			= "bch4",
	[OMAP_ECC_BCH8_CODE_HW]			= "bch8",
};

static const char * const nand_xfer_types[] = {
	[NAND_OMAP_PREFETCH_POLLED]		= "prefetch-polled",
	[NAND_OMAP_POLLED]			= "polled",
@@ -1378,13 +1370,41 @@ static int gpmc_probe_nand_child(struct platform_device *pdev,
	gpmc_nand_data->cs = val;
	gpmc_nand_data->of_node = child;

	if (!of_property_read_string(child, "ti,nand-ecc-opt", &s))
		for (val = 0; val < ARRAY_SIZE(nand_ecc_opts); val++)
			if (!strcasecmp(s, nand_ecc_opts[val])) {
				gpmc_nand_data->ecc_opt = val;
				break;
	/* Detect availability of ELM module */
	gpmc_nand_data->elm_of_node = of_parse_phandle(child, "ti,elm-id", 0);
	if (gpmc_nand_data->elm_of_node == NULL)
		gpmc_nand_data->elm_of_node =
					of_parse_phandle(child, "elm_id", 0);
	if (gpmc_nand_data->elm_of_node == NULL)
		pr_warn("%s: ti,elm-id property not found\n", __func__);

	/* select ecc-scheme for NAND */
	if (of_property_read_string(child, "ti,nand-ecc-opt", &s)) {
		pr_err("%s: ti,nand-ecc-opt not found\n", __func__);
		return -ENODEV;
	}
	if (!strcmp(s, "ham1") || !strcmp(s, "sw") ||
		!strcmp(s, "hw") || !strcmp(s, "hw-romcode"))
		gpmc_nand_data->ecc_opt =
				OMAP_ECC_HAM1_CODE_HW;
	else if (!strcmp(s, "bch4"))
		if (gpmc_nand_data->elm_of_node)
			gpmc_nand_data->ecc_opt =
				OMAP_ECC_BCH4_CODE_HW;
		else
			gpmc_nand_data->ecc_opt =
				OMAP_ECC_BCH4_CODE_HW_DETECTION_SW;
	else if (!strcmp(s, "bch8"))
		if (gpmc_nand_data->elm_of_node)
			gpmc_nand_data->ecc_opt =
				OMAP_ECC_BCH8_CODE_HW;
		else
			gpmc_nand_data->ecc_opt =
				OMAP_ECC_BCH8_CODE_HW_DETECTION_SW;
	else
		pr_err("%s: ti,nand-ecc-opt invalid value\n", __func__);

	/* select data transfer mode for NAND controller */
	if (!of_property_read_string(child, "ti,nand-xfer-type", &s))
		for (val = 0; val < ARRAY_SIZE(nand_xfer_types); val++)
			if (!strcasecmp(s, nand_xfer_types[val])) {
Loading