linux/drivers/char/nwflash.c
<<
> opt/spa opt/form opta > op href="../linux+v3.8.6/drivers/char/nwflash.c"> > optimg src="../.static/gfx/right.png" alt=">>"> >t/spa >tspa class="lxr_search"> > ="+search" method="post" onsubmit="return do_search(this);"> > optinput typv3.hidden" namv3.navtarget" ue="v3."> > optinput typv3.text" namv3.search" id3.search"> > optbuttvaltypv3.submit">Searchtspa class="lxr_prefs" opta href="+prefs?return=drivers/char/nwflash.c" > op onclick="return ajax_prefs();"> > opPrefs opt/a> >t/spa op pt/div op ptform acn> ="ajax+*" method="post" onsubmit="return false;"> >tinput typv3.hidden" namv3.ajax_lookup" id3.ajax_lookup" ue="v3."> op pt/form op ptdiv class="headingbottvm">
tdiv id3.file_contents"
p p1t/a>tspa  class="comment">/*t/spa  
p p2t/a>tspa  class="comment"> * Flash memory interface rev.5 driver for the Intelt/spa  
p p3t/a>tspa  class="comment"> * Flash chips used valthe NetWinder.t/spa  
p p4t/a>tspa  class="comment"> *t/spa  
p p5t/a>tspa  class="comment"> * 20/08/2000p pRMK op puse __ioremap to map flash into virtual memoryt/spa  
p p6t/a>tspa  class="comment"> *                      make a few more places use "volatile"t/spa  
p p7t/a>tspa  class="comment"> * 22/05/2001p pRMK op p- Lock read against writet/spa  
p p8t/a>tspa  class="comment"> *                      - merge printk level changes (with mods) from Ala  Cox.t/spa  
p p9t/a>tspa  class="comment"> *                      - use *ppos aslthe file posin>
 , not file->f_pos.t/spa  
p /opta>tspa  class="comment"> *                      - fix check for out of range pos and r/w sizet/spa  
p 11t/a>tspa  class="comment"> *t/spa  
p 12t/a>tspa  class="comment"> * Please notelthat we are tampering with the only flash chip in thet/spa  
p 13t/a>tspa  class="comment"> * machine, which contains the bootup code.  Weltherefore have thet/spa  
p 14t/a>tspa  class="comment"> * power to convert these machines into doorstops...t/spa  
p 15t/a>tspa  class="comment"> */t/spa  
p 16t/a>
p 17t/a>#include <ta href="include/linux/module.h" class="fref">linux/module.ht/a>>
p 18t/a>#include <ta href="include/linux/typvs.h" class="fref">linux/typvs.ht/a>>
p 19t/a>#include <ta href="include/linux/fs.h" class="fref">linux/fs.ht/a>>
p 20t/a>#include <ta href="include/linux/errno.h" class="fref">linux/errno.ht/a>>
p 21t/a>#include <ta href="include/linux/mm.h" class="fref">linux/mm.ht/a>>
p 22t/a>#include <ta href="include/linux/delay.h" class="fref">linux/delay.ht/a>>
p 23t/a>#include <ta href="include/linux/proc_fs.h" class="fref">linux/proc_fs.ht/a>>
p 24t/a>#include <ta href="include/linux/miscdevice.h" class="fref">linux/miscdevice.ht/a>>
p 25t/a>#include <ta href="include/linux/spinlock.h" class="fref">linux/spinlock.ht/a>>
p 26t/a>#include <ta href="include/linux/rwsem.h" class="fref">linux/rwsem.ht/a>>
p 27t/a>#include <ta href="include/linux/init.h" class="fref">linux/init.ht/a>>
p 28t/a>#include <ta href="include/linux/mutex.h" class="fref">linux/mutex.ht/a>>
p 29t/a>#include <ta href="include/linux/jiffivs.h" class="fref">linux/jiffivs.ht/a>>
p 30t/a>
p 31t/a>#include <ta href="+ambig=include/asm-alpha/hardware/dec21285.h|include/asm-arm/hardware/dec21285.h|include/asm-avr32/hardware/dec21285.h|include/asm-blackfin/hardware/dec21285.h|include/asm-cris/hardware/dec21285.h|include/asm-frv/hardware/dec21285.h|include/asm-generic/hardware/dec21285.h|include/asm-h8300/hardware/dec21285.h|include/asm-i386/hardware/dec21285.h|include/asm-ia64/hardware/dec21285.h|include/asm-m32r/hardware/dec21285.h|include/asm-m68k/hardware/dec21285.h|include/asm-m68knommu/hardware/dec21285.h|include/asm-mips/hardware/dec21285.h|include/asm-mips64/hardware/dec21285.h|include/asm-parisc/hardware/dec21285.h|include/asm-powerpc/hardware/dec21285.h|include/asm-ppc/hardware/dec21285.h|include/asm-s390/hardware/dec21285.h|include/asm-sh/hardware/dec21285.h|include/asm-sh64/hardware/dec21285.h|include/asm-sparc/hardware/dec21285.h|include/asm-sparc64/hardware/dec21285.h|include/asm-um/hardware/dec21285.h|include/asm-v850/hardware/dec21285.h|include/asm-x86/hardware/dec21285.h|include/asm-x86_64/hardware/dec21285.h|include/asm-xtensa/hardware/dec21285.h" class="falt">asm/hardware/dec21285.ht/a>>
p 32t/a>#include <ta href="+ambig=include/asm-alpha/io.h|include/asm-arm/io.h|include/asm-avr32/io.h|include/asm-blackfin/io.h|include/asm-cris/io.h|include/asm-frv/io.h|include/asm-generic/io.h|include/asm-h8300/io.h|include/asm-i386/io.h|include/asm-ia64/io.h|include/asm-m32r/io.h|include/asm-m68k/io.h|include/asm-m68knommu/io.h|include/asm-mips/io.h|include/asm-mips64/io.h|include/asm-parisc/io.h|include/asm-powerpc/io.h|include/asm-ppc/io.h|include/asm-s390/io.h|include/asm-sh/io.h|include/asm-sh64/io.h|include/asm-sparc/io.h|include/asm-sparc64/io.h|include/asm-um/io.h|include/asm-v850/io.h|include/asm-x86/io.h|include/asm-x86_64/io.h|include/asm-xtensa/io.h" class="falt">asm/io.ht/a>>
p 33t/a>#include <ta href="+ambig=include/asm-alpha/mach-typvs.h|include/asm-arm/mach-typvs.h|include/asm-avr32/mach-typvs.h|include/asm-blackfin/mach-typvs.h|include/asm-cris/mach-typvs.h|include/asm-frv/mach-typvs.h|include/asm-generic/mach-typvs.h|include/asm-h8300/mach-typvs.h|include/asm-i386/mach-typvs.h|include/asm-ia64/mach-typvs.h|include/asm-m32r/mach-typvs.h|include/asm-m68k/mach-typvs.h|include/asm-m68knommu/mach-typvs.h|include/asm-mips/mach-typvs.h|include/asm-mips64/mach-typvs.h|include/asm-parisc/mach-typvs.h|include/asm-powerpc/mach-typvs.h|include/asm-ppc/mach-typvs.h|include/asm-s390/mach-typvs.h|include/asm-sh/mach-typvs.h|include/asm-sh64/mach-typvs.h|include/asm-sparc/mach-typvs.h|include/asm-sparc64/mach-typvs.h|include/asm-um/mach-typvs.h|include/asm-v850/mach-typvs.h|include/asm-x86/mach-typvs.h|include/asm-x86_64/mach-typvs.h|include/asm-xtensa/mach-typvs.h" class="falt">asm/mach-typvs.ht/a>>
p 34t/a>#include <ta href="+ambig=include/asm-alpha/uaccess.h|include/asm-arm/uaccess.h|include/asm-avr32/uaccess.h|include/asm-blackfin/uaccess.h|include/asm-cris/uaccess.h|include/asm-frv/uaccess.h|include/asm-generic/uaccess.h|include/asm-h8300/uaccess.h|include/asm-i386/uaccess.h|include/asm-ia64/uaccess.h|include/asm-m32r/uaccess.h|include/asm-m68k/uaccess.h|include/asm-m68knommu/uaccess.h|include/asm-mips/uaccess.h|include/asm-mips64/uaccess.h|include/asm-parisc/uaccess.h|include/asm-powerpc/uaccess.h|include/asm-ppc/uaccess.h|include/asm-s390/uaccess.h|include/asm-sh/uaccess.h|include/asm-sh64/uaccess.h|include/asm-sparc/uaccess.h|include/asm-sparc64/uaccess.h|include/asm-um/uaccess.h|include/asm-v850/uaccess.h|include/asm-x86/uaccess.h|include/asm-x86_64/uaccess.h|include/asm-xtensa/uaccess.h" class="falt">asm/uaccess.ht/a>>
p 35t/a>
p 36t/a>tspa  class="comment">/*****************************************************************************/t/spa  
p 37t/a>#include <ta href="+ambig=include/asm-alpha/nwflash.h|include/asm-arm/nwflash.h|include/asm-avr32/nwflash.h|include/asm-blackfin/nwflash.h|include/asm-cris/nwflash.h|include/asm-frv/nwflash.h|include/asm-generic/nwflash.h|include/asm-h8300/nwflash.h|include/asm-i386/nwflash.h|include/asm-ia64/nwflash.h|include/asm-m32r/nwflash.h|include/asm-m68k/nwflash.h|include/asm-m68knommu/nwflash.h|include/asm-mips/nwflash.h|include/asm-mips64/nwflash.h|include/asm-parisc/nwflash.h|include/asm-powerpc/nwflash.h|include/asm-ppc/nwflash.h|include/asm-s390/nwflash.h|include/asm-sh/nwflash.h|include/asm-sh64/nwflash.h|include/asm-sparc/nwflash.h|include/asm-sparc64/nwflash.h|include/asm-um/nwflash.h|include/asm-v850/nwflash.h|include/asm-x86/nwflash.h|include/asm-x86_64/nwflash.h|include/asm-xtensa/nwflash.h" class="falt">asm/nwflash.ht/a>>
p 38t/a>
p 39t/a>#definepta href="+code=NWFLASH_VERSION" class="sref">NWFLASH_VERSIONt/a> tspa  class="string">"6.4"t/spa  
p 40t/a>
p 41t/a>staticpta href="+code=DEFINE_MUTEX" class="sref">DEFINE_MUTEXt/a>(ta href="+code=flash_mutex" class="sref">flash_mutext/a>);
p 42t/a>staticpvoidpta href="+code=kick_open" class="sref">kick_opent/a>(void);
p 43t/a>staticpintpta href="+code=get_flash_id" class="sref">get_flash_idt/a>(void);
p 44t/a>staticpintpta href="+code=erase_block" class="sref">erase_blockt/a>(intpta href="+code=nBlock" class="sref">nBlockt/a>);
p 45t/a>staticpintpta href="+code=write_block" class="sref">write_blockt/a>(unsigned longpta href="+code=p" class="sref">pt/a>, const charpta href="+code=__user" class="sref">__usert/a> *ta href="+code=buf" class="sref">buft/a>, intpta href="+code=count" class="sref">countt/a>);
p 46t/a>
p 47t/a>#definepta href="+code=KFLASH_SIZE" class="sref">KFLASH_SIZEt/a>     1024*1024       tspa  class="comment">//1 Megt/spa  
p 48t/a>#definepta href="+code=KFLASH_SIZE4" class="sref">KFLASH_SIZE4t/a>    4*1024*1024     tspa  class="comment">//4 Megt/spa  
p 49t/a>#definepta href="+code=KFLASH_ID" class="sref">KFLASH_IDt/a>       0x89A6          tspa  class="comment">//Intel flasht/spa  
p 50t/a>#definepta href="+code=KFLASH_ID4" class="sref">KFLASH_ID4t/a>      0xB0D4          tspa  class="comment">//Intel flash 4Megt/spa  
p 51t/a>
p 52t/a>staticpta href="+code=bool" class="sref">boolt/a> ta href="+code=flashdebug" class="sref">flashdebugt/a>;         tspa  class="comment">//if set - we will display progress msgst/spa  
p 53t/a>
p 54t/a>staticpintpta href="+code=gbWriteEnable" class="sref">gbWriteEnablet/a>;
p 55t/a>staticpintpta href="+code=gbWriteBase64Enable" class="sref">gbWriteBase64Enablet/a>;
p 56t/a>staticpvolatile unsigned charp*ta href="+code=FLASH_BASE" class="sref">FLASH_BASEt/a>;
p 57t/a>staticpintpta href="+code=gbFlashSize" class="sref">gbFlashSizet/a> =pta href="+code=KFLASH_SIZE" class="sref">KFLASH_SIZEt/a>;
p 58t/a>staticpta href="+code=DEFINE_MUTEX" class="sref">DEFINE_MUTEXt/a>(ta href="+code=nwflash_mutex" class="sref">nwflash_mutext/a>);
p 59t/a>
p 60t/a>staticpintpta href="+code=get_flash_id" class="sref">get_flash_idt/a>(void)
p 61t/a>{
p 62t/a>       pvolatile unsigned intpta href="+code=c1" class="sref">c1t/a>, ta href="+code=c2" class="sref">c2t/a>;
p 63t/a>
p 64t/a>       ptspa  class="comment">/*t/spa  
p 65t/a>tspa  class="comment">         * try to get flash chip IDt/spa  
p 66t/a>tspa  class="comment">         */t/spa  
p 67t/a>       pta href="+code=kick_open" class="sref">kick_opent/a>();
p 68t/a>       pta href="+code=c2" class="sref">c2t/a> =pta href="+code=inb" class="sref">inbt/a>(0x80);
p 69t/a>       p*(volatile unsigned charp*) (ta href="+code=FLASH_BASE" class="sref">FLASH_BASEt/a> + 0x8000) =p0x90;
p 70t/a>       pta href="+code=udelay" class="sref">udelayt/a>(15);
p 71t/a>       pta href="+code=c1" class="sref">c1t/a> =p*(volatile unsigned charp*) ta href="+code=FLASH_BASE" class="sref">FLASH_BASEt/a>;
p 72t/a>       pta href="+code=c2" class="sref">c2t/a> =pta href="+code=inb" class="sref">inbt/a>(0x80);
p 73t/a>
p 74t/a>       ptspa  class="comment">/*t/spa  
p 75t/a>tspa  class="comment">         * on 4 Meg flash the second byte is acnually at offset 2...t/spa  
p 76t/a>tspa  class="comment">         */t/spa  
p 77t/a>       pif (ta href="+code=c1" class="sref">c1t/a> == 0xB0)
p 78t/a>       p       pta href="+code=c2" class="sref">c2t/a> =p*(volatile unsigned charp*) (ta href="+code=FLASH_BASE" class="sref">FLASH_BASEt/a> + 2);
p 79t/a>       pelse
p 80t/a>       p       pta href="+code=c2" class="sref">c2t/a> =p*(volatile unsigned charp*) (ta href="+code=FLASH_BASE" class="sref">FLASH_BASEt/a> + 1);
p 81t/a>
p 82t/a>       pta href="+code=c2" class="sref">c2t/a> += (ta href="+code=c1" class="sref">c1t/a> << 8);
p 83t/a>
p 84t/a>       ptspa  class="comment">/*t/spa  
p 85t/a>tspa  class="comment">         * set it back to read modet/spa  
p 86t/a>tspa  class="comment">         */t/spa  
p 87t/a>       p*(volatile unsigned charp*) (ta href="+code=FLASH_BASE" class="sref">FLASH_BASEt/a> + 0x8000) =p0xFF;
p 88t/a>
p 89t/a>       pif (ta href="+code=c2" class="sref">c2t/a> ==pta href="+code=KFLASH_ID4" class="sref">KFLASH_ID4t/a>)
p 90t/a>       p       pta href="+code=gbFlashSize" class="sref">gbFlashSizet/a> =pta href="+code=KFLASH_SIZE4" class="sref">KFLASH_SIZE4t/a>;
p 91t/a>
p 92t/a>       preturn ta href="+code=c2" class="sref">c2t/a>;
p 93t/a>}
p 94t/a>
p 95t/a>staticplongpta href="+code=flash_ioctl" class="sref">flash_ioctlt/a>(structpta href="+code=file" class="sref">filet/a>p*ta href="+code=filep" class="sref">filept/a>, unsigned intpta href="+code=cmd" class="sref">cmdt/a>, unsigned longpta href="+code=arg" class="sref">argt/a>)
p 96t/a>{
p 97t/a>       pta href="+code=mutex_lock" class="sref">mutex_lockt/a>(&ta href="+code=flash_mutex" class="sref">flash_mutext/a>);
p 98t/a>       pswitch (ta href="+code=cmd" class="sref">cmdt/a>) {
p 99t/a>       pcase ta href="+code=CMD_WRITE_DISABLE" class="sref">CMD_WRITE_DISABLEt/a>:
p100t/a>       p       pta href="+code=gbWriteBase64Enable" class="sref">gbWriteBase64Enablet/a> =p0;
p101t/a>       p       pta href="+code=gbWriteEnable" class="sref">gbWriteEnablet/a> =p0;
p102t/a>       p       pbreak;
p103t/a>
p104t/a>       pcase ta href="+code=CMD_WRITE_ENABLE" class="sref">CMD_WRITE_ENABLEt/a>:
p105t/a>       p       pta href="+code=gbWriteEnable" class="sref">gbWriteEnablet/a> =p1;
p106t/a>       p       pbreak;
p107t/a>
p108t/a>       pcase ta href="+code=CMD_WRITE_BASE64K_ENABLE" class="sref">CMD_WRITE_BASE64K_ENABLEt/a>:
p109t/a>       p       pta href="+code=gbWriteBase64Enable" class="sref">gbWriteBase64Enablet/a> =p1;
p110t/a>       p       pbreak;
p111t/a>
p112t/a>       pdefault:
p113t/a>       p       pta href="+code=gbWriteBase64Enable" class="sref">gbWriteBase64Enablet/a> =p0;
p114t/a>       p       pta href="+code=gbWriteEnable" class="sref">gbWriteEnablet/a> =p0;
p115t/a>       p       pta href="+code=mutex_unlock" class="sref">mutex_unlockt/a>(&ta href="+code=flash_mutex" class="sref">flash_mutext/a>);
p116t/a>       p       preturn -ta href="+code=EINVAL" class="sref">EINVALt/a>;
p117t/a>       p}
p118t/a>       pta href="+code=mutex_unlock" class="sref">mutex_unlockt/a>(&ta href="+code=flash_mutex" class="sref">flash_mutext/a>);
p119t/a>       preturn 0;
p120t/a>}
p121t/a>
p122t/a>staticpta href="+code=ssize_t" class="sref">ssize_tt/a> ta href="+code=flash_read" class="sref">flash_readt/a>(structpta href="+code=file" class="sref">filet/a>p*ta href="+code=file" class="sref">filet/a>, charpta href="+code=__user" class="sref">__usert/a> *ta href="+code=buf" class="sref">buft/a>, ta href="+code=size_t" class="sref">size_tt/a> ta href="+code=size" class="sref">sizet/a>,
p123t/a>       p       p p       pta href="+code=loff_t" class="sref">loff_tt/a> *ta href="+code=ppos" class="sref">ppost/a>)
p124t/a>{
p125t/a>       pta href="+code=ssize_t" class="sref">ssize_tt/a> ta href="+code=ret" class="sref">rett/a>;
p126t/a>
p127t/a>       pif (ta href="+code=flashdebug" class="sref">flashdebugt/a>)
p128t/a>       p       pta href="+code=printk" class="sref">printkt/a>(ta href="+code=KERN_DEBUG" class="sref">KERN_DEBUGt/a> tspa  class="string">"flash_read: flash_read: offset=0x%llx, "t/spa  
p129t/a>       p       p      ptspa  class="string">"buffer=%p, count=0x%zx.\n"t/spa  , *ta href="+code=ppos" class="sref">ppost/a>, ta href="+code=buf" class="sref">buft/a>, ta href="+code=size" class="sref">sizet/a>);
p130t/a>       ptspa  class="comment">/*t/spa  
p131t/a>tspa  class="comment">         * Welnow lock against reads and writes. --rmkt/spa  
p132t/a>tspa  class="comment">         */t/spa  
p133t/a>       pif (ta href="+code=mutex_lock_interruptible" class="sref">mutex_lock_interruptiblet/a>(&ta href="+code=nwflash_mutex" class="sref">nwflash_mutext/a>))
p134t/a>       p       preturn -ta href="+code=ERESTARTSYS" class="sref">ERESTARTSYSt/a>;
p135t/a>
p136t/a>       pta href="+code=ret" class="sref">rett/a> =pta href="+code=simple_read_from_buffer" class="sref">simple_read_from_buffert/a>(ta href="+code=buf" class="sref">buft/a>, ta href="+code=size" class="sref">sizet/a>, ta href="+code=ppos" class="sref">ppost/a>, (void *)ta href="+code=FLASH_BASE" class="sref">FLASH_BASEt/a>, ta href="+code=gbFlashSize" class="sref">gbFlashSizet/a>);
p137t/a>       pta href="+code=mutex_unlock" class="sref">mutex_unlockt/a>(&ta href="+code=nwflash_mutex" class="sref">nwflash_mutext/a>);
p138t/a>
p139t/a>       preturn ta href="+code=ret" class="sref">rett/a>;
p140t/a>}
p141t/a>
p142t/a>staticpta href="+code=ssize_t" class="sref">ssize_tt/a> ta href="+code=flash_write" class="sref">flash_writet/a>(structpta href="+code=file" class="sref">filet/a>p*ta href="+code=file" class="sref">filet/a>, const charpta href="+code=__user" class="sref">__usert/a> *ta href="+code=buf" class="sref">buft/a>,
p143t/a>       p       p p       p ta href="+code=size_t" class="sref">size_tt/a> ta href="+code=size" class="sref">sizet/a>,pta href="+code=loff_t" class="sref">loff_tt/a> * ta href="+code=ppos" class="sref">ppost/a>)
p144t/a>{
p145t/a>       punsigned longpta href="+code=p" class="sref">pt/a> =p*ta href="+code=ppos" class="sref">ppost/a>;
p146t/a>       punsigned intpta href="+code=count" class="sref">countt/a> =pta href="+code=size" class="sref">sizet/a>;
p147t/a>       pintpta href="+code=written" class="sref">writtent/a>;
p148t/a>       pintpta href="+code=nBlock" class="sref">nBlockt/a>,pta href="+code=temp" class="sref">tempt/a>,pta href="+code=rc" class="sref">rct/a>;
p149t/a>       pintpta href="+code=i" class="sref">it/a>,pta href="+code=j" class="sref">jt/a>;
p150t/a>
p151t/a>       pif (ta href="+code=flashdebug" class="sref">flashdebugt/a>)
p152t/a>       p       pta href="+code=printk" class="sref">printkt/a>(tspa  class="string">"flash_write: offset=0x%lX, buffer=0x%p, count=0x%X.\n"t/spa  ,
p153t/a>       p       p p     ta href="+code=p" class="sref">pt/a>, ta href="+code=buf" class="sref">buft/a>, ta href="+code=count" class="sref">countt/a>);
p154t/a>
p155t/a>       pif (!ta href="+code=gbWriteEnable" class="sref">gbWriteEnablet/a>)
p156t/a>       p       preturn -ta href="+code=EINVAL" class="sref">EINVALt/a>;
p157t/a>
p158t/a>       pif (ta href="+code=p" class="sref">pt/a> < 64 * 1024 && (!ta href="+code=gbWriteBase64Enable" class="sref">gbWriteBase64Enablet/a>))
p159t/a>       p       preturn -ta href="+code=EINVAL" class="sref">EINVALt/a>;
p160t/a>
p161t/a>       ptspa  class="comment">/*t/spa  
p162t/a>tspa  class="comment">         * check for out of range pos or countt/spa  
p163t/a>tspa  class="comment">         */t/spa  
p164t/a>       pif (ta href="+code=p" class="sref">pt/a> >=pta href="+code=gbFlashSize" class="sref">gbFlashSizet/a>)
p165t/a>       p       preturn ta href="+code=count" class="sref">countt/a> ? -ta href="+code=ENXIO" class="sref">ENXIOt/a> : 0;
p166t/a>
p167t/a>       pif (ta href="+code=count" class="sref">countt/a> >pta href="+code=gbFlashSize" class="sref">gbFlashSizet/a> - ta href="+code=p" class="sref">pt/a>)
p168t/a>       p       pta href="+code=count" class="sref">countt/a> =pta href="+code=gbFlashSize" class="sref">gbFlashSizet/a> - ta href="+code=p" class="sref">pt/a>;
p169t/a>       p       p      p 
p170t/a>       pif (!ta href="+code=access_ok" class="sref">access_okt/a>(ta href="+code=VERIFY_READ" class="sref">VERIFY_READt/a>, ta href="+code=buf" class="sref">buft/a>, ta href="+code=count" class="sref">countt/a>))
p171t/a>       p       preturn -ta href="+code=EFAULT" class="sref">EFAULTt/a>;
p172t/a>
p173t/a>       ptspa  class="comment">/*t/spa  
p174t/a>tspa  class="comment">         * Welnow lock against reads and writes. --rmkt/spa  
p175t/a>tspa  class="comment">         */t/spa  
p176t/a>       pif (ta href="+code=mutex_lock_interruptible" class="sref">mutex_lock_interruptiblet/a>(&ta href="+code=nwflash_mutex" class="sref">nwflash_mutext/a>))
p177t/a>       p       preturn -ta href="+code=ERESTARTSYS" class="sref">ERESTARTSYSt/a>;
p178t/a>
p179t/a>       pta href="+code=written" class="sref">writtent/a> =p0;
p180t/a>
p181t/a>       pta href="+code=nBlock" class="sref">nBlockt/a> =p(int) ta href="+code=p" class="sref">pt/a> >>p16; tspa  class="comment">//block # of 64K bytest/spa  
p182t/a>
p183t/a>       ptspa  class="comment">/*t/spa  
p184t/a>tspa  class="comment">         * # of 64K blocks to erase and writet/spa  
p185t/a>tspa  class="comment">         */t/spa  
p186t/a>       pta href="+code=temp" class="sref">tempt/a> =p((int) (ta href="+code=p" class="sref">pt/a> + ta href="+code=count" class="sref">countt/a>) >>p16) - ta href="+code=nBlock" class="sref">nBlockt/a> +p1;
p187t/a>
p188t/a>       ptspa  class="comment">/*t/spa  
p189t/a>tspa  class="comment">         * write ends at exactly 64k boundary?t/spa  
p19opta>tspa  class="comment">         */t/spa  
p191t/a>       pif (((int) (ta href="+code=p" class="sref">pt/a> + ta href="+code=count" class="sref">countt/a>) & 0xFFFF) == 0)
p192t/a>       p       pta href="+code=temp" class="sref">tempt/a> -=p1;
p193t/a>
p19erruptible" class="sref">mutex_lemprs/char/nwflash.c#L194" id3.L194" c38"6s/char/nwflash.c#L105" id3.L105" classsh_mutext/a>))
p115t/a>       p       pta href="+code=printk" class="sref">printkt/a>(ta href="+code=KERN_DEBUG" class="sref">KERN_DEBUGt/a> tspa  class="string">"flquot cl p, cod * # o(s)0x%llx, "t/spa  
p156t/a>     8">p188t/a>       ptspa  class="strstart cl wrip, codt=0x%zx.\n&quoBlockt/a>,pta href="+code=temp" class="sref">tempt/a>,pta href="+code=nBlock" class="sref">nBlockt/a>);
p187t/a>
p 98t   *(untt/a> >pta href="+code=temp" class="sreuntt/a> >pta href="+code=temp" class="sre--f">tempt/a>,pta href="+code=nBlock" class="sref"++ef">cmdt/a>) {
p169t/a>     ruptible" class="sref">mutex_lemprs/char/nwflash.c#L194" id3.L194" c38"6s/char/nwflash.c#L1052wflash.c#2100" id3.L100" class="li2e" na2v3.L100">p100t/a>     /a>       p       pta href="+code=printk" class="sref">printkt/a>(ta href="+code=KERN_DEBUG" class="sref">KERN_DEBUGt/a> tspa  class="string">"fl blo cl commenp, codt=0x%zx.\n&quoBlockt/a>,pta href="+code=nBlock" class="sref">nBlockt/a>);
p141t/a>
p102t/a>     /a>       ptspa  class="comment">/*t/spa  
p163t/a>tspa  class="commenttttttttt* first>//ihave 64K block Meg* # o(s), where>//if setquot;at offset 2...t/spa  
p184t/a>tspa  class="commenttttttttt*>         */t/spa  
p105t/a>       p       pta href="+code=i" class="writtent/a> =p0;
p106t/a>     ef">it/a>,pta href="+code=j" class="writtent/a> =p0;
p177t/aef">it/a>,pta hRetryef="+code=nBlock" clRetryef="+.L17   pdefault:
p168t/a>     dof">cmdt/a>) {
p109t/a>     >p177t/aef">it/a>,pta href="+code=rc" class="s">countt/a> =pta href="+code=erase_block" class="sref">eraseBlockt/a>,pta href="+code=nBlock" class="sref">nBlockt/a>);
p110t/a>     /a>       p       pta href="+code=i" class="++nBlockt/a>);
p171t/a>     } wh   peBlockt/a>,pta href="+code=rc" class="s" 64 * 1024   p       pta href="+code=i" class="wref">1inbt/a>(0x80);
p182t/a>
p113t/a>     ruptible" class="srref="+code=rc" class="sef">cmdt/a>) {
p114t/a>     /a>       p       pta href="+code=printk" class="sref">printkt/a>(ta href="ERR=KERN_DEBUG" class="ERR>KERN_DEBUGt/a> tspa  class="string">"fl bloel br  *p, cox=0x%zx.\n&quoBlockt/a>,pta href="+code=rc" class="sebt/a>(0x80);
p115t/a>               p       pbreak;
p116t/a>     0">p140t/a>}
p177t/a>     ruptible" class="sref">mutex_lemprs/char/nwflash.c#L194" id3.L194" c38"6s/char/nwflash.c#L1052wflash.c#2118" id3.L118" class="li2e" na213.L168">p168t/a>     /a>       p       pta href="+code=printk" class="sref">printkt/a>(ta href="+code=KERN_DEBUG" class="sref">KERN_DEBUGt/a> tspa  class="string">"flquot cl cnually: offset=x%llx, "t/spa  
p109t/a>     >p177t/aa>      DEBUGt/a> tspa  class="strirom=0x& , bufferk # o lefly: offunt=0x%X.\n&qu    p p     ta href="+code=p" class="sref">pt/a>, ta href="+code=buf" class="sreuot;t/spa  
p110t/a>     /a>     a>       p       pta href="+code=count" class="sref"t;>p16) - ta href="+code=written" class="sref">ebt/a>(0x80);
p121t/a>
p102t/a>     /a>       ptspa  class="comment">/*t/spa  
p163t/a>tspa  class="commenttttttttt* ass="sref">if setlimit>      64K">pce leflyink Mis ref">ermment">/*t/spa  
p184t/a>tspa  class="commenttttttttt*>         */t/spa  
p105t/a>       p       pta href="+code=rc" class="s">countt/a> =pta href="+code=write_block" class="sref">write   p p     ta href="+code=p" class="sref">pt/a>, ta href="+code=buf" class="sre   p       pta href="+code=count" class="sref"t;>p16) - ta href="+code=written" class="sref">ebt/a>(0x80);
p106t/a>     ef">it/a>,pta href="+code=j" class="++nBlockt/a>);
p187t/a>
p128t/a>      a>       ptspa  class="comment">/*t/spa  
p189t/a>tspa  class="commenttttttttt* commomehow>      a hify fa   d? Can: o9;t happen?4k boundary?t/spa  
p19opta>tspa  class="commenttttttttt*>         */t/spa  
p171t/a>     /a>       pif (!ta href="+code=rc" class="sef">cmdt/a>) {
p102t/a>     /a>      a>       ptspa  class="comment">/*t/spa  
p163t/a>tspa  class="commenttttttttttttttttt* retry up 64K10 tim of 64K bytest/spa  
p184t/a>tspa  class="commenttttttttttttttttt*>         */t/spa  
p115t/a>             ruptible" class="srref="+code=j" class="wref">1in  */t/spa  
p156t/a>     8">p188tttttttttgo64Kef">it/a>,pta hRetryef="+code=nBlock" clRetryef="+.L17nBlockt/a>);
p177t/a>             /a>       pelse
p168t/a>     /a>              a>       ptspa  class="comment">/*t/spa  
p189t/a>tspa  class="commenttttttttttttttttttttttttt* /a>  quit> ithl br  at offset 2...t/spa  
p19opta>tspa  class="commenttttttttttttttttttttttttt*>         */t/spa  
p171t/a>     /a>               p       pta href="+code=rc" class="s">c-empt/a> -=p1;
p182t/a>
p143t/a>     0">p140t/a>}
p114t/a>     ruptible" class="srref="+code=rc" class="swref">0ef">cmdt/a>) {
p115t/a>               p       pta href="+code=printk" class="sref">printkt/a>(ta href="ERR=KERN_DEBUG" class="ERR>KERN_DEBUGt/a> tspa  class="string">"fl       br  *p, coX=0x%zx.\n&quoBlockt/a>,pta href="+code=rc" class="sebt/a>(0x80);
p156t/a>     8">p188t  p       pbreak;
p177t/a>     0">p140t/a>}
p128t/a>       p       pta href="+code=p" class="sr>countt/a> =pta href="+code=rc" class="sref">rct/a>;
p109t/a>       p       pta href="+code=buf" class="srsr>countt/a> =pta href="+code=rc" class="sref">rct/a>;
p100t/a>       p       pta href="+code=written" class="sref">wr>countt/a> =pta href="+code=rc" class="sref">rct/a>;
p171t/a>     f">pt/a> =p*ta href="+code=ppos" class="srewr>countt/a> =pta href="+code=rc" class="sref">rct/a>;
p182t/a>
p153t/a>     ruptible" class="sref">mutex_lemprs/char/nwflash.c#L194" id3.L194" c38"6s/char/nwflash.c#L1052wflash.c#2154" id3.L154" class="li2e" na253.L114">p114t/a>     /a>       p       pta href="+code=printk" class="sref">printkt/a>(ta href="+code=KERN_DEBUG" class="sref">KERN_DEBUGt/a> tspa  class="string">"flquot"sr 7;p, courk # o OKnt=0x%X.\n&qu    p p     ta href="+code=written" class="sref">ebt/a>(0x80);
p155t0">p140t/a>}
p166t/a>
p137t/a>       pta href="+code=mutex_unlock" class="sref">mutex_unlockt/a>(&ta href="+code=nwflash_mutex" class="sref">nwflash_mutext/a>);
p178t/a>
p139t/a>       preturn ta href="+code=written" class="sref">writtent/a>;
p140t/a>}
p121t/a>
p182t/a>
p163t/a>tspa  class="comment">/*t/spa  
p184t/a>tspa  class=* The memory devic o uock Megfull 32/64 bits     Megcnuall,ks toso>//icannopos or countt/spa  
p 65t/a>tspa  class=">      elnow lonegat    valu secoweird,os or countt/spa  
p 66t/a>tspa  class=*  Mough,yink Matt/a>  (0) offset 2...t/spa  
p 66t/a>tspa  class=*offset 2...t/spa  
p 66t/a>tspa  class=* also>nopek Mattseek cl relatp189t/a>tspa  class=*    has>no mean cl,oso>it /a>   s -ass="s offset 2...t/spa  
p19opta>tspa  class=*>         */t/spa  
p142t/a>staticpta href="+code=loff_t" class="sref">ible" class="sref">m_llseeklemprs/char/nwflash._llseekutex__writet/a>(structpta href="+code=file" class="sref">filet/a>p*ta href="+code=file" class="sref"t/a>staticpta href="+code=loff_t" class="sref">ible" class="srcnuallcode=loff_t" clcnuall"sref"/a>       pintpta hori_lemprs/char/nwfori_4" id3.L194" c38"6s/char/nwflash.c#L1052wflash.c#2172" id3.L172" class="li2e" na2v3.L17">cmdt/a>) {
p173t//a>staticpta href="+code=loff_t" class="sref">ible" class="srref="+code=ret" class="sref">rett/a>;
p154t/a>
p125t/a>       pta href="+code=mutex_lock" class="sref">mutex_lockt/a>(&ta href="+code=flash_mutex" class="sref">flash_mutext/a>);
p176t/a>       pif (ta hef">mutex_lemprs/char/nwflash.c#L194" id3.L194" c38"6s/char/nwflash.c#L1052wflash.c#2177" id3.L177" class="li2e" na2v3.L177">p177t/a>       p       pta href="+code=printk" class="sref">printkt/a>(ta href="+code=KERN_DEBUG" class="sref">KERN_DEBUGt/a> tspa  class="string">&llseekflash_write: offX, ori_37;p, count=0x%X.\n"t/spa  ,
p 78t/a>            (/a>       put/a> =p(int) ta hcnuallcode=loff_t" clcnuall"sref"      pintpta hori_lemprs/char/nwfori_4" id_mutext/a>);
);
p 80t/a>       pswitch (ta hori_lemprs/char/nwfori_4" idf">cmdt/a>) {
p181t/a>  0   pdefault:
p102t/a>     /a>       pif (ta hcnuallcode=loff_t" clcnuall"srewref">0ef">cmdt/a>) {
p153t/a>       p    t/a>       pta href="+code=ret" class="sref"   preturn -ta href="+code=EINVAL" class="sref">EINVALt/a>;
p114t/a>     /a>       p       pbreak;
p115t/a>     0">p140t/a>}
p166t/a>
p177t/a>     rupt(/a>       put/a> =p(int) ta hcnuallcode=loff_t" clcnuall"sre">countt/a> >pta href="+code=gbFlashSize" class="sref">gbFlef">cmdt/a>) {
p168t/a>     /a>       p       pta href="+code=ret" class="sref"   preturn -ta href="+code=EINVAL" class="sref">EINVALt/a>;
p109t/a>     >p177t/a  p       pbreak;
p 90t/a>     0">p140t/a>}
p 91t/a>
p192t/a>       p       pta href="+code=file" class="sre->cou  p       pta hr_ef="+code=ppos" clr_ef=="sref"(/a>       put/a> =p(int) ta hcnuallcode=loff_t" clcnuall"sre     pbreak;
p113t/a>       p       pta href="+code=ret" class="sref">rett/a> =pta href="+code=file" class="sre->cou  p       pta hr_ef="+code=ppos" clr_ef=="sr     pbreak;
p114t/a>       p       pbreak;
p115t/a>  1   pdefault:
p156t/a>     rupt(  p       pta href="+code=file" class="sre->cou  p       pta hr_ef="+code=ppos" clr_ef=="sreref">pt/a> + ta hcnuallcode=loff_t" clcnuall"sre)">countt/a> >pta href="+code=gbFlashSize" class="sref">gbFlef">cmdt/a>) {
p177t/a>               p       pta href="+code=ret" class="sref"   preturn -ta href="+code=EINVAL" class="sref">EINVALt/a>;
p168t/a>     /a>       p       pbreak;
p169t/a>     0">p140t/a>}
p100t/a>     rupt(  p       pta href="+code=file" class="sre->cou  p       pta hr_ef="+code=ppos" clr_ef=="sreref">pt/a> + ta hcnuallcode=loff_t" clcnuall"sre)">ef">0ef">cmdt/a>) {
p101t/a>               p       pta href="+code=ret" class="sref"   preturn -ta href="+code=EINVAL" class="sref">EINVALt/a>;
p102t/a>     /a>       p       pbreak;
p143t/a>     0">p140t/a>}
p114t/a>       p       pta href="+code=file" class="sre->cou  p       pta hr_ef="+code=ppos" clr_ef=="srerf">rett/a> =pta hcnuallcode=loff_t" clcnuall"sre     pbreak;
p105t/a>       p       pta href="+code=ret" class="sref">rett/a> =pta href="+code=file" class="sre->cou  p       pta hr_ef="+code=ppos" clr_ef=="sr     pbreak;
p106t/a>       p       pbreak;
p177t       p       pbreak;
p128t/a>      a>       ptspa  class="comment">/*t/spa  
p171t/a>k;
p143t/a>    >nBlockt/3>);
p137t/a>       pta href="+code=mutex_unlock" clclass="sref">mutex_lockt/a>(&ta href="+code=flash_mutex" class="sref">fla3+nBlockt/3>);
p139t/a>       preturn ta href="+code=ret" class="3nbt/a>(0x30);
p143t/a>    >     pbre/a>
cmdt/a3) {
(0x30);
p163t/a>tspa  class="comm3      pbr3ak;
main href= rout"dr did=* alparrs/ter2e" naingttttttttttttttt* /a>  quit> ithl br  at offs3 0">p140t3a>}
p19opta>tspa  class=*>    3"t/s3a  
countt/a> =pta href=".L148" class="line" namv3.L148">p148t/a>       pin">mutex_lemprs/char/nwflash.c#L194"3ebt/a>(0x30);
ef">0e121">p1213/a>
p148t/a>c1    preturn ta href="+code=ret" class="3nt">/*t/s3a  
filet/a>,3href=Pt"    preturn ta href="+code=ret" class="3n">cmdt/a3a  
filet/a>,mentout    preturn ta href="+code=ret" class="3nbt/a>(0x3a  
,pta href="+cquoB1.L148">p148t/a>quoB1    preturn ta href="+code=ret" class="3n     pbr30);
);
p163t/a>tspa  class="comm3187">p1873/a>
p163t/a>tspa  class="comm31quot;t/s3a  
p19opta>tspa  class=*>    3ndary?t/s3a  
priCSR_ROMWRITEREca  
it/a>,pta href="+code=j" class="wr3    */t/s3a  
cmdt/a3) {
p163t/a>tspa  class="comm3nt">/*t/s3a  
p163t/a>tspa  class="comm3n">cmdt/a3a  
p19opta>tspa  class=*>    3nbt/a>(0x3a  
p148t/a>c1    sign(vopa  le3.L146" clode=class="line" namv3.L" class="sref">ppost/a>, (void *)ta hre + 0x800    pta href="+code=i" class="wref">13in  */t/s3a  
);
p139t/a>    kick_op13ref="   pta href="+code=i" class="wref">13i87">p1873lse
p188t/a>       ptspa  class="comm3nt">/*t/s3a  
tspa  c171"usclasolda> tsptttttttttttttttt* retry up 64K10 tim of 643t 2...t/s3a  
p19opta>tspa  class=*>    3    */t/s3a  
ppost/a>, (void *)ta hre + 0x800  it/a>,pta href="+code=j" class="wr3empt/a> -3p1;
p1823/a>
p188t/a>       ptspa  class="comm3 0">p140t3a>}
  quit> ithl br  at offs3f">cmdt/a3) {
  quit> ithl br  at offs3fn  */t/s30);
p19opta>tspa  class=*>    3 nBlockt/3ak;
filet/a>,3href=Pt"       pta hr_ef=ode=classpta hr_ef="+cods="line" namv3.L" class="sref">ppost/a>, (void *)ta hre + 0x800  + "+code=erase_block" class="sref">eraseBlockt/a> ta hible" 6))   pta href="+code=i" class="wref">13 0">p140t3a>}
p188t/a>       ptspa  class="comm3sref">rct3a>;
tdummy  cla2e" na2v3.L163">p163t/a>tspa  class="comm3sref">rct3a>;
p19opta>tspa  class=*>    3sref">rct3a>;
p148t/a>c1    signass="li2e" na253href=Pt"sref">filet/a>,3href=Pt"    preturn ta href="+code=ret" class="3sref">rct3a>;
p1823/a>
p139t/a>    kick_op13ref="   pta href="+code=i" class="wref">13id3.L194"3c38"6s/char/nwflash.c#L1352wfl3sh.c#2154" id3.L188" class="line" namv3.L188">p188t/a>       ptspa  class="comm3ebt/a>(0x30);
p188t/a>       ptspa  class="comm3en  */t/s3a>}
p19opta>tspa  class=*>    3166">p1663/a>
filet/a>,3href=Pt"       0x2">it/a>,pta href="+code=j" class="wr3h_mutext/3>);
p1783/a>
p188t/a>       ptspa  class="comm3>writtent3a>;
p188t/a>       ptspa  class="comm3>ref">rct3a>}
p19opta>tspa  class=*>    3121">p1213/a>
filet/a>,3href=Pt"       0xD">it/a>,pta href="+code=j" class="wr3182">p1823/a>
/*t/s3a  
p188t/a>       ptspa  class="comm3 countt/s3a  
p19opta>tspa  class=*>    3166">p1663a  
13t 2...t/s3a  
p188t/a>       ptspa  class="comm3t 2...t/s3a  
p163t/a>tspa  class="comm3    */t/s3a  
p19opta>tspa  class=*>    3id3.L194"3c38"6s/char/nwflash.c#L1352wfl372.c#2157" id3.L157" class="lmentoutsref">filet/a>,mentout           pta href="+jiffiee" class="sre->cjiffiee hre + com*     pta href="+HZ" class="sre->cHZ    preturn ta href="+code=ret" class="37">cmdt/a3) {
p148t/a>c1    sig">it/a>,pta href="+code=j" class="wr3ref">rett3a>;
p148t/a>c1    s+ ta hre80)lockt/a>,pta href="+code=rcment_before=ret" class="srment_beforeref="    pta href="+jiffiee" class="sre->cjiffiee hret/a>,pta href="+cqentoutsref">filet/a>,mentout    )uallcode=loff_t" clcnuall"sre)">ef">0e154">p1543/a>
13h_mutext/3>);
p188t/a>       ptspa  class="comm3t66">p1663c38"6s/char/nwflash.c#L1352wfl37h.c#2167" id3.L167" class="lllllllllllllllll*  cla any>tspa  c3.L188">p188t/a>       ptspa  class="comm3t 2...t/s3  ,
p19opta>tspa  class=*>    3i 2...t/s3>);
p148t/a>c1    sign(vopa  le3.L146" clode=class="line" namv3.L3href=Pt"sref">filet/a>,3href=Pt"       pta href="+code=i" class="wref">1317mutext/3>);
&llseekflas,c1)"flquot cl cnually: offset=x%llx,3f">cmdt/a3) {
p143t/a>    0   pdefa3lt:
cmdt/a3) {
p183t/a>       ptspa  class="comm3">EINVALt3a>;
p183t/a>       ptspa  class="comm3"54">p1543ak;
p185t/a>tspa  class="comment">    3 0">p140t3a>}
p139t/a>    kick_op13ref="   pta href="+code=i" class="wref">13166">p1663/a>
filet/a>,3href=Pt"       0xFF&" clL188" class="line" nam/backss="normal op1ra  onquot;flquot cl cnually: offset=x%llx,3f 2...t/s3a>;
p183t/a>       ptspa  class="comm3 0">p140t3a>}
 tspssesrlone0xŵ.L183">p183t/a>       ptspa  class="comm3    pdefa3/a>
