diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/isdn/hisax/teles_cs.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/isdn/hisax/teles_cs.c')
-rw-r--r-- | drivers/isdn/hisax/teles_cs.c | 104 |
1 files changed, 10 insertions, 94 deletions
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 7296102ca255..161a1938552e 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c | |||
@@ -9,7 +9,7 @@ | |||
9 | Also inspired by ELSA PCMCIA driver | 9 | Also inspired by ELSA PCMCIA driver |
10 | by Klaus Lichtenwalder <Lichtenwalder@ACM.org> | 10 | by Klaus Lichtenwalder <Lichtenwalder@ACM.org> |
11 | 11 | ||
12 | Extentions to new hisax_pcmcia by Karsten Keil | 12 | Extensions to new hisax_pcmcia by Karsten Keil |
13 | 13 | ||
14 | minor changes to be compatible with kernel 2.4.x | 14 | minor changes to be compatible with kernel 2.4.x |
15 | by Jan.Schubert@GMX.li | 15 | by Jan.Schubert@GMX.li |
@@ -27,7 +27,6 @@ | |||
27 | #include <asm/io.h> | 27 | #include <asm/io.h> |
28 | #include <asm/system.h> | 28 | #include <asm/system.h> |
29 | 29 | ||
30 | #include <pcmcia/cs.h> | ||
31 | #include <pcmcia/cistpl.h> | 30 | #include <pcmcia/cistpl.h> |
32 | #include <pcmcia/cisreg.h> | 31 | #include <pcmcia/cisreg.h> |
33 | #include <pcmcia/ds.h> | 32 | #include <pcmcia/ds.h> |
@@ -45,26 +44,8 @@ MODULE_LICENSE("GPL"); | |||
45 | static int protocol = 2; /* EURO-ISDN Default */ | 44 | static int protocol = 2; /* EURO-ISDN Default */ |
46 | module_param(protocol, int, 0); | 45 | module_param(protocol, int, 0); |
47 | 46 | ||
48 | /*====================================================================*/ | ||
49 | |||
50 | /* | ||
51 | The event() function is this driver's Card Services event handler. | ||
52 | It will be called by Card Services when an appropriate card status | ||
53 | event is received. The config() and release() entry points are | ||
54 | used to configure or release a socket, in response to card insertion | ||
55 | and ejection events. They are invoked from the teles_cs event | ||
56 | handler. | ||
57 | */ | ||
58 | |||
59 | static int teles_cs_config(struct pcmcia_device *link) __devinit ; | 47 | static int teles_cs_config(struct pcmcia_device *link) __devinit ; |
60 | static void teles_cs_release(struct pcmcia_device *link); | 48 | static void teles_cs_release(struct pcmcia_device *link); |
61 | |||
62 | /* | ||
63 | The attach() and detach() entry points are used to create and destroy | ||
64 | "instances" of the driver, where each instance represents everything | ||
65 | needed to manage one actual PCMCIA card. | ||
66 | */ | ||
67 | |||
68 | static void teles_detach(struct pcmcia_device *p_dev) __devexit ; | 49 | static void teles_detach(struct pcmcia_device *p_dev) __devexit ; |
69 | 50 | ||
70 | typedef struct local_info_t { | 51 | typedef struct local_info_t { |
@@ -73,18 +54,6 @@ typedef struct local_info_t { | |||
73 | int cardnr; | 54 | int cardnr; |
74 | } local_info_t; | 55 | } local_info_t; |
75 | 56 | ||
76 | /*====================================================================== | ||
77 | |||
78 | teles_attach() creates an "instance" of the driver, allocatingx | ||
79 | local data structures for one device. The device is registered | ||
80 | with Card Services. | ||
81 | |||
82 | The dev_link structure is initialized, but we don't actually | ||
83 | configure the card at this point -- we wait until we receive a | ||
84 | card insertion event. | ||
85 | |||
86 | ======================================================================*/ | ||
87 | |||
88 | static int __devinit teles_probe(struct pcmcia_device *link) | 57 | static int __devinit teles_probe(struct pcmcia_device *link) |
89 | { | 58 | { |
90 | local_info_t *local; | 59 | local_info_t *local; |
@@ -99,31 +68,11 @@ static int __devinit teles_probe(struct pcmcia_device *link) | |||
99 | local->p_dev = link; | 68 | local->p_dev = link; |
100 | link->priv = local; | 69 | link->priv = local; |
101 | 70 | ||
102 | /* | 71 | link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; |
103 | General socket configuration defaults can go here. In this | ||
104 | client, we assume very little, and rely on the CIS for almost | ||
105 | everything. In most clients, many details (i.e., number, sizes, | ||
106 | and attributes of IO windows) are fixed by the nature of the | ||
107 | device, and can be hard-wired here. | ||
108 | */ | ||
109 | link->resource[0]->end = 96; | ||
110 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; | ||
111 | |||
112 | link->conf.Attributes = CONF_ENABLE_IRQ; | ||
113 | link->conf.IntType = INT_MEMORY_AND_IO; | ||
114 | 72 | ||
115 | return teles_cs_config(link); | 73 | return teles_cs_config(link); |
116 | } /* teles_attach */ | 74 | } /* teles_attach */ |
117 | 75 | ||
118 | /*====================================================================== | ||
119 | |||
120 | This deletes a driver "instance". The device is de-registered | ||
121 | with Card Services. If it has been released, all local data | ||
122 | structures are freed. Otherwise, the structures will be freed | ||
123 | when the device is released. | ||
124 | |||
125 | ======================================================================*/ | ||
126 | |||
127 | static void __devexit teles_detach(struct pcmcia_device *link) | 76 | static void __devexit teles_detach(struct pcmcia_device *link) |
128 | { | 77 | { |
129 | local_info_t *info = link->priv; | 78 | local_info_t *info = link->priv; |
@@ -136,27 +85,17 @@ static void __devexit teles_detach(struct pcmcia_device *link) | |||
136 | kfree(info); | 85 | kfree(info); |
137 | } /* teles_detach */ | 86 | } /* teles_detach */ |
138 | 87 | ||
139 | /*====================================================================== | 88 | static int teles_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data) |
140 | |||
141 | teles_cs_config() is scheduled to run after a CARD_INSERTION event | ||
142 | is received, to configure the PCMCIA socket, and to make the | ||
143 | device available to the system. | ||
144 | |||
145 | ======================================================================*/ | ||
146 | |||
147 | static int teles_cs_configcheck(struct pcmcia_device *p_dev, | ||
148 | cistpl_cftable_entry_t *cf, | ||
149 | cistpl_cftable_entry_t *dflt, | ||
150 | unsigned int vcc, | ||
151 | void *priv_data) | ||
152 | { | 89 | { |
153 | int j; | 90 | int j; |
154 | 91 | ||
155 | p_dev->io_lines = 5; | 92 | p_dev->io_lines = 5; |
93 | p_dev->resource[0]->end = 96; | ||
94 | p_dev->resource[0]->flags &= IO_DATA_PATH_WIDTH; | ||
95 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; | ||
156 | 96 | ||
157 | if ((cf->io.nwin > 0) && cf->io.win[0].base) { | 97 | if ((p_dev->resource[0]->end) && p_dev->resource[0]->start) { |
158 | printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); | 98 | printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); |
159 | p_dev->resource[0]->start = cf->io.win[0].base; | ||
160 | if (!pcmcia_request_io(p_dev)) | 99 | if (!pcmcia_request_io(p_dev)) |
161 | return 0; | 100 | return 0; |
162 | } else { | 101 | } else { |
@@ -172,12 +111,10 @@ static int teles_cs_configcheck(struct pcmcia_device *p_dev, | |||
172 | 111 | ||
173 | static int __devinit teles_cs_config(struct pcmcia_device *link) | 112 | static int __devinit teles_cs_config(struct pcmcia_device *link) |
174 | { | 113 | { |
175 | local_info_t *dev; | ||
176 | int i; | 114 | int i; |
177 | IsdnCard_t icard; | 115 | IsdnCard_t icard; |
178 | 116 | ||
179 | dev_dbg(&link->dev, "teles_config(0x%p)\n", link); | 117 | dev_dbg(&link->dev, "teles_config(0x%p)\n", link); |
180 | dev = link->priv; | ||
181 | 118 | ||
182 | i = pcmcia_loop_config(link, teles_cs_configcheck, NULL); | 119 | i = pcmcia_loop_config(link, teles_cs_configcheck, NULL); |
183 | if (i != 0) | 120 | if (i != 0) |
@@ -186,21 +123,10 @@ static int __devinit teles_cs_config(struct pcmcia_device *link) | |||
186 | if (!link->irq) | 123 | if (!link->irq) |
187 | goto cs_failed; | 124 | goto cs_failed; |
188 | 125 | ||
189 | i = pcmcia_request_configuration(link, &link->conf); | 126 | i = pcmcia_enable_device(link); |
190 | if (i != 0) | 127 | if (i != 0) |
191 | goto cs_failed; | 128 | goto cs_failed; |
192 | 129 | ||
193 | /* Finally, report what we've done */ | ||
194 | dev_info(&link->dev, "index 0x%02x:", | ||
195 | link->conf.ConfigIndex); | ||
196 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | ||
197 | printk(", irq %d", link->irq); | ||
198 | if (link->resource[0]) | ||
199 | printk(" & %pR", link->resource[0]); | ||
200 | if (link->resource[1]) | ||
201 | printk(" & %pR", link->resource[1]); | ||
202 | printk("\n"); | ||
203 | |||
204 | icard.para[0] = link->irq; | 130 | icard.para[0] = link->irq; |
205 | icard.para[1] = link->resource[0]->start; | 131 | icard.para[1] = link->resource[0]->start; |
206 | icard.protocol = protocol; | 132 | icard.protocol = protocol; |
@@ -222,14 +148,6 @@ cs_failed: | |||
222 | return -ENODEV; | 148 | return -ENODEV; |
223 | } /* teles_cs_config */ | 149 | } /* teles_cs_config */ |
224 | 150 | ||
225 | /*====================================================================== | ||
226 | |||
227 | After a card is removed, teles_cs_release() will unregister the net | ||
228 | device, and release the PCMCIA configuration. If the device is | ||
229 | still open, this will be postponed until it is closed. | ||
230 | |||
231 | ======================================================================*/ | ||
232 | |||
233 | static void teles_cs_release(struct pcmcia_device *link) | 151 | static void teles_cs_release(struct pcmcia_device *link) |
234 | { | 152 | { |
235 | local_info_t *local = link->priv; | 153 | local_info_t *local = link->priv; |
@@ -265,7 +183,7 @@ static int teles_resume(struct pcmcia_device *link) | |||
265 | } | 183 | } |
266 | 184 | ||
267 | 185 | ||
268 | static struct pcmcia_device_id teles_ids[] = { | 186 | static const struct pcmcia_device_id teles_ids[] = { |
269 | PCMCIA_DEVICE_PROD_ID12("TELES", "S0/PC", 0x67b50eae, 0xe9e70119), | 187 | PCMCIA_DEVICE_PROD_ID12("TELES", "S0/PC", 0x67b50eae, 0xe9e70119), |
270 | PCMCIA_DEVICE_NULL, | 188 | PCMCIA_DEVICE_NULL, |
271 | }; | 189 | }; |
@@ -273,9 +191,7 @@ MODULE_DEVICE_TABLE(pcmcia, teles_ids); | |||
273 | 191 | ||
274 | static struct pcmcia_driver teles_cs_driver = { | 192 | static struct pcmcia_driver teles_cs_driver = { |
275 | .owner = THIS_MODULE, | 193 | .owner = THIS_MODULE, |
276 | .drv = { | 194 | .name = "teles_cs", |
277 | .name = "teles_cs", | ||
278 | }, | ||
279 | .probe = teles_probe, | 195 | .probe = teles_probe, |
280 | .remove = __devexit_p(teles_detach), | 196 | .remove = __devexit_p(teles_detach), |
281 | .id_table = teles_ids, | 197 | .id_table = teles_ids, |