diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2006-05-07 12:16:36 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-07 12:16:36 -0400 |
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 c7b8bcdef013..50f954461aa8 100644 --- a/include/linux/mtd/physmap.h +++ b/include/linux/mtd/physmap.h | |||
@@ -24,22 +24,18 @@ | |||
24 | #include <linux/mtd/map.h> | 24 | #include <linux/mtd/map.h> |
25 | #include <linux/mtd/partitions.h> | 25 | #include <linux/mtd/partitions.h> |
26 | 26 | ||
27 | /* | 27 | struct physmap_flash_data { |
28 | * The map_info for physmap. Board can override size, buswidth, phys, | 28 | unsigned int width; |
29 | * (*set_vpp)(), etc in their initial setup routine. | 29 | void (*set_vpp)(struct map_info *, int); |
30 | */ | 30 | unsigned int nr_parts; |
31 | extern struct map_info physmap_map; | 31 | struct mtd_partition *parts; |
32 | }; | ||
32 | 33 | ||
33 | /* | 34 | /* |
34 | * Board needs to specify the exact mapping during their setup time. | 35 | * Board needs to specify the exact mapping during their setup time. |
35 | */ | 36 | */ |
36 | static inline void physmap_configure(unsigned long addr, unsigned long size, int bankwidth, void (*set_vpp)(struct map_info *, int) ) | 37 | void physmap_configure(unsigned long addr, unsigned long size, |
37 | { | 38 | int bankwidth, void (*set_vpp)(struct map_info *, int) ); |
38 | physmap_map.phys = addr; | ||
39 | physmap_map.size = size; | ||
40 | physmap_map.bankwidth = bankwidth; | ||
41 | physmap_map.set_vpp = set_vpp; | ||
42 | } | ||
43 | 39 | ||
44 | #if defined(CONFIG_MTD_PARTITIONS) | 40 | #if defined(CONFIG_MTD_PARTITIONS) |
45 | 41 | ||
@@ -58,4 +54,3 @@ void physmap_set_partitions(struct mtd_partition *parts, int num_parts); | |||
58 | #endif /* defined(CONFIG_MTD) */ | 54 | #endif /* defined(CONFIG_MTD) */ |
59 | 55 | ||
60 | #endif /* __LINUX_MTD_PHYSMAP__ */ | 56 | #endif /* __LINUX_MTD_PHYSMAP__ */ |
61 | |||