lkml.org 
[lkml]   [2018]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [LINUX PATCH v9 4/4] mtd: rawnand: pl353: Add basic driver for arm pl353 smc nand interface
Date
Hi Miquel,

> -----Original Message-----
> From: Miquel Raynal [mailto:miquel.raynal@bootlin.com]
> Sent: Friday, June 8, 2018 6:06 PM
> To: Naga Sureshkumar Relli <nagasure@xilinx.com>
> Cc: boris.brezillon@bootlin.com; richard@nod.at; wmw2@infradead.org;
> computersforpeace@gmail.com; marek.vasut@gmail.com; f.fainelli@gmail.com;
> mmayer@broadcom.com; rogerq@ti.com; ladis@linux-mips.org; ada@thorsis.com;
> honghui.zhang@mediatek.com; linux-mtd@lists.infradead.org; linux-kernel@vger.kernel.org;
> nagasureshkumarrelli@gmail.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.
Ok, I will add it in next version.
>
> > >
> > > > + }
> > > > +}
> > > > +
> > > > +/**
> > > > + * 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.
Ok, got it. I will update like xnfc.
>
> > > > + 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#L251
> 5
Understood. Thanks.
I will update in next version.

Thanks,
Naga Sureshkumar Relli.
>
> Thanks,
> Miquèl
\
 
 \ /
  Last update: 2018-06-08 15:09    [W:0.055 / U:0.776 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site