Re: [PATCH v3 2/4] mtd: rawnand: Add Macronix MX25F0A NAND controller

Miquel Raynal
2019-05-20T12:23:58Z

Hi Mason,

masonccyang@mxic.com.tw wrote on Fri, 17 May 2019 17:30:21 +0800:

> Hi Miquel,
>
> > > +
> > > +static void mxic_nand_select_chip(struct nand_chip *chip, int chipnr)
> >
> > _select_target() is preferred now
>
> Do you mean I implement mxic_nand_select_target() to control #CS ?
>
> If so, I need to call mxic_nand_select_target( ) to control #CS ON
> and then #CS OFF in _exec_op() due to nand_select_target()<in nand_base,c>
> is still calling chip->legacy.select_chip ?

You must forget about the ->select_chip() callback. Now it should be
handled directly from the controller driver. Please have a look at the
commit pointed against the marvell_nand.c driver.

[...]

> > > + if (!mxic)
> > > + return -ENOMEM;
> > > +
> > > + nand_chip = &mxic->nand;
> > > + mtd = nand_to_mtd(nand_chip);
> > > + mtd->dev.parent = pdev->dev.parent;
> > > + nand_chip->ecc.priv = NULL;
> > > + nand_set_flash_node(nand_chip, pdev->dev.parent->of_node);
> > > + nand_chip->priv = mxic;
> > > +
> > > + mxic->mfd = mfd;
> > > +
> > > + nand_chip->legacy.select_chip = mxic_nand_select_chip;
> >
> > Please don't implement legacy interfaces. You can check in
> > marvell_nand.c how this is handled now:
> >
> > b25251414f6e mtd: rawnand: marvell: Stop implementing ->select_chip()
> >
>
> Does it mean chip->legacy.select_chip() will phase-out ?

Yes it will.

Thanks,
Miquèl