summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/raw/nandsim.c
diff options
context:
space:
mode:
authorBoris Brezillon <bbrezillon@kernel.org>2018-10-25 17:10:37 +0200
committerMiquel Raynal <miquel.raynal@bootlin.com>2019-04-08 10:21:12 +0200
commit629a442cad5facbebc204ff81e1974f8febab636 (patch)
treef24769f38c1fc76c8d6a1d06f08b3b621df361e7 /drivers/mtd/nand/raw/nandsim.c
parentmtd: rawnand: Prepare things to reuse the generic NAND layer (diff)
downloadlinux-629a442cad5facbebc204ff81e1974f8febab636.tar.xz
linux-629a442cad5facbebc204ff81e1974f8febab636.zip
mtd: rawnand: Fill memorg during detection
If we want to use the generic NAND layer, we need to have the memorg struct appropriately filled. Patch the detection code to fill this struct. Signed-off-by: Boris Brezillon <bbrezillon@kernel.org> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'drivers/mtd/nand/raw/nandsim.c')
-rw-r--r--drivers/mtd/nand/raw/nandsim.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/mtd/nand/raw/nandsim.c b/drivers/mtd/nand/raw/nandsim.c
index edf5fd3d5f07..bf54733f8b5b 100644
--- a/drivers/mtd/nand/raw/nandsim.c
+++ b/drivers/mtd/nand/raw/nandsim.c
@@ -2304,6 +2304,10 @@ static int __init ns_init_module(void)
if (overridesize) {
uint64_t new_size = (uint64_t)nsmtd->erasesize << overridesize;
+ struct nand_memory_organization *memorg;
+
+ memorg = nanddev_get_memorg(&chip->base);
+
if (new_size >> overridesize != nsmtd->erasesize) {
NS_ERR("overridesize is too big\n");
retval = -EINVAL;
@@ -2311,6 +2315,7 @@ static int __init ns_init_module(void)
}
/* N.B. This relies on nand_scan not doing anything with the size before we change it */
nsmtd->size = new_size;
+ memorg->eraseblocks_per_lun = 1 << overridesize;
chip->chipsize = new_size;
chip->chip_shift = ffs(nsmtd->erasesize) + overridesize - 1;
chip->pagemask = (chip->chipsize >> chip->page_shift) - 1;