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