[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.20.1601161521520.26667@eddie.linux-mips.org>
Date: Sat, 16 Jan 2016 19:36:45 +0000 (GMT)
From: "Maciej W. Rozycki" <macro@...ux-mips.org>
To: Rafał Miłecki <zajec5@...il.com>
cc: Brian Norris <computersforpeace@...il.com>,
Ralf Baechle <ralf@...ux-mips.org>,
Javier Martinez Canillas <javier@....samsung.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Fengguang Wu <fengguang.wu@...el.com>,
Michael Ellerman <mpe@...erman.id.au>,
Luis de Bethencourt <luisbg@....samsung.com>,
Jeremy Kerr <jk@...abs.org>,
Neelesh Gupta <neelegup@...ux.vnet.ibm.com>,
"linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
David Woodhouse <dwmw2@...radead.org>,
Cyril Bur <cyrilbur@...il.com>
Subject: Re: [PATCH] mtd: bcm47xxsflash: use devm_ioremap_nocache() instead
of KSEG0ADDR()
On Sat, 16 Jan 2016, Rafał Miłecki wrote:
> > This code is in a function called `bcm47xxsflash_read' and reads from an
> > MMIO region, presumably flash memory which behaves like ordinary memory on
> > reads (i.e. no side effects). Therefore using a cached mapping will in
> > most cases result in much better performance as the CPU will load
> > (prefetch) data in cacheline-sized quantities rather than hitting the
> > external bus every time with a word-sized quantity transferred only.
>
> So I wanted to stick to the cached mapping, but it appears it's not
> possible with devm_*. We have two options:
> 1) devm_ioremap_nocache - it obviously won't be cached mapping
> 2) devm_ioremap_resource - it uses devm_ioremap which uses ioremap
> which is nocache on MIPS
>
> Should I introduce a new
> devm_ioremap_resource_cache
> with some
> devm_ioremap_cache
> helper? And then use it in bcm47xxsflash?
This sounds like a plan to me, except that with `devm_ioremap_wc' also in
the view and all the three `devm_ioremap*' functions being identical --
except from the use of a different `ioremap_*' call -- it looks to me it
really asks for a `mode' argument and all the code to be unified.
Compatibility macros (or, perhaps better, static inline functions) could
be provided to preserve the internal API for the existing code.
I.e. there would be a new `devm_ioremap_resource_mode' entry point which
calls `devm_ioremap_mode', which then selects, perhaps with `switch' on
`mode', from the available `ioremap*' calls.
Maciej
Powered by blists - more mailing lists