2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2005-11-07 19:15:31 +08:00
|
|
|
* For boards with physically mapped flash and using
|
2005-04-17 06:20:36 +08:00
|
|
|
* drivers/mtd/maps/physmap.c mapping driver.
|
|
|
|
*
|
|
|
|
* 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__
|
2006-05-14 19:25:19 +08:00
|
|
|
#define __LINUX_MTD_PHYSMAP__
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <linux/mtd/mtd.h>
|
|
|
|
#include <linux/mtd/partitions.h>
|
|
|
|
|
2007-02-09 22:30:29 +08:00
|
|
|
struct map_info;
|
|
|
|
|
[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>
2006-05-08 00:16:36 +08:00
|
|
|
struct physmap_flash_data {
|
|
|
|
unsigned int width;
|
2011-05-18 17:51:48 +08:00
|
|
|
int (*init)(struct platform_device *);
|
|
|
|
void (*exit)(struct platform_device *);
|
[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>
2006-05-08 00:16:36 +08:00
|
|
|
void (*set_vpp)(struct map_info *, int);
|
|
|
|
unsigned int nr_parts;
|
2008-12-17 02:22:39 +08:00
|
|
|
unsigned int pfow_base;
|
2010-01-15 15:50:14 +08:00
|
|
|
char *probe_type;
|
[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>
2006-05-08 00:16:36 +08:00
|
|
|
struct mtd_partition *parts;
|
|
|
|
};
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Board needs to specify the exact mapping during their setup time.
|
|
|
|
*/
|
[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>
2006-05-08 00:16:36 +08:00
|
|
|
void physmap_configure(unsigned long addr, unsigned long size,
|
|
|
|
int bankwidth, void (*set_vpp)(struct map_info *, int) );
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-05-14 19:25:19 +08:00
|
|
|
#ifdef CONFIG_MTD_PARTITIONS
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
2005-11-07 19:15:31 +08:00
|
|
|
* Machines that wish to do flash partition may want to call this function in
|
|
|
|
* their setup routine.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* physmap_set_partitions(mypartitions, num_parts);
|
|
|
|
*
|
2005-11-07 19:15:31 +08:00
|
|
|
* Note that one can always override this hard-coded partition with
|
2005-04-17 06:20:36 +08:00
|
|
|
* 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 /* __LINUX_MTD_PHYSMAP__ */
|