diff options
Diffstat (limited to 'drivers/pcmcia/m8xx_pcmcia.c')
-rw-r--r-- | drivers/pcmcia/m8xx_pcmcia.c | 114 |
1 files changed, 93 insertions, 21 deletions
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index 6d9f71cfcb34..0e07d9535116 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c | |||
@@ -9,6 +9,9 @@ | |||
9 | * <oliver.kurth@cyclades.de> | 9 | * <oliver.kurth@cyclades.de> |
10 | * Further fixes, v2.6 kernel port | 10 | * Further fixes, v2.6 kernel port |
11 | * <marcelo.tosatti@cyclades.com> | 11 | * <marcelo.tosatti@cyclades.com> |
12 | * | ||
13 | * Some fixes, additions (C) 2005 Montavista Software, Inc. | ||
14 | * <vbordug@ru.mvista.com> | ||
12 | * | 15 | * |
13 | * "The ExCA standard specifies that socket controllers should provide | 16 | * "The ExCA standard specifies that socket controllers should provide |
14 | * two IO and five memory windows per socket, which can be independently | 17 | * two IO and five memory windows per socket, which can be independently |
@@ -97,6 +100,11 @@ MODULE_LICENSE("Dual MPL/GPL"); | |||
97 | #endif | 100 | #endif |
98 | #endif | 101 | #endif |
99 | 102 | ||
103 | #if defined(CONFIG_MPC885ADS) | ||
104 | #define CONFIG_PCMCIA_SLOT_A | ||
105 | #define PCMCIA_GLITCHY_CD | ||
106 | #endif | ||
107 | |||
100 | /* Cyclades ACS uses both slots */ | 108 | /* Cyclades ACS uses both slots */ |
101 | #ifdef CONFIG_PRxK | 109 | #ifdef CONFIG_PRxK |
102 | #define CONFIG_PCMCIA_SLOT_A | 110 | #define CONFIG_PCMCIA_SLOT_A |
@@ -374,10 +382,10 @@ static int voltage_set(int slot, int vcc, int vpp) | |||
374 | } | 382 | } |
375 | 383 | ||
376 | /* first, turn off all power */ | 384 | /* first, turn off all power */ |
377 | out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) & ~(BCSR1_PCCVCC_MASK | BCSR1_PCCVPP_MASK)); | 385 | out_be32((u32 *)BCSR1, in_be32((u32 *)BCSR1) & ~(BCSR1_PCCVCC_MASK | BCSR1_PCCVPP_MASK)); |
378 | 386 | ||
379 | /* enable new powersettings */ | 387 | /* enable new powersettings */ |
380 | out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) | reg); | 388 | out_be32((u32 *)BCSR1, in_be32((u32 *)BCSR1) | reg); |
381 | 389 | ||
382 | return 0; | 390 | return 0; |
383 | } | 391 | } |
@@ -386,12 +394,89 @@ static int voltage_set(int slot, int vcc, int vpp) | |||
386 | 394 | ||
387 | static void hardware_enable(int slot) | 395 | static void hardware_enable(int slot) |
388 | { | 396 | { |
389 | out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) & ~BCSR1_PCCEN); | 397 | out_be32((u32 *)BCSR1, in_be32((u32 *)BCSR1) & ~BCSR1_PCCEN); |
390 | } | 398 | } |
391 | 399 | ||
392 | static void hardware_disable(int slot) | 400 | static void hardware_disable(int slot) |
393 | { | 401 | { |
394 | out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) | BCSR1_PCCEN); | 402 | out_be32((u32 *)BCSR1, in_be32((u32 *)BCSR1) | BCSR1_PCCEN); |
403 | } | ||
404 | |||
405 | #endif | ||
406 | |||
407 | /* MPC885ADS Boards */ | ||
408 | |||
409 | #if defined(CONFIG_MPC885ADS) | ||
410 | |||
411 | #define PCMCIA_BOARD_MSG "MPC885ADS" | ||
412 | |||
413 | static int voltage_set(int slot, int vcc, int vpp) | ||
414 | { | ||
415 | u32 reg = 0; | ||
416 | unsigned *bcsr_io; | ||
417 | |||
418 | bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); | ||
419 | |||
420 | switch(vcc) { | ||
421 | case 0: | ||
422 | break; | ||
423 | case 33: | ||
424 | reg |= BCSR1_PCCVCC0; | ||
425 | break; | ||
426 | case 50: | ||
427 | reg |= BCSR1_PCCVCC1; | ||
428 | break; | ||
429 | default: | ||
430 | return 1; | ||
431 | } | ||
432 | |||
433 | switch(vpp) { | ||
434 | case 0: | ||
435 | break; | ||
436 | case 33: | ||
437 | case 50: | ||
438 | if(vcc == vpp) | ||
439 | reg |= BCSR1_PCCVPP1; | ||
440 | else | ||
441 | return 1; | ||
442 | break; | ||
443 | case 120: | ||
444 | if ((vcc == 33) || (vcc == 50)) | ||
445 | reg |= BCSR1_PCCVPP0; | ||
446 | else | ||
447 | return 1; | ||
448 | default: | ||
449 | return 1; | ||
450 | } | ||
451 | |||
452 | /* first, turn off all power */ | ||
453 | out_be32(bcsr_io, in_be32(bcsr_io) & ~(BCSR1_PCCVCC_MASK | BCSR1_PCCVPP_MASK)); | ||
454 | |||
455 | /* enable new powersettings */ | ||
456 | out_be32(bcsr_io, in_be32(bcsr_io) | reg); | ||
457 | |||
458 | iounmap(bcsr_io); | ||
459 | return 0; | ||
460 | } | ||
461 | |||
462 | #define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V | ||
463 | |||
464 | static void hardware_enable(int slot) | ||
465 | { | ||
466 | unsigned *bcsr_io; | ||
467 | |||
468 | bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); | ||
469 | out_be32(bcsr_io, in_be32(bcsr_io) & ~BCSR1_PCCEN); | ||
470 | iounmap(bcsr_io); | ||
471 | } | ||
472 | |||
473 | static void hardware_disable(int slot) | ||
474 | { | ||
475 | unsigned *bcsr_io; | ||
476 | |||
477 | bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); | ||
478 | out_be32(bcsr_io, in_be32(bcsr_io) | BCSR1_PCCEN); | ||
479 | iounmap(bcsr_io); | ||
395 | } | 480 | } |
396 | 481 | ||
397 | #endif | 482 | #endif |
@@ -440,10 +525,10 @@ static int voltage_set(int slot, int vcc, int vpp) | |||
440 | } | 525 | } |
441 | 526 | ||
442 | /* first, turn off all power */ | 527 | /* first, turn off all power */ |
443 | out_8(&((u8 *)MBX_CSR2_ADDR), in_8(&((u8 *)MBX_CSR2_ADDR)) & ~(CSR2_VCC_MASK | CSR2_VPP_MASK)); | 528 | out_8((u8 *)MBX_CSR2_ADDR, in_8((u8 *)MBX_CSR2_ADDR) & ~(CSR2_VCC_MASK | CSR2_VPP_MASK)); |
444 | 529 | ||
445 | /* enable new powersettings */ | 530 | /* enable new powersettings */ |
446 | out_8(&((u8 *)MBX_CSR2_ADDR), in_8(&((u8 *)MBX_CSR2_ADDR)) | reg); | 531 | out_8((u8 *)MBX_CSR2_ADDR, in_8((u8 *)MBX_CSR2_ADDR) | reg); |
447 | 532 | ||
448 | return 0; | 533 | return 0; |
449 | } | 534 | } |
@@ -823,17 +908,6 @@ static int m8xx_get_status(struct pcmcia_socket *sock, unsigned int *value) | |||
823 | return 0; | 908 | return 0; |
824 | } | 909 | } |
825 | 910 | ||
826 | static int m8xx_get_socket(struct pcmcia_socket *sock, socket_state_t *state) | ||
827 | { | ||
828 | int lsock = container_of(sock, struct socket_info, socket)->slot; | ||
829 | *state = socket[lsock].state; /* copy the whole structure */ | ||
830 | |||
831 | dprintk("GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, " | ||
832 | "io_irq %d, csc_mask %#2.2x\n", lsock, state->flags, | ||
833 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); | ||
834 | return 0; | ||
835 | } | ||
836 | |||
837 | static int m8xx_set_socket(struct pcmcia_socket *sock, socket_state_t *state) | 911 | static int m8xx_set_socket(struct pcmcia_socket *sock, socket_state_t *state) |
838 | { | 912 | { |
839 | int lsock = container_of(sock, struct socket_info, socket)->slot; | 913 | int lsock = container_of(sock, struct socket_info, socket)->slot; |
@@ -1023,8 +1097,7 @@ static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) | |||
1023 | if(io->flags & MAP_WRPROT) | 1097 | if(io->flags & MAP_WRPROT) |
1024 | reg |= M8XX_PCMCIA_POR_WRPROT; | 1098 | reg |= M8XX_PCMCIA_POR_WRPROT; |
1025 | 1099 | ||
1026 | /*if(io->flags & (MAP_16BIT | MAP_AUTOSZ))*/ | 1100 | if(io->flags & (MAP_16BIT | MAP_AUTOSZ)) |
1027 | if(io->flags & MAP_16BIT) | ||
1028 | reg |= M8XX_PCMCIA_POR_16BIT; | 1101 | reg |= M8XX_PCMCIA_POR_16BIT; |
1029 | 1102 | ||
1030 | if(io->flags & MAP_ACTIVE) | 1103 | if(io->flags & MAP_ACTIVE) |
@@ -1169,7 +1242,6 @@ static struct pccard_operations m8xx_services = { | |||
1169 | .init = m8xx_sock_init, | 1242 | .init = m8xx_sock_init, |
1170 | .suspend = m8xx_suspend, | 1243 | .suspend = m8xx_suspend, |
1171 | .get_status = m8xx_get_status, | 1244 | .get_status = m8xx_get_status, |
1172 | .get_socket = m8xx_get_socket, | ||
1173 | .set_socket = m8xx_set_socket, | 1245 | .set_socket = m8xx_set_socket, |
1174 | .set_io_map = m8xx_set_io_map, | 1246 | .set_io_map = m8xx_set_io_map, |
1175 | .set_mem_map = m8xx_set_mem_map, | 1247 | .set_mem_map = m8xx_set_mem_map, |
@@ -1244,7 +1316,7 @@ static int __init m8xx_init(void) | |||
1244 | socket[i].socket.io_offset = 0; | 1316 | socket[i].socket.io_offset = 0; |
1245 | socket[i].socket.pci_irq = i ? 7 : 9; | 1317 | socket[i].socket.pci_irq = i ? 7 : 9; |
1246 | socket[i].socket.ops = &m8xx_services; | 1318 | socket[i].socket.ops = &m8xx_services; |
1247 | socket[i].socket.resource_ops = &pccard_nonstatic_ops; | 1319 | socket[i].socket.resource_ops = &pccard_iodyn_ops; |
1248 | socket[i].socket.cb_dev = NULL; | 1320 | socket[i].socket.cb_dev = NULL; |
1249 | socket[i].socket.dev.dev = &m8xx_device.dev; | 1321 | socket[i].socket.dev.dev = &m8xx_device.dev; |
1250 | } | 1322 | } |