[RFC] Make physmap into a platform device driver...

Jared Hulbert jaredeh at gmail.com
Wed Jan 11 12:36:44 EST 2006


> My patch is below - it probably ought to have the re-addition of write
> protection methods which I had stripped out since I've got partially
> written support for paging in chips and thought the two might end up
> related.

One thing I would like to see is the addition of something like:

<code>
       info->map.cached = ioremap_cached(res->start, info->map.size);
       dev_dbg(dev, "cached %p, %lu bytes\n", info->map.cached, info->map.size);

       if (info->map.cached == NULL) {
               dev_err(dev, "failed to ioremap_cached() region\n");
               err = -EIO;
               goto exit_free;
       }
</code>

The problem is how do we populate info->map.inval_cache?

drivers/mtd/maps/mainstone-flash.c does it as follows.

<code>
static void mainstone_map_inval_cache(struct map_info *map, unsigned long from,
                                       ssize_t len)
{
         consistent_sync((char *)map->cached + from, len, DMA_FROM_DEVICE);
}

 static struct map_info mainstone_maps[2] = { {
         .size =         WINDOW_SIZE,
         .phys =         PXA_CS0_PHYS,
         .inval_cache =  mainstone_map_inval_cache,
 }, {
         .size =         WINDOW_SIZE,
         .phys =         PXA_CS1_PHYS,
         .inval_cache =  mainstone_map_inval_cache,
} };
</code>

Is the consistent_sync() and ioremap_cached() generic enough to
include in a platflash.c?




More information about the linux-mtd mailing list