[PATCH] mtd: bcm47xxsflash: use devm_ioremap_nocache() instead of KSEG0ADDR()

Maciej W. Rozycki macro at linux-mips.org
Sat Jan 16 11:36:45 PST 2016


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



More information about the linux-mtd mailing list