···66 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.77 *88 * Copyright (C) 1999 David A. Hinds99- * Copyright (C) 2004-2005 Dominik Brodowski99+ * Copyright (C) 2004-2010 Dominik Brodowski1010 *1111 * This program is free software; you can redistribute it and/or modify1212 * it under the terms of the GNU General Public License version 2 as···5555}565657575858+/**5959+ * release_io_space() - release IO ports allocated with alloc_io_space()6060+ * @s: pcmcia socket6161+ * @res: resource to release6262+ *6363+ */5864static void release_io_space(struct pcmcia_socket *s, struct resource *res)5965{6066 resource_size_t num = resource_size(res);···8680 }8781 }8882 }8989-} /* release_io_space */8383+}90849191-/** alloc_io_space8585+8686+/**8787+ * alloc_io_space() - allocate IO ports for use by a PCMCIA device8888+ * @s: pcmcia socket8989+ * @res: resource to allocate (begin: begin, end: size)9090+ * @lines: number of IO lines decoded by the PCMCIA card9291 *9392 * Special stuff for managing IO windows, because they are scarce9493 */···145134 }146135 dev_dbg(&s->dev, "alloc_io_space request result %d: %pR\n", ret, res);147136 return ret;148148-} /* alloc_io_space */137137+}149138150139151140/**···185174 mutex_unlock(&s->ops_mutex);186175187176 return ret;188188-} /* pcmcia_access_config */177177+}189178190179191180/**···214203EXPORT_SYMBOL(pcmcia_write_config_byte);215204216205206206+/**207207+ * pcmcia_map_mem_page() - modify iomem window to point to a different offset208208+ * @p_dev: pcmcia device209209+ * @res: iomem resource already enabled by pcmcia_request_window()210210+ * @offset: card_offset to map211211+ *212212+ * pcmcia_map_mem_page() modifies what can be read and written by accessing213213+ * an iomem range previously enabled by pcmcia_request_window(), by setting214214+ * the card_offset value to @offset.215215+ */217216int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res,218217 unsigned int offset)219218{···242221 dev_warn(&p_dev->dev, "failed to set_mem_map\n");243222 mutex_unlock(&s->ops_mutex);244223 return ret;245245-} /* pcmcia_map_mem_page */224224+}246225EXPORT_SYMBOL(pcmcia_map_mem_page);247226248227249228/**250229 * pcmcia_fixup_iowidth() - reduce io width to 8bit230230+ * @p_dev: pcmcia device251231 *252232 * pcmcia_fixup_iowidth() allows a PCMCIA device driver to reduce the253233 * IO width to 8bit after having called pcmcia_enable_device()···297275298276/**299277 * pcmcia_fixup_vpp() - set Vpp to a new voltage level278278+ * @p_dev: pcmcia device279279+ * @new_vpp: new Vpp voltage300280 *301281 * pcmcia_fixup_vpp() allows a PCMCIA device driver to set Vpp to302282 * a new voltage level between calls to pcmcia_enable_device()···336312EXPORT_SYMBOL(pcmcia_fixup_vpp);337313338314315315+/**316316+ * pcmcia_release_configuration() - physically disable a PCMCIA device317317+ * @p_dev: pcmcia device318318+ *319319+ * pcmcia_release_configuration() is the 1:1 counterpart to320320+ * pcmcia_enable_device(): If a PCMCIA device is no longer used by any321321+ * driver, the Vpp voltage is set to 0, IRQs will no longer be generated,322322+ * and I/O ranges will be disabled. As pcmcia_release_io() and323323+ * pcmcia_release_window() still need to be called, device drivers are324324+ * expected to call pcmcia_disable_device() instead.325325+ */339326int pcmcia_release_configuration(struct pcmcia_device *p_dev)340327{341328 pccard_io_map io = { 0, 0, 0, 0, 1 };···359324 if (p_dev->_locked) {360325 p_dev->_locked = 0;361326 if (--(s->lock_count) == 0) {362362- s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */327327+ s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */363328 s->socket.Vpp = 0;364329 s->socket.io_irq = 0;365330 s->ops->set_socket(s, &s->socket);···381346 mutex_unlock(&s->ops_mutex);382347383348 return 0;384384-} /* pcmcia_release_configuration */349349+}385350386351387387-/** pcmcia_release_io352352+/**353353+ * pcmcia_release_io() - release I/O allocated by a PCMCIA device354354+ * @p_dev: pcmcia device388355 *389389- * Release_io() releases the I/O ranges allocated by a client. This390390- * may be invoked some time after a card ejection has already dumped391391- * the actual socket configuration, so if the client is "stale", we392392- * don't bother checking the port ranges against the current socket393393- * values.356356+ * pcmcia_release_io() releases the I/O ranges allocated by a PCMCIA357357+ * device. This may be invoked some time after a card ejection has358358+ * already dumped the actual socket configuration, so if the client is359359+ * "stale", we don't bother checking the port ranges against the360360+ * current socket values.394361 */395362static int pcmcia_release_io(struct pcmcia_device *p_dev)396363{···420383 return ret;421384} /* pcmcia_release_io */422385386386+423387/**424388 * pcmcia_release_window() - release reserved iomem for PCMCIA devices389389+ * @p_dev: pcmcia device390390+ * @res: iomem resource to release425391 *426426- * pcmcia_release_window() releases struct resource *res which was392392+ * pcmcia_release_window() releases &struct resource *res which was427393 * previously reserved by calling pcmcia_request_window().428394 */429395int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res)···471431} /* pcmcia_release_window */472432EXPORT_SYMBOL(pcmcia_release_window);473433434434+474435/**475436 * pcmcia_enable_device() - set up and activate a PCMCIA device437437+ * @p_dev: the associated PCMCIA device476438 *439439+ * pcmcia_enable_device() physically enables a PCMCIA device. It parses440440+ * the flags passed to in @flags and stored in @p_dev->flags and sets up441441+ * the Vpp voltage, enables the speaker line, I/O ports and store proper442442+ * values to configuration registers.477443 */478444int pcmcia_enable_device(struct pcmcia_device *p_dev)479445{···611565612566/**613567 * pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices568568+ * @p_dev: the associated PCMCIA device614569 *615615- * pcmcia_request_io() attepts to reserve the IO port ranges specified in570570+ * pcmcia_request_io() attempts to reserve the IO port ranges specified in616571 * &struct pcmcia_device @p_dev->resource[0] and @p_dev->resource[1]. The617572 * "start" value is the requested start of the IO port resource; "end"618573 * reflects the number of ports requested. The number of IO lines requested···677630678631/**679632 * pcmcia_request_irq() - attempt to request a IRQ for a PCMCIA device633633+ * @p_dev: the associated PCMCIA device634634+ * @handler: IRQ handler to register680635 *681681- * pcmcia_request_irq() is a wrapper around request_irq which will allow636636+ * pcmcia_request_irq() is a wrapper around request_irq() which allows682637 * the PCMCIA core to clean up the registration in pcmcia_disable_device().683638 * Drivers are free to use request_irq() directly, but then they need to684684- * call free_irq themselfves, too. Also, only IRQF_SHARED capable IRQ639639+ * call free_irq() themselfves, too. Also, only %IRQF_SHARED capable IRQ685640 * handlers are allowed.686641 */687642int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev,···706657707658/**708659 * pcmcia_request_exclusive_irq() - attempt to request an exclusive IRQ first660660+ * @p_dev: the associated PCMCIA device661661+ * @handler: IRQ handler to register709662 *710710- * pcmcia_request_exclusive_irq() is a wrapper around request_irq which663663+ * pcmcia_request_exclusive_irq() is a wrapper around request_irq() which711664 * attempts first to request an exclusive IRQ. If it fails, it also accepts712665 * a shared IRQ, but prints out a warning. PCMCIA drivers should allow for713666 * IRQ sharing and either use request_irq directly (then they need to call714714- * free_irq themselves, too), or the pcmcia_request_irq() function.667667+ * free_irq() themselves, too), or the pcmcia_request_irq() function.715668 */716669int __must_check717670__pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev,···856805857806/**858807 * pcmcia_request_window() - attempt to reserve iomem for PCMCIA devices808808+ * @p_dev: the associated PCMCIA device809809+ * @res: &struct resource pointing to p_dev->resource[2..5]810810+ * @speed: access speed859811 *860812 * pcmcia_request_window() attepts to reserve an iomem ranges specified in861861- * struct resource *res pointing to one of the entries in862862- * struct pcmcia_device *p_dev->resource[2..5]. The "start" value is the813813+ * &struct resource @res pointing to one of the entries in814814+ * &struct pcmcia_device @p_dev->resource[2..5]. The "start" value is the863815 * requested start of the IO mem resource; "end" reflects the size864816 * requested.865817 */···954900} /* pcmcia_request_window */955901EXPORT_SYMBOL(pcmcia_request_window);956902903903+904904+/**905905+ * pcmcia_disable_device() - disable and clean up a PCMCIA device906906+ * @p_dev: the associated PCMCIA device907907+ *908908+ * pcmcia_disable_device() is the driver-callable counterpart to909909+ * pcmcia_enable_device(): If a PCMCIA device is no longer used,910910+ * drivers are expected to clean up and disable the device by calling911911+ * this function. Any I/O ranges (iomem and ioports) will be released,912912+ * the Vpp voltage will be set to 0, and IRQs will no longer be913913+ * generated -- at least if there is no other card function (of914914+ * multifunction devices) being used.915915+ */957916void pcmcia_disable_device(struct pcmcia_device *p_dev)958917{959918 int i;