diff options
| -rw-r--r-- | drivers/mtd/maps/Kconfig | 18 | ||||
| -rw-r--r-- | drivers/mtd/maps/Makefile | 1 | ||||
| -rw-r--r-- | drivers/mtd/maps/bast-flash.c | 224 |
3 files changed, 0 insertions, 243 deletions
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index d2d339a7598d..ef1e29ea5a2c 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
| @@ -556,24 +556,6 @@ config MTD_DMV182 | |||
| 556 | help | 556 | help |
| 557 | Map driver for Dy-4 SVME/DMV-182 board. | 557 | Map driver for Dy-4 SVME/DMV-182 board. |
| 558 | 558 | ||
| 559 | config MTD_BAST | ||
| 560 | tristate "Map driver for Simtec BAST (EB2410ITX) or Thorcom VR1000" | ||
| 561 | depends on ARCH_BAST || MACH_VR1000 | ||
| 562 | select MTD_PARTITIONS | ||
| 563 | select MTD_MAP_BANK_WIDTH_16 | ||
| 564 | select MTD_JEDECPROBE | ||
| 565 | help | ||
| 566 | Map driver for NOR flash on the Simtec BAST (EB2410ITX), or the | ||
| 567 | Thorcom VR1000 | ||
| 568 | |||
| 569 | Note, this driver *cannot* over-ride the WP link on the | ||
| 570 | board, or currently detect the state of the link. | ||
| 571 | |||
| 572 | config MTD_BAST_MAXSIZE | ||
| 573 | int "Maximum size for BAST flash area (MiB)" | ||
| 574 | depends on MTD_BAST | ||
| 575 | default "4" | ||
| 576 | |||
| 577 | config MTD_SHARP_SL | 559 | config MTD_SHARP_SL |
| 578 | tristate "ROM mapped on Sharp SL Series" | 560 | tristate "ROM mapped on Sharp SL Series" |
| 579 | depends on ARCH_PXA | 561 | depends on ARCH_PXA |
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index f3b0c5951663..b29ea5460657 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile | |||
| @@ -9,7 +9,6 @@ endif | |||
| 9 | # Chip mappings | 9 | # Chip mappings |
| 10 | obj-$(CONFIG_MTD_CDB89712) += cdb89712.o | 10 | obj-$(CONFIG_MTD_CDB89712) += cdb89712.o |
| 11 | obj-$(CONFIG_MTD_ARM_INTEGRATOR)+= integrator-flash.o | 11 | obj-$(CONFIG_MTD_ARM_INTEGRATOR)+= integrator-flash.o |
| 12 | obj-$(CONFIG_MTD_BAST) += bast-flash.o | ||
| 13 | obj-$(CONFIG_MTD_CFI_FLAGADM) += cfi_flagadm.o | 12 | obj-$(CONFIG_MTD_CFI_FLAGADM) += cfi_flagadm.o |
| 14 | obj-$(CONFIG_MTD_DC21285) += dc21285.o | 13 | obj-$(CONFIG_MTD_DC21285) += dc21285.o |
| 15 | obj-$(CONFIG_MTD_DILNETPC) += dilnetpc.o | 14 | obj-$(CONFIG_MTD_DILNETPC) += dilnetpc.o |
diff --git a/drivers/mtd/maps/bast-flash.c b/drivers/mtd/maps/bast-flash.c deleted file mode 100644 index ca5414880341..000000000000 --- a/drivers/mtd/maps/bast-flash.c +++ /dev/null | |||
| @@ -1,224 +0,0 @@ | |||
| 1 | /* linux/drivers/mtd/maps/bast-flash.c | ||
| 2 | * | ||
| 3 | * Copyright (c) 2004-2005 Simtec Electronics | ||
| 4 | * Ben Dooks <ben@simtec.co.uk> | ||
| 5 | * | ||
| 6 | * Simtec Bast (EB2410ITX) NOR MTD Mapping driver | ||
| 7 | * | ||
| 8 | * Changelog: | ||
| 9 | * 20-Sep-2004 BJD Initial version | ||
| 10 | * 17-Jan-2005 BJD Add whole device if no partitions found | ||
| 11 | * | ||
| 12 | * This program is free software; you can redistribute it and/or modify | ||
| 13 | * it under the terms of the GNU General Public License as published by | ||
| 14 | * the Free Software Foundation; either version 2 of the License, or | ||
| 15 | * (at your option) any later version. | ||
| 16 | * | ||
| 17 | * This program is distributed in the hope that it will be useful, | ||
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 20 | * GNU General Public License for more details. | ||
| 21 | * | ||
| 22 | * You should have received a copy of the GNU General Public License | ||
| 23 | * along with this program; if not, write to the Free Software | ||
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 25 | */ | ||
| 26 | |||
| 27 | #include <linux/module.h> | ||
| 28 | #include <linux/types.h> | ||
| 29 | #include <linux/init.h> | ||
| 30 | #include <linux/kernel.h> | ||
| 31 | #include <linux/string.h> | ||
| 32 | #include <linux/ioport.h> | ||
| 33 | #include <linux/device.h> | ||
| 34 | #include <linux/slab.h> | ||
| 35 | #include <linux/platform_device.h> | ||
| 36 | #include <linux/mtd/mtd.h> | ||
| 37 | #include <linux/mtd/map.h> | ||
| 38 | #include <linux/mtd/partitions.h> | ||
| 39 | |||
| 40 | #include <asm/io.h> | ||
| 41 | #include <asm/mach/flash.h> | ||
| 42 | |||
| 43 | #include <asm/arch/map.h> | ||
| 44 | #include <asm/arch/bast-map.h> | ||
| 45 | #include <asm/arch/bast-cpld.h> | ||
| 46 | |||
| 47 | #ifdef CONFIG_MTD_BAST_MAXSIZE | ||
| 48 | #define AREA_MAXSIZE (CONFIG_MTD_BAST_MAXSIZE * SZ_1M) | ||
| 49 | #else | ||
| 50 | #define AREA_MAXSIZE (32 * SZ_1M) | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #define PFX "bast-flash: " | ||
| 54 | |||
| 55 | struct bast_flash_info { | ||
| 56 | struct mtd_info *mtd; | ||
| 57 | struct map_info map; | ||
| 58 | struct mtd_partition *partitions; | ||
| 59 | struct resource *area; | ||
| 60 | }; | ||
| 61 | |||
| 62 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | ||
| 63 | |||
| 64 | static void bast_flash_setrw(int to) | ||
| 65 | { | ||
| 66 | unsigned int val; | ||
| 67 | unsigned long flags; | ||
| 68 | |||
| 69 | local_irq_save(flags); | ||
| 70 | val = __raw_readb(BAST_VA_CTRL3); | ||
| 71 | |||
| 72 | if (to) | ||
| 73 | val |= BAST_CPLD_CTRL3_ROMWEN; | ||
| 74 | else | ||
| 75 | val &= ~BAST_CPLD_CTRL3_ROMWEN; | ||
| 76 | |||
| 77 | pr_debug("new cpld ctrl3=%02x\n", val); | ||
| 78 | |||
| 79 | __raw_writeb(val, BAST_VA_CTRL3); | ||
| 80 | local_irq_restore(flags); | ||
| 81 | } | ||
| 82 | |||
| 83 | static int bast_flash_remove(struct platform_device *pdev) | ||
| 84 | { | ||
| 85 | struct bast_flash_info *info = platform_get_drvdata(pdev); | ||
| 86 | |||
| 87 | platform_set_drvdata(pdev, NULL); | ||
| 88 | |||
| 89 | if (info == NULL) | ||
| 90 | return 0; | ||
| 91 | |||
| 92 | if (info->map.virt != NULL) | ||
| 93 | iounmap(info->map.virt); | ||
| 94 | |||
| 95 | if (info->mtd) { | ||
| 96 | del_mtd_partitions(info->mtd); | ||
| 97 | map_destroy(info->mtd); | ||
| 98 | } | ||
| 99 | |||
| 100 | kfree(info->partitions); | ||
| 101 | |||
| 102 | if (info->area) { | ||
| 103 | release_resource(info->area); | ||
| 104 | kfree(info->area); | ||
| 105 | } | ||
| 106 | |||
| 107 | kfree(info); | ||
| 108 | |||
| 109 | return 0; | ||
| 110 | } | ||
| 111 | |||
| 112 | static int bast_flash_probe(struct platform_device *pdev) | ||
| 113 | { | ||
| 114 | struct bast_flash_info *info; | ||
| 115 | struct resource *res; | ||
| 116 | int err = 0; | ||
| 117 | |||
| 118 | info = kmalloc(sizeof(*info), GFP_KERNEL); | ||
| 119 | if (info == NULL) { | ||
| 120 | printk(KERN_ERR PFX "no memory for flash info\n"); | ||
| 121 | err = -ENOMEM; | ||
| 122 | goto exit_error; | ||
| 123 | } | ||
| 124 | |||
| 125 | memzero(info, sizeof(*info)); | ||
| 126 | platform_set_drvdata(pdev, info); | ||
| 127 | |||
| 128 | res = pdev->resource; /* assume that the flash has one resource */ | ||
| 129 | |||
| 130 | info->map.phys = res->start; | ||
| 131 | info->map.size = res->end - res->start + 1; | ||
| 132 | info->map.name = pdev->dev.bus_id; | ||
| 133 | info->map.bankwidth = 2; | ||
| 134 | |||
| 135 | if (info->map.size > AREA_MAXSIZE) | ||
| 136 | info->map.size = AREA_MAXSIZE; | ||
| 137 | |||
| 138 | pr_debug("%s: area %08lx, size %ld\n", __func__, | ||
| 139 | info->map.phys, info->map.size); | ||
| 140 | |||
| 141 | info->area = request_mem_region(res->start, info->map.size, | ||
| 142 | pdev->name); | ||
| 143 | if (info->area == NULL) { | ||
| 144 | printk(KERN_ERR PFX "cannot reserve flash memory region\n"); | ||
| 145 | err = -ENOENT; | ||
| 146 | goto exit_error; | ||
| 147 | } | ||
| 148 | |||
| 149 | info->map.virt = ioremap(res->start, info->map.size); | ||
| 150 | pr_debug("%s: virt at %08x\n", __func__, (int)info->map.virt); | ||
| 151 | |||
| 152 | if (info->map.virt == 0) { | ||
| 153 | printk(KERN_ERR PFX "failed to ioremap() region\n"); | ||
| 154 | err = -EIO; | ||
| 155 | goto exit_error; | ||
| 156 | } | ||
| 157 | |||
| 158 | simple_map_init(&info->map); | ||
| 159 | |||
| 160 | /* enable the write to the flash area */ | ||
| 161 | |||
| 162 | bast_flash_setrw(1); | ||
| 163 | |||
| 164 | /* probe for the device(s) */ | ||
| 165 | |||
| 166 | info->mtd = do_map_probe("jedec_probe", &info->map); | ||
| 167 | if (info->mtd == NULL) | ||
| 168 | info->mtd = do_map_probe("cfi_probe", &info->map); | ||
| 169 | |||
| 170 | if (info->mtd == NULL) { | ||
| 171 | printk(KERN_ERR PFX "map_probe() failed\n"); | ||
| 172 | err = -ENXIO; | ||
| 173 | goto exit_error; | ||
| 174 | } | ||
| 175 | |||
| 176 | /* mark ourselves as the owner */ | ||
| 177 | info->mtd->owner = THIS_MODULE; | ||
| 178 | |||
| 179 | err = parse_mtd_partitions(info->mtd, probes, &info->partitions, 0); | ||
| 180 | if (err > 0) { | ||
| 181 | err = add_mtd_partitions(info->mtd, info->partitions, err); | ||
| 182 | if (err) | ||
| 183 | printk(KERN_ERR PFX "cannot add/parse partitions\n"); | ||
| 184 | } else { | ||
| 185 | err = add_mtd_device(info->mtd); | ||
| 186 | } | ||
| 187 | |||
| 188 | if (err == 0) | ||
| 189 | return 0; | ||
| 190 | |||
| 191 | /* fall through to exit error */ | ||
| 192 | |||
| 193 | exit_error: | ||
| 194 | bast_flash_remove(pdev); | ||
| 195 | return err; | ||
| 196 | } | ||
| 197 | |||
| 198 | static struct platform_driver bast_flash_driver = { | ||
| 199 | .probe = bast_flash_probe, | ||
| 200 | .remove = bast_flash_remove, | ||
| 201 | .driver = { | ||
| 202 | .name = "bast-nor", | ||
| 203 | .owner = THIS_MODULE, | ||
| 204 | }, | ||
| 205 | }; | ||
| 206 | |||
| 207 | static int __init bast_flash_init(void) | ||
| 208 | { | ||
| 209 | printk("BAST NOR-Flash Driver, (c) 2004 Simtec Electronics\n"); | ||
| 210 | return platform_driver_register(&bast_flash_driver); | ||
| 211 | } | ||
| 212 | |||
| 213 | static void __exit bast_flash_exit(void) | ||
| 214 | { | ||
| 215 | platform_driver_unregister(&bast_flash_driver); | ||
| 216 | } | ||
| 217 | |||
| 218 | module_init(bast_flash_init); | ||
| 219 | module_exit(bast_flash_exit); | ||
| 220 | |||
| 221 | MODULE_LICENSE("GPL"); | ||
| 222 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); | ||
| 223 | MODULE_DESCRIPTION("BAST MTD Map driver"); | ||
| 224 | MODULE_ALIAS("platform:bast-nor"); | ||
