diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2006-05-07 17:16:36 +0100 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-07 17:16:36 +0100 |
commit | 73566edf9b91dd085ddb12033d0ea7288979dd10 (patch) | |
tree | ec3810665792713ae97b6bb566f530f77e367586 /include/linux/mtd | |
parent | 422138dd68202fbd8ca9fb0df65e92d733249374 (diff) |
[MTD] Convert physmap to platform driver
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>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r-- | include/linux/mtd/physmap.h | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h index c7b8bcdef01..50f954461aa 100644 --- a/include/linux/mtd/physmap.h +++ b/include/linux/mtd/physmap.h @@ -24,22 +24,18 @@ #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> -/* - * The map_info for physmap. Board can override size, buswidth, phys, - * (*set_vpp)(), etc in their initial setup routine. - */ -extern struct map_info physmap_map; +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. */ -static inline void physmap_configure(unsigned long addr, unsigned long size, int bankwidth, void (*set_vpp)(struct map_info *, int) ) -{ - physmap_map.phys = addr; - physmap_map.size = size; - physmap_map.bankwidth = bankwidth; - physmap_map.set_vpp = set_vpp; -} +void physmap_configure(unsigned long addr, unsigned long size, + int bankwidth, void (*set_vpp)(struct map_info *, int) ); #if defined(CONFIG_MTD_PARTITIONS) @@ -58,4 +54,3 @@ void physmap_set_partitions(struct mtd_partition *parts, int num_parts); #endif /* defined(CONFIG_MTD) */ #endif /* __LINUX_MTD_PHYSMAP__ */ - |