Question about CFI allocation

Josh Boyer jwboyer at gmail.com
Mon Jan 31 15:23:29 EST 2011


On Mon, Jan 31, 2011 at 12:48 AM, Mitsutaka Amano
<mitsutaka.amano at gmail.com> wrote:
> On Wed, Jan 26, 2011 at 11:43 PM, Josh Boyer <jwboyer at gmail.com> wrote:
>> On Wed, Jan 26, 2011 at 6:09 AM, Mitsutaka Amano
>> <mitsutaka.amano at gmail.com> wrote:
>>> Hi all, I'm a newbie about mtd.
>>>
>>> I'm trying to use the cfi on the mpc85xx board. Part of mtdblock is
>>> used by rootfs. So I have questions.
>>>
>>> Why does CFI(or other flash memory) have to alloc to the vmalloc
>>> area(such as PHYSMAP or PHYSMAP_OF)?
>>
>> The CFI code is not calling vmalloc explicitly.  It's calling ioremap,
>> which happens to come from vmalloc space on most (all?) architectures.
>>  It has to do that because otherwise the CFI driver can't get access
>> to the physical flash because of the MMU.
> I understand that CFI needs ioremap() -> vmalloc space for accessing
> to the physical flash via MMU.
>
> Why allocate amount of flash memory size? my board has 256MB flash
> memory and be allocated 256MB over by of_flash_probe.

It's either do that so you can address the whole flash space, or
implement a sliding window in the mapping driver.  That can be rather
complicated when you consider concurrent access to the flash, and
doing repeated ioremap/iounmap calls so I would guess simplicity is
why.

That is mostly applicable for NOR flash directly accessible.  If there
is a controller in front of the flash that only needs a small area
ioremapped, then it shouldn't use physmap_of.c and should write a
proper driver for it.  The NDFC driver is an example of something like
that.

josh



More information about the linux-mtd mailing list