After dwmw2 let me know it ought to be done, I rewrote the physmap map driver to be a platform driver. I know zilch about the driver model, so I probably botched it in some way, but I've done some tests on an ixp23xx board which uses physmap, and it all seems to work. In order to not break existing physmap users, I've added some compat code that will instantiate a platform device iff CONFIG_MTD_PHYSMAP_LEN is defined and != 0. Also, I've changed the default value for CONFIG_MTD_PHYSMAP_LEN to zero, so that people who inadvertently compile in physmap (or new, platform-style, users of physmap) don't get burned. This works pretty well -- the new physmap driver is a drop-in replacement for the old one, and works on said ixp23xx board without any code changes needed. (This should hold as long as users don't touch 'physmap_map' directly.) Once all physmap users have been converted to instantiate their own platform devices, the compat code can go. (Or we decide that we can change all the in-tree users at the same time, and never merge the compat code.) Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
57 lines
1.6 KiB
C
57 lines
1.6 KiB
C
/*
|
|
* For boards with physically mapped flash and using
|
|
* drivers/mtd/maps/physmap.c mapping driver.
|
|
*
|
|
* $Id: physmap.h,v 1.4 2005/11/07 11:14:55 gleixner Exp $
|
|
*
|
|
* Copyright (C) 2003 MontaVista Software Inc.
|
|
* Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
* option) any later version.
|
|
*
|
|
*/
|
|
|
|
#ifndef __LINUX_MTD_PHYSMAP__
|
|
|
|
#include <linux/config.h>
|
|
|
|
#if defined(CONFIG_MTD_PHYSMAP)
|
|
|
|
#include <linux/mtd/mtd.h>
|
|
#include <linux/mtd/map.h>
|
|
#include <linux/mtd/partitions.h>
|
|
|
|
struct physmap_flash_data {
|
|
unsigned int width;
|
|
void (*set_vpp)(struct map_info *, int);
|
|
unsigned int nr_parts;
|
|
struct mtd_partition *parts;
|
|
};
|
|
|
|
/*
|
|
* Board needs to specify the exact mapping during their setup time.
|
|
*/
|
|
void physmap_configure(unsigned long addr, unsigned long size,
|
|
int bankwidth, void (*set_vpp)(struct map_info *, int) );
|
|
|
|
#if defined(CONFIG_MTD_PARTITIONS)
|
|
|
|
/*
|
|
* Machines that wish to do flash partition may want to call this function in
|
|
* their setup routine.
|
|
*
|
|
* physmap_set_partitions(mypartitions, num_parts);
|
|
*
|
|
* Note that one can always override this hard-coded partition with
|
|
* command line partition (you need to enable CONFIG_MTD_CMDLINE_PARTS).
|
|
*/
|
|
void physmap_set_partitions(struct mtd_partition *parts, int num_parts);
|
|
|
|
#endif /* defined(CONFIG_MTD_PARTITIONS) */
|
|
#endif /* defined(CONFIG_MTD) */
|
|
|
|
#endif /* __LINUX_MTD_PHYSMAP__ */
|