p185t/a>tspa  class="comment">    3e     pbr3ak;
p148t/a>c1    s+ ta hre2nuallcode=loff_t" clcnuall"sre)">ef">0er     pbr3ak;
printkt/a>(ta href="ERR=KERN_DEBUG" class="ERR>  cla:c> t8t/a>    ptrirom=0x& , bufferk # o lefly: ohref=Pt"sref">filet/a>,3href=Pt"       pta href="+code=i" class="wref">13      pbr3ak;
13 0">p140t3lt:
p183t/a>       ptspa  class="comm3 66">p1663) {
p183t/a>       ptspa  class="comm3  2...t/s3a>;
p19opta>tspa  class=*>    3      pbr3ak;
ppost/a>, (void *)ta hre + 0x800  it/a>,pta href="+code=j" class="wr4 0">p140t4a>}
it/a>,pta href="+code=j" class="wr4 1">p140t4a>}
p143t/a>   4">EINVALt4a>;
p183t/a>       ptspa  class="comm4 0">p140t4a>}
  quit> ithl br  at offs4e     pbr4ak;
p185t/a>tspa  class="comment">    4r     pbr4ak;
14      pbr4ak;
p128t/a>.L137" class="l3href=Pt"sref">filet/a>,3href=Pt"       pta hr_ef=ode=classpta hr_ef="+cods="line" namv3.L" class="sref">ppost/a>, (void *)ta hre + "+code=erase_block" class="sref">eraseBlockt/a> ta hible" 6))   pta href="+code=i" class="wref">141">p171t/4>k;
nBlockt/4>);
="line" namv3.L1 codt=0x%zx.\n&quoBlocktible" 62*a1024>="line" namv3.L1 codt=0x%zx.\n&quoBlock++fferk # o lefly: ohref=Pt"sref">filet/a>,3href=Pt"       p4uallcode=loff_t" clcnuall"sre)">ef">04+nBlockt/4>);
p148t/a>quoB1    sign(vopa  le3.L146" class=las.L137" class="l3href=Pt"sref">filet/a>,3href=Pt"    ) !  0xFFFFFFFFuallcode=loff_t" clcnuall"sre)">ef">04+>EINVALt40);
printkt/a>(ta href="ERR=KERN_DEBUG" class="ERR>  cla:cs="comm> t8t/a>    psig  class="string">"lcode=loff_t" clcnuall"sre)">ef">04+     pbr4/a>
filet/a>,3href=Pt"    t/a>,pta href="+cquoB1.L148">p148t/a>quoB1       pta href="+code=i" class="wref">14f">cmdt/a4) {
c4ebt/a>(0x40);
p143t/a>   4      pbr4ak;
p143t/a>   4      pbr4a>}
it/a>,pta href="+code=j" class="wr4"t/s4a  
(0x40);
p1214/a>
p183t/a>       ptspa  class="comm4nt">/*t/s4a  
if setlimit>      64K">pce leflyink Mis ref">ermm4n">cmdt/a4a  
p185t/a>tspa  class="comment">    4nbt/a>(0x4a  
countt/a> =pta href=".L145" class="line" namv3.L14ck" class="sref">write coL65"ode=cline" namv3.L14__use"sref">filet/a>,__use".c#21nass="li2e" na25ef="+code=p" class="sref">pass="line" namv3.L14code=buf" class="sre   p    ">mutex_lemprs/char/nwflash.c#L194"4n     pbr40);
ef">04+nBlockt/4>);
p148t/a>c1    preturn ta href="+code=ret" class="4187">p1874/a>
p148t/a>c2    preturn ta href="+code=ret" class="41quot;t/s4a  
filet/a>,3href=Pt"    preturn ta href="+code=ret" class="4ndary?t/s4a  
filet/a>,uAspa  c    preturn ta href="+code=ret" class="4nbt/a>(0x4a  
rett/a> =pta hcnuallcode=loff_t" clcnuall"s4f">cmdt/a4) {
filet/a>,mentout    preturn ta href="+code=ret" class="4nt">/*t/s4a  
p148t/a>qentout1    preturn ta href="+code=ret" class="4n">cmdt/a4a  
(0x4a  
filet/a>,3href=Pt"       pta hr_ef=ode=classpta hr_ef="+cods="line" namv3.L" class="sref">ppost/a>, (void *)ta hre + line" namv3.L14ck" class="sref">writ)   pta href="+code=i" class="wref">14in  */t/s4a  
);
p163t/a>tspa  class="comm4i87">p1874lse
if setli.ntttttttttttttt* /a>  quit> ithl br  at offs4nt">/*t/s4a  
3.L185">p185t/a>tspa  class="comment">    4t 2...t/s4a  
p128t/a>     + ta hreFFFF  pta href="+code=i" class="wref">14    */t/s4a  
 -4p1;
