linux/drivers/pcmcia/sa1111_badge4.c
<<
on v.6./spa> .6./form .6.a on v.6 href="../linux+v3.1.32/drivers/pcmcia/sa1111_badge4.c">on v.6.img src="../.static/gfx/right.png" alt=">>">on./spa> on.spa> class="lxr_search">on v="+search" method="post" onsubmit="return do_search(this);">on v.6.input typon>hidden" namon>navtarget" option>">on v.6.input typon>text" namon>search" idn>search">on v.6.butt3submit">Search on.spa> class="lxr_prefs" .6.a href="+prefs?return=drivers/pcmcia/sa1111_badge4.c"on v.6 onclick="return ajax_prefs();">on v.6Prefs .6./a>on./spa> v.6 6./div v.6 6.form ac >="ajax+*" method="post" onsubmit="return false;">on.input typon>hidden" namon>ajax_lookup" idn>ajax_lookup" option>">o v.6 6./form o v.6 6.div class="headingbott3m">
search_results" class="search_results" . v.6 6./div .div idn>content"> .div idn>file_contents"
78/fe/8124cbb97188b7f139c0dd76a3f7d7d18a00_3/0"
L1" class="line" namon>L1">6 61./a>.spa> class="comment">/*./spa>
 L2" class="line" namon>L2">6 62./a>.spa> class="comment"> * linux/drivers/pcmcia/sa1100_badge4.c./spa>
 L3" class="line" namon>L3">6 63./a>.spa> class="comment"> *./spa>
 L4" class="line" namon>L4">6 64./a>.spa> class="comment"> * BadgePAD 4 PCMCIA specific routines./spa>
 L5" class="line" namon>L5">6 65./a>.spa> class="comment"> *./spa>
 L6" class="line" namon>L6">6 66./a>.spa> class="comment"> *   Christopher Hoover <ch@hpl.hp.com>./spa>
 L7" class="line" namon>L7">6 67./a>.spa> class="comment"> *./spa>
 L8" class="line" namon>L8">6 68./a>.spa> class="comment"> * Copyright (C) 2002 Hewlett-Packard Compa>y./spa>
 L9" class="line" namon>L9">6 69./a>.spa> class="comment"> *./spa>
 L10" class="line" namon>L10">6 7.11a>.spa> class="comment"> * This program is free software; you ca> redistribute it and/or modify./spa>
 L11" class="line" namon>L11">6 11./a>.spa> class="comment"> * it under the terms of the GNU General Public License vers13
 L12" class="line" namon>L12">6 12./a>.spa> class="comment"> * published by the Free Software Founda	  >../spa>
 L13" class="line" namon>L13">6 13./a>.spa> class="comment"> *./spa>
 L14" class="line" namon>L14">6 14./a>.spa> class="comment"> */./spa>
 L15" class="line" namon>L15">6 15./a>#include <linux/module.h./a>> L16" class="line" namon>L16">6 16./a>#include <linux/kernel.h./a>> L17" class="line" namon>L17">6 17./a>#include <linux/device.h./a>> L18" class="line" namon>L18">6 18./a>#include <linux/errno.h./a>> L19" class="line" namon>L19">6 19./a>#include <linux/init.h./a>> L20" class="line" namon>L20">6 2.11a> L21" class="line" namon>L21">6 21./a>#include <mach/hardware.h./a>> L22" class="line" namon>L22">6 22./a>#include <asm/mach-typos.h./a>> L23" class="line" namon>L23">6 23./a>#include <mach/badge4.h./a>> L24" class="line" namon>L24">6 24./a>#include <asm/hardware/sa1111.h./a>> L25" class="line" namon>L25">6 2511a> L26" class="line" namon>L26">6 26./a>#include "sa1111_generic.h./a>" L27" class="line" namon>L27">6 2711a> L28" class="line" namon>L28">6 28./a>.spa> class="comment">/*./spa>
 L29" class="line" namon>L29">6 29./a>.spa> class="comment"> * BadgePAD 4 Details./spa>
 L30" class="line" namon>L30">6 3.11a>.spa> class="comment"> *./spa>
 L31" class="line" namon>L31">6 31./a>.spa> class="comment"> * PCM Vcc:./spa>
 L32" class="line" namon>L32">6 32./a>.spa> class="comment"> *./spa>
 L33" class="line" namon>L33">6 33./a>.spa> class="comment"> *  PCM Vcc on BadgePAD 4 ca> be jumpered for 3v3 (short pins 1 and63./spa>
 L34" class="line" namon>L34">6 34./a>.spa> class="comment"> *  on JP6) or 5v0 (short pins 3 and65 on JP6)../spa>
 L35" class="line" namon>L35">6 35./a>.spa> class="comment"> *./spa>
 L36" class="line" namon>L36">6 36./a>.spa> class="comment"> * PCM Vpp:./spa>
 L37" class="line" namon>L37">6 37./a>.spa> class="comment"> *./spa>
 L38" class="line" namon>L38">6 38./a>.spa> class="comment"> *  PCM Vpp on BadgePAD 4 ca> be jumpered for 12v0 (short pins 4 and66./spa>
 L39" class="line" namon>L39">6 39./a>.spa> class="comment"> *  on JP6) or tied to PCM Vcc (short pins 2 and64 on JP6).  N.B.,./spa>
 L40" class="line" namon>L40">6 4.11a>.spa> class="comment"> *  12v0 opera	  > requires that the power supply ac	ually supply 12v0./spa>
 L41" class="line" namon>L41">6 41./a>.spa> class="comment"> *  via pin 7 of JP7../spa>
 L42" class="line" namon>L42">6 42./a>.spa> class="comment"> *./spa>
 L43" class="line" namon>L43">6 43./a>.spa> class="comment"> * CF Vcc:./spa>
 L44" class="line" namon>L44">6 44./a>.spa> class="comment"> *./spa>
 L45" class="line" namon>L45">6 45./a>.spa> class="comment"> *  CF Vcc on BadgePAD 4 ca> be jumpered either for 3v3 (short pins 1./spa>
 L46" class="line" namon>L46">6 46./a>.spa> class="comment"> *  and62 on JP10) or 5v0 (short pins 2 and63 on JP10)../spa>
 L47" class="line" namon>L47">6 47./a>.spa> class="comment"> *./spa>
 L48" class="line" namon>L48">6 48./a>.spa> class="comment"> * Unfortunately there's no way programmatically to determine how a./spa>
 L49" class="line" namon>L49">6 49./a>.spa> class="comment"> * give> board is jumpered.  This code assumes a default jumpering./spa>
 L50" class="line" namon>L50">6 5.11a>.spa> class="comment"> * as described below../spa>
 L51" class="line" namon>L51">6 51./a>.spa> class="comment"> *./spa>
 L52" class="line" namon>L52">6 52./a>.spa> class="comment"> * If the defaults aren't correct, you may override them with a pcmv./spa>
 L53" class="line" namon>L53">6 53./a>.spa> class="comment"> * setup argument: pcmv=<pcm vcc>,<pcm vpp>,<cf vcc>.  The units are./spa>
 L54" class="line" namon>L54">6 54./a>.spa> class="comment"> * tenths of volts; e.g. pcmv=33,120,50 indicates 3v3 PCM Vcc, 12v0./spa>
 L55" class="line" namon>L55">6 55./a>.spa> class="comment"> * PCM Vpp, and65v0 CF Vcc../spa>
 L56" class="line" namon>L56">6 56./a>.spa> class="comment"> *./spa>
 L57" class="line" namon>L57">6 57./a>.spa> class="comment"> */./spa>
 L58" class="line" namon>L58">6 5811a> L59" class="line" namon>L59">6 59./a>static int6.a href="+code=badge4_pcmvcc" class="sref">badge4_pcmvcc./a> = 5.;  .spa> class="comment">/* pins 3 and65 jumpered on JP6 */./spa>
 L60" class="line" namon>L60">6 60./a>static int6.a href="+code=badge4_pcmvpp" class="sref">badge4_pcmvpp./a> = 5.;  .spa> class="comment">/* pins 2 and64 jumpered on JP6 */./spa>
 L61" class="line" namon>L61">6 61./a>static int6.a href="+code=badge4_cfvcc" class="sref">badge4_cfvcc./a> = 33;   .spa> class="comment">/* pins 1 and62 jumpered on JP10 */./spa>
 L62" class="line" namon>L62">6 6211a> L63" class="line" namon>L63">6 63./a>static void6.a href="+code=complain_about_jumpering" class="sref">complain_about_jumpering./a>(const char *.a href="+code=whom" class="sref">whom./a>, L64" class="line" namon>L64">6 64./a>                                     const char *.a href="+code=supply" class="sref">supply./a>, L65" class="line" namon>L65">6 65./a>                                     int6.a href="+code=give>" class="sref">give>./a>, int6.a href="+code=wanted" class="sref">wanted./a>) L66" class="line" namon>L66">6 66./a>{ L67" class="line" namon>L67">6 67./a>        .a href="+code=printk" class="sref">printk./a>(.a href="+code=KERN_ERR" class="sref">KERN_ERR11a> L68" class="line" namon>L68">6 68./a>         .spa> class="string">"%s: %s %d.%dV wanted but board is jumpered for %s %d.%dV opera	  >"
 L69" class="line" namon>L69">6 69./a>         .spa> class="string">"; re-jumper the board and/or use pcmv=xx,xx,xx\>"
, L70" class="line" namon>L70">6 70./a>               .a href="+code=whom" class="sref">whom./a>, .a href="+code=supply" class="sref">supply./a>, L71" class="line" namon>L71">6 71./a>               .a href="+code=wanted" class="sref">wanted./a> / 10, .a href="+code=wanted" class="sref">wanted./a> % 10, L72" class="line" namon>L72">6 72./a>               .a href="+code=supply" class="sref">supply./a>, L73" class="line" namon>L73">6 73./a>               .a href="+code=give>" class="sref">give>./a> / 10, .a href="+code=give>" class="sref">give>./a> % 10); L74" class="line" namon>L74">6 74./a>} L75" class="line" namon>L75">6 7511a> L76" class="line" namon>L76">6 76./a>static int L77" class="line" namon>L77">6 77./a>.a href="+code=badge4_pcmcia_configure_socket" class="sref">badge4_pcmcia_configure_socket./a>(struct6.a href="+code=soc_pcmcia_socket" class="sref">soc_pcmcia_socket./a> *.a href="+code=skt" class="sref">skt./a>, const .a href="+code=socket_state_t" class="sref">socket_state_t./a> *.a href="+code=state" class="sref">state./a>) L78" class="line" namon>L78">6 78./a>{ L79" class="line" namon>L79">6 79./a>        int6.a href="+code=ret" class="sref">ret./a>; L80" class="line" namon>L80">6 8.11a> L81" class="line" namon>L81">6 81./a>        switch (.a href="+code=skt" class="sref">skt./a>->.a href="+code=nr" class="sref">nr./a>) { L82" class="line" namon>L82">6 82./a>        case 0: L83" class="line" namon>L83">6 83./a>                if ((.a href="+code=state" class="sref">state./a>->.a href="+code=Vcc" class="sref">Vcc./a> != 0) && L84" class="line" namon>L84">6 84./a>                    (.a href="+code=state" class="sref">state./a>->.a href="+code=Vcc" class="sref">Vcc./a> != .a href="+code=badge4_pcmvcc" class="sref">badge4_pcmvcc./a>)) { L85" class="line" namon>L85">6 85./a>                        .a href="+code=complain_about_jumpering" class="sref">complain_about_jumpering./a>(.a href="+code=__func__" class="sref">__func__./a>, .spa> class="string">"pcmvcc"
, L86" class="line" namon>L86">6 86./a>                                                 .a href="+code=badge4_pcmvcc" class="sref">badge4_pcmvcc./a>, .a href="+code=state" class="sref">state./a>->.a href="+code=Vcc" class="sref">Vcc./a>); L87" class="line" namon>L87">6 87./a>                        .spa> class="comment">// Apply power regardless of the jumpering../spa>
 L88" class="line" namon>L88">6 88./a>                        .spa> class="comment">// return -1;
 L89" class="line" namon>L89">6 89./a>                } L90" class="line" namon>L90">6 90./a>                if ((.a href="+code=state" class="sref">state./a>->.a href="+code=Vpp" class="sref">Vpp./a> != 0) && L91" class="line" namon>L91">6 91./a>                    (.a href="+code=state" class="sref">state./a>->.a href="+code=Vpp" class="sref">Vpp./a> != .a href="+code=badge4_pcmvpp" class="sref">badge4_pcmvpp./a>)) { L92" class="line" namon>L92">6 92./a>                        .a href="+code=complain_about_jumpering" class="sref">complain_about_jumpering./a>(.a href="+code=__func__" class="sref">__func__./a>, .spa> class="string">"pcmvpp"
, L93" class="line" namon>L93">6 93./a>                                                 .a href="+code=badge4_pcmvpp" class="sref">badge4_pcmvpp./a>, .a href="+code=state" class="sref">state./a>->.a href="+code=Vpp" class="sref">Vpp./a>); L94" class="line" namon>L94">6 94./a>                        return -1; L95" class="line" namon>L95">6 95./a>                } L96" class="line" namon>L96">6 96./a>                break; L97" class="line" namon>L97">6 9711a> L98" class="line" namon>L98">6 98./a>        case 1: L99" class="line" namon>L99">6 99./a>                if ((.a href="+code=state" class="sref">state./a>->.a href="+code=Vcc" class="sref">Vcc./a> != 0) && L100" class="line" namon>L100">6100./a>                    (.a href="+code=state" class="sref">state./a>->.a href="+code=Vcc" class="sref">Vcc./a> != .a href="+code=badge4_cfvcc" class="sref">badge4_cfvcc./a>)) { L101" class="line" namon>L101">6101./a>                        .a href="+code=complain_about_jumpering" class="sref">complain_about_jumpering./a>(.a href="+code=__func__" class="sref">__func__./a>, .spa> class="string">"cfvcc"
, L102" class="line" namon>L102">6102./a>                                                 .a href="+code=badge4_cfvcc" class="sref">badge4_cfvcc./a>, .a href="+code=state" class="sref">state./a>->.a href="+code=Vcc" class="sref">Vcc./a>); L103" class="line" namon>L103">6103./a>                        return -1; L104" class="line" namon>L104">6104./a>                } L105" class="line" namon>L105">6105./a>                break; L106" class="line" namon>L106">610611a> L107" class="line" namon>L107">6107./a>        default: L108" class="line" namon>L108">6108./a>                return -1; L109" class="line" namon>L109">6109./a>        } L110" class="line" namon>L110">611.11a> L111" class="line" namon>L111">6111./a>        .a href="+code=ret" class="sref">ret./a> = .a href="+code=sa1111_pcmcia_configure_socket" class="sref">sa1111_pcmcia_configure_socket./a>(.a href="+code=skt" class="sref">skt./a>, .a href="+code=state" class="sref">state./a>); L112" class="line" namon>L112">6112./a>        if (.a href="+code=ret" class="sref">ret./a> == 0) { L113" class="line" namon>L113">6113./a>                unsigned long .a href="+code=flags" class="sref">flags./a>; L114" class="line" namon>L114">6114./a>                int6.a href="+code=need5V" class="sref">need5V./a>; L115" class="line" namon>L115">611511a> L116" class="line" namon>L116">6116./a>                .a href="+code=local_irq_save" class="sref">local_irq_save./a>(.a href="+code=flags" class="sref">flags./a>); L117" class="line" namon>L117">611711a> L118" class="line" namon>L118">6118./a>                .a href="+code=need5V" class="sref">need5V./a> = ((.a href="+code=state" class="sref">state./a>->.a href="+code=Vcc" class="sref">Vcc./a> == 5.) || (.a href="+code=state" class="sref">state./a>->.a href="+code=Vpp" class="sref">Vpp./a> == 5.)); L119" class="line" namon>L119">6119./a> L120" class="line" namon>L120">6120./a>                .a href="+code=badge4_set_5V" class="sref">badge4_set_5V./a>(.a href="+code=BADGE4_5V_PCMCIA_SOCK" class="sref">BADGE4_5V_PCMCIA_SOCK./a>(.a href="+code=skt" class="sref">skt./a>->.a href="+code=nr" class="sref">nr./a>), .a href="+code=need5V" class="sref">need5V./a>); L121" class="line" namon>L121">61'f3ref="drivers/pcmcia/sa1111_badge4.c#L121" idense vers1>L12" class="line" namon>L112"26102./a>                .a href="+code=local_irestorsave" class="sref">local_irestorsave./a>(.a href="+code=flags" class="sref">flags./a>); L23" class="line" namo1n>L23126113./a>        } L24" class="line" namo1n>L241>6 24.  } L25" class="line" namo1n>L25126105./a>        retunt6.a href="+code=ret" class="sref">ret./a>; L26" class="line" namo1n>L261>6 26.   } L27" class="line" namo1n>L271>6 2711a> L28" class="line" namo1n>L281>6 28./a>stata>(struct6.a href="+co11_pcmclow_levelret" class="sre11_pcmclow_level105.//a>.a href="+code=badge4_pcmcoplags" class="srede=badge4_pcmcopld5V./a>0) { L29" class="line" namo1n>L29126109./a>     ./a>.a href="+coownee=nr" class="sreownee103./a>               a> = .a href="+coTHIS_MODULE=nr" class="sreTHIS_MODULEply./a>, L30" class="line" namo1n>L30130109./a>     ./a>.a href="+coia_configure_socket" class="sreia_configure_socket.       a> = .a href="+code=badge4_pcmcia_configure_socket" class="sref">badge4_pcmcia_configure_socket./a>, L31" class="line" namo1n>L31131109./a>     ./a>.a href="+cofirscket" class="srefirsc103./a>               a>; 10, L32" class="line" namo1n>L32132109./a>     ./a>.a href="+code=nr" class="sref">nr./a>                  a>2 10, >L13" class="line" namon>>L231>6 33.}/a>; L34" class="line" namo1n>L34136 24.  } L35" class="line" namo1n>L351>6 35.   int6.a href="+coe4_pcmcf">badgux/iret" class="sre11_pcmcf">badgux/iket./a>(struct6.a href="+coux/devret" class="sreux/deve_t./a> *.a href="+coux/ret" class="sreux/ate./a>) L36" class="line" namo1n>L36136 66./a>{ L37" class="line" namo1n>L37136107./a>        int6.a href="+code=ret" class="sref">ret. a>-nt6.a href="+coENODEed5V" class="sreENODEeret./a>; L38" class="line" namo1n>L38136 5811a> L39" class="line" namo1n>L39136 79./a>        if (.a href="+cof">m="l_is111_badd5V" class="sref">m="l_is111_badket.//a>)) { L40" class="line" namo1n>L40146120./a>                .a href="+code=printk" class="sref">printk./a>(.a href="+code=KEINFOntk" class="srede=KEINFO 5811a> L41" class="line" namo1n>L41146101./a>                       .spa> class="string">"%f">badge4_pcm=;d.,;f">badge4_ppp=;d.,;f">badge4_cf=;d.,xx\>"
, L42" class="line" namo1n>L42146102./a>                    a>(.a href="+code=__func__" class="sref">__func__./>
, L43" class="line" namo1n>L43146103./a>                       .a href="+code=badge4_pcmvcc" class="sref">badge4_pcmvcc./a>, .a href="+code=badge4_pcmvpp" class="sref">badge4_pcmvpp./a>, .a href="+code=badge4_cfvcc" class="sref">badge4_cfvcc.//a>; L44" class="line" namo1n>L44146 24.  } L45" class="line" namo1n>L45146105./a>              = .a href="+code=sxx_drvge4_pcmcoplags" class="srede=sxx_drvge4_pcmcoplntk./mp;&a/a>.a href="+code=badge4_pcmcoplags" class="srede=badge4_pcmcopld5V.//a>; L46" class="line" namo1n>L46146116./a>                .a href="+code=ret" class="sref">ret./a> = .a href="+code=sa1111_pcmcadnted" class="srede=sa1111_pcmcadnntk./a>(.a href="+coux/ret" class="sreux/ate., mp;&a/a>.a href="+code=badge4_pcmcoplags" class="srede=badge4_pcmcopld5V./>
, L47" class="line" namo1n>L47146 87./a>                              = .a href="+code=sxx_drvge4_pcmcadn_="dons" class="srede=sxx_drvge4_pcmcadn_="dd5V.//a>; L48" class="line" namo1n>L48146118./a>        } L49" class="line" namo1n>L49146119./a> L50" class="line" namo1n>L50156120./a>        retunt6.a href="+code=ret" class="sref">ret./a>; L51" class="line" namo1n>L511>6 51.   } L52" class="line" namo1n>L52156 6211a> L53" class="line" namo1n>L53156 63./a>stat   int6.a href="+co_gux/iret" class="sre_gux/iket.int6.a href="+coe4_v_ * seret" class="sre11_v_ * sentk./st char *.a href="+codons" class="sredate./a>) L54" class="line" namo1n>L541>6 54.)) { L55" class="line" namo1n>L55156105./a>        int6.a href="+co/ret" class="sre/ate.[4]/a>; L56" class="line" namo1n>L5615610611a> L57" class="line" namo1n>L57156 67./a>        .a href="+codons" class="sredate./a> = .a href="+coget_213"
	dons" class="sreget_213"
	dOCK./a>(.a href="+codons" class="sredate./a>, .a href="+coARRAY_SIZE=nr" class="sreARRAY_SIZEOCK./a>(.a href="+co/ret" class="sre/ate./a>), .a href="+co/ret" class="sre/ate.//a>; L58" class="line" namo1n>L581>6 5811a> L59" class="line" namo1n>L59156 79./a>        if (.a href="+co/ret" class="sre/ate.[0] a>-&= 1)int6.a href="+code=badge4_pcmvcc" class="sref">badge4_pcmvcc./a>f (.a href="+co/ret" class="sre/ate.[1]/a>; L60" class="line" namo1n>L60160 79./a>        if (.a href="+co/ret" class="sre/ate.[0] a>-&= 2)int6.a href="+code=badge4_pcmvpp" class="sref">badge4_pcmvpp./a>f (.a href="+co/ret" class="sre/ate.[2]/a>; L61" class="line" namo1n>L61161 79./a>        if (.a href="+co/ret" class="sre/ate.[0] a>-&= 3)int6.a href="+code=badge4_cfvcc" class="sref">badge4_cfvcc./a>f (.a href="+co/ret" class="sre/ate.[3]/a>; L62" class="line" namo1n>L621>6 6211a> L63" class="line" namo1n>L63166103./a>        retun -1; L64" class="line" namo1n>L64166 74./a>} L65" class="line" namo1n>L6516611511a> L66" class="line" namo1n>L661>6 66.nt6.a href="+co_g * seret" class="sre__ * sentk./>, .spa> class="string">"p=x\>"L67" class="line" namo1n>L671>6 67.
.  Toriginal LXRree softwhed by t>; LXRrs="che upply./ ch(t exjumpcommal drivra	 ed >; li.no">lxr@l">li.noply..
6 6./di
 
.d7" classubfooter">
lxr.l">li.no kindly hostished >; pro.no">Redpill L">pro ASply./ provi undof L">uxa>, cultstrs 1 adV opera	s ser/devs since 1995.
6 6./div
/bodydi
/htmldi