Commit b44574c7 authored by Miquel Raynal's avatar Miquel Raynal
Browse files

Merge tag 'spi-nor/for-6.14' into mtd/next

SPI NOR changes for 6.14

Notable changes:

- Add flash entries for Atmel AT25SF321, Spansion S28HL256T, S28HL02GT.

- Add support for vcc-supply regulators and their DT bindings.

- Drop mx25u25635f entry. The flash shares its ID with mx25u25645g and
  both parts have an SFDP table. Removing their entry lets them be
  driven by the generic SFDP-based driver.
parents cd97c961 943e5f85
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -96,6 +96,10 @@ properties:
      If "broken-flash-reset" is present then having this property does not
      make any difference.

  vcc-supply:
    description:
      Supply for the SPI NOR power.

  spi-cpol: true
  spi-cpha: true

+4 −0
Original line number Diff line number Diff line
@@ -238,6 +238,10 @@ static const struct flash_info atmel_nor_parts[] = {
		.flags = SPI_NOR_HAS_LOCK,
		.no_sfdp_flags = SECT_4K,
		.fixups = &at25fs_nor_fixups
	}, {
		.id = SNOR_ID(0x1f, 0x87, 0x01),
		.size = SZ_4M,
		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
	},
};

+12 −7
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/mtd/spi-nor.h>
#include <linux/mutex.h>
#include <linux/of_platform.h>
#include <linux/regulator/consumer.h>
#include <linux/sched/task_stack.h>
#include <linux/sizes.h>
#include <linux/slab.h>
@@ -3576,7 +3577,8 @@ static int spi_nor_create_write_dirmap(struct spi_nor *nor)
static int spi_nor_probe(struct spi_mem *spimem)
{
	struct spi_device *spi = spimem->spi;
	struct flash_platform_data *data = dev_get_platdata(&spi->dev);
	struct device *dev = &spi->dev;
	struct flash_platform_data *data = dev_get_platdata(dev);
	struct spi_nor *nor;
	/*
	 * Enable all caps by default. The core will mask them after
@@ -3586,13 +3588,17 @@ static int spi_nor_probe(struct spi_mem *spimem)
	char *flash_name;
	int ret;

	nor = devm_kzalloc(&spi->dev, sizeof(*nor), GFP_KERNEL);
	ret = devm_regulator_get_enable(dev, "vcc");
	if (ret)
		return ret;

	nor = devm_kzalloc(dev, sizeof(*nor), GFP_KERNEL);
	if (!nor)
		return -ENOMEM;

	nor->spimem = spimem;
	nor->dev = &spi->dev;
	spi_nor_set_flash_node(nor, spi->dev.of_node);
	nor->dev = dev;
	spi_nor_set_flash_node(nor, dev->of_node);

	spi_mem_set_drvdata(spimem, nor);

@@ -3628,9 +3634,8 @@ static int spi_nor_probe(struct spi_mem *spimem)
	 */
	if (nor->params->page_size > PAGE_SIZE) {
		nor->bouncebuf_size = nor->params->page_size;
		devm_kfree(nor->dev, nor->bouncebuf);
		nor->bouncebuf = devm_kmalloc(nor->dev,
					      nor->bouncebuf_size,
		devm_kfree(dev, nor->bouncebuf);
		nor->bouncebuf = devm_kmalloc(dev, nor->bouncebuf_size,
					      GFP_KERNEL);
		if (!nor->bouncebuf)
			return -ENOMEM;
+5 −1
Original line number Diff line number Diff line
@@ -448,7 +448,11 @@ struct spi_nor_id {
 * @id:   pointer to struct spi_nor_id or NULL, which means "no ID" (mostly
 *        older chips).
 * @name: (obsolete) the name of the flash. Do not set it for new additions.
 * @size:           the size of the flash in bytes.
 * @size:           the size of the flash in bytes. The flash size is one
 *                  property parsed by the SFDP. We use it as an indicator
 *                  whether we need SFDP parsing for a particular flash.
 *                  I.e. non-legacy flash entries in flash_info will have
 *                  a size of zero iff SFDP should be used.
 * @sector_size:    (optional) the size listed here is what works with
 *                  SPINOR_OP_SE, which isn't necessarily called a "sector" by
 *                  the vendor. Defaults to 64k.
+2 −7
Original line number Diff line number Diff line
@@ -142,12 +142,6 @@ static const struct flash_info macronix_nor_parts[] = {
		.name = "mx25u12835f",
		.size = SZ_16M,
		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
	}, {
		.id = SNOR_ID(0xc2, 0x25, 0x39),
		.name = "mx25u25635f",
		.size = SZ_32M,
		.no_sfdp_flags = SECT_4K,
		.fixup_flags = SPI_NOR_4B_OPCODES,
	}, {
		.id = SNOR_ID(0xc2, 0x25, 0x3a),
		.name = "mx25u51245g",
@@ -230,7 +224,8 @@ static int macronix_nor_octal_dtr_en(struct spi_nor *nor)
		return ret;

	/* Read flash ID to make sure the switch was successful. */
	ret = spi_nor_read_id(nor, 4, 4, buf, SNOR_PROTO_8_8_8_DTR);
	ret = spi_nor_read_id(nor, nor->addr_nbytes, 4, buf,
			      SNOR_PROTO_8_8_8_DTR);
	if (ret) {
		dev_dbg(nor->dev, "error %d reading JEDEC ID after enabling 8D-8D-8D mode\n", ret);
		return ret;
Loading