mtd: nand: Add a helper to retrieve the number of pages per target
authorBoris Brezillon <bbrezillon@kernel.org>
Mon, 29 Oct 2018 16:18:39 +0000 (17:18 +0100)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 8 Apr 2019 08:21:09 +0000 (10:21 +0200)
Will be used by the raw NAND framework.

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>
include/linux/mtd/nand.h

index 12d75402472ab46cf8aa352887e45495c609c88e..cebc38b6d6f582aa723728ff37fb53a8c2ce73e1 100644 (file)
@@ -271,6 +271,20 @@ nanddev_pages_per_eraseblock(const struct nand_device *nand)
        return nand->memorg.pages_per_eraseblock;
 }
 
+/**
+ * nanddev_pages_per_target() - Get the number of pages per target
+ * @nand: NAND device
+ *
+ * Return: the number of pages per target.
+ */
+static inline unsigned int
+nanddev_pages_per_target(const struct nand_device *nand)
+{
+       return nand->memorg.pages_per_eraseblock *
+              nand->memorg.eraseblocks_per_lun *
+              nand->memorg.luns_per_target;
+}
+
 /**
  * nanddev_per_page_oobsize() - Get NAND erase block size
  * @nand: NAND device