aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/mtd
diff options
context:
space:
mode:
authorTudor Ambarus <tudor.ambarus@microchip.com>2018-09-11 18:40:07 +0300
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-10-08 21:28:26 +0200
commitb038e8e3be724dd293a0849f5fe267fdddcca9dd (patch)
tree27f30af85a1cc4bb683c0ef0d98bfb999918f461 /include/linux/mtd
parentmtd: spi-nor: add support to non-uniform SFDP SPI NOR flash memories (diff)
downloadwireguard-linux-b038e8e3be724dd293a0849f5fe267fdddcca9dd.tar.xz
wireguard-linux-b038e8e3be724dd293a0849f5fe267fdddcca9dd.zip
mtd: spi-nor: parse SFDP Sector Map Parameter Table
Add support for the SFDP (JESD216B) Sector Map Parameter Table. This table is optional, but when available, we parse it to identify the location and size of sectors within the main data array of the flash memory device and to identify which Erase Types are supported by each sector. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r--include/linux/mtd/spi-nor.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 894cbf88bf2e..7f0c7303575e 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -419,6 +419,18 @@ spi_nor_region_end(const struct spi_nor_erase_region *region)
return (region->offset & ~SNOR_ERASE_FLAGS_MASK) + region->size;
}
+static void __maybe_unused
+spi_nor_region_mark_end(struct spi_nor_erase_region *region)
+{
+ region->offset |= SNOR_LAST_REGION;
+}
+
+static void __maybe_unused
+spi_nor_region_mark_overlay(struct spi_nor_erase_region *region)
+{
+ region->offset |= SNOR_OVERLAID_REGION;
+}
+
static bool __maybe_unused spi_nor_has_uniform_erase(const struct spi_nor *nor)
{
return !!nor->erase_map.uniform_erase_type;