[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <OF147D635A.8968CD6B-ON4825848D.00088AD5-4825848D.000B9D06@mxic.com.tw>
Date: Tue, 8 Oct 2019 10:06:50 +0800
From: masonccyang@...c.com.tw
To: "Miquel Raynal" <miquel.raynal@...tlin.com>
Cc: bbrezillon@...nel.org, computersforpeace@...il.com,
dwmw2@...radead.org, frieder.schrempf@...tron.de,
gregkh@...uxfoundation.org, juliensu@...c.com.tw,
linux-kernel@...r.kernel.org, linux-mtd@...ts.infradead.org,
marcel.ziswiler@...adex.com, marek.vasut@...il.com, richard@....at,
tglx@...utronix.de, vigneshr@...com
Subject: Re: [PATCH RFC 3/3] mtd: rawnand: Add support Macronix power down mode
Hi Miquel,
> > +int nand_power_down_op(struct nand_chip *chip)
> > +{
> > + int ret;
> > +
> > + if (nand_has_exec_op(chip)) {
> > + struct nand_op_instr instrs[] = {
> > + NAND_OP_CMD(NAND_CMD_POWER_DOWN, 0),
> > + };
> > +
> > + struct nand_operation op = NAND_OPERATION(chip->cur_cs,
instrs);
> > +
> > + ret = nand_exec_op(chip, &op);
> > + if (ret)
> > + return ret;
> > +
> > + } else {
> > + chip->legacy.cmdfunc(chip, NAND_CMD_POWER_DOWN, -1, -1);
> > + }
> > +
> > + return 0;
> > +}
> > +
> > +static int mxic_nand_suspend(struct mtd_info *mtd)
> > +{
> > + struct nand_chip *chip = mtd_to_nand(mtd);
> > +
> > + mutex_lock(&chip->lock);
> > +
> > + nand_select_target(chip, 0);
> > + nand_power_down_op(chip);
> > + nand_deselect_target(chip);
> > +
> > + chip->suspend = 1;
> > + mutex_unlock(&chip->lock);
> > +
> > + return 0;
> > +}
> > +
> > +static void mxic_nand_resume(struct mtd_info *mtd)
> > +{
> > + struct nand_chip *chip = mtd_to_nand(mtd);
> > +
> > + mutex_lock(&chip->lock);
> > + // toggle #CS pin to resume NAND device
>
> C++ style comments are forbidden in code.
okay, got it. thanks.
>
> > + nand_select_target(chip, 0);
>
> On several NAND controllers there is no way to act on the CS line
> without actually writing bytes to the NAND chip. So basically this
> is very likely to not work.
any other way to make it work ? GPIO ?
or just have some comments description here.
i.e,.
/* The NAND chip will exit the deep power down mode with #CS toggling,
* please refer to datasheet for the timing requirement of tCRDP and tRDP.
*/
>
> > + ndelay(20);
>
> Is this delay known somewhere? Is this purely experimental?
it's timing requirement tCRDP 20 ns(min) to release device
from deep power-down mode.
You may download datasheet at
https://www.macronix.com/zh-tw/products/NAND-Flash/SLC-NAND-Flash/Pages/spec.aspx?p=MX30LF4G28AD&m=SLC%20NAND&n=PM2579
>
> > + nand_deselect_target(chip);
> > +
> > + if (chip->suspend)
> > + chip->suspended = 0;
> > + else
> > + pr_err("%s call for a chip which is not in suspended state\n",
> > + __func__);
> > + mutex_unlock(&chip->lock);
> > +}
thanks & best regards,
Mason
CONFIDENTIALITY NOTE:
This e-mail and any attachments may contain confidential information
and/or personal data, which is protected by applicable laws. Please be
reminded that duplication, disclosure, distribution, or use of this e-mail
(and/or its attachments) or any part thereof is prohibited. If you receive
this e-mail in error, please notify us immediately and delete this mail as
well as its attachment(s) from your system. In addition, please be
informed that collection, processing, and/or use of personal data is
prohibited unless expressly permitted by personal data protection laws.
Thank you for your attention and cooperation.
Macronix International Co., Ltd.
=====================================================================
============================================================================
CONFIDENTIALITY NOTE:
This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation.
Macronix International Co., Ltd.
=====================================================================
Powered by blists - more mailing lists