LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Naga Sureshkumar Relli <nagasure@xilinx.com>
Cc: "boris.brezillon@bootlin.com" <boris.brezillon@bootlin.com>,
	"richard@nod.at" <richard@nod.at>,
	"wmw2@infradead.org" <wmw2@infradead.org>,
	"computersforpeace@gmail.com" <computersforpeace@gmail.com>,
	"marek.vasut@gmail.com" <marek.vasut@gmail.com>,
	"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
	"mmayer@broadcom.com" <mmayer@broadcom.com>,
	"rogerq@ti.com" <rogerq@ti.com>,
	"ladis@linux-mips.org" <ladis@linux-mips.org>,
	"ada@thorsis.com" <ada@thorsis.com>,
	"honghui.zhang@mediatek.com" <honghui.zhang@mediatek.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"nagasureshkumarrelli@gmail.com" <nagasureshkumarrelli@gmail.com>
Subject: Re: [LINUX PATCH v9 4/4] mtd: rawnand: pl353: Add basic driver for arm pl353 smc nand interface
Date: Fri, 8 Jun 2018 14:35:49 +0200	[thread overview]
Message-ID: <20180608143549.04400f92@xps13> (raw)
In-Reply-To: <MWHPR02MB26238A3344D0F611D8D6B0DAAF7B0@MWHPR02MB2623.namprd02.prod.outlook.com>

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

  reply	other threads:[~2018-06-08 12:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06  7:49 [LINUX PATCH v9 0/4] Add arm pl353 smc memory and nand driver for xilinx zynq soc Naga Sureshkumar Relli
2018-06-06  7:49 ` [LINUX PATCH v9 1/4] Devicetree: Add pl353 smc controller devicetree binding information Naga Sureshkumar Relli
2018-06-07 15:42   ` Miquel Raynal
2018-06-07 15:47     ` Miquel Raynal
2018-06-08  5:20     ` Naga Sureshkumar Relli
2018-06-08  5:51       ` Boris Brezillon
2018-06-08  8:01         ` Naga Sureshkumar Relli
2018-06-08  7:23       ` Miquel Raynal
2018-06-06  7:49 ` [LINUX PATCH v9 2/4] memory: pl353: Add driver for arm pl353 static memory controller Naga Sureshkumar Relli
2018-06-07 16:07   ` Miquel Raynal
2018-06-19 10:54     ` Naga Sureshkumar Relli
2018-06-06  7:49 ` [LINUX PATCH v9 3/4] Documentation: nand: pl353: Add documentation for controller and driver Naga Sureshkumar Relli
2018-06-06  7:49 ` [LINUX PATCH v9 4/4] mtd: rawnand: pl353: Add basic driver for arm pl353 smc nand interface Naga Sureshkumar Relli
2018-06-07 19:59   ` Miquel Raynal
2018-06-08 12:23     ` Naga Sureshkumar Relli
2018-06-08 12:35       ` Miquel Raynal [this message]
2018-06-08 13:08         ` Naga Sureshkumar Relli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180608143549.04400f92@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=ada@thorsis.com \
    --cc=boris.brezillon@bootlin.com \
    --cc=computersforpeace@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=honghui.zhang@mediatek.com \
    --cc=ladis@linux-mips.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=mmayer@broadcom.com \
    --cc=nagasure@xilinx.com \
    --cc=nagasureshkumarrelli@gmail.com \
    --cc=richard@nod.at \
    --cc=rogerq@ti.com \
    --cc=wmw2@infradead.org \
    --subject='Re: [LINUX PATCH v9 4/4] mtd: rawnand: pl353: Add basic driver for arm pl353 smc nand interface' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).