aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-07-31 01:09:32 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-09-29 11:20:23 -0400
commit9485ee14e143c7076e88deea1e87ca3eb0b2f94e (patch)
tree781e50cb3f35722fcff8e3ecab22f364aac32ecb /drivers/pcmcia
parent1ac71e5a35eebee60cdcf15b3980bd94498f037b (diff)
pcmcia: Documentation update
Fill in missing descriptions and update some others for functions in pcmcia_resource.c. Tested-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/pcmcia_resource.c111
1 files changed, 89 insertions, 22 deletions
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 28de5e6e164c..3194d515c023 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -6,7 +6,7 @@
6 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 6 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
7 * 7 *
8 * Copyright (C) 1999 David A. Hinds 8 * Copyright (C) 1999 David A. Hinds
9 * Copyright (C) 2004-2005 Dominik Brodowski 9 * Copyright (C) 2004-2010 Dominik Brodowski
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
@@ -55,6 +55,12 @@ struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align,
55} 55}
56 56
57 57
58/**
59 * release_io_space() - release IO ports allocated with alloc_io_space()
60 * @s: pcmcia socket
61 * @res: resource to release
62 *
63 */
58static void release_io_space(struct pcmcia_socket *s, struct resource *res) 64static void release_io_space(struct pcmcia_socket *s, struct resource *res)
59{ 65{
60 resource_size_t num = resource_size(res); 66 resource_size_t num = resource_size(res);
@@ -80,9 +86,14 @@ static void release_io_space(struct pcmcia_socket *s, struct resource *res)
80 } 86 }
81 } 87 }
82 } 88 }
83} /* release_io_space */ 89}
90
84 91
85/** alloc_io_space 92/**
93 * alloc_io_space() - allocate IO ports for use by a PCMCIA device
94 * @s: pcmcia socket
95 * @res: resource to allocate (begin: begin, end: size)
96 * @lines: number of IO lines decoded by the PCMCIA card
86 * 97 *
87 * Special stuff for managing IO windows, because they are scarce 98 * Special stuff for managing IO windows, because they are scarce
88 */ 99 */
@@ -134,7 +145,7 @@ static int alloc_io_space(struct pcmcia_socket *s, struct resource *res,
134 } 145 }
135 dev_dbg(&s->dev, "alloc_io_space request result %d: %pR\n", ret, res); 146 dev_dbg(&s->dev, "alloc_io_space request result %d: %pR\n", ret, res);
136 return ret; 147 return ret;
137} /* alloc_io_space */ 148}
138 149
139 150
140/** 151/**
@@ -174,7 +185,7 @@ static int pcmcia_access_config(struct pcmcia_device *p_dev,
174 mutex_unlock(&s->ops_mutex); 185 mutex_unlock(&s->ops_mutex);
175 186
176 return ret; 187 return ret;
177} /* pcmcia_access_config */ 188}
178 189
179 190
180/** 191/**
@@ -203,6 +214,16 @@ int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val)
203EXPORT_SYMBOL(pcmcia_write_config_byte); 214EXPORT_SYMBOL(pcmcia_write_config_byte);
204 215
205 216
217/**
218 * pcmcia_map_mem_page() - modify iomem window to point to a different offset
219 * @p_dev: pcmcia device
220 * @res: iomem resource already enabled by pcmcia_request_window()
221 * @offset: card_offset to map
222 *
223 * pcmcia_map_mem_page() modifies what can be read and written by accessing
224 * an iomem range previously enabled by pcmcia_request_window(), by setting
225 * the card_offset value to @offset.
226 */
206int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, 227int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res,
207 unsigned int offset) 228 unsigned int offset)
208{ 229{
@@ -221,12 +242,13 @@ int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res,
221 dev_warn(&p_dev->dev, "failed to set_mem_map\n"); 242 dev_warn(&p_dev->dev, "failed to set_mem_map\n");
222 mutex_unlock(&s->ops_mutex); 243 mutex_unlock(&s->ops_mutex);
223 return ret; 244 return ret;
224} /* pcmcia_map_mem_page */ 245}
225EXPORT_SYMBOL(pcmcia_map_mem_page); 246EXPORT_SYMBOL(pcmcia_map_mem_page);
226 247
227 248
228/** 249/**
229 * pcmcia_fixup_iowidth() - reduce io width to 8bit 250 * pcmcia_fixup_iowidth() - reduce io width to 8bit
251 * @p_dev: pcmcia device
230 * 252 *
231 * pcmcia_fixup_iowidth() allows a PCMCIA device driver to reduce the 253 * pcmcia_fixup_iowidth() allows a PCMCIA device driver to reduce the
232 * IO width to 8bit after having called pcmcia_enable_device() 254 * IO width to 8bit after having called pcmcia_enable_device()
@@ -275,6 +297,8 @@ EXPORT_SYMBOL(pcmcia_fixup_iowidth);
275 297
276/** 298/**
277 * pcmcia_fixup_vpp() - set Vpp to a new voltage level 299 * pcmcia_fixup_vpp() - set Vpp to a new voltage level
300 * @p_dev: pcmcia device
301 * @new_vpp: new Vpp voltage
278 * 302 *
279 * pcmcia_fixup_vpp() allows a PCMCIA device driver to set Vpp to 303 * pcmcia_fixup_vpp() allows a PCMCIA device driver to set Vpp to
280 * a new voltage level between calls to pcmcia_enable_device() 304 * a new voltage level between calls to pcmcia_enable_device()
@@ -312,6 +336,17 @@ unlock:
312EXPORT_SYMBOL(pcmcia_fixup_vpp); 336EXPORT_SYMBOL(pcmcia_fixup_vpp);
313 337
314 338
339/**
340 * pcmcia_release_configuration() - physically disable a PCMCIA device
341 * @p_dev: pcmcia device
342 *
343 * pcmcia_release_configuration() is the 1:1 counterpart to
344 * pcmcia_enable_device(): If a PCMCIA device is no longer used by any
345 * driver, the Vpp voltage is set to 0, IRQs will no longer be generated,
346 * and I/O ranges will be disabled. As pcmcia_release_io() and
347 * pcmcia_release_window() still need to be called, device drivers are
348 * expected to call pcmcia_disable_device() instead.
349 */
315int pcmcia_release_configuration(struct pcmcia_device *p_dev) 350int pcmcia_release_configuration(struct pcmcia_device *p_dev)
316{ 351{
317 pccard_io_map io = { 0, 0, 0, 0, 1 }; 352 pccard_io_map io = { 0, 0, 0, 0, 1 };
@@ -324,7 +359,7 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev)
324 if (p_dev->_locked) { 359 if (p_dev->_locked) {
325 p_dev->_locked = 0; 360 p_dev->_locked = 0;
326 if (--(s->lock_count) == 0) { 361 if (--(s->lock_count) == 0) {
327 s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ 362 s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */
328 s->socket.Vpp = 0; 363 s->socket.Vpp = 0;
329 s->socket.io_irq = 0; 364 s->socket.io_irq = 0;
330 s->ops->set_socket(s, &s->socket); 365 s->ops->set_socket(s, &s->socket);
@@ -346,16 +381,18 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev)
346 mutex_unlock(&s->ops_mutex); 381 mutex_unlock(&s->ops_mutex);
347 382
348 return 0; 383 return 0;
349} /* pcmcia_release_configuration */ 384}
350 385
351 386
352/** pcmcia_release_io 387/**
388 * pcmcia_release_io() - release I/O allocated by a PCMCIA device
389 * @p_dev: pcmcia device
353 * 390 *
354 * Release_io() releases the I/O ranges allocated by a client. This 391 * pcmcia_release_io() releases the I/O ranges allocated by a PCMCIA
355 * may be invoked some time after a card ejection has already dumped 392 * device. This may be invoked some time after a card ejection has
356 * the actual socket configuration, so if the client is "stale", we 393 * already dumped the actual socket configuration, so if the client is
357 * don't bother checking the port ranges against the current socket 394 * "stale", we don't bother checking the port ranges against the
358 * values. 395 * current socket values.
359 */ 396 */
360static int pcmcia_release_io(struct pcmcia_device *p_dev) 397static int pcmcia_release_io(struct pcmcia_device *p_dev)
361{ 398{
@@ -383,10 +420,13 @@ out:
383 return ret; 420 return ret;
384} /* pcmcia_release_io */ 421} /* pcmcia_release_io */
385 422
423
386/** 424/**
387 * pcmcia_release_window() - release reserved iomem for PCMCIA devices 425 * pcmcia_release_window() - release reserved iomem for PCMCIA devices
426 * @p_dev: pcmcia device
427 * @res: iomem resource to release
388 * 428 *
389 * pcmcia_release_window() releases struct resource *res which was 429 * pcmcia_release_window() releases &struct resource *res which was
390 * previously reserved by calling pcmcia_request_window(). 430 * previously reserved by calling pcmcia_request_window().
391 */ 431 */
392int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) 432int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res)
@@ -431,9 +471,15 @@ int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res)
431} /* pcmcia_release_window */ 471} /* pcmcia_release_window */
432EXPORT_SYMBOL(pcmcia_release_window); 472EXPORT_SYMBOL(pcmcia_release_window);
433 473
474
434/** 475/**
435 * pcmcia_enable_device() - set up and activate a PCMCIA device 476 * pcmcia_enable_device() - set up and activate a PCMCIA device
477 * @p_dev: the associated PCMCIA device
436 * 478 *
479 * pcmcia_enable_device() physically enables a PCMCIA device. It parses
480 * the flags passed to in @flags and stored in @p_dev->flags and sets up
481 * the Vpp voltage, enables the speaker line, I/O ports and store proper
482 * values to configuration registers.
437 */ 483 */
438int pcmcia_enable_device(struct pcmcia_device *p_dev) 484int pcmcia_enable_device(struct pcmcia_device *p_dev)
439{ 485{
@@ -565,8 +611,9 @@ EXPORT_SYMBOL(pcmcia_enable_device);
565 611
566/** 612/**
567 * pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices 613 * pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices
614 * @p_dev: the associated PCMCIA device
568 * 615 *
569 * pcmcia_request_io() attepts to reserve the IO port ranges specified in 616 * pcmcia_request_io() attempts to reserve the IO port ranges specified in
570 * &struct pcmcia_device @p_dev->resource[0] and @p_dev->resource[1]. The 617 * &struct pcmcia_device @p_dev->resource[0] and @p_dev->resource[1]. The
571 * "start" value is the requested start of the IO port resource; "end" 618 * "start" value is the requested start of the IO port resource; "end"
572 * reflects the number of ports requested. The number of IO lines requested 619 * reflects the number of ports requested. The number of IO lines requested
@@ -630,11 +677,13 @@ EXPORT_SYMBOL(pcmcia_request_io);
630 677
631/** 678/**
632 * pcmcia_request_irq() - attempt to request a IRQ for a PCMCIA device 679 * pcmcia_request_irq() - attempt to request a IRQ for a PCMCIA device
680 * @p_dev: the associated PCMCIA device
681 * @handler: IRQ handler to register
633 * 682 *
634 * pcmcia_request_irq() is a wrapper around request_irq which will allow 683 * pcmcia_request_irq() is a wrapper around request_irq() which allows
635 * the PCMCIA core to clean up the registration in pcmcia_disable_device(). 684 * the PCMCIA core to clean up the registration in pcmcia_disable_device().
636 * Drivers are free to use request_irq() directly, but then they need to 685 * Drivers are free to use request_irq() directly, but then they need to
637 * call free_irq themselfves, too. Also, only IRQF_SHARED capable IRQ 686 * call free_irq() themselfves, too. Also, only %IRQF_SHARED capable IRQ
638 * handlers are allowed. 687 * handlers are allowed.
639 */ 688 */
640int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, 689int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev,
@@ -657,12 +706,14 @@ EXPORT_SYMBOL(pcmcia_request_irq);
657 706
658/** 707/**
659 * pcmcia_request_exclusive_irq() - attempt to request an exclusive IRQ first 708 * pcmcia_request_exclusive_irq() - attempt to request an exclusive IRQ first
709 * @p_dev: the associated PCMCIA device
710 * @handler: IRQ handler to register
660 * 711 *
661 * pcmcia_request_exclusive_irq() is a wrapper around request_irq which 712 * pcmcia_request_exclusive_irq() is a wrapper around request_irq() which
662 * attempts first to request an exclusive IRQ. If it fails, it also accepts 713 * attempts first to request an exclusive IRQ. If it fails, it also accepts
663 * a shared IRQ, but prints out a warning. PCMCIA drivers should allow for 714 * a shared IRQ, but prints out a warning. PCMCIA drivers should allow for
664 * IRQ sharing and either use request_irq directly (then they need to call 715 * IRQ sharing and either use request_irq directly (then they need to call
665 * free_irq themselves, too), or the pcmcia_request_irq() function. 716 * free_irq() themselves, too), or the pcmcia_request_irq() function.
666 */ 717 */
667int __must_check 718int __must_check
668__pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev, 719__pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev,
@@ -805,10 +856,13 @@ int pcmcia_setup_irq(struct pcmcia_device *p_dev)
805 856
806/** 857/**
807 * pcmcia_request_window() - attempt to reserve iomem for PCMCIA devices 858 * pcmcia_request_window() - attempt to reserve iomem for PCMCIA devices
859 * @p_dev: the associated PCMCIA device
860 * @res: &struct resource pointing to p_dev->resource[2..5]
861 * @speed: access speed
808 * 862 *
809 * pcmcia_request_window() attepts to reserve an iomem ranges specified in 863 * pcmcia_request_window() attepts to reserve an iomem ranges specified in
810 * struct resource *res pointing to one of the entries in 864 * &struct resource @res pointing to one of the entries in
811 * struct pcmcia_device *p_dev->resource[2..5]. The "start" value is the 865 * &struct pcmcia_device @p_dev->resource[2..5]. The "start" value is the
812 * requested start of the IO mem resource; "end" reflects the size 866 * requested start of the IO mem resource; "end" reflects the size
813 * requested. 867 * requested.
814 */ 868 */
@@ -900,6 +954,19 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res,
900} /* pcmcia_request_window */ 954} /* pcmcia_request_window */
901EXPORT_SYMBOL(pcmcia_request_window); 955EXPORT_SYMBOL(pcmcia_request_window);
902 956
957
958/**
959 * pcmcia_disable_device() - disable and clean up a PCMCIA device
960 * @p_dev: the associated PCMCIA device
961 *
962 * pcmcia_disable_device() is the driver-callable counterpart to
963 * pcmcia_enable_device(): If a PCMCIA device is no longer used,
964 * drivers are expected to clean up and disable the device by calling
965 * this function. Any I/O ranges (iomem and ioports) will be released,
966 * the Vpp voltage will be set to 0, and IRQs will no longer be
967 * generated -- at least if there is no other card function (of
968 * multifunction devices) being used.
969 */
903void pcmcia_disable_device(struct pcmcia_device *p_dev) 970void pcmcia_disable_device(struct pcmcia_device *p_dev)
904{ 971{
905 int i; 972 int i;