18c2ecf20Sopenharmony_ci==============
28c2ecf20Sopenharmony_ciDriver changes
38c2ecf20Sopenharmony_ci==============
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciThis file details changes in 2.6 which affect PCMCIA card driver authors:
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci* pcmcia_loop_config() and autoconfiguration (as of 2.6.36)
88c2ecf20Sopenharmony_ci   If `struct pcmcia_device *p_dev->config_flags` is set accordingly,
98c2ecf20Sopenharmony_ci   pcmcia_loop_config() now sets up certain configuration values
108c2ecf20Sopenharmony_ci   automatically, though the driver may still override the settings
118c2ecf20Sopenharmony_ci   in the callback function. The following autoconfiguration options
128c2ecf20Sopenharmony_ci   are provided at the moment:
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci	- CONF_AUTO_CHECK_VCC : check for matching Vcc
158c2ecf20Sopenharmony_ci	- CONF_AUTO_SET_VPP   : set Vpp
168c2ecf20Sopenharmony_ci	- CONF_AUTO_AUDIO     : auto-enable audio line, if required
178c2ecf20Sopenharmony_ci	- CONF_AUTO_SET_IO    : set ioport resources (->resource[0,1])
188c2ecf20Sopenharmony_ci	- CONF_AUTO_SET_IOMEM : set first iomem resource (->resource[2])
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci* pcmcia_request_configuration -> pcmcia_enable_device (as of 2.6.36)
218c2ecf20Sopenharmony_ci   pcmcia_request_configuration() got renamed to pcmcia_enable_device(),
228c2ecf20Sopenharmony_ci   as it mirrors pcmcia_disable_device(). Configuration settings are now
238c2ecf20Sopenharmony_ci   stored in struct pcmcia_device, e.g. in the fields config_flags,
248c2ecf20Sopenharmony_ci   config_index, config_base, vpp.
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci* pcmcia_request_window changes (as of 2.6.36)
278c2ecf20Sopenharmony_ci   Instead of win_req_t, drivers are now requested to fill out
288c2ecf20Sopenharmony_ci   `struct pcmcia_device *p_dev->resource[2,3,4,5]` for up to four ioport
298c2ecf20Sopenharmony_ci   ranges. After a call to pcmcia_request_window(), the regions found there
308c2ecf20Sopenharmony_ci   are reserved and may be used immediately -- until pcmcia_release_window()
318c2ecf20Sopenharmony_ci   is called.
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci* pcmcia_request_io changes (as of 2.6.36)
348c2ecf20Sopenharmony_ci   Instead of io_req_t, drivers are now requested to fill out
358c2ecf20Sopenharmony_ci   `struct pcmcia_device *p_dev->resource[0,1]` for up to two ioport
368c2ecf20Sopenharmony_ci   ranges. After a call to pcmcia_request_io(), the ports found there
378c2ecf20Sopenharmony_ci   are reserved, after calling pcmcia_request_configuration(), they may
388c2ecf20Sopenharmony_ci   be used.
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci* No dev_info_t, no cs_types.h (as of 2.6.36)
418c2ecf20Sopenharmony_ci   dev_info_t and a few other typedefs are removed. No longer use them
428c2ecf20Sopenharmony_ci   in PCMCIA device drivers. Also, do not include pcmcia/cs_types.h, as
438c2ecf20Sopenharmony_ci   this file is gone.
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci* No dev_node_t (as of 2.6.35)
468c2ecf20Sopenharmony_ci   There is no more need to fill out a "dev_node_t" structure.
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci* New IRQ request rules (as of 2.6.35)
498c2ecf20Sopenharmony_ci   Instead of the old pcmcia_request_irq() interface, drivers may now
508c2ecf20Sopenharmony_ci   choose between:
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci   - calling request_irq/free_irq directly. Use the IRQ from `*p_dev->irq`.
538c2ecf20Sopenharmony_ci   - use pcmcia_request_irq(p_dev, handler_t); the PCMCIA core will
548c2ecf20Sopenharmony_ci     clean up automatically on calls to pcmcia_disable_device() or
558c2ecf20Sopenharmony_ci     device ejection.
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci* no cs_error / CS_CHECK / CONFIG_PCMCIA_DEBUG (as of 2.6.33)
588c2ecf20Sopenharmony_ci   Instead of the cs_error() callback or the CS_CHECK() macro, please use
598c2ecf20Sopenharmony_ci   Linux-style checking of return values, and -- if necessary -- debug
608c2ecf20Sopenharmony_ci   messages using "dev_dbg()" or "pr_debug()".
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci* New CIS tuple access (as of 2.6.33)
638c2ecf20Sopenharmony_ci   Instead of pcmcia_get_{first,next}_tuple(), pcmcia_get_tuple_data() and
648c2ecf20Sopenharmony_ci   pcmcia_parse_tuple(), a driver shall use "pcmcia_get_tuple()" if it is
658c2ecf20Sopenharmony_ci   only interested in one (raw) tuple, or "pcmcia_loop_tuple()" if it is
668c2ecf20Sopenharmony_ci   interested in all tuples of one type. To decode the MAC from CISTPL_FUNCE,
678c2ecf20Sopenharmony_ci   a new helper "pcmcia_get_mac_from_cis()" was added.
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci* New configuration loop helper (as of 2.6.28)
708c2ecf20Sopenharmony_ci   By calling pcmcia_loop_config(), a driver can iterate over all available
718c2ecf20Sopenharmony_ci   configuration options. During a driver's probe() phase, one doesn't need
728c2ecf20Sopenharmony_ci   to use pcmcia_get_{first,next}_tuple, pcmcia_get_tuple_data and
738c2ecf20Sopenharmony_ci   pcmcia_parse_tuple directly in most if not all cases.
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci* New release helper (as of 2.6.17)
768c2ecf20Sopenharmony_ci   Instead of calling pcmcia_release_{configuration,io,irq,win}, all that's
778c2ecf20Sopenharmony_ci   necessary now is calling pcmcia_disable_device. As there is no valid
788c2ecf20Sopenharmony_ci   reason left to call pcmcia_release_io and pcmcia_release_irq, the
798c2ecf20Sopenharmony_ci   exports for them were removed.
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci* Unify detach and REMOVAL event code, as well as attach and INSERTION
828c2ecf20Sopenharmony_ci  code (as of 2.6.16)::
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci       void (*remove)          (struct pcmcia_device *dev);
858c2ecf20Sopenharmony_ci       int (*probe)            (struct pcmcia_device *dev);
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci* Move suspend, resume and reset out of event handler (as of 2.6.16)::
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci       int (*suspend)          (struct pcmcia_device *dev);
908c2ecf20Sopenharmony_ci       int (*resume)           (struct pcmcia_device *dev);
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci  should be initialized in struct pcmcia_driver, and handle
938c2ecf20Sopenharmony_ci  (SUSPEND == RESET_PHYSICAL) and (RESUME == CARD_RESET) events
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci* event handler initialization in struct pcmcia_driver (as of 2.6.13)
968c2ecf20Sopenharmony_ci   The event handler is notified of all events, and must be initialized
978c2ecf20Sopenharmony_ci   as the event() callback in the driver's struct pcmcia_driver.
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci* pcmcia/version.h should not be used (as of 2.6.13)
1008c2ecf20Sopenharmony_ci   This file will be removed eventually.
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci* in-kernel device<->driver matching (as of 2.6.13)
1038c2ecf20Sopenharmony_ci   PCMCIA devices and their correct drivers can now be matched in
1048c2ecf20Sopenharmony_ci   kernelspace. See 'devicetable.txt' for details.
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci* Device model integration (as of 2.6.11)
1078c2ecf20Sopenharmony_ci   A struct pcmcia_device is registered with the device model core,
1088c2ecf20Sopenharmony_ci   and can be used (e.g. for SET_NETDEV_DEV) by using
1098c2ecf20Sopenharmony_ci   handle_to_dev(client_handle_t * handle).
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci* Convert internal I/O port addresses to unsigned int (as of 2.6.11)
1128c2ecf20Sopenharmony_ci   ioaddr_t should be replaced by unsigned int in PCMCIA card drivers.
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci* irq_mask and irq_list parameters (as of 2.6.11)
1158c2ecf20Sopenharmony_ci   The irq_mask and irq_list parameters should no longer be used in
1168c2ecf20Sopenharmony_ci   PCMCIA card drivers. Instead, it is the job of the PCMCIA core to
1178c2ecf20Sopenharmony_ci   determine which IRQ should be used. Therefore, link->irq.IRQInfo2
1188c2ecf20Sopenharmony_ci   is ignored.
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci* client->PendingEvents is gone (as of 2.6.11)
1218c2ecf20Sopenharmony_ci   client->PendingEvents is no longer available.
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci* client->Attributes are gone (as of 2.6.11)
1248c2ecf20Sopenharmony_ci   client->Attributes is unused, therefore it is removed from all
1258c2ecf20Sopenharmony_ci   PCMCIA card drivers
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci* core functions no longer available (as of 2.6.11)
1288c2ecf20Sopenharmony_ci   The following functions have been removed from the kernel source
1298c2ecf20Sopenharmony_ci   because they are unused by all in-kernel drivers, and no external
1308c2ecf20Sopenharmony_ci   driver was reported to rely on them::
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci	pcmcia_get_first_region()
1338c2ecf20Sopenharmony_ci	pcmcia_get_next_region()
1348c2ecf20Sopenharmony_ci	pcmcia_modify_window()
1358c2ecf20Sopenharmony_ci	pcmcia_set_event_mask()
1368c2ecf20Sopenharmony_ci	pcmcia_get_first_window()
1378c2ecf20Sopenharmony_ci	pcmcia_get_next_window()
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci* device list iteration upon module removal (as of 2.6.10)
1408c2ecf20Sopenharmony_ci   It is no longer necessary to iterate on the driver's internal
1418c2ecf20Sopenharmony_ci   client list and call the ->detach() function upon module removal.
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci* Resource management. (as of 2.6.8)
1448c2ecf20Sopenharmony_ci   Although the PCMCIA subsystem will allocate resources for cards,
1458c2ecf20Sopenharmony_ci   it no longer marks these resources busy. This means that driver
1468c2ecf20Sopenharmony_ci   authors are now responsible for claiming your resources as per
1478c2ecf20Sopenharmony_ci   other drivers in Linux. You should use request_region() to mark
1488c2ecf20Sopenharmony_ci   your IO regions in-use, and request_mem_region() to mark your
1498c2ecf20Sopenharmony_ci   memory regions in-use. The name argument should be a pointer to
1508c2ecf20Sopenharmony_ci   your driver name. Eg, for pcnet_cs, name should point to the
1518c2ecf20Sopenharmony_ci   string "pcnet_cs".
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci* CardServices is gone
1548c2ecf20Sopenharmony_ci  CardServices() in 2.4 is just a big switch statement to call various
1558c2ecf20Sopenharmony_ci  services.  In 2.6, all of those entry points are exported and called
1568c2ecf20Sopenharmony_ci  directly (except for pcmcia_report_error(), just use cs_error() instead).
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci* struct pcmcia_driver
1598c2ecf20Sopenharmony_ci  You need to use struct pcmcia_driver and pcmcia_{un,}register_driver
1608c2ecf20Sopenharmony_ci  instead of {un,}register_pccard_driver
161