Reduce the size of a probed flash for broken HW

Nicolas Pitre nico at cam.org
Mon Apr 24 11:07:38 EDT 2006


On Mon, 24 Apr 2006, Franck Bui-Huu wrote:

> [discussed with Vitaly Wool on IRC]
> 
> My hardware has some problem to access my onboard flashes specially
> the last 64Ko of them. So I need a way to restrict access to these areas.
> 
> Several solutions comes in mind:
> 
>   - In the mapping driver, try to modify the mtd_info and cfi_info
>     setup by the MTD probing functions to reduce the detected
>     size. This solution is really hackish since it modifies internal
>     structures of the MTD layer that the mapping driver is not
>     supposed to be aware of. I just did this in my driver:
> 
> 	*mtd = do_map_probe("xxx_probe", map);
> 	while ((*mtd)->size > 32Mo - 64Ko)
> 		(*mtd)->size -= (*mtd)->erasesize;
> 
>     and it seems to work fine...

I think that is indeed the easiest solution.  Just keep it to your map 
driver and clearly label it with a big comment explaining why you do so.

I don't think you need to modify the cfi_info at all.


Nicolas




More information about the linux-mtd mailing list