diff options
author | Tony Luck <tony.luck@intel.com> | 2005-10-31 10:51:57 -0800 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2005-10-31 10:51:57 -0800 |
commit | c7fb577e2a6cb04732541f2dc402bd46747f7558 (patch) | |
tree | df3b1a1922ed13bfbcc45d08650c38beeb1a7bd1 /drivers/mtd/maps | |
parent | 9cec58dc138d6fcad9f447a19c8ff69f6540e667 (diff) | |
parent | 581c1b14394aee60aff46ea67d05483261ed6527 (diff) | |
download | op-kernel-dev-c7fb577e2a6cb04732541f2dc402bd46747f7558.zip op-kernel-dev-c7fb577e2a6cb04732541f2dc402bd46747f7558.tar.gz |
manual update from upstream:
Applied Al's change 06a544971fad0992fe8b92c5647538d573089dd4
to new location of swiotlb.c
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r-- | drivers/mtd/maps/bast-flash.c | 3 | ||||
-rw-r--r-- | drivers/mtd/maps/ceiva.c | 1 | ||||
-rw-r--r-- | drivers/mtd/maps/dc21285.c | 1 | ||||
-rw-r--r-- | drivers/mtd/maps/dilnetpc.c | 5 | ||||
-rw-r--r-- | drivers/mtd/maps/epxa10db-flash.c | 5 | ||||
-rw-r--r-- | drivers/mtd/maps/fortunet.c | 5 | ||||
-rw-r--r-- | drivers/mtd/maps/integrator-flash.c | 2 | ||||
-rw-r--r-- | drivers/mtd/maps/ixp2000.c | 7 | ||||
-rw-r--r-- | drivers/mtd/maps/ixp4xx.c | 8 | ||||
-rw-r--r-- | drivers/mtd/maps/lubbock-flash.c | 3 | ||||
-rw-r--r-- | drivers/mtd/maps/mainstone-flash.c | 3 | ||||
-rw-r--r-- | drivers/mtd/maps/omap-toto-flash.c | 2 | ||||
-rw-r--r-- | drivers/mtd/maps/omap_nor.c | 4 | ||||
-rw-r--r-- | drivers/mtd/maps/pci.c | 1 | ||||
-rw-r--r-- | drivers/mtd/maps/plat-ram.c | 2 | ||||
-rw-r--r-- | drivers/mtd/maps/sa1100-flash.c | 77 | ||||
-rw-r--r-- | drivers/mtd/maps/tqm8xxl.c | 4 |
17 files changed, 97 insertions, 36 deletions
diff --git a/drivers/mtd/maps/bast-flash.c b/drivers/mtd/maps/bast-flash.c index 0ba0ff7..bfe994e 100644 --- a/drivers/mtd/maps/bast-flash.c +++ b/drivers/mtd/maps/bast-flash.c @@ -33,7 +33,8 @@ #include <linux/string.h> #include <linux/ioport.h> #include <linux/device.h> - +#include <linux/slab.h> +#include <linux/platform_device.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> diff --git a/drivers/mtd/maps/ceiva.c b/drivers/mtd/maps/ceiva.c index da8584a..c68b31d 100644 --- a/drivers/mtd/maps/ceiva.c +++ b/drivers/mtd/maps/ceiva.c @@ -20,6 +20,7 @@ #include <linux/ioport.h> #include <linux/kernel.h> #include <linux/init.h> +#include <linux/slab.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> diff --git a/drivers/mtd/maps/dc21285.c b/drivers/mtd/maps/dc21285.c index 938c41f..e5b7416 100644 --- a/drivers/mtd/maps/dc21285.c +++ b/drivers/mtd/maps/dc21285.c @@ -13,6 +13,7 @@ #include <linux/kernel.h> #include <linux/init.h> #include <linux/delay.h> +#include <linux/slab.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> diff --git a/drivers/mtd/maps/dilnetpc.c b/drivers/mtd/maps/dilnetpc.c index 0bc79c9..f995196 100644 --- a/drivers/mtd/maps/dilnetpc.c +++ b/drivers/mtd/maps/dilnetpc.c @@ -30,12 +30,15 @@ #include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> -#include <asm/io.h> +#include <linux/string.h> + #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> #include <linux/mtd/concat.h> +#include <asm/io.h> + /* ** The DIL/NetPC keeps its BIOS in two distinct flash blocks. ** Destroying any of these blocks transforms the DNPC into diff --git a/drivers/mtd/maps/epxa10db-flash.c b/drivers/mtd/maps/epxa10db-flash.c index ab6dbe2..1df6188 100644 --- a/drivers/mtd/maps/epxa10db-flash.c +++ b/drivers/mtd/maps/epxa10db-flash.c @@ -27,12 +27,15 @@ #include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> -#include <asm/io.h> +#include <linux/slab.h> + #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> +#include <asm/io.h> #include <asm/hardware.h> + #ifdef CONFIG_EPXA10DB #define BOARD_NAME "EPXA10DB" #else diff --git a/drivers/mtd/maps/fortunet.c b/drivers/mtd/maps/fortunet.c index 068bb6a..00f7bbe 100644 --- a/drivers/mtd/maps/fortunet.c +++ b/drivers/mtd/maps/fortunet.c @@ -7,11 +7,14 @@ #include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> -#include <asm/io.h> +#include <linux/string.h> + #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> +#include <asm/io.h> + #define MAX_NUM_REGIONS 4 #define MAX_NUM_PARTITIONS 8 diff --git a/drivers/mtd/maps/integrator-flash.c b/drivers/mtd/maps/integrator-flash.c index e39a98a..d14a018 100644 --- a/drivers/mtd/maps/integrator-flash.c +++ b/drivers/mtd/maps/integrator-flash.c @@ -32,7 +32,7 @@ #include <linux/kernel.h> #include <linux/slab.h> #include <linux/ioport.h> -#include <linux/device.h> +#include <linux/platform_device.h> #include <linux/init.h> #include <linux/mtd/mtd.h> diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c index a9f86c7..00b9f67 100644 --- a/drivers/mtd/maps/ixp2000.c +++ b/drivers/mtd/maps/ixp2000.c @@ -22,11 +22,14 @@ #include <linux/init.h> #include <linux/kernel.h> #include <linux/string.h> +#include <linux/slab.h> +#include <linux/ioport.h> +#include <linux/device.h> +#include <linux/platform_device.h> + #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> -#include <linux/ioport.h> -#include <linux/device.h> #include <asm/io.h> #include <asm/hardware.h> diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index 3fcc328..733a929 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c @@ -20,11 +20,15 @@ #include <linux/init.h> #include <linux/kernel.h> #include <linux/string.h> +#include <linux/slab.h> +#include <linux/ioport.h> +#include <linux/device.h> +#include <linux/platform_device.h> + #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> -#include <linux/ioport.h> -#include <linux/device.h> + #include <asm/io.h> #include <asm/mach/flash.h> diff --git a/drivers/mtd/maps/lubbock-flash.c b/drivers/mtd/maps/lubbock-flash.c index 1298de4..2337e0c 100644 --- a/drivers/mtd/maps/lubbock-flash.c +++ b/drivers/mtd/maps/lubbock-flash.c @@ -15,10 +15,13 @@ #include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> +#include <linux/slab.h> + #include <linux/dma-mapping.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> + #include <asm/io.h> #include <asm/hardware.h> #include <asm/arch/pxa-regs.h> diff --git a/drivers/mtd/maps/mainstone-flash.c b/drivers/mtd/maps/mainstone-flash.c index 87e93fa..da0f8a6 100644 --- a/drivers/mtd/maps/mainstone-flash.c +++ b/drivers/mtd/maps/mainstone-flash.c @@ -16,9 +16,12 @@ #include <linux/kernel.h> #include <linux/init.h> #include <linux/dma-mapping.h> +#include <linux/slab.h> + #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> + #include <asm/io.h> #include <asm/hardware.h> #include <asm/arch/pxa-regs.h> diff --git a/drivers/mtd/maps/omap-toto-flash.c b/drivers/mtd/maps/omap-toto-flash.c index 4961090..da36e8d 100644 --- a/drivers/mtd/maps/omap-toto-flash.c +++ b/drivers/mtd/maps/omap-toto-flash.c @@ -12,9 +12,9 @@ #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> - #include <linux/errno.h> #include <linux/init.h> +#include <linux/slab.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c index b17bca6..7f370bb 100644 --- a/drivers/mtd/maps/omap_nor.c +++ b/drivers/mtd/maps/omap_nor.c @@ -30,12 +30,14 @@ * 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/device.h> +#include <linux/platform_device.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/ioport.h> +#include <linux/slab.h> + #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> diff --git a/drivers/mtd/maps/pci.c b/drivers/mtd/maps/pci.c index 18dbd3a..d9c64e9 100644 --- a/drivers/mtd/maps/pci.c +++ b/drivers/mtd/maps/pci.c @@ -17,6 +17,7 @@ #include <linux/kernel.h> #include <linux/pci.h> #include <linux/init.h> +#include <linux/slab.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c index 118b045..104576b 100644 --- a/drivers/mtd/maps/plat-ram.c +++ b/drivers/mtd/maps/plat-ram.c @@ -30,6 +30,8 @@ #include <linux/string.h> #include <linux/ioport.h> #include <linux/device.h> +#include <linux/slab.h> +#include <linux/platform_device.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index 8dcaa35..c8d0da1 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c @@ -13,7 +13,7 @@ #include <linux/init.h> #include <linux/errno.h> #include <linux/slab.h> -#include <linux/device.h> +#include <linux/platform_device.h> #include <linux/err.h> #include <linux/mtd/mtd.h> @@ -21,6 +21,7 @@ #include <linux/mtd/partitions.h> #include <linux/mtd/concat.h> +#include <asm/hardware.h> #include <asm/io.h> #include <asm/sizes.h> #include <asm/mach/flash.h> @@ -129,20 +130,21 @@ struct sa_subdev_info { char name[16]; struct map_info map; struct mtd_info *mtd; - struct flash_platform_data *data; + struct flash_platform_data *plat; }; struct sa_info { struct mtd_partition *parts; struct mtd_info *mtd; int num_subdev; + unsigned int nr_parts; struct sa_subdev_info subdev[0]; }; static void sa1100_set_vpp(struct map_info *map, int on) { struct sa_subdev_info *subdev = container_of(map, struct sa_subdev_info, map); - subdev->data->set_vpp(on); + subdev->plat->set_vpp(on); } static void sa1100_destroy_subdev(struct sa_subdev_info *subdev) @@ -186,7 +188,7 @@ static int sa1100_probe_subdev(struct sa_subdev_info *subdev, struct resource *r goto out; } - if (subdev->data->set_vpp) + if (subdev->plat->set_vpp) subdev->map.set_vpp = sa1100_set_vpp; subdev->map.phys = phys; @@ -203,7 +205,7 @@ static int sa1100_probe_subdev(struct sa_subdev_info *subdev, struct resource *r * Now let's probe for the actual flash. Do it here since * specific machine settings might have been set above. */ - subdev->mtd = do_map_probe(subdev->data->map_name, &subdev->map); + subdev->mtd = do_map_probe(subdev->plat->map_name, &subdev->map); if (subdev->mtd == NULL) { ret = -ENXIO; goto err; @@ -222,13 +224,17 @@ static int sa1100_probe_subdev(struct sa_subdev_info *subdev, struct resource *r return ret; } -static void sa1100_destroy(struct sa_info *info) +static void sa1100_destroy(struct sa_info *info, struct flash_platform_data *plat) { int i; if (info->mtd) { - del_mtd_partitions(info->mtd); - + if (info->nr_parts == 0) + del_mtd_device(info->mtd); +#ifdef CONFIG_MTD_PARTITIONS + else + del_mtd_partitions(info->mtd); +#endif #ifdef CONFIG_MTD_CONCAT if (info->mtd != info->subdev[0].mtd) mtd_concat_destroy(info->mtd); @@ -241,10 +247,13 @@ static void sa1100_destroy(struct sa_info *info) for (i = info->num_subdev - 1; i >= 0; i--) sa1100_destroy_subdev(&info->subdev[i]); kfree(info); + + if (plat->exit) + plat->exit(); } static struct sa_info *__init -sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash) +sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat) { struct sa_info *info; int nr, size, i, ret = 0; @@ -274,6 +283,12 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash memset(info, 0, size); + if (plat->init) { + ret = plat->init(); + if (ret) + goto err; + } + /* * Claim and then map the memory regions. */ @@ -286,8 +301,8 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash break; subdev->map.name = subdev->name; - sprintf(subdev->name, "sa1100-%d", i); - subdev->data = flash; + sprintf(subdev->name, "%s-%d", plat->name, i); + subdev->plat = plat; ret = sa1100_probe_subdev(subdev, res); if (ret) @@ -308,7 +323,7 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash * otherwise fail. Either way, it'll be called "sa1100". */ if (info->num_subdev == 1) { - strcpy(info->subdev[0].name, "sa1100"); + strcpy(info->subdev[0].name, plat->name); info->mtd = info->subdev[0].mtd; ret = 0; } else if (info->num_subdev > 1) { @@ -321,7 +336,7 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash cdev[i] = info->subdev[i].mtd; info->mtd = mtd_concat_create(cdev, info->num_subdev, - "sa1100"); + plat->name); if (info->mtd == NULL) ret = -ENXIO; #else @@ -335,7 +350,7 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash return info; err: - sa1100_destroy(info); + sa1100_destroy(info, plat); out: return ERR_PTR(ret); } @@ -345,16 +360,16 @@ static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; static int __init sa1100_mtd_probe(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); - struct flash_platform_data *flash = pdev->dev.platform_data; + struct flash_platform_data *plat = pdev->dev.platform_data; struct mtd_partition *parts; const char *part_type = NULL; struct sa_info *info; int err, nr_parts = 0; - if (!flash) + if (!plat) return -ENODEV; - info = sa1100_setup_mtd(pdev, flash); + info = sa1100_setup_mtd(pdev, plat); if (IS_ERR(info)) { err = PTR_ERR(info); goto out; @@ -371,8 +386,8 @@ static int __init sa1100_mtd_probe(struct device *dev) } else #endif { - parts = flash->parts; - nr_parts = flash->nr_parts; + parts = plat->parts; + nr_parts = plat->nr_parts; part_type = "static"; } @@ -386,6 +401,8 @@ static int __init sa1100_mtd_probe(struct device *dev) add_mtd_partitions(info->mtd, parts, nr_parts); } + info->nr_parts = nr_parts; + dev_set_drvdata(dev, info); err = 0; @@ -396,33 +413,44 @@ static int __init sa1100_mtd_probe(struct device *dev) static int __exit sa1100_mtd_remove(struct device *dev) { struct sa_info *info = dev_get_drvdata(dev); + struct flash_platform_data *plat = dev->platform_data; + dev_set_drvdata(dev, NULL); - sa1100_destroy(info); + sa1100_destroy(info, plat); + return 0; } #ifdef CONFIG_PM -static int sa1100_mtd_suspend(struct device *dev, pm_message_t state, u32 level) +static int sa1100_mtd_suspend(struct device *dev, pm_message_t state) { struct sa_info *info = dev_get_drvdata(dev); int ret = 0; - if (info && level == SUSPEND_SAVE_STATE) + if (info) ret = info->mtd->suspend(info->mtd); return ret; } -static int sa1100_mtd_resume(struct device *dev, u32 level) +static int sa1100_mtd_resume(struct device *dev) { struct sa_info *info = dev_get_drvdata(dev); - if (info && level == RESUME_RESTORE_STATE) + if (info) info->mtd->resume(info->mtd); return 0; } + +static void sa1100_mtd_shutdown(struct device *dev) +{ + struct sa_info *info = dev_get_drvdata(dev); + if (info && info->mtd->suspend(info->mtd) == 0) + info->mtd->resume(info->mtd); +} #else #define sa1100_mtd_suspend NULL #define sa1100_mtd_resume NULL +#define sa1100_mtd_shutdown NULL #endif static struct device_driver sa1100_mtd_driver = { @@ -432,6 +460,7 @@ static struct device_driver sa1100_mtd_driver = { .remove = __exit_p(sa1100_mtd_remove), .suspend = sa1100_mtd_suspend, .resume = sa1100_mtd_resume, + .shutdown = sa1100_mtd_shutdown, }; static int __init sa1100_mtd_init(void) diff --git a/drivers/mtd/maps/tqm8xxl.c b/drivers/mtd/maps/tqm8xxl.c index 995e999..4e28b97 100644 --- a/drivers/mtd/maps/tqm8xxl.c +++ b/drivers/mtd/maps/tqm8xxl.c @@ -27,12 +27,14 @@ #include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> -#include <asm/io.h> +#include <linux/slab.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> +#include <asm/io.h> + #define FLASH_ADDR 0x40000000 #define FLASH_SIZE 0x00800000 #define FLASH_BANK_MAX 4 |