diff options
-rw-r--r-- | drivers/mtd/maps/pcmciamtd.c | 4 | ||||
-rw-r--r-- | drivers/pcmcia/cs_internal.h | 1 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_ioctl.c | 61 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_resource.c | 68 | ||||
-rw-r--r-- | include/pcmcia/cs.h | 1 |
5 files changed, 62 insertions, 73 deletions
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 00530f9bf4a7..0cc31675aeb9 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c | |||
@@ -560,9 +560,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
560 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); | 560 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); |
561 | 561 | ||
562 | /* Get write protect status */ | 562 | /* Get write protect status */ |
563 | CS_CHECK(GetStatus, pcmcia_get_status(link, &status)); | 563 | DEBUG(2, "window handle = 0x%8.8lx", (unsigned long)link->win); |
564 | DEBUG(2, "status value: 0x%x window handle = 0x%8.8lx", | ||
565 | status.CardState, (unsigned long)link->win); | ||
566 | dev->win_base = ioremap(req.Base, req.Size); | 564 | dev->win_base = ioremap(req.Base, req.Size); |
567 | if(!dev->win_base) { | 565 | if(!dev->win_base) { |
568 | err("ioremap(%lu, %u) failed", req.Base, req.Size); | 566 | err("ioremap(%lu, %u) failed", req.Base, req.Size); |
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 0a9e420defda..63dc1a28bda2 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
@@ -118,7 +118,6 @@ extern struct list_head pcmcia_socket_list; | |||
118 | int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req); | 118 | int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req); |
119 | int pccard_get_configuration_info(struct pcmcia_socket *s, struct pcmcia_device *p_dev, config_info_t *config); | 119 | int pccard_get_configuration_info(struct pcmcia_socket *s, struct pcmcia_device *p_dev, config_info_t *config); |
120 | int pccard_reset_card(struct pcmcia_socket *skt); | 120 | int pccard_reset_card(struct pcmcia_socket *skt); |
121 | int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev, cs_status_t *status); | ||
122 | 121 | ||
123 | 122 | ||
124 | struct pcmcia_callback{ | 123 | struct pcmcia_callback{ |
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 2d0521019536..afd00e7bbbef 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <pcmcia/cs_types.h> | 32 | #include <pcmcia/cs_types.h> |
33 | #include <pcmcia/cs.h> | 33 | #include <pcmcia/cs.h> |
34 | #include <pcmcia/cistpl.h> | 34 | #include <pcmcia/cistpl.h> |
35 | #include <pcmcia/cisreg.h> | ||
35 | #include <pcmcia/ds.h> | 36 | #include <pcmcia/ds.h> |
36 | #include <pcmcia/ss.h> | 37 | #include <pcmcia/ss.h> |
37 | 38 | ||
@@ -224,6 +225,66 @@ static int pcmcia_adjust_resource_info(adjust_t *adj) | |||
224 | return (ret); | 225 | return (ret); |
225 | } | 226 | } |
226 | 227 | ||
228 | /** pccard_get_status | ||
229 | * | ||
230 | * Get the current socket state bits. We don't support the latched | ||
231 | * SocketState yet: I haven't seen any point for it. | ||
232 | */ | ||
233 | |||
234 | static int pccard_get_status(struct pcmcia_socket *s, | ||
235 | struct pcmcia_device *p_dev, | ||
236 | cs_status_t *status) | ||
237 | { | ||
238 | config_t *c; | ||
239 | int val; | ||
240 | |||
241 | s->ops->get_status(s, &val); | ||
242 | status->CardState = status->SocketState = 0; | ||
243 | status->CardState |= (val & SS_DETECT) ? CS_EVENT_CARD_DETECT : 0; | ||
244 | status->CardState |= (val & SS_CARDBUS) ? CS_EVENT_CB_DETECT : 0; | ||
245 | status->CardState |= (val & SS_3VCARD) ? CS_EVENT_3VCARD : 0; | ||
246 | status->CardState |= (val & SS_XVCARD) ? CS_EVENT_XVCARD : 0; | ||
247 | if (s->state & SOCKET_SUSPEND) | ||
248 | status->CardState |= CS_EVENT_PM_SUSPEND; | ||
249 | if (!(s->state & SOCKET_PRESENT)) | ||
250 | return CS_NO_CARD; | ||
251 | |||
252 | c = (p_dev) ? p_dev->function_config : NULL; | ||
253 | |||
254 | if ((c != NULL) && (c->state & CONFIG_LOCKED) && | ||
255 | (c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) { | ||
256 | u_char reg; | ||
257 | if (c->CardValues & PRESENT_PIN_REPLACE) { | ||
258 | pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_PRR)>>1, 1, ®); | ||
259 | status->CardState |= | ||
260 | (reg & PRR_WP_STATUS) ? CS_EVENT_WRITE_PROTECT : 0; | ||
261 | status->CardState |= | ||
262 | (reg & PRR_READY_STATUS) ? CS_EVENT_READY_CHANGE : 0; | ||
263 | status->CardState |= | ||
264 | (reg & PRR_BVD2_STATUS) ? CS_EVENT_BATTERY_LOW : 0; | ||
265 | status->CardState |= | ||
266 | (reg & PRR_BVD1_STATUS) ? CS_EVENT_BATTERY_DEAD : 0; | ||
267 | } else { | ||
268 | /* No PRR? Then assume we're always ready */ | ||
269 | status->CardState |= CS_EVENT_READY_CHANGE; | ||
270 | } | ||
271 | if (c->CardValues & PRESENT_EXT_STATUS) { | ||
272 | pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_ESR)>>1, 1, ®); | ||
273 | status->CardState |= | ||
274 | (reg & ESR_REQ_ATTN) ? CS_EVENT_REQUEST_ATTENTION : 0; | ||
275 | } | ||
276 | return CS_SUCCESS; | ||
277 | } | ||
278 | status->CardState |= | ||
279 | (val & SS_WRPROT) ? CS_EVENT_WRITE_PROTECT : 0; | ||
280 | status->CardState |= | ||
281 | (val & SS_BATDEAD) ? CS_EVENT_BATTERY_DEAD : 0; | ||
282 | status->CardState |= | ||
283 | (val & SS_BATWARN) ? CS_EVENT_BATTERY_LOW : 0; | ||
284 | status->CardState |= | ||
285 | (val & SS_READY) ? CS_EVENT_READY_CHANGE : 0; | ||
286 | return CS_SUCCESS; | ||
287 | } /* pccard_get_status */ | ||
227 | 288 | ||
228 | /*====================================================================== | 289 | /*====================================================================== |
229 | 290 | ||
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index cb6b5da3f29a..4884a18cf9e6 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -309,74 +309,6 @@ int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, | |||
309 | EXPORT_SYMBOL(pcmcia_get_window); | 309 | EXPORT_SYMBOL(pcmcia_get_window); |
310 | 310 | ||
311 | 311 | ||
312 | /** pccard_get_status | ||
313 | * | ||
314 | * Get the current socket state bits. We don't support the latched | ||
315 | * SocketState yet: I haven't seen any point for it. | ||
316 | */ | ||
317 | |||
318 | int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev, | ||
319 | cs_status_t *status) | ||
320 | { | ||
321 | config_t *c; | ||
322 | int val; | ||
323 | |||
324 | s->ops->get_status(s, &val); | ||
325 | status->CardState = status->SocketState = 0; | ||
326 | status->CardState |= (val & SS_DETECT) ? CS_EVENT_CARD_DETECT : 0; | ||
327 | status->CardState |= (val & SS_CARDBUS) ? CS_EVENT_CB_DETECT : 0; | ||
328 | status->CardState |= (val & SS_3VCARD) ? CS_EVENT_3VCARD : 0; | ||
329 | status->CardState |= (val & SS_XVCARD) ? CS_EVENT_XVCARD : 0; | ||
330 | if (s->state & SOCKET_SUSPEND) | ||
331 | status->CardState |= CS_EVENT_PM_SUSPEND; | ||
332 | if (!(s->state & SOCKET_PRESENT)) | ||
333 | return CS_NO_CARD; | ||
334 | |||
335 | c = (p_dev) ? p_dev->function_config : NULL; | ||
336 | |||
337 | if ((c != NULL) && (c->state & CONFIG_LOCKED) && | ||
338 | (c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) { | ||
339 | u_char reg; | ||
340 | if (c->CardValues & PRESENT_PIN_REPLACE) { | ||
341 | pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_PRR)>>1, 1, ®); | ||
342 | status->CardState |= | ||
343 | (reg & PRR_WP_STATUS) ? CS_EVENT_WRITE_PROTECT : 0; | ||
344 | status->CardState |= | ||
345 | (reg & PRR_READY_STATUS) ? CS_EVENT_READY_CHANGE : 0; | ||
346 | status->CardState |= | ||
347 | (reg & PRR_BVD2_STATUS) ? CS_EVENT_BATTERY_LOW : 0; | ||
348 | status->CardState |= | ||
349 | (reg & PRR_BVD1_STATUS) ? CS_EVENT_BATTERY_DEAD : 0; | ||
350 | } else { | ||
351 | /* No PRR? Then assume we're always ready */ | ||
352 | status->CardState |= CS_EVENT_READY_CHANGE; | ||
353 | } | ||
354 | if (c->CardValues & PRESENT_EXT_STATUS) { | ||
355 | pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_ESR)>>1, 1, ®); | ||
356 | status->CardState |= | ||
357 | (reg & ESR_REQ_ATTN) ? CS_EVENT_REQUEST_ATTENTION : 0; | ||
358 | } | ||
359 | return CS_SUCCESS; | ||
360 | } | ||
361 | status->CardState |= | ||
362 | (val & SS_WRPROT) ? CS_EVENT_WRITE_PROTECT : 0; | ||
363 | status->CardState |= | ||
364 | (val & SS_BATDEAD) ? CS_EVENT_BATTERY_DEAD : 0; | ||
365 | status->CardState |= | ||
366 | (val & SS_BATWARN) ? CS_EVENT_BATTERY_LOW : 0; | ||
367 | status->CardState |= | ||
368 | (val & SS_READY) ? CS_EVENT_READY_CHANGE : 0; | ||
369 | return CS_SUCCESS; | ||
370 | } /* pccard_get_status */ | ||
371 | |||
372 | int pcmcia_get_status(struct pcmcia_device *p_dev, cs_status_t *status) | ||
373 | { | ||
374 | return pccard_get_status(p_dev->socket, p_dev, status); | ||
375 | } | ||
376 | EXPORT_SYMBOL(pcmcia_get_status); | ||
377 | |||
378 | |||
379 | |||
380 | /** pcmcia_get_mem_page | 312 | /** pcmcia_get_mem_page |
381 | * | 313 | * |
382 | * Change the card address of an already open memory window. | 314 | * Change the card address of an already open memory window. |
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 7b67ca9771ce..45d84b275789 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h | |||
@@ -373,7 +373,6 @@ struct pcmcia_socket; | |||
373 | 373 | ||
374 | int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg); | 374 | int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg); |
375 | int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config); | 375 | int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config); |
376 | int pcmcia_get_status(struct pcmcia_device *p_dev, cs_status_t *status); | ||
377 | int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); | 376 | int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); |
378 | int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); | 377 | int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); |
379 | int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); | 378 | int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); |