summaryrefslogtreecommitdiff
path: root/include/linux/mtd
diff options
context:
space:
mode:
authorBoris Brezillon <bbrezillon@kernel.org>2018-10-29 12:29:48 +0300
committerMiquel Raynal <miquel.raynal@bootlin.com>2019-04-08 11:21:09 +0300
commit7c4ecca103b3d70c50adc693c9f5d39d292e13e0 (patch)
treec2a12299a0ffd89fbf3ab1150c2525da8378d083 /include/linux/mtd
parent377e517b5fa53590418a7b4c2206082d92434fa3 (diff)
downloadlinux-7c4ecca103b3d70c50adc693c9f5d39d292e13e0.tar.xz
mtd: nand: Add a helper returning the number of eraseblocks per target
Some drivers in the raw NAND framework seems to need this helper, so let's just add it instead of open-coding the logic. Signed-off-by: Boris Brezillon <bbrezillon@kernel.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r--include/linux/mtd/nand.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index d32bb623d532..12d75402472a 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -295,6 +295,18 @@ nanddev_eraseblocks_per_lun(const struct nand_device *nand)
}
/**
+ * nanddev_eraseblocks_per_target() - Get the number of eraseblocks per target
+ * @nand: NAND device
+ *
+ * Return: the number of eraseblocks per target.
+ */
+static inline unsigned int
+nanddev_eraseblocks_per_target(const struct nand_device *nand)
+{
+ return nand->memorg.eraseblocks_per_lun * nand->memorg.luns_per_target;
+}
+
+/**
* nanddev_target_size() - Get the total size provided by a single target/die
* @nand: NAND device
*