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