[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180608143549.04400f92@xps13>
Date: Fri, 8 Jun 2018 14:35:49 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Naga Sureshkumar Relli <nagasure@...inx.com>
Cc: "boris.brezillon@...tlin.com" <boris.brezillon@...tlin.com>,
"richard@....at" <richard@....at>,
"wmw2@...radead.org" <wmw2@...radead.org>,
"computersforpeace@...il.com" <computersforpeace@...il.com>,
"marek.vasut@...il.com" <marek.vasut@...il.com>,
"f.fainelli@...il.com" <f.fainelli@...il.com>,
"mmayer@...adcom.com" <mmayer@...adcom.com>,
"rogerq@...com" <rogerq@...com>,
"ladis@...ux-mips.org" <ladis@...ux-mips.org>,
"ada@...rsis.com" <ada@...rsis.com>,
"honghui.zhang@...iatek.com" <honghui.zhang@...iatek.com>,
"linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"nagasureshkumarrelli@...il.com" <nagasureshkumarrelli@...il.com>
Subject: Re: [LINUX PATCH v9 4/4] mtd: rawnand: pl353: Add basic driver for
arm pl353 smc nand interface
Hi Naga,
> > > + ecc->read_page = pl353_nand_read_page_hwecc;
> > > + ecc->size = PL353_NAND_ECC_SIZE;
> > > + ecc->write_page = pl353_nand_write_page_hwecc;
> > > + pl353_smc_set_ecc_pg_size(mtd->writesize);
> > > + switch (mtd->writesize) {
> > > + case SZ_512:
> > > + case SZ_1K:
> > > + case SZ_2K:
> > > + pl353_smc_set_ecc_mode(PL353_SMC_ECCMODE_APB);
> > > + break;
> > > + default:
> > > + /*
> > > + * The software ECC routines won't work with the
> > > + * SMC controller
> > > + */
> > > + ecc->calculate = nand_calculate_ecc;
> > > + ecc->correct = nand_correct_data;
> > > + ecc->size = 256;
> > > + break;
> > > + }
> > > + if (mtd->writesize <= SZ_512)
> > > + xnand->addr_cycles = 1;
> > > + else
> > > + xnand->addr_cycles = 2;
> > > +
> > > + if (chip->options & NAND_ROW_ADDR_3)
> > > + xnand->addr_cycles += 3;
> > > + else
> > > + xnand->addr_cycles += 2;
> > > +
> > > + if (mtd->oobsize == 16)
> > > + mtd_set_ooblayout(mtd, &pl353_ecc_ooblayout16_ops);
> > > + else if (mtd->oobsize == 64)
> > > + mtd_set_ooblayout(mtd, &pl353_ecc_ooblayout64_ops);
> >
> > else?
> You mean to say, add an error condition?
I do.
> >
> > > + }
> > > +}
> > > +
> > > +/**
> > > + * pl353_nand_probe - Probe method for the NAND driver
> > > + * @pdev: Pointer to the platform_device structure
> > > + *
> > > + * This function initializes the driver data structures and the hardware.
> > > + *
> > > + * Return: 0 on success or error value on failure
> > > + */
> > > +static int pl353_nand_probe(struct platform_device *pdev) {
> > > + struct pl353_nand_info *xnand;
> >
> > xnand is a strange name, more and more because its a bout NAND controller data, not NAND
> > chip.
> We added this name to represent Xilinx Nand(xnand),
> >
I see where the x comes from.
Maybe just nfc (for NAND flash controller) or xnfc if you prefer. What
I want is to clearly make the distinction between what is a NAND chip,
what is a NAND controller.
> > > + struct mtd_info *mtd;
> > > + struct nand_chip *nand_chip;
> >
> > This one you can call it just "nand" or "chip".
> Ok, I will update.
>
> >
> > > + struct resource *res;
> > > +
> > > + xnand = devm_kzalloc(&pdev->dev, sizeof(*xnand), GFP_KERNEL);
> > > + if (!xnand)
> > > + return -ENOMEM;
> > > +
> > > + /* Map physical address of NAND flash */
> > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > > + xnand->nand_base = devm_ioremap_resource(&pdev->dev, res);
> > > + if (IS_ERR(xnand->nand_base))
> > > + return PTR_ERR(xnand->nand_base);
> > > +
> > > + nand_chip = &xnand->chip;
> > > + mtd = nand_to_mtd(nand_chip);
> > > + nand_chip->exec_op = pl353_nfc_exec_op;
> > > + nand_set_controller_data(nand_chip, xnand);
> > > + mtd->priv = nand_chip;
> > > + mtd->owner = THIS_MODULE;
> > > + mtd->name = PL353_NAND_DRIVER_NAME;
> >
> > A label property in the DT might overwrite this value.
> Could you please explain a bit more ?
>
I meant something like this:
https://elixir.bootlin.com/linux/latest/source/drivers/mtd/nand/raw/marvell_nand.c#L2515
Thanks,
Miquèl
Powered by blists - more mailing lists