mtd: rawnand: Get rid of chip->chipsize
The target size can now be returned by nanddev_get_targetsize(). Get rid of the chip->chipsize field and use this helper instead. 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>
This commit is contained in:

committed by
Miquel Raynal

parent
298151689b
commit
6c836d515f
@@ -986,6 +986,7 @@ static void flctl_read_buf(struct nand_chip *chip, uint8_t *buf, int len)
|
||||
|
||||
static int flctl_chip_attach_chip(struct nand_chip *chip)
|
||||
{
|
||||
u64 targetsize = nanddev_target_size(&chip->base);
|
||||
struct mtd_info *mtd = nand_to_mtd(chip);
|
||||
struct sh_flctl *flctl = mtd_to_flctl(mtd);
|
||||
|
||||
@@ -998,11 +999,11 @@ static int flctl_chip_attach_chip(struct nand_chip *chip)
|
||||
|
||||
if (mtd->writesize == 512) {
|
||||
flctl->page_size = 0;
|
||||
if (chip->chipsize > (32 << 20)) {
|
||||
if (targetsize > (32 << 20)) {
|
||||
/* big than 32MB */
|
||||
flctl->rw_ADRCNT = ADRCNT_4;
|
||||
flctl->erase_ADRCNT = ADRCNT_3;
|
||||
} else if (chip->chipsize > (2 << 16)) {
|
||||
} else if (targetsize > (2 << 16)) {
|
||||
/* big than 128KB */
|
||||
flctl->rw_ADRCNT = ADRCNT_3;
|
||||
flctl->erase_ADRCNT = ADRCNT_2;
|
||||
@@ -1012,11 +1013,11 @@ static int flctl_chip_attach_chip(struct nand_chip *chip)
|
||||
}
|
||||
} else {
|
||||
flctl->page_size = 1;
|
||||
if (chip->chipsize > (128 << 20)) {
|
||||
if (targetsize > (128 << 20)) {
|
||||
/* big than 128MB */
|
||||
flctl->rw_ADRCNT = ADRCNT2_E;
|
||||
flctl->erase_ADRCNT = ADRCNT_3;
|
||||
} else if (chip->chipsize > (8 << 16)) {
|
||||
} else if (targetsize > (8 << 16)) {
|
||||
/* big than 512KB */
|
||||
flctl->rw_ADRCNT = ADRCNT_4;
|
||||
flctl->erase_ADRCNT = ADRCNT_2;
|
||||
|
Reference in New Issue
Block a user