Flash Mapping and gpio

Allon Stern allon.stern at argonst.com
Fri Sep 12 13:14:37 EDT 2008

On Sep 12, 2008, at 12:54 PM, Fundu wrote:

> First off thanks Allon, I really appreciate your input.
>> static map_word __xipram custom_map_read(struct map_info
>> *map,
>> unsigned long ofs)
>> {
>>       CUSTOM_BANKSWITCH(ofs);
>>       return inline_map_read(map, ofs & BANK_MASK); //
>> mask out the bank
>> }
> that makes sense. but one question don't you need to adjust the  
> offset before calling inline_map_read ? or does the macro do that  
> for you ?

That's what the BANK_MASK does. It contains the high address field  
which points to the chip, and the low address bits for the bank, but  
masks off the bits of offset that change. In this case, my chip is at  
0xA0000000, and the banks are 16MB, so my mask is 0xA0FFFFFF.


More information about the linux-mtd mailing list