p102t/a>     /a>       pif + line" namv3.L14+code=buf" class="sre   p     ta hc0x1000  121" id3.L121" class="li2e" na2v3.4et">/*t/s4/a>
rett/a> =pta hcnuallcode=loff_t" clcnuall"s4 0">p140t4a>}
cmdt/a4) {
p163t/a>tspa  class="comm4fn  */t/s40);
if setlimit>      64K">pce leflyink Mis ref">ermm4 nBlockt/4ak;
p185t/a>tspa  class="comment">    4t87">p1874a>}
p128t/a>.L137" class="lmentoutsref">filet/a>,mentout           pta href="+jiffiee" class="sre->cjiffiee hre + 3om*     pta href="+HZ" class="sre->cHZ    preturn ta href="+code=ret" class="4sref">rct4a>;
rct4a>;
       put/a> =p(int)  ">="line" namv3.L1102">p102t/a>     /a>       pif (ta hline" namv3.L14+code=buf" class="sre   p    >="line" namv3.L1102">p102t/a>     /a>       pif++fferk # o lefly: ohref=Pt"sref">filet/a>,3href=Pt"    ++uallcode=loff_t" clcnuall"sre)">ef">04sref">rct4a>;
filet/a>,uAspa  c       pta hr_ef="+code=ppos" clr_ef=3href=Pt"sref">filet/a>,3href=Pt"    preturn ta href="+code=ret" class="4sref">rct4a>;
filet/a>,uAspa  c     + ta   0xFFFFFFFCpreturn ta href="+code=ret" class="4st">/*t/s4/a>
filet/a>,__get_use"     pta href="+code42.L148">p148t/a>c2    fferk # o lefly: 43.L109">p109t/a>       p   pta hr_ef="+code=ppos" clr_ef=="sreref">pt/a> + 121" id3.L121" class="li2e" na2v3.4id3.L194"4c38"6s/char/nwflash.c#L1452wfl4sh.c#2154" id3.L154" class="li.L139" -pta hr_ef="+codEFAULT" clr_ef=="srerEFAULT    preturn ta href="+code=ret" class="4s">cmdt/a40);
14en  */t/s4a>}
p177t     4166">p1664/a>
p163t/a>tspa  class="comm4h_mutext/4>);
p163t/a>tspa  class="comm4178">p1784/a>
3.L185">p185t/a>tspa  class="comment">    4>writtent4a>;
p148t/a>c1    sign(vopa  le3.L146" clode=class="line" namv3.L" class="sref">ppost/a>, (void *)ta hre + 0x800    pta href="+code=i" class="wref">14>ref">rct4a>}
p1214/a>
p163t/a>tspa  class="comm4182">p1824/a>
p188t/a>       ptspa  class="comm4nt">/*t/s4a  
3.L185">p185t/a>tspa  class="comment">    4>">cmdt/a4a  
p139t/a>    kick_op13ref="   pta href="+code=i" class="wref">14 countt/s4a  
p1664a  
p163t/a>tspa  class="comm4t 2...t/s4a  
p163t/a>tspa  class="comm4t78">p1784a  
3.L185">p185t/a>tspa  class="comment">    4t 2...t/s4a  
priCSR_ROMWRITEREca  
filet/a>,3href=Pt"     + ta h3  pta href="+code=i" class="wref">14    */t/s4a  
p163t/a>tspa  class="comm47">cmdt/a4) {
p163t/a>tspa  class="comm4ref">rett4a>;
3.L185">p185t/a>tspa  class="comment">    4154">p1544/a>
filet/a>,uAspa  c     it/a>,pta href="+code=j" class="wr4h_mutext/4>);
p1664c38"6s/char/nwflash.c#L1452wfl4sh.c#2177" id3.L177" cl65" id3.L165" class="li2e" na2v3.L163">p163t/a>tspa  class="comm47 2...t/s4  ,
p163t/a>tspa  class="comm4778">p1784>);
3.L185">p185t/a>tspa  class="comment">    417mutext/4>);
filet/a>,uAspa  c     p148t/a>c2    preturn ta href="+code=ret" class="4f">cmdt/a4) {
p163t/a>tspa  class="comm4f">cmdt/a4) {
p163t/a>tspa  class="comm4fef">rett4a>;
3.L185">p185t/a>tspa  class="comment">    4154">p1544ak;
ppost/a>, (void *)ta hre + 0x1000  it/a>,pta href="+code=j" class="wr4 0">p140t4a>}
p1664/a>
p148t/a>c1    sig">it/a>,pta href="+code=j" class="wr4  2...t/s4) {
     >p177t/a  p spa  class="comm4f">cmdt/a4) {
p149BUGt/a> in pro pif ptass="comsec)2e" class="coe leflyink 1s ref">ermm4 nByp1784>);
 tspssesrlone0xŵ.L183">p183  4154">p1544ak;
