linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <bbrezillon@kernel.org>
To: Marc Gonzalez <marc.w.gonzalez@free.fr>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Will Deacon <will.deacon@arm.com>,
	Boris Brezillon <boris.brezillon@bootlin.com>,
	Maxim Levitsky <maximlevitsky@gmail.com>,
	Tudor Ambarus <tudor.ambarus@microchip.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Richard Weinberger <richard@nod.at>,
	Janusz Krzysztofik <jmkrzyszt@gmail.com>,
	Stefan Agner <stefan@agner.ch>,
	Marek Vasut <marek.vasut@gmail.com>,
	Harvey Hunt <harveyhuntnexus@gmail.com>,
	linux-mtd@lists.infradead.org,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Han Xu <han.xu@nxp.com>, Xiaolei Li <xiaolei.li@mediatek.com>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH v3 15/22] mtd: rawnand: fsmc: Stop implementing ->select_chip()
Date: Thu, 10 Jan 2019 09:32:27 +0100	[thread overview]
Message-ID: <20190110093227.674832ce@bbrezillon> (raw)
In-Reply-To: <c642fe39-8109-f4fd-9cb8-88cc7262472d@free.fr>

On Wed, 9 Jan 2019 23:20:40 +0100
Marc Gonzalez <marc.w.gonzalez@free.fr> wrote:

> On 09/01/2019 20:44, Boris Brezillon wrote:
> 
> > Might be caused by a missing barrier: when de-asserting the CE line, we
> > must make sure all accesses to the ->data_va range have been done.
> > Can you try with the following diff applied?
> >   
> > --->8---  
> > diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c
> > index 325b4414dccc..264d809c2d37 100644
> > --- a/drivers/mtd/nand/raw/fsmc_nand.c
> > +++ b/drivers/mtd/nand/raw/fsmc_nand.c
> > @@ -598,16 +598,21 @@ static void fsmc_ce_ctrl(struct fsmc_nand_data *host, bool assert)
> >  {
> >         u32 pc = readl(host->regs_va + FSMC_PC);
> >  
> > -       if (!assert)
> > +       if (!assert) {
> > +               /*
> > +                * Make sure all previous read/write have been done before
> > +                * de-asserting the CE line.
> > +                */
> > +               mb();
> >                 writel_relaxed(pc & ~FSMC_ENABLE, host->regs_va + FSMC_PC);
> > -       else
> > +       } else {
> >                 writel_relaxed(pc | FSMC_ENABLE, host->regs_va + FSMC_PC);
> > -
> > -       /*
> > -        * nCE line changes must be applied before returning from this
> > -        * function.
> > -        */
> > -       mb();
> > +               /*
> > +                * nCE assertion must be applied before returning from this
> > +                * function.
> > +                */
> > +               mb();
> > +       }  
> 
> + Will Deacon, an expert on arm mmio shenanigans.
> e.g. https://elinux.org/images/a/a8/Uh-oh-Its-IO-Ordering-Will-Deacon-Arm.pdf
> 
> As far as I understand (which isn't very far), a memory barrier (however
> strong) cannot guarantee that all (posted) writes have reached a device
> (unless the underlying bus explicitly provides such guarantees?)
> 
> At best, a memory barrier guarantees that the mmio writes have "left" the CPU
> and its "coherency fabric" (shared LLC). Thus subsequent accesses are
> guaranteed to appear "later" on the bus. (Much hand-waving sorry)

Yes, that's what I was trying to enforce.

  reply	other threads:[~2019-01-10  8:32 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-11  7:55 [PATCH v3 00/22] mtd: rawnand: 3rd batch of cleanup Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 01/22] mtd: rawnand: Stop passing mtd_info objects to internal functions Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 02/22] mtd: rawnand: Reorganize code to avoid forward declarations Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 03/22] mtd: rawnand: legacy: Drop useless test in nand_legacy_set_defaults() Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 04/22] mtd: rawnand: Move nand_exec_op() to internal.h Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 05/22] mtd: rawnand: Remove unused NAND_CONTROLLER_ALLOC flag Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 06/22] mtd: rawnand: ams-delta: Allow this driver to be compiled when COMPILE_TEST=y Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 07/22] mtd: rawnand: ams-delta: Add an SPDX tag to replace the license text Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 08/22] mtd: rawnand: ams-delta: Fix various coding style issues Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 09/22] mtd: rawnand: ams-delta: cleanup ams_delta_init() error path Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 10/22] mtd: rawnand: ams-delta: Check mtd_device_register() return code Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 11/22] mtd: rawnand: ams-delta: Explicitly inherit from nand_controller Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 12/22] mtd: rawnand: Add nand_[de]select_target() helpers Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 13/22] mtd: rawnand: Pass the CS line to be selected in struct nand_operation Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 14/22] mtd: rawnand: Make ->select_chip() optional when ->exec_op() is implemented Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 15/22] mtd: rawnand: fsmc: Stop implementing ->select_chip() Boris Brezillon
2019-01-09 18:18   ` Linus Walleij
2019-01-09 19:44     ` Boris Brezillon
2019-01-09 20:41       ` Linus Walleij
2019-01-09 20:54         ` Boris Brezillon
2019-01-09 21:30           ` Linus Walleij
2019-01-09 21:52             ` Boris Brezillon
2019-01-09 22:00               ` Linus Walleij
2019-01-09 22:20       ` Marc Gonzalez
2019-01-10  8:32         ` Boris Brezillon [this message]
2018-11-11  7:55 ` [PATCH v3 16/22] mtd: rawnand: marvell: " Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 17/22] mtd: rawnand: tegra: " Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 18/22] mtd: rawnand: vf610: " Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 19/22] mtd: rawnand: ams-delta: " Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 20/22] mtd: rawnand: Deprecate the ->select_chip() hook Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 21/22] mtd: rawnand: Move the ->exec_op() method to nand_controller_ops Boris Brezillon
2018-11-11  7:55 ` [PATCH v3 22/22] mtd: rawnand: Move ->setup_data_interface() " Boris Brezillon
2018-11-18 20:47 ` [PATCH v3 00/22] mtd: rawnand: 3rd batch of cleanup Miquel Raynal

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=20190110093227.674832ce@bbrezillon \
    --to=bbrezillon@kernel.org \
    --cc=boris.brezillon@bootlin.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=han.xu@nxp.com \
    --cc=harveyhuntnexus@gmail.com \
    --cc=jmkrzyszt@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marc.w.gonzalez@free.fr \
    --cc=marek.vasut@gmail.com \
    --cc=maximlevitsky@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=stefan@agner.ch \
    --cc=tudor.ambarus@microchip.com \
    --cc=will.deacon@arm.com \
    --cc=xiaolei.li@mediatek.com \
    --cc=yamada.masahiro@socionext.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).