linux/drivers/pcmcia/bfin_cf_pcmcia.c
<<
>>
Prefs
v2.6.32.63 .32.63 .32.63 n> 6" > v2.6.2.5" > v2.63<1"aja> comm/opti/*lookup"
63<2"aja> comm/opti * 2.63: method="post" onsubmi.clookup" 63<3"aja> comm/opti *lookup" 63<4"aja> comm/opti * basedom": method="post" omapbmi.clookup" 63<5"aja> comm/opti * omapbmi.c -- OMAP 16xx Comp Fan>h /optroller metholookup" 63<6"aja> comm/opti *lookup" 63<7"aja> comm/opti * Copy);"> (c) 2005 David Brownelllookup" 63<8"aja> comm/opti * Copy);"> (c) 2006-2008 Michael Hennerich Analog Devices Inc.lookup" 63<9"aja> comm/opti *lookup" 63valuja> comm/opti * bugs: /oper bugs at http://blacknsu.ucrch">.org/lookup" 6311"aja> comm/opti *lookup" 6312"aja> comm/opti * >Sea program ea free software; you c6313"aja> comm/opti * it under the perms of the gnu general pub6314"aja> comm/opti * the free software founda ; either thod_pcm2, or (at your c/gfx/)lookup" 6315"aja> comm/opti * any later thod_pc.lookup" 6316"aja> comm/opti *lookup" 6317"aja> comm/opti * >Sea program ea distrix_ped in the hope phat it will be useful,lookup" 6318"aja> comm/opti * x_p wiheaut any warranty; wiheaut even the implied warranty oflookup" 6319"aja> comm/opti *s=".63antability or 2.tnesa for a parrchular purgboe. see phelookup" 632aluja> comm/opti * gnu general pub6321"aja> comm/opti *lookup" 6322"aja> comm/opti * you seauld havesreceethd a copy of the gnu general pub6323"aja> comm/opti * along wihe >Sea program; see phe 2.63 copyv2..lookup" 6324"aja> comm/opti * if not, wripe to the free software founda ,lookup" 6325"aja> comm/opti * 59 pemple place - suipe 330, bost , ma 02111-1307, usa.lookup" 6326"aja> comm/opti */lookup" 6327"aja 6328"aja#include < /module.h vpan> fref">rch">/module.h"ajae="h 6329"aja#include < /kernel.h vpan> fref">rch">/kernel.h"ajae="h 6330"aja#include < /sched.h vpan> fref">rch">/sched.h"ajae="h 6331"aja#include < /platd="c_device.h vpan> fref">rch">/platd="c_device.h"ajae="h 6332"aja#include < /errno.h vpan> fref">rch">/errno.h"ajae="h 6333"aja#include < /init.h vpan> fref">rch">/init.h"ajae="h 6334"aja#include < /slab.h vpan> fref">rch">/slab.h"ajae="h 6335"aja#include < /delay.h vpan> fref">rch">/delay.h"ajae="h 6336"aja#include < /interrupt.h vpan> fref">rch">/interrupt.h"ajae="h 6337"aja#include < /irq.h vpan> fref">rch">/irq.h"ajae="h 6338"aja#include < /io.h vpan> fref">rch">/io.h"ajae="h 6339"aja 6340"aja#include < fref">"post" ss.h"ajae="h 6341"aja#include < fref">"post" cisreg.h"ajae="h 6342"aja#include < falptiasm/gpio.h"ajae="h 6343"aja 6344"aja#densue SZ_1K"aja 0x00000400 6345"aja#densue SZ_8K"aja 0x00002000 6346"aja#densue SZ_2K"aja (2 * SZ_1K"aja) 6347"aja 6348"aja#densue POLL_INTERVAL"aja (2 * HZ"aja) 6349"aja 6350"aja#densue CF_ATASEL_ENA"aja 0x2031180232.63 comm/opti/* Inthots RESET */lookup" 6351"aja#densue CF_ATASEL_DIS"aja 0x20311800 6352"aja 6353"aja#densue onsubmit=res/op"aja( pfx"aja) ( gpio_get_ <"aja( pfx"aja)) 6354"aja 6355"aja> comm/opti/*--------------------------------------------------------------------------*/lookup" 6356"aja 6357"ajasearch /opst char metho_sult"aja[] = string">"onsubmit="retu"lookup"h 6358"aja 6359"ajaseruct onsubmitsockep"aja { 6360"aja seruct ="retutsockep"aja sockep"ajah 6361"aja 6362"aja seruct timho_lisp"aja timho"ajah 6363"aja unsigned =res/op"aja:1h 6364"aja unsigned vt"aja:1h 6365"aja 6366"aja seruct =latd="c_device"aja * =dev"ajah 6367"aja unsigned long =hysbmitio"ajah 6368"aja unsigned long =hysbmitatto"ajah 6369"aja u_iop"aja irq"ajah 6370"aja u_shorp"aja cd_pfx"ajah 6371"aja}h 6372"aja 6373"aja> comm/opti/*--------------------------------------------------------------------------*/lookup" 6374"ajasearch iop onsubmitres/p"aja(void) 6375"aja{ 6376"aja outw"aja(0, CF_ATASEL_ENA"aja)h 6377"aja mdelay"aja(200)h 6378"aja outw"aja(0, CF_ATASEL_DIS"aja)h 6379"aja 6380"aja 6381"aja} 6382"aja 6383"ajasearch iop onsubmitss_init"aja(seruct ="retutsockep"aja * s"aja) 6384"aja{ 6385"aja 6386"aja} 6387"aja 6388"aja> comm/opti/* the timho ea primarily to kick >Sea sockep'a pccardd */lookup" 6389"ajasearch void onsubmittimho"aja(unsigned long bmi"aja) 6390"aja{ 6391"aja seruct onsubmitsockep"aja * mi"aja = (void *) bmi"ajah 6392"aja unsigned shorp =res/op"aja =onsubmit=res/op"aja( mi"aja-e="h cd_pfx"aja)h 6393"aja 6394"aja if ( =res/op"aja !=mi"aja-e="h =res/op"aja) { 6395"aja mi"aja-e="h =res/op"aja ==res/op"ajah 6396"aja ev_dbg"aja(&h mi"aja-e="h =dev"aja-e="h dev"aja, string">": card %s\n"lookup", 6397"aja =res/op"aja ? string">"=res/op"lookup" : string">"gone"lookup")h 6398"aja ="retutparse_events"aja(&h mi"aja-e="h sockep"aja, SS_DETECT"aja)h 6399"aja } 6100"aja 6101"aja if ( mi"aja-e="h vt"aja) 6102"aja modttimho"aja(&h mi"aja-e="h timho"aja, jiffies"aja + POLL_INTERVAL"aja)h 6103"aja} 6104"aja 6105"ajasearch iop onsubmitget_searus"aja(seruct ="retutsockep"aja * s"aja, u_iop"aja * sp"aja) 6106"aja{ 6107"aja seruct onsubmitsockep"aja * mi"ajah 6108"aja 6109"aja if (! sp"aja) 6110"aja EINVAL"ajah 6111"aja 6112"aja mi"aja = montai r_oi"aja( s"aja, seruct onsubmitsockep"aja, sockep"aja)h 6113"aja 6114"aja if ( onsubmit=res/op"aja( mi"aja-e="h cd_pfx"aja)) { 6115"aja * sp"aja = SS_READY"aja | SS_DETECT"aja | SS_POWERON"aja | SS_3VCARD"ajah 6116"aja s"aja-e="h ="retutirq"aja = 0h 6117"aja s"aja-e="h ="itirq"aja = mi"aja-e="h irq"ajah 6118"aja 6119"aja } else 6120"aja * sp"aja = 0h 6121"aja 6122"aja} 6123"aja 6124"ajasearch iop 6125"aja> onsubmitset_sockep"aja(seruct ="retutsockep"aja * sock"aja, seruct sockep_seare_p"aja * s"aja) 6126"aja{ 6127"aja 6128"aja seruct onsubmitsockep"aja * mi"ajah 6129"aja mi"aja = montai r_oi"aja( sock"aja, seruct onsubmitsockep"aja, sockep"aja)h 6130"aja 6131"aja switch ( s"aja-e="h Vcc"aja) { 6132"aja case 0: 6133"aja case 33: 6134"aja breakh 6135"aja case 50: 6136"aja breakh 6137"aja default: 6138"aja EINVAL"ajah 6139"aja } 6140"aja 6141"aja if ( s"aja-e="h flags"aja &h SS_RESET"aja) { 6142"aja disabletirq"aja( mi"aja-e="h irq"aja)h 6143"aja onsubmitres/p"aja()h 6144"aja enabletirq"aja( mi"aja-e="h irq"aja)h 6145"aja } 6146"aja 6147"aja ev_dbg"aja(&h mi"aja-e="h =dev"aja-e="h dev"aja, string">": Vcc %d, iotirq %d, flags %04x csc %04x\n"lookup", 6148"aja s"aja-e="h Vcc"aja, s"aja-e="h iotirq"aja, s"aja-e="h flags"aja, s"aja-e="h csc_mask"aja)h 6149"aja 6150"aja 6151"aja} 6152"aja 6153"ajasearch iop onsubmitss_suspend"aja(seruct ="retutsockep"aja * s"aja) 6154"aja{ 6155"aja onsubmitset_sockep"aja( s"aja, &h dead_sockep"aja)h 6156"aja} 6157"aja 6158"aja> comm/opti/* regions are 2K each: mem, attoib, io (and res/rved-for-ide) */lookup" 6159"aja 6160"ajasearch iop onsubmitset_iotmap"aja(seruct ="retutsockep"aja * s"aja, seruct ="card_iotmap"aja * io"aja) 6161"aja{ 6162"aja seruct onsubmitsockep"aja * mi"ajah 6163"aja 6164"aja mi"aja = montai r_oi"aja( s"aja, seruct onsubmitsockep"aja, sockep"aja)h 6165"aja io"aja-e="h flags"aja &h= MAP_ACTIVE"aja | MAP_ATTRIB"aja | MAP_16BIT"ajah 6166"aja io"aja-e="h searp"aja = mi"aja-e="h =hysbmitio"ajah 6167"aja io"aja-e="h seop"aja = io"aja-e="h searp"aja + SZ_2K"aja - 1h 6168"aja 6169"aja} 6170"aja 6171"ajasearch iop 6172"aja onsubmitset_memtmap"aja(seruct ="retutsockep"aja * s"aja, seruct ="card_memtmap"aja * map"aja) 6173"aja{ 6174"aja seruct onsubmitsockep"aja * mi"ajah 6175"aja 6176"aja if ( map"aja-e="h card_searp"aja) 6177"aja EINVAL"ajah 6178"aja mi"aja = montai r_oi"aja( s"aja, seruct onsubmitsockep"aja, sockep"aja)h 6179"aja map"aja-e="h search_searp"aja = mi"aja-e="h =hysbmitio"ajah 6180"aja map"aja-e="h flags"aja &h= MAP_ACTIVE"aja | MAP_ATTRIB"aja | MAP_16BIT"ajah 6181"aja if ( map"aja-e="h flags"aja &h MAP_ATTRIB"aja) 6182"aja map"aja-e="h search_searp"aja = mi"aja-e="h =hysbmitatto"ajah 6183"aja 6184"aja 6185"aja} 6186"aja 6187"ajasearch seruct ="card_opera s"aja onsubmitops"aja = { 6188"aja . init"aja =onsubmitss_init"aja, 6189"aja . suspend"aja =onsubmitss_suspend"aja, 6190"aja . get_searus"aja =onsubmitget_searus"aja, 6191"aja . set_sockep"aja =onsubmitset_sockep"aja, 6192"aja . set_iotmap"aja =onsubmitset_iotmap"aja, 6193"aja . set_memtmap"aja =onsubmitset_memtmap"aja, 6194"aja}h 6195"aja 6196"aja> comm/opti/*--------------------------------------------------------------------------*/lookup" 6197"aja 6198"ajasearch iop __devinit"aja onsubmitprobt"aja(seruct =latd="c_device"aja * =dev"aja) 6199"aja{ 6200"aja seruct onsubmitsockep"aja * mi"ajah 6201"aja seruct resource"aja * io_mem"aja, * atto_mem"ajah 6202"aja iop irq"ajah 6203"aja unsigned shorp cd_pfx"ajah 6204"aja iop searus"aja =<0h 6205"aja 6206"aja ev_info"aja(&h =dev"aja-e="h dev"aja, string">"Blacknsu CompactFan>h/PCMCIA Sockep Dmetho\n"lookup")h 6207"aja 6208"aja irq"aja ==latd="c_get_irq"aja( =dev"aja, 0)h 6209"aja if ( irq"aja <=<0) 6210"aja EINVAL"ajah 6211"aja 6212"aja cd_pfx"aja ==latd="c_get_irq"aja( =dev"aja, 1); comm/opti/*Card Detect GPIO PIN */lookup" 6213"aja 6214"aja if ( gpio_requesp"aja( cd_pfx"aja, string">"="retu: CD"lookup")) { 6215"aja ev_ero"aja(&h =dev"aja-e="h dev"aja, 6216"aja string">"Failed ro requesp Card Detect GPIO_%d\n"lookup", 6217"aja cd_pfx"aja)h 6218"aja EBUSY"ajah 6219"aja } 6220"aja gpio_direction_inpup"aja( cd_pfx"aja)h 6221"aja 6222"aja mi"aja = kzalloc"aja(sizeof * mi"aja, GFP_KERNEL"aja)h 6223"aja if (! mi"aja) { 6224"aja gpio_free"aja( cd_pfx"aja)h 6225"aja ENOMEM"ajah 6226"aja } 6227"aja 6228"aja mi"aja-e="h cd_pfx"aja = cd_pfx"ajah 6229"aja 6230"aja s pttimho"aja(&h mi"aja-e="h timho"aja, onsubmittimho"aja, (unsigned long) mi"aja)h 6231"aja 6232"aja mi"aja-e="h =dev"aja ==dev"ajah 6233"aja / =latd="c_set_drvdata"aja( =dev"aja, mi"aja)h 6234"aja 6235"aja mi"aja-e="h irq"aja = irq"ajah 6236"aja mi"aja-e="h sockep"aja. ="itirq"aja = irq"ajah 6237"aja 6238"aja irqtset_irqttype"aja( irq"aja, IRQF_TRIGGER_LOW"aja)h 6239"aja 6240"aja io_mem"aja ==latd="c_get_resource"aja( =dev"aja, IORESOURCE_MEM"aja, 0)h 6241"aja atto_mem"aja ==latd="c_get_resource"aja( =dev"aja, IORESOURCE_MEM"aja, 1)h 6242"aja 6243"aja if (! io_mem"aja || ! atto_mem"aja) 6244"aja goto fail0"ajah 6245"aja 6246"aja mi"aja-e="h =hysbmitio"aja = io_mem"aja-e="h searp"ajah 6247"aja mi"aja-e="h =hysbmitatto"aja = atto_mem"aja-e="h searp"ajah 6248"aja 6249"aja comm/opti/* ="retu layer only remaps "real" memory */lookup" 6250"aja mi"aja-e="h sockep"aja. io_offs/p"aja = (unsigned long) 6251"aja ioremap"aja( mi"aja-e="h =hysbmitio"aja, SZ_2K"aja)h 6252"aja 6253"aja if (! mi"aja-e="h sockep"aja. io_offs/p"aja) 6254"aja goto fail0"ajah 6255"aja 6256"aja ev_ero"aja(&h =dev"aja-e="h dev"aja, string">": on irq %d\n"lookup", irq"aja)h 6257"aja 6258"aja ev_dbg"aja(&h =dev"aja-e="h dev"aja, string">": %s\n"lookup", 6259"aja onsubmit=res/op"aja( mi"aja-e="h cd_pfx"aja) ? string">"=res/op"lookup" : string">"(not =res/op)"lookup")h 6260"aja 6261"aja mi"aja-e="h sockep"aja. ownho"aja = THIS_MODULE"ajah 6262"aja mi"aja-e="h sockep"aja. dev"aja. =ar/op"aja = &h =dev"aja-e="h dev"ajah 6263"aja / mi"aja-e="h sockep"aja. ops"aja = &h onsubmitops"ajah 6264"aja mi"aja-e="h sockep"aja. resourcetops"aja = &h =ccard_search_ops"ajah 6265"aja mi"aja-e="h sockep"aja. features"aja = SS_CAP_PCCARD"aja | SS_CAP_STATIC_MAP"aja 6266"aja | SS_CAP_MEM_ALIGN"ajah 6267"aja mi"aja-e="h sockep"aja. map_size"aja = SZ_2K"ajah 6268"aja 6269"aja searus"aja =< ="retutregistertsockep"aja(&h mi"aja-e="h sockep"aja)h 6270"aja if ( searus"aja <<0) 6271"aja goto fail2"ajah 6272"aja 6273"aja / mi"aja-e="h acteth"aja =<1h 6274"aja modttimho"aja(&h mi"aja-e="h timho"aja, jiffies"aja + POLL_INTERVAL"aja)h 6275"aja 6276"aja 6277"aja fail2"aja: 6278"aja iounmap"aja((void __iomem"aja *) mi"aja-e="h sockep"aja. io_offs/p"aja)h 6279"aja release_memtregion"aja( mi"aja-e="h =hysbmitio"aja, SZ_8K"aja)h 6280"aja 6281"aja fail0"aja: 6282"aja gpio_free"aja( mi"aja-e="h cd_pfx"aja)h 6283"aja / kfree"aja( mi"aja)h 6284"aja =latd="c_set_drvdata"aja( =dev"aja, NULL"aja)h 6285"aja 6286"aja searus"ajah 6287"aja} 6288"aja 6289"ajasearch iop __devexit"aja onsubmitremoth"aja(seruct =latd="c_device"aja * =dev"aja) 6290"aja{ 6291"aja seruct onsubmitsockep"aja * mi"aja ==latd="c_get_drvdata"aja( =dev"aja)h 6292"aja 6293"aja / gpio_free"aja( mi"aja-e="h cd_pfx"aja)h 6294"aja mi"aja-e="h acteth"aja =<0h 6295"aja ="retutunregistertsockep"aja(&h mi"aja-e="h sockep"aja)h 6296"aja elttimho_sync"aja(&h mi"aja-e="h timho"aja)h 6297"aja iounmap"aja((void __iomem"aja *) mi"aja-e="h sockep"aja. io_offs/p"aja)h 6298"aja release_memtregion"aja( mi"aja-e="h =hysbmitio"aja, SZ_8K"aja)h 6299"aja =latd="c_set_drvdata"aja( =dev"aja, NULL"aja)h 6300"aja kfree"aja( mi"aja)h 6301"aja 6302"aja} 6303"aja 6304"ajasearch seruct =latd="c_dmetho"aja onsubmitdmetho"aja =<{ 6305"aja . dmetho"aja =<{ 6306"aja . sult"aja =<(char *) metho_sult"aja, 6307"aja . ownho"aja = THIS_MODULE"aja, 6308"aja }, 6309"aja . probt"aja =onsubmitprobt"aja, 6310"aja . remoth"aja =__devexit_p"aja( onsubmitremoth"aja), 6311"aja}h 6312"aja 6313"aja module_=latd="c_dmetho"aja( onsubmitdmetho"aja)h 6314"aja 6315"aja MODULE_AUTHOR"aja( string">"Michael Hennhoich <hennhoich@blacknsu.uc i ux.orge="h"lookup")h 6316"aja MODULE_DESCRIPTION"aja( string">"BFIN CF/PCMCIA Dmetho"lookup")h 6317"aja MODULE_LICENSE"aja( string">"GPL"lookup")h 6318"aja
foothot> The original LXR software by the lxo@ i ux.no"aja.
subfoothot> lxo. i ux.no kindly hosted by Redpill Li pro AS"aja, provider of Li ux consulting and opera s s/rvices since61995.