driver-changes.rst 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. ==============
  2. Driver changes
  3. ==============
  4. This file details changes in 2.6 which affect PCMCIA card driver authors:
  5. * pcmcia_loop_config() and autoconfiguration (as of 2.6.36)
  6. If `struct pcmcia_device *p_dev->config_flags` is set accordingly,
  7. pcmcia_loop_config() now sets up certain configuration values
  8. automatically, though the driver may still override the settings
  9. in the callback function. The following autoconfiguration options
  10. are provided at the moment:
  11. - CONF_AUTO_CHECK_VCC : check for matching Vcc
  12. - CONF_AUTO_SET_VPP : set Vpp
  13. - CONF_AUTO_AUDIO : auto-enable audio line, if required
  14. - CONF_AUTO_SET_IO : set ioport resources (->resource[0,1])
  15. - CONF_AUTO_SET_IOMEM : set first iomem resource (->resource[2])
  16. * pcmcia_request_configuration -> pcmcia_enable_device (as of 2.6.36)
  17. pcmcia_request_configuration() got renamed to pcmcia_enable_device(),
  18. as it mirrors pcmcia_disable_device(). Configuration settings are now
  19. stored in struct pcmcia_device, e.g. in the fields config_flags,
  20. config_index, config_base, vpp.
  21. * pcmcia_request_window changes (as of 2.6.36)
  22. Instead of win_req_t, drivers are now requested to fill out
  23. `struct pcmcia_device *p_dev->resource[2,3,4,5]` for up to four ioport
  24. ranges. After a call to pcmcia_request_window(), the regions found there
  25. are reserved and may be used immediately -- until pcmcia_release_window()
  26. is called.
  27. * pcmcia_request_io changes (as of 2.6.36)
  28. Instead of io_req_t, drivers are now requested to fill out
  29. `struct pcmcia_device *p_dev->resource[0,1]` for up to two ioport
  30. ranges. After a call to pcmcia_request_io(), the ports found there
  31. are reserved, after calling pcmcia_request_configuration(), they may
  32. be used.
  33. * No dev_info_t, no cs_types.h (as of 2.6.36)
  34. dev_info_t and a few other typedefs are removed. No longer use them
  35. in PCMCIA device drivers. Also, do not include pcmcia/cs_types.h, as
  36. this file is gone.
  37. * No dev_node_t (as of 2.6.35)
  38. There is no more need to fill out a "dev_node_t" structure.
  39. * New IRQ request rules (as of 2.6.35)
  40. Instead of the old pcmcia_request_irq() interface, drivers may now
  41. choose between:
  42. - calling request_irq/free_irq directly. Use the IRQ from `*p_dev->irq`.
  43. - use pcmcia_request_irq(p_dev, handler_t); the PCMCIA core will
  44. clean up automatically on calls to pcmcia_disable_device() or
  45. device ejection.
  46. * no cs_error / CS_CHECK / CONFIG_PCMCIA_DEBUG (as of 2.6.33)
  47. Instead of the cs_error() callback or the CS_CHECK() macro, please use
  48. Linux-style checking of return values, and -- if necessary -- debug
  49. messages using "dev_dbg()" or "pr_debug()".
  50. * New CIS tuple access (as of 2.6.33)
  51. Instead of pcmcia_get_{first,next}_tuple(), pcmcia_get_tuple_data() and
  52. pcmcia_parse_tuple(), a driver shall use "pcmcia_get_tuple()" if it is
  53. only interested in one (raw) tuple, or "pcmcia_loop_tuple()" if it is
  54. interested in all tuples of one type. To decode the MAC from CISTPL_FUNCE,
  55. a new helper "pcmcia_get_mac_from_cis()" was added.
  56. * New configuration loop helper (as of 2.6.28)
  57. By calling pcmcia_loop_config(), a driver can iterate over all available
  58. configuration options. During a driver's probe() phase, one doesn't need
  59. to use pcmcia_get_{first,next}_tuple, pcmcia_get_tuple_data and
  60. pcmcia_parse_tuple directly in most if not all cases.
  61. * New release helper (as of 2.6.17)
  62. Instead of calling pcmcia_release_{configuration,io,irq,win}, all that's
  63. necessary now is calling pcmcia_disable_device. As there is no valid
  64. reason left to call pcmcia_release_io and pcmcia_release_irq, the
  65. exports for them were removed.
  66. * Unify detach and REMOVAL event code, as well as attach and INSERTION
  67. code (as of 2.6.16)::
  68. void (*remove) (struct pcmcia_device *dev);
  69. int (*probe) (struct pcmcia_device *dev);
  70. * Move suspend, resume and reset out of event handler (as of 2.6.16)::
  71. int (*suspend) (struct pcmcia_device *dev);
  72. int (*resume) (struct pcmcia_device *dev);
  73. should be initialized in struct pcmcia_driver, and handle
  74. (SUSPEND == RESET_PHYSICAL) and (RESUME == CARD_RESET) events
  75. * event handler initialization in struct pcmcia_driver (as of 2.6.13)
  76. The event handler is notified of all events, and must be initialized
  77. as the event() callback in the driver's struct pcmcia_driver.
  78. * pcmcia/version.h should not be used (as of 2.6.13)
  79. This file will be removed eventually.
  80. * in-kernel device<->driver matching (as of 2.6.13)
  81. PCMCIA devices and their correct drivers can now be matched in
  82. kernelspace. See 'devicetable.txt' for details.
  83. * Device model integration (as of 2.6.11)
  84. A struct pcmcia_device is registered with the device model core,
  85. and can be used (e.g. for SET_NETDEV_DEV) by using
  86. handle_to_dev(client_handle_t * handle).
  87. * Convert internal I/O port addresses to unsigned int (as of 2.6.11)
  88. ioaddr_t should be replaced by unsigned int in PCMCIA card drivers.
  89. * irq_mask and irq_list parameters (as of 2.6.11)
  90. The irq_mask and irq_list parameters should no longer be used in
  91. PCMCIA card drivers. Instead, it is the job of the PCMCIA core to
  92. determine which IRQ should be used. Therefore, link->irq.IRQInfo2
  93. is ignored.
  94. * client->PendingEvents is gone (as of 2.6.11)
  95. client->PendingEvents is no longer available.
  96. * client->Attributes are gone (as of 2.6.11)
  97. client->Attributes is unused, therefore it is removed from all
  98. PCMCIA card drivers
  99. * core functions no longer available (as of 2.6.11)
  100. The following functions have been removed from the kernel source
  101. because they are unused by all in-kernel drivers, and no external
  102. driver was reported to rely on them::
  103. pcmcia_get_first_region()
  104. pcmcia_get_next_region()
  105. pcmcia_modify_window()
  106. pcmcia_set_event_mask()
  107. pcmcia_get_first_window()
  108. pcmcia_get_next_window()
  109. * device list iteration upon module removal (as of 2.6.10)
  110. It is no longer necessary to iterate on the driver's internal
  111. client list and call the ->detach() function upon module removal.
  112. * Resource management. (as of 2.6.8)
  113. Although the PCMCIA subsystem will allocate resources for cards,
  114. it no longer marks these resources busy. This means that driver
  115. authors are now responsible for claiming your resources as per
  116. other drivers in Linux. You should use request_region() to mark
  117. your IO regions in-use, and request_mem_region() to mark your
  118. memory regions in-use. The name argument should be a pointer to
  119. your driver name. Eg, for pcnet_cs, name should point to the
  120. string "pcnet_cs".
  121. * CardServices is gone
  122. CardServices() in 2.4 is just a big switch statement to call various
  123. services. In 2.6, all of those entry points are exported and called
  124. directly (except for pcmcia_report_error(), just use cs_error() instead).
  125. * struct pcmcia_driver
  126. You need to use struct pcmcia_driver and pcmcia_{un,}register_driver
  127. instead of {un,}register_pccard_driver