···44 *55 * (C) 2000 Red Hat. GPL'd66 *77- * $Id: cfi_cmdset_0001.c,v 1.185 2005/11/07 11:14:22 gleixner Exp $77+ * $Id: cfi_cmdset_0001.c,v 1.186 2005/11/23 22:07:52 nico Exp $88 *99 *1010 * 10/10/2000 Nicolas Pitre <nico@cam.org>···644644 *645645 * - contension arbitration is handled in the owner's context.646646 *647647- * The 'shared' struct can be read when its lock is taken.648648- * However any writes to it can only be made when the current649649- * owner's lock is also held.647647+ * The 'shared' struct can be read and/or written only when648648+ * its lock is taken.650649 */651650 struct flchip_shared *shared = chip->priv;652651 struct flchip *contender;···674675 }675676 timeo = jiffies + HZ;676677 spin_lock(&shared->lock);678678+ spin_unlock(contender->mutex);677679 }678680679681 /* We now own it */680682 shared->writing = chip;681683 if (mode == FL_ERASING)682684 shared->erasing = chip;683683- if (contender && contender != chip)684684- spin_unlock(contender->mutex);685685 spin_unlock(&shared->lock);686686 }687687
+4-4
drivers/mtd/chips/cfi_probe.c
···11/*22 Common Flash Interface probe code.33 (C) 2000 Red Hat. GPL'd.44- $Id: cfi_probe.c,v 1.84 2005/11/07 11:14:23 gleixner Exp $44+ $Id: cfi_probe.c,v 1.86 2005/11/29 14:48:31 gleixner Exp $55*/6677#include <linux/config.h>···230230 cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL);231231 cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL);232232 cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL);233233- cfi->mfr = cfi_read_query(map, base);234234- cfi->id = cfi_read_query(map, base + ofs_factor);233233+ cfi->mfr = cfi_read_query16(map, base);234234+ cfi->id = cfi_read_query16(map, base + ofs_factor);235235236236 /* Put it back into Read Mode */237237 cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);···426426 .module = THIS_MODULE427427};428428429429-int __init cfi_probe_init(void)429429+static int __init cfi_probe_init(void)430430{431431 register_mtd_chip_driver(&cfi_chipdrv);432432 return 0;
+66-57
drivers/mtd/chips/sharp.c
···44 * Copyright 2000,2001 David A. Schleef <ds@schleef.org>55 * 2000,2001 Lineo, Inc.66 *77- * $Id: sharp.c,v 1.16 2005/11/07 11:14:23 gleixner Exp $77+ * $Id: sharp.c,v 1.17 2005/11/29 14:28:28 gleixner Exp $88 *99 * Devices supported:1010 * LH28F016SCT Symmetrical block flash memory, 2Mx8···160160 return mtd;161161}162162163163+static inline void sharp_send_cmd(struct map_info *map, unsigned long cmd, unsigned long adr)164164+{165165+ map_word map_cmd;166166+ map_cmd.x[0] = cmd;167167+ map_write(map, map_cmd, adr);168168+}169169+163170static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd)164171{165165- unsigned long tmp;172172+ map_word tmp, read0, read4;166173 unsigned long base = 0;167167- u32 read0, read4;168174 int width = 4;169175170170- tmp = map_read32(map, base+0);176176+ tmp = map_read(map, base+0);171177172172- map_write32(map, CMD_READ_ID, base+0);178178+ sharp_send_cmd(map, CMD_READ_ID, base+0);173179174174- read0=map_read32(map, base+0);175175- read4=map_read32(map, base+4);176176- if(read0 == 0x89898989){180180+ read0 = map_read(map, base+0);181181+ read4 = map_read(map, base+4);182182+ if(read0.x[0] == 0x89898989){177183 printk("Looks like sharp flash\n");178178- switch(read4){184184+ switch(read4.x[0]){179185 case 0xaaaaaaaa:180186 case 0xa0a0a0a0:181187 /* aa - LH28F016SCT-L95 2Mx8, 32 64k blocks*/···203197 return width;204198#endif205199 default:206206- printk("Sort-of looks like sharp flash, 0x%08x 0x%08x\n",207207- read0,read4);200200+ printk("Sort-of looks like sharp flash, 0x%08lx 0x%08lx\n",201201+ read0.x[0], read4.x[0]);208202 }209209- }else if((map_read32(map, base+0) == CMD_READ_ID)){203203+ }else if((map_read(map, base+0).x[0] == CMD_READ_ID)){210204 /* RAM, probably */211205 printk("Looks like RAM\n");212212- map_write32(map, tmp, base+0);206206+ map_write(map, tmp, base+0);213207 }else{214214- printk("Doesn't look like sharp flash, 0x%08x 0x%08x\n",215215- read0,read4);208208+ printk("Doesn't look like sharp flash, 0x%08lx 0x%08lx\n",209209+ read0.x[0], read4.x[0]);216210 }217211218212 return 0;···221215/* This function returns with the chip->mutex lock held. */222216static int sharp_wait(struct map_info *map, struct flchip *chip)223217{224224- int status, i;218218+ int i;219219+ map_word status;225220 unsigned long timeo = jiffies + HZ;226221 DECLARE_WAITQUEUE(wait, current);227222 int adr = 0;···232225233226 switch(chip->state){234227 case FL_READY:235235- map_write32(map,CMD_READ_STATUS,adr);228228+ sharp_send_cmd(map, CMD_READ_STATUS, adr);236229 chip->state = FL_STATUS;237230 case FL_STATUS:238231 for(i=0;i<100;i++){239239- status = map_read32(map,adr);240240- if((status & SR_READY)==SR_READY)232232+ status = map_read(map, adr);233233+ if((status.x[0] & SR_READY)==SR_READY)241234 break;242235 udelay(1);243236 }···261254 goto retry;262255 }263256264264- map_write32(map,CMD_RESET, adr);257257+ sharp_send_cmd(map, CMD_RESET, adr);265258266259 chip->state = FL_READY;267260···358351 int timeo;359352 int try;360353 int i;361361- int status = 0;354354+ map_word data, status;362355356356+ status.x[0] = 0;363357 ret = sharp_wait(map,chip);364358365359 for(try=0;try<10;try++){366366- map_write32(map,CMD_BYTE_WRITE,adr);360360+ sharp_send_cmd(map, CMD_BYTE_WRITE, adr);367361 /* cpu_to_le32 -> hack to fix the writel be->le conversion */368368- map_write32(map,cpu_to_le32(datum),adr);362362+ data.x[0] = cpu_to_le32(datum);363363+ map_write(map, data, adr);369364370365 chip->state = FL_WRITING;371366372367 timeo = jiffies + (HZ/2);373368374374- map_write32(map,CMD_READ_STATUS,adr);369369+ sharp_send_cmd(map, CMD_READ_STATUS, adr);375370 for(i=0;i<100;i++){376376- status = map_read32(map,adr);377377- if((status & SR_READY)==SR_READY)371371+ status = map_read(map, adr);372372+ if((status.x[0] & SR_READY) == SR_READY)378373 break;379374 }380375 if(i==100){381376 printk("sharp: timed out writing\n");382377 }383378384384- if(!(status&SR_ERRORS))379379+ if(!(status.x[0] & SR_ERRORS))385380 break;386381387387- printk("sharp: error writing byte at addr=%08lx status=%08x\n",adr,status);382382+ printk("sharp: error writing byte at addr=%08lx status=%08lx\n", adr, status.x[0]);388383389389- map_write32(map,CMD_CLEAR_STATUS,adr);384384+ sharp_send_cmd(map, CMD_CLEAR_STATUS, adr);390385 }391391- map_write32(map,CMD_RESET,adr);386386+ sharp_send_cmd(map, CMD_RESET, adr);392387 chip->state = FL_READY;393388394389 wake_up(&chip->wq);···443434{444435 int ret;445436 unsigned long timeo;446446- int status;437437+ map_word status;447438 DECLARE_WAITQUEUE(wait, current);448439449449- map_write32(map,CMD_READ_STATUS,adr);450450- status = map_read32(map,adr);440440+ sharp_send_cmd(map, CMD_READ_STATUS, adr);441441+ status = map_read(map, adr);451442452443 timeo = jiffies + HZ;453444454445 while(time_before(jiffies, timeo)){455455- map_write32(map,CMD_READ_STATUS,adr);456456- status = map_read32(map,adr);457457- if((status & SR_READY)==SR_READY){446446+ sharp_send_cmd(map, CMD_READ_STATUS, adr);447447+ status = map_read(map, adr);448448+ if((status.x[0] & SR_READY)==SR_READY){458449 ret = 0;459450 goto out;460451 }···485476{486477 int ret;487478 //int timeo;488488- int status;479479+ map_word status;489480 //int i;490481491482//printk("sharp_erase_oneblock()\n");···495486 sharp_unlock_oneblock(map,chip,adr);496487#endif497488498498- map_write32(map,CMD_BLOCK_ERASE_1,adr);499499- map_write32(map,CMD_BLOCK_ERASE_2,adr);489489+ sharp_send_cmd(map, CMD_BLOCK_ERASE_1, adr);490490+ sharp_send_cmd(map, CMD_BLOCK_ERASE_2, adr);500491501492 chip->state = FL_ERASING;502493503494 ret = sharp_do_wait_for_ready(map,chip,adr);504495 if(ret<0)return ret;505496506506- map_write32(map,CMD_READ_STATUS,adr);507507- status = map_read32(map,adr);497497+ sharp_send_cmd(map, CMD_READ_STATUS, adr);498498+ status = map_read(map, adr);508499509509- if(!(status&SR_ERRORS)){510510- map_write32(map,CMD_RESET,adr);500500+ if(!(status.x[0] & SR_ERRORS)){501501+ sharp_send_cmd(map, CMD_RESET, adr);511502 chip->state = FL_READY;512503 //spin_unlock_bh(chip->mutex);513504 return 0;514505 }515506516516- printk("sharp: error erasing block at addr=%08lx status=%08x\n",adr,status);517517- map_write32(map,CMD_CLEAR_STATUS,adr);507507+ printk("sharp: error erasing block at addr=%08lx status=%08lx\n", adr, status.x[0]);508508+ sharp_send_cmd(map, CMD_CLEAR_STATUS, adr);518509519510 //spin_unlock_bh(chip->mutex);520511···526517 unsigned long adr)527518{528519 int i;529529- int status;520520+ map_word status;530521531531- map_write32(map,CMD_CLEAR_BLOCK_LOCKS_1,adr);532532- map_write32(map,CMD_CLEAR_BLOCK_LOCKS_2,adr);522522+ sharp_send_cmd(map, CMD_CLEAR_BLOCK_LOCKS_1, adr);523523+ sharp_send_cmd(map, CMD_CLEAR_BLOCK_LOCKS_2, adr);533524534525 udelay(100);535526536536- status = map_read32(map,adr);537537- printk("status=%08x\n",status);527527+ status = map_read(map, adr);528528+ printk("status=%08lx\n", status.x[0]);538529539530 for(i=0;i<1000;i++){540540- //map_write32(map,CMD_READ_STATUS,adr);541541- status = map_read32(map,adr);542542- if((status & SR_READY)==SR_READY)531531+ //sharp_send_cmd(map, CMD_READ_STATUS, adr);532532+ status = map_read(map, adr);533533+ if((status.x[0] & SR_READY) == SR_READY)543534 break;544535 udelay(100);545536 }···547538 printk("sharp: timed out unlocking block\n");548539 }549540550550- if(!(status&SR_ERRORS)){551551- map_write32(map,CMD_RESET,adr);541541+ if(!(status.x[0] & SR_ERRORS)){542542+ sharp_send_cmd(map, CMD_RESET, adr);552543 chip->state = FL_READY;553544 return;554545 }555546556556- printk("sharp: error unlocking block at addr=%08lx status=%08x\n",adr,status);557557- map_write32(map,CMD_CLEAR_STATUS,adr);547547+ printk("sharp: error unlocking block at addr=%08lx status=%08lx\n", adr, status.x[0]);548548+ sharp_send_cmd(map, CMD_CLEAR_STATUS, adr);558549}559550#endif560551
+3-3
drivers/mtd/devices/block2mtd.c
···11/*22- * $Id: block2mtd.c,v 1.29 2005/11/07 11:14:24 gleixner Exp $22+ * $Id: block2mtd.c,v 1.30 2005/11/29 14:48:32 gleixner Exp $33 *44 * block2mtd.c - create an mtd from a block device55 *···1919#include <linux/mtd/mtd.h>2020#include <linux/buffer_head.h>21212222-#define VERSION "$Revision: 1.29 $"2222+#define VERSION "$Revision: 1.30 $"232324242525#define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)···404041414242#define PAGE_READAHEAD 644343-void cache_readahead(struct address_space *mapping, int index)4343+static void cache_readahead(struct address_space *mapping, int index)4444{4545 filler_t *filler = (filler_t*)mapping->a_ops->readpage;4646 int i, pagei;
+3-3
drivers/mtd/devices/ms02-nv.c
···66 * as published by the Free Software Foundation; either version77 * 2 of the License, or (at your option) any later version.88 *99- * $Id: ms02-nv.c,v 1.10 2005/06/20 12:24:41 macro Exp $99+ * $Id: ms02-nv.c,v 1.11 2005/11/14 13:41:47 macro Exp $1010 */11111212#include <linux/init.h>···293293294294 switch (mips_machtype) {295295 case MACH_DS5000_200:296296- csr = (volatile u32 *)KN02_CSR_BASE;296296+ csr = (volatile u32 *)CKSEG1ADDR(KN02_SLOT_BASE + KN02_CSR);297297 if (*csr & KN02_CSR_BNK32M)298298 stride = 2;299299 break;300300 case MACH_DS5000_2X0:301301 case MACH_DS5900:302302- csr = (volatile u32 *)KN03_MCR_BASE;302302+ csr = (volatile u32 *)CKSEG1ADDR(KN03_SLOT_BASE + IOASIC_MCR);303303 if (*csr & KN03_MCR_BNK32M)304304 stride = 2;305305 break;
+3-3
drivers/mtd/ftl.c
···11/* This version ported to the Linux-MTD system by dwmw2@infradead.org22- * $Id: ftl.c,v 1.58 2005/11/07 11:14:19 gleixner Exp $22+ * $Id: ftl.c,v 1.59 2005/11/29 14:48:31 gleixner Exp $33 *44 * Fixes: Arnaldo Carvalho de Melo <acme@conectiva.com.br>55 * - fixes some leaks on failure in build_maps and ftl_notify_add, cleanups···10841084 .owner = THIS_MODULE,10851085};1086108610871087-int init_ftl(void)10871087+static int init_ftl(void)10881088{10891089- DEBUG(0, "$Id: ftl.c,v 1.58 2005/11/07 11:14:19 gleixner Exp $\n");10891089+ DEBUG(0, "$Id: ftl.c,v 1.59 2005/11/29 14:48:31 gleixner Exp $\n");1090109010911091 return register_mtd_blktrans(&ftl_tr);10921092}
-6
drivers/mtd/maps/Kconfig
···538538 This enables access to the flash chips on the Interface MPC-1211(CTP/PCI/MPC-SH02).539539 If you have such a board, say 'Y'.540540541541-config MTD_PQ2FADS542542- tristate "JEDEC flash SIMM mapped on PQ2FADS and 8272ADS boards"543543- depends on (ADS8272 || PQ2FADS) && MTD_PARTITIONS && MTD_JEDECPROBE && MTD_PHYSMAP && MTD_CFI_GEOMETRY && MTD_CFI_INTELEXT544544- help545545- This enables access to flash SIMM on PQ2FADS-like boards546546-547541config MTD_OMAP_NOR548542 tristate "TI OMAP board mappings"549543 depends on MTD_CFI && ARCH_OMAP
···1616 * along with this program; if not, write to the Free Software1717 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA1818 *1919- * $Id: sc520cdp.c,v 1.22 2005/11/07 11:14:28 gleixner Exp $1919+ * $Id: sc520cdp.c,v 1.23 2005/11/17 08:20:27 dwmw2 Exp $2020 *2121 *2222 * The SC520CDP is an evaluation board for the Elan SC520 processor available···164164 unsigned long default_address;165165};166166167167-static struct sc520_par_table par_table[NUM_FLASH_BANKS] =167167+static const struct sc520_par_table par_table[NUM_FLASH_BANKS] =168168{169169 { /* Flash Bank #0: selected by ROMCS0 */170170 SC520_PAR_ROMCS0,
···30303131#define PREFIX "rfd_ftl: "32323333-/* Major device # for FTL device */3434-3535-/* A request for this major has been sent to device@lanana.org */3333+/* This major has been assigned by device@lanana.org */3634#ifndef RFD_FTL_MAJOR3737-#define RFD_FTL_MAJOR 953535+#define RFD_FTL_MAJOR 2563836#endif39374038/* Maximum number of partitions in an FTL region */
+2
fs/jffs2/fs.c
···234234 c = JFFS2_SB_INFO(inode->i_sb);235235236236 jffs2_init_inode_info(f);237237+ down(&f->sem);237238238239 ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node);239240···401400402401 f = JFFS2_INODE_INFO(inode);403402 jffs2_init_inode_info(f);403403+ down(&f->sem);404404405405 memset(ri, 0, sizeof(*ri));406406 /* Set OS-specific defaults for new inodes */
···1122/* Common Flash Interface structures33 * See http://support.intel.com/design/flash/technote/index.htm44- * $Id: cfi.h,v 1.56 2005/11/07 11:14:54 gleixner Exp $44+ * $Id: cfi.h,v 1.57 2005/11/15 23:28:17 tpoynor Exp $55 */6677#ifndef __MTD_CFI_H__···416416417417 if (map_bankwidth_is_1(map)) {418418 return val.x[0];419419+ } else if (map_bankwidth_is_2(map)) {420420+ return cfi16_to_cpu(val.x[0]);421421+ } else {422422+ /* No point in a 64-bit byteswap since that would just be423423+ swapping the responses from different chips, and we are424424+ only interested in one chip (a representative sample) */425425+ return cfi32_to_cpu(val.x[0]);426426+ }427427+}428428+429429+static inline uint16_t cfi_read_query16(struct map_info *map, uint32_t addr)430430+{431431+ map_word val = map_read(map, addr);432432+433433+ if (map_bankwidth_is_1(map)) {434434+ return val.x[0] & 0xff;419435 } else if (map_bankwidth_is_2(map)) {420436 return cfi16_to_cpu(val.x[0]);421437 } else {