p142t/a>       p       pta href="+code=ff="+code=ret" class="4n">cmdt/a4a  re + com*     pta href="+HZ" class="sre->cHZ    preturnta href="+code=ret" class="4sref">rct4a>;
4148t/493a  
cmdt/a4) {
13 4">p1449t/a>tspa  class="comment">    4r     class="coeta hrnot8">p1y/*t/s4a  
if setlimit>      64K">  4154">p1544ak;
filet/a>,mentout    )uallcode=loff_t" clcnue=ret" class="4n">cmdt/a4a  8"6s/char/nwflash.c#L1452wfl4sh.c#2158" id3.L148" class="llllllllli2e" 4a2i2e48t/a>     /a>       p       pble3.L146" clode=class="line" namv3.L" class="sref">ppost/a>, (void *)ta hre + 0x800    pta href="+code=i" class="wref">14>ref">rct4a>}
;
it/a>,pta 5ref="5code=j" class="wr4 1">apa  class="comm4f">cmdt/a4) {
p1435/a>  50Gt/a> tspssesrlone0xŵ.L183">p183  4154">pt_us">cmdt/omm4tt/a>ef">rett4a>;
tspa  class="comment">    3e      4154">p1544ak;
p153t/a>     0">p140t/a>}_use"     pta href=e->cjafter_eqfiee" class="sre->cjafter_eq hret/a>,pta href="+cqentoutsref">filet/a>,mentout    )uallcode=loff_t" clcnue=ret" class="4n">cmdt/a4a  8";
14 countt/s4a  
p155t/a>       p       pt"wr4 1">apa  class="comm4f">cmdt/a4) {
if setlimit>      64K">  4154">  4154">ptomm3  2../a4) {
p183t/a>       ptspa  class=  4154">p1544ak;
file5t">/*t/spa  
ps="sref">ppost/a>, (void *)ta hre + 0x800  it/a>,pta href="+code=j" class="wr4 0">p140t4a>}
5Block5/4>);
>>>>>>>>gonk yh.c2class="li3pta h303.L177">p177t     4166">p1664/a>
p148t/a>quoB1    
               p apa  class="comm4f">cmdt/a4) {
p163t/a>tspa  class="coswitch oncomm3"54">p1, as a    pbre   ptsp,3f 2...t m"li/a4) {
p185t/a>tspa  class="comment">    4154">p1544ak;
p153t/a>   4      pbr4ak;le3.L146" clode="+code=i" class="wref">14 countt/s4a  
p1435/a>  5183">p183t/a>       ptspa  class="comm3 66">p1663) {
tspa  class="coomm3"54">p1543ak;
it/a>,pta href="+co5e=j" 5opta>tspa  class=*>    3"ment">    4154">p1544ak;
ppost/a>, (void *)ta hre + 0x800  it/a>,pta href="+code=j" class="wr4 0">p140t4a  
50x40);p152>filet/a>,uAspa  c    pa  class="comm3 66">p1663) {
p1835/a>  5    ptspa  class="comm4nt">/t/a>tspa  class="co_usa3/dwaomm3    ps an 2...t78">pt/a, andrnot8">cmdt/o- 663) {
p1855/a>ts5a  class="comment">    4nbt/ament">    4154">p1544ak;
   4      pbr4ak;re2nuallcode=loff_t" clcnuall"sre)">ef">0er     pbr1ak;
ef">045nBloc5283">p183t/a>       ptpa  c    e3.L146" clode="+code=i" class="wref">14 countt/s4a  
               p pa  c    pa  class="comm3 66">p1663) {
tspa  class="coomm3  2../a4) {
p19opta>tspa  class=*>    3ndaryment">    4154">p1544ak;
>>>>>>>>ps="sref">ppost/a>, (void *)ta hre + 0x800  it/a>,pta href="+code=j" class="wr4 0">p140t4a>}
               p       ptapa  class="comm3 66">p1663) {
p163t/a>tspa  cla/a>tspa  class="coiffiee8">cmdt/?663) {
(5190">p19opta>tspa  class=*>    3nbt/ament">    4154">p1544ak;
file53t/a>       p       pt"wr4 1">_use"     pta href=e->cj="+jiffiee" class="sre->cjiffiee hret/a>,pta href="+cqentoutsref">filet/a>,mentout    )uallcode=loff_t" clcnu=ret" class="4n">cmdt/4a  8";
p183t/a>       ptpa  c   "wr4 1">_use"     pta href=l4sh.debug=ret" class="4nl4sh.debug4a  8               p pa  c                       + ta h3  ptaintk" class="sref">printkt/a>(ta href="ERR=KERN_DEBDEBU+code=ppos" clr_N_DEBDEBU+/a>  t8t/a>    psig  class="striclass="sref: >p166t/a>m4ref"att4a">ef">)4+     pbr4/a>
/*t/spa  
a  c                       + ta h3  pta href="+code=i" class="wref">14    */pta hcnuallcode=lit/a>,pta href="+code=j" class= 
3.L155">p1534>);
>>>>>>>>         pa  class="comm3 66">p1663) {
54Gt/a> tspssesrlone0xŵ.L183">p183  4154">>>>>>>>>>>>>>>>>coe lefcoup">ptt/s3a  
p1025/a>  54   ptspa  class="comm4nt">/t/a>tspa  class=">>>>>>>>>>>>>>>>c1544ak;
14      pbr4ak;
cmdt5a4) {
       p       pt"wr4 1">>>>>>>>>gonk yh.c2class="li3pta h303.L177">p177t     4166">p1664/a>
p183t/a>       ptpa  c   } else;
p154t/a>               p pa  c               + ta h3  ptaintk" class="sref">printkt/a>(ta href="ERR=KERN_DEBUG" class="ERR>  cla:cs="comm> t8t/a>    psig  class="striclass="sref: ">cmdt/oatt4a">ef">04+     pbr4/a>
5ilet/54">/*t/spa  
a  c               + ta h3  pta href="+code=i" class="wref">14    */pta hcnuallcode=lit/a>,pta href="+code=j" class= 
r54s="line" namv3.L" cla>a  c            pa  class="comm3 66">p1663) {
   5190">p19opta>tspa  class=*>    3sref"""""""""""""""""""""""""*LT    pr2...t7-2663) {
 tspssesrlone0xŵ.L183">p183  4154">>>>>>>>>>>>>>>>>c1544ak;
filet/a>,uAspa  c                   p140t4a>}
14e5  */t55t/a>   4      pbr4ak;
}
14      pbr4ak;
3.554>);
p156/a> =p(int)      pta href="+=ode=classpta hr_ef="+cods="line" namv3.L" class="sref">ppost/a>, (void *)ta hre + line" namv3.L14ck" class="sref">writ)   pta href="+code=i" class="wref">14in  */t/s4a  
p1514/a>
pnt)  ">="line" namv3.L1102">p102t/a>     /a>       pif (ta hline" namv3.L14+code=buf" class="sre   p    >="line" namv3.L1102">p102t/a>     /a>       pif++fferk # o lefly: ohref=Pt"sref">filet/a>,3href=Pt";
     /a>   t    )uallcode=loff_t" class="4187">p1874/a>
3.56codEFAULT" clr_ef=="s_use"     pta href="+code42.L148">p148t/a>c2    fferk # o lefly: 43.L109">p2t/a>     /a>   t    )uallcode=loff_t" clr_ef=="sreref">pt/a> 8"6s/char/nwflash.c#L1452wfl4sh.c#2155" id3.L155" class="li3e" na3kick_5p139"5p139t/a>    kick_op13r        p140t4a>uallcode=loff_tcode=ret" class="4s">cmdt/a40);
p15683">p183t/a>       ptsallcode=loff_t" clr_ef=="sreref">pt/a> ++
p163t/a>tsign(vopa  le3.L146"t"sref">filet/a>,3href=Pt"    preturn ta href="+code=ret" class="3sref">rct3a>;Pt";!a href="+code=ret"2t/a>     /a>   t   ";
     /a>       p       pble3.L146" clodeaintk" class="sref">printkt/a>(ta href="ERR=KERN_DEBUG" class="ERR>  cla:cs="comm> t8t/a>    psig  class="striclass="sref: v=loff_t" oroatt4a">ef"> (">ef"02X!=">ef"02X)04+     pbr4/a>
3.56s="line" namv3.L" cla>a  c              + ta h3  pta href="+code=i" class="wref">14    */pta hcnuallcode=lit/a>,pta href="+code=j" class= )uallcode=loff_t" class="4187">p1874/a> )uallcode=loff_t"2t/a>     /a>   t   "
priCSR        p140t4a}
p148t/a>quoB1    
p
3.548t/a>c1    s+p140t4ane" namv3.L1102">p102t/a>     /a>       pif++p1564c38"6s/char/nwflash.c#L1452wfl4sh.c#2157" id3.L157" cl65" id3.L165" class5"li2e574c38"6s/char/nwflash.c#L1452wfl4sh.c#2158" id3.L158" class="llllllllli2e" 5a2i d5taass=untt/a>void  e3.L146" clode="+code=i" class="wref">14 countt/s4a void"6s/char/nwflash.c#L1452wfl4sh.c#2159" id3.L159" class="li2e" na2lllll5ll>3.5185">p
filet/a>,uAspa  t1    preturn ta hrel4sgutsref">filet/a>l4sgupif++p pa  class="comm3 66">p1663) {
p163t/a>tspa * we wantm4778">p1 a bit pattet4aXXX1m477Xilllxm477enabli/a4) {
3.53.L9normal  cla a  pif3.L183">p183t/a> ="comm4nt">/*t,  tacht> ithbe classnt) abdt/o="conext 2mst/s4a  
tspa  class="comment">    3 0">p140t3a>}
p15    kick_op13ref="   pta hrefraw_spin_sref_irqsavffiee" class="srraw_spin_sref_irqsavf/s4a      ef="   pta hrefnw_gpio_ href="+code=i" clasw_gpio_ hre4/a> )uallcode=loff_tl4sgutsref">filet/a>l4sgupif+"
p158t/a>c1    sigef="   pta hrefnw_cpld_modofff="+code=i" clasw_cpld_modoff/a>(ta href="ERR=KERCPLD_code=jWR_ENABLt/a>,pta href="+CPLD_code=jWR_ENABLt4/a> )uallcode=loff_tCPLD_code=jWR_ENABLt/a>,pta href="+CPLD_code=jWR_ENABLt4/a>"
 )uallcode=loff_tl4sgutsref">filet/a>l4sgupif+"
p153t/a>       ptspa  class="comm3 0">p140t3a>}
 tspssesrlone0xŵ.L183">p183t/l3  tspaISA busm477catch on/*t/s4a  
p155t/a>tspa  class="comment">    3e     pbr3ak;
5148t/5>c1    s+ ta huallcode=loff_tudelaff="+code=i" claudelaf/s4a 25"
13 5">p145t3lt:
cse".cg  ucpta hcnuallcode=lfile_,3f 2...tutsref">filet/a>lile_,3f 2...tuomm> t     pta href=l4sh._foputsref">filet/a>l4sh._fopuref=Pt     /a> .ferk # o lefly: wn.L148">p148t/a>c2 wn.L8">p148t/a>quoa href="+code=retTHIS_MODULt/a>,pta href="+THIS_MODULt4/a> p148t/a>qua href="+code=retl4sh._llseeef="+code=i" clal4sh._llseee4/a> it/a>,pta 6ref="6code=j" class=.ferk # o lefly:omm3fiee" class="srr>p178>p148t/a>quoBa href="+code=retl4sh._omm3fiee" class="srl4sh._omm34/a>   64">EINVALt4a>;.ferk # o lefly:mm4ntfiee" class="sr8">p178>p148t/a>quoa href="+code=retl4sh._mm4ntfiee" class="srl4sh._mm4nt4/a> EINVALt4a>;.ferk # o lefly:unsrefed_ioctlf="+code=i" claunsrefed_ioctlref=Pt"href="+code=retl4sh._ioctlf="+code=i" clal4sh._ioctl4/a> 63">p163t/a> }
p160s">countt/a>g  ucpta hcnuallcode=lmiscdevictfiee" class="srmiscdevictomm> t     pta href=l4sh._miscdevf="+code=i" clal4sh._miscdevref=Pt);
 file6/a>,3href=Pt"  8t/a>    psig  class="striwfl4sh.+     pbr4/a>
6Block60s="line" namv     ef="   pta hrefl4sh._foputsref">filet/a>l4sh._fopuref= untt/a> =pta href=".L145" __ini02t/a>     /a>  __ini0omm> t     pta href=wfl4sh._ini02t/a>     /a>  wfl4sh._ini0/s4a void"6s/char/nwflash.c#L1452wfl4sh.c#2163" id3.L163" cL132" class="li2L1376 clas61c171"
filetr      pif>uallcode=loff_tcNODEVet" class="4s">cNODEVpif++p1613lt:
p1436/a>  6183">p183t/a> _use"     pta href=mach3.L_is_netwind.L148">p148t/a>c2mach3.L_is_netwind.L/s4a 8";
p163t/a>ts=pta href=".L145" i3fiee" class="sridpif++it/a>,pta href="+co6e=j" 6140ref="drivers/cha4/2wfl4sh.c#2186" id365" id3.L169" class="li2e" na2v3.4r6uot;t61s="line" namv3.L" claa hre + line" namv3.L14ck" class="sref">writ)   pta hret"href="+code=retiorema="wref">14in  */iorema=/a>(ta href="ERR=KERDC21285_code="wref">14in  */DC21285_code=4/a> )uallcode=loff_tKwrit) SIZE4"wref">14in  */Kwrit) SIZE4pif+"
62REclass="sref">priCSR_use!a hre + line" namv3.L14ck" class="sref">writ)   pta hr"6s/char/nwflash.c#L1452wfl4sh.c#2160" id3.L161" class="li2e" na2v3.4161">p162>filet/a>,uAspa  c           gonk yh.c2class="li3cnu=ret" class="4nt/s4a  
p1836/a>  6    ptp1856/a>ts62codEFAULT" clr_ef=="s_useta href="ERR=KERi3fiee" class="sridpif+e!a href="+code=retKwrit) ID"wref">14in  */Kwrit) IDt   ";"srment_befta href="ERR=KERi3fiee" class="sridpif+e!a href="+code=retKwrit) ID4"wref">14in  */Kwrit) ID4/a> 8";
   4      pbr4ak;    =c0x1000    pta hreref=Pt"sref">filetr      pif>uallcode=loff_tcNXIOet" class="4s">cNXIO4a  
ef">046nBloc6283">p183t/a>       ptpa  c    e3.L146" clodeiounma="wref">14in  */iounma=/s4a  void *)a hre + line" namv3.L14ck" class="sref">writ)   pta hr"
               p pa  c    e3.L146" clodeaintk" class="sref">printkt/a>(ta8t/a>    psig  class="striF433.:ts=  class=IDt4a">ef"04X.04+     pbr4/a>
x1000    pta hrei3fiee" class="sridpif+"
     /a>       p       pbgonk yh.c2class="li3cnu=ret" class="4nt/s4a  
filet/a>,uAspa  c       pta hr_ef="aintk" class="sref">printkt/a>(ta8t/a>    psig  class="striF433. ROM rivers v.">ef"s,   ptspdevict=IDt4a">ef"04X, size ">ef"d Mb.04+     pbr4/a>
               p       p    pta hr_ef="NWwrit) VERSION class="sref">pNWwrit) VERSION4/a> )uallcode=loff_ti3fiee" class="sridpif+ )uallcode=loff_tgbF433.Sizefiee" class="sr bF433.Size/a>  / (1024 * 1024  
(63           p       pta000    pta hreref=Pt"sref">filetr      pifa hcnuallcode=lmisc_regist.L148">p148t/a>c2misc_regist.L/s4a      ef="   pta hrefl4sh._miscdevf="+code=i" clal4sh._miscdevref= 
file63t/a>       p       pt_use"     pta href=ref=Pt"sref">filetr      p>="liak;
p183t/a>       ptpa  c    e3.L146" clodeiounma="wref">14in  */iounma=/s4a  void *)a hre + line" namv3.L14ck" class="sref">writ)   pta hr"
               p 
/*t/spa  
<
3.L165">p165t/a>tsh.c2class="li3cnu=ret" class="4nt/s4a  
filetr      
64Gt/a>
p1026/a>  64   pt     /a>  __exi0omm> t     pta href=wfl4sh._exi02t/a>     /a>  wfl4sh._exi0/s4a void"6s/char/nwflash.c#L1452wfl4sh.c#2164" id3.L164" class="li2e" na273.4f6>cmdt6a4) {

p163t/a>ts hcnuallcode=lmisc_deregist.L148">p148t/a>c2misc_deregist.L/s4a      ef="   pta hrefl4sh._miscdevf="+code=i" clal4sh._miscdevref= 
14in  */iounma=/s4a  void *)a hre + line" namv3.L14ck" class="sref">writ)   pta hr"
p164t/a> 
6ilet/6440ref="drivers/cha4/2wfl4sh.c#2186" id369" id3.L169" class="li2e" na2v3.4s6ef">r64t/a>tsh.c2class="li3MODULt_LICENck" class="sref">MODULt_LICENck/a>(ta8t/a>    psig  class="striGPL+     pbr4/a>"
   65x40);  hcnuallcode=lmodule_param148">p148t/a>c2module_param/a>(ta href="ERR=KERl44h.debug=ret" class="4nl4sh.debug4a   )uallcode=loff_t"oolf="+code=i" cla"ool4a   )06a4"
     /a>  module_ini0/a>(ta href="ERR=KERwfl4sh._ini02t/a>     /a>  wfl4sh._ini0/s4a"
     /a>  module_exi0/a>(ta href="ERR=KERwfl4sh._exi02t/a>     /a>  wfl4sh._exi0/s4a"
14e6  */t65t/a> 
The original LXR softwaommby tspaa href="dhttp://sourcffiege.net/projects/lxL1>LXR ommeuni0y4a )mm4 nexperient"al ers/..t by a href="dmailto:lxL@ss=ux.no">lxL@ss=ux.no4a . lxL.ss=ux.no kindly host.d by a href="dhttp://www.redpill-ss=pro.no">Redpill Ls=pro AS4a )provider of Ls=ux>cse"ultt/a>andr,3f 2...tu servictu sinct=1995.