linux/drivers/pcmcia/pxa2xx_cm_x255.c
<<
> v4/spa v4/form v4a > v href="../linux+v3.7 .8/drivers/pcmcia/pxa2xx_cm_x255.c"> > v4img src="../.static/gfx/right.png" alt=">>"> 4/spa 4spa class="lxr_search"> > > v4input typ1e=hidden" nam1e=navtarget" pt3=1e="> > v4input typ1e=text" nam1e=search" ide=search"> > v4buttSearch v onclick="return ajax_prefs();"> > vPrefs v4/a> 4/spa > v v4/div > v v4form ac7" ="ajax+*" method="post" onsubmit="return false;"> 4input typ1e=hidden" nam1e=ajax_lookup" ide=ajax_lookup" pt3=1e="> > v v4/form > v v4div class="headingbott
v
v v v4div ide=search_results" class="search_results" > v v4/div 4div ide=content"> 4div ide=file_contents"
v v14/a>4spa	 class="comment">/*4/spa	  v v24/a>4spa	 class="comment"> * linux/drivers/pcmcia/pxa/pxa_cm_x255.c4/spa	  v v34/a>4spa	 class="comment"> *4/spa	  v v44/a>4spa	 class="comment"> * This program is free software; you ca	 redistribute it and/or modify4/spa	  v v54/a>4spa	 class="comment"> * it under the terms of the GNU General Public License vers7v v64/a>4spa	 class="comment"> * published by the Free Software Founda7"
	.4/spa	  v v74/a>4spa	 class="comment"> *4/spa	  v v84/a>4spa	 class="comment"> * Compulab Ltd., 2003, 2007, 20084/spa	  v v94/a>4spa	 class="comment"> * Mike Rapoport <mike@compulab.co.il>4/spa	  v .84spa	 class="comment"> *4/spa	  v 114/a>4spa	 class="comment"> */4/spa	  v 124/a> v 134/a>#include <linux/platform_device.h4/a>> v 144/a>#include <linux/irq.h4/a>> v 154/a>#include <linux/delay.h4/a>> v 164/a>#include <linux/gpio.h4/a>> v 174/a>#include <linux/export.h4/a>> v 184/a> v 194/a>#include "soc_comm
	.h4/a>" v 204/a> v 214/a>#definev4a href="+code=GPIO_PCMCIA_SKTSEL" class="sref">GPIO_PCMCIA_SKTSEL4/a> > v v(54) v 224/a>#definev4a href="+code=GPIO_PCMCIA_S0_CD_VALID" class="sref">GPIO_PCMCIA_S0_CD_VALID4/a> (16) v 234/a>#definev4a href="+code=GPIO_PCMCIA_S1_CD_VALID" class="sref">GPIO_PCMCIA_S1_CD_VALID4/a> (17) v 244/a>#definev4a href="+code=GPIO_PCMCIA_S0_RDYINT" class="sref">GPIO_PCMCIA_S0_RDYINT4/a> > (6) v 254/a>#definev4a href="+code=GPIO_PCMCIA_S1_RDYINT" class="sref">GPIO_PCMCIA_S1_RDYINT4/a> > (8) v 264/a>#definev4a href="+code=GPIO_PCMCIA_RESET" class="sref">GPIO_PCMCIA_RESET4/a> > v v (9) v 274/a> v 284/a>static intv4a href="+code=cmx255_pcmcia_hw_init" class="sref">cmx255_pcmcia_hw_init4/a>(structv4a href="+code=soc_pcmcia_socket" class="sref">soc_pcmcia_socket4/a> *4a href="+code=skt" class="sref">skt4/a>) v 294/a>{ v 304/a> > v v  intv4a href="+code=ret" class="sref">ret4/a> =v4a href="+code=gpio_request" class="sref">gpio_request4/a>(4a href="+code=GPIO_PCMCIA_RESET" class="sref">GPIO_PCMCIA_RESET4/a>, 4spa	 class="string">"PCCard reset"v 314/a> > v v  if (4a href="+code=ret" class="sref">ret4/a>) v 324/a> > v v          return 4a href="+code=ret" class="sref">ret4/a>; v 334/a> > v v  4a href="+code=gpio_direc7"
	_output" class="sref">gpio_direc7"
	_output4/a>(4a href="+code=GPIO_PCMCIA_RESET" class="sref">GPIO_PCMCIA_RESET4/a>, 0); v 344/a> v 354/a> > v v  if (4a href="+code=skt" class="sref">skt4/a>->4a href="+code=nr" class="sref">nr4/a> == 0) { v 364/a> > v v          4a href="+code=skt" class="sref">skt4/a>->4a href="+code=stat" class="sref">stat4/a>[4a href="+code=SOC_STAT_CD" class="sref">SOC_STAT_CD4/a>].4a href="+code=gpio" class="sref">gpio4/a> =v4a href="+code=GPIO_PCMCIA_S0_CD_VALID" class="sref">GPIO_PCMCIA_S0_CD_VALID4/a>; v 374/a> > v v          4a href="+code=skt" class="sref">skt4/a>->4a href="+code=stat" class="sref">stat4/a>[4a href="+code=SOC_STAT_CD" class="sref">SOC_STAT_CD4/a>].4a href="+code=nam1" class="sref">nam14/a> =v4spa	 class="string">"PCMCIA0 CD"v 384/a> > v v          4a href="+code=skt" class="sref">skt4/a>->4a href="+code=stat" class="sref">stat4/a>[4a href="+code=SOC_STAT_RDY" class="sref">SOC_STAT_RDY4/a>].4a href="+code=gpio" class="sref">gpio4/a> =v4a href="+code=GPIO_PCMCIA_S0_RDYINT" class="sref">GPIO_PCMCIA_S0_RDYINT4/a>; v 394/a> > v v          4a href="+code=skt" class="sref">skt4/a>->4a href="+code=stat" class="sref">stat4/a>[4a href="+code=SOC_STAT_RDY" class="sref">SOC_STAT_RDY4/a>].4a href="+code=nam1" class="sref">nam14/a> =v4spa	 class="string">"PCMCIA0 RDY"v 404/a> > v v  } else { v 414/a> > v v          4a href="+code=skt" class="sref">skt4/a>->4a href="+code=stat" class="sref">stat4/a>[4a href="+code=SOC_STAT_CD" class="sref">SOC_STAT_CD4/a>].4a href="+code=gpio" class="sref">gpio4/a> =v4a href="+code=GPIO_PCMCIA_S1_CD_VALID" class="sref">GPIO_PCMCIA_S1_CD_VALID4/a>; v 424/a> > v v          4a href="+code=skt" class="sref">skt4/a>->4a href="+code=stat" class="sref">stat4/a>[4a href="+code=SOC_STAT_CD" class="sref">SOC_STAT_CD4/a>].4a href="+code=nam1" class="sref">nam14/a> =v4spa	 class="string">"PCMCIA1 CD"v 434/a> > v v          4a href="+code=skt" class="sref">skt4/a>->4a href="+code=stat" class="sref">stat4/a>[4a href="+code=SOC_STAT_RDY" class="sref">SOC_STAT_RDY4/a>].4a href="+code=gpio" class="sref">gpio4/a> =v4a href="+code=GPIO_PCMCIA_S1_RDYINT" class="sref">GPIO_PCMCIA_S1_RDYINT4/a>; v 444/a> > v v          4a href="+code=skt" class="sref">skt4/a>->4a href="+code=stat" class="sref">stat4/a>[4a href="+code=SOC_STAT_RDY" class="sref">SOC_STAT_RDY4/a>].4a href="+code=nam1" class="sref">nam14/a> =v4spa	 class="string">"PCMCIA1 RDY"v 454/a> > v v  } v 464/a> v 474/a> > v v  return 0; v 484/a>} v 494/a> v 504/a>static voidv4a href="+code=cmx255_pcmcia_shutdown" class="sref">cmx255_pcmcia_shutdown4/a>(structv4a href="+code=soc_pcmcia_socket" class="sref">soc_pcmcia_socket4/a> *4a href="+code=skt" class="sref">skt4/a>) v 514/a>{ v 524/a> > v v  4a href="+code=gpio_free" class="sref">gpio_free4/a>(4a href="+code=GPIO_PCMCIA_RESET" class="sref">GPIO_PCMCIA_RESET4/a>); v 534/a>} v 544/a> v 554/a> v 564/a>static voidv4a href="+code=cmx255_pcmcia_socket_state" class="sref">cmx255_pcmcia_socket_state4/a>(structv4a href="+code=soc_pcmcia_socket" class="sref">soc_pcmcia_socket4/a> *4a href="+code=skt" class="sref">skt4/a>, v 574/a> > v v                                 structv4a href="+code=pcmcia_state" class="sref">pcmcia_state4/a> *4a href="+code=state" class="sref">state4/a>) v 584/a>{ v 594/a> > v v  4a href="+code=state" class="sref">state4/a>->4a href="+code=vs_3v" class="sref">vs_3v4/a> >= 0; v 604/a> > v v  4a href="+code=state" class="sref">state4/a>->4a href="+code=vs_Xv" class="sref">vs_Xv4/a> >= 0; v 614/a>} v 624/a> v 634/a> v 644/a>static intv4a href="+code=cmx255_pcmcia_configure_socket" class="sref">cmx255_pcmcia_configure_socket4/a>(structv4a href="+code=soc_pcmcia_socket" class="sref">soc_pcmcia_socket4/a> *4a href="+code=skt" class="sref">skt4/a>, v 654/a> > v v                                    constv4a href="+code=socket_state_t" class="sref">socket_state_t4/a> *4a href="+code=state" class="sref">state4/a>) v 664/a>{ v 674/a> > v v  switch (4a href="+code=skt" class="sref">skt4/a>->4a href="+code=nr" class="sref">nr4/a>) { v 684/a> > v v  case 0: v 694/a> > v v          if (4a href="+code=state" class="sref">state4/a>->4a href="+code=flags" class="sref">flags4/a> &v4a href="+code=SS_RESET" class="sref">SS_RESET4/a>) { v 704/a> > v v                  4a href="+code=gpio_set_pt3=1" class="sref">gpio_set_pt3=14/a>(4a href="+code=GPIO_PCMCIA_SKTSEL" class="sref">GPIO_PCMCIA_SKTSEL4/a>, 0); v 714/a> > v v                  4a href="+code=udelay" class="sref">udelay4/a>(1); v 724/a> > v v                  4a href="+code=gpio_set_pt3=1" class="sref">gpio_set_pt3=14/a>(4a href="+code=GPIO_PCMCIA_RESET" class="sref">GPIO_PCMCIA_RESET4/a>, 1); v 734/a> > v v                  4a href="+code=udelay" class="sref">udelay4/a>(10); v 744/a> > v v                  4a href="+code=gpio_set_pt3=1" class="sref">gpio_set_pt3=14/a>(4a href="+code=GPIO_PCMCIA_RESET" class="sref">GPIO_PCMCIA_RESET4/a>, 0); v 754/a> > v v          } v 764/a> > v v          break; v 774/a> > v v  case 1: v 784/a> > v v          if (4a href="+code=state" class="sref">state4/a>->4a href="+code=flags" class="sref">flags4/a> &v4a href="+code=SS_RESET" class="sref">SS_RESET4/a>) { v 794/a> > v v                  4a href="+code=gpio_set_pt3=1" class="sref">gpio_set_pt3=14/a>(4a href="+code=GPIO_PCMCIA_SKTSEL" class="sref">GPIO_PCMCIA_SKTSEL4/a>, 1); v 804/a> > v v                  4a href="+code=udelay" class="sref">udelay4/a>(1); v 814/a> > v v                  4a href="+code=gpio_set_pt3=1" class="sref">gpio_set_pt3=14/a>(4a href="+code=GPIO_PCMCIA_RESET" class="sref">GPIO_PCMCIA_RESET4/a>, 1); v 824/a> > v v                  4a href="+code=udelay" class="sref">udelay4/a>(10); v 834/a> > v v                  4a href="+code=gpio_set_pt3=1" class="sref">gpio_set_pt3=14/a>(4a href="+code=GPIO_PCMCIA_RESET" class="sref">GPIO_PCMCIA_RESET4/a>, 0); v 844/a> > v v          } v 854/a> > v v          break; v 864/a> > v v  } v 874/a> v 884/a> > v v  return 0; v 894/a>} v 904/a> v 914/a>static structv4a href="+code=pcmcia_low_level" class="sref">pcmcia_low_level4/a> 4a href="+code=cmx255_pcmcia_ops" class="sref">cmx255_pcmcia_ops4/a> 4a href="+code=__initdata" class="sref">__initdata4/a> =v{ v 924/a> > v v  .4a href="+code=owner" class="sref">owner4/a> > v v            =v4a href="+code=THIS_MODULE" class="sref">THIS_MODULE4/a>, v 934/a> > v v  .4a href="+code=hw_init" class="sref">hw_init4/a> v v            =v4a href="+code=cmx255_pcmcia_hw_init" class="sref">cmx255_pcmcia_hw_init4/a>, v 944/a> > v v  .4a href="+code=hw_shutdown" class="sref">hw_shutdown4/a> v v        =v4a href="+code=cmx255_pcmcia_shutdown" class="sref">cmx255_pcmcia_shutdown4/a>, v 954/a> > v v  .4a href="+code=socket_state" class="sref">socket_state4/a>v v        =v4a href="+code=cmx255_pcmcia_socket_state" class="sref">cmx255_pcmcia_socket_state4/a>, v 964/a> > v v  .4a href="+code=configure_socket" class="sref">configure_socket4/a>       =v4a href="+code=cmx255_pcmcia_configure_socket" class="sref">cmx255_pcmcia_configure_socket4/a>, v 974/a> > v v  .4a href="+code=nr" class="sref">nr4/a>                     = 1, v 984/a>}; v 994/a> v1004/a>static structv4a href="+code=platform_device" class="sref">platform_device4/a> *4a href="+code=cmx255_pcmcia_device" class="sref">cmx255_pcmcia_device4/a>; v1014/a> v1024/a>intv4a href="+code=__init" class="sref">__init4/a> 4a href="+code=cmx255_pcmcia_init" class="sref">cmx255_pcmcia_init4/a>(void) v1034/a>{ v1044/a> > v v  intv4a href="+code=ret" class="sref">ret4/a>; v1054/a> v1064/a> > v v  4a href="+code=cmx255_pcmcia_device" class="sref">cmx255_pcmcia_device4/a> =v4a href="+code=platform_device_alloc" class="sref">platform_device_alloc4/a>(4spa	 class="string">"pxa2xx-pcmcia"v1074/a> v1084/a> > v v  if (!4a href="+code=cmx255_pcmcia_device" class="sref">cmx255_pcmcia_device4/a>) v1094/a> > v v          return -4a href="+code=ENOMEM" class="sref">ENOMEM4/a>; v1104/a> v1114/a> > v v  4a href="+code=ret" class="sref">ret4/a> =v4a href="+code=platform_device_add_data" class="sref">platform_device_add_data4/a>(4a href="+code=cmx255_pcmcia_device" class="sref">cmx255_pcmcia_device4/a>, &4a href="+code=cmx255_pcmcia_ops" class="sref">cmx255_pcmcia_ops4/a>, v1124/a> > v v                                 sizeof(4a href="+code=cmx255_pcmcia_ops" class="sref">cmx255_pcmcia_ops4/a>)); v1134/a> v1144/a> > v v  if (4a href="+code=ret" class="sref">ret4/a> == 0) { v1154/a> > v v          4a href="+code=printk" class="sref">printk4/a>(4a href="+code=KERN_INFO" class="sref">KERN_INFO4/a> 4spa	 class="string">"Registering cm-x255 PCMCIA interface.\n"v1164/a> > v v          4a href="+code=ret" class="sref">ret4/a> =v4a href="+code=platform_device_add" class="sref">platform_device_add4/a>(4a href="+code=cmx255_pcmcia_device" class="sref">cmx255_pcmcia_device4/a>); v1174/a> > v v  } v1184/a> v1194/a> > v v  if (4a href="+code=ret" class="sref">ret4/a>) v1204/a> > v v          4a href="+code=platform_device_put" class="sref">platform_device_put4/a>(4a href="+code=cmx255_pcmcia_device" class="sref">cmx255_pcmcia_device4/a>); v1214/a> v1224/a> > v v  return 4a href="+code=ret" class="sref">ret4/a>; v1234/a>} v1244/a> v1254/a>voidv4a href="+code=__exit" class="sref">__exit4/a> 4a href="+code=cmx255_pcmcia_exit" class="sref">cmx255_pcmcia_exit4/a>(void) v1264/a>{ v1274/a> > v v  4a href="+code=platform_device_unregister" class="sref">platform_device_unregister4/a>(4a href="+code=cmx255_pcmcia_device" class="sref">cmx255_pcmcia_device4/a>); v1284/a>} v1294/a>
The original LXR software by the LXR community4/a>, this experimental vers7lxr@linux.no4/a>. 4/div 4div class="subfooter"> lxr.linux.no kindly hostedoby Redpill Linpro AS4/a>, provider of Linux consulting and opera7" s services since 1995. 4/div 4/body 4/html