pcmcia.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #include <common.h>
  2. #include <mpc8xx.h>
  3. #include <pcmcia.h>
  4. #undef CONFIG_PCMCIA
  5. #if defined(CONFIG_CMD_PCMCIA)
  6. #define CONFIG_PCMCIA
  7. #endif
  8. #if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
  9. #define CONFIG_PCMCIA
  10. #endif
  11. #ifdef CONFIG_PCMCIA
  12. #define PCMCIA_BOARD_MSG "GTH COMPACT FLASH"
  13. int pcmcia_voltage_set (int slot, int vcc, int vpp)
  14. { /* Do nothing */
  15. return 0;
  16. }
  17. int pcmcia_hardware_enable (int slot)
  18. {
  19. volatile immap_t *immap;
  20. volatile cpm8xx_t *cp;
  21. volatile pcmconf8xx_t *pcmp;
  22. volatile sysconf8xx_t *sysp;
  23. uint reg, mask;
  24. debug ("hardware_enable: GTH Slot %c\n", 'A' + slot);
  25. immap = (immap_t *) CFG_IMMR;
  26. sysp = (sysconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_siu_conf));
  27. pcmp = (pcmconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_pcmcia));
  28. cp = (cpm8xx_t *) (&(((immap_t *) CFG_IMMR)->im_cpm));
  29. /* clear interrupt state, and disable interrupts */
  30. pcmp->pcmc_pscr = PCMCIA_MASK (_slot_);
  31. pcmp->pcmc_per &= ~PCMCIA_MASK (_slot_);
  32. /*
  33. * Disable interrupts, DMA, and PCMCIA buffers
  34. * (isolate the interface) and assert RESET signal
  35. */
  36. debug ("Disable PCMCIA buffers and assert RESET\n");
  37. reg = 0;
  38. reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
  39. reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
  40. PCMCIA_PGCRX (_slot_) = reg;
  41. udelay (500);
  42. /*
  43. * Make sure there is a card in the slot,
  44. * then configure the interface.
  45. */
  46. udelay (10000);
  47. debug ("[%d] %s: PIPR(%p)=0x%x\n",
  48. __LINE__, __FUNCTION__,
  49. &(pcmp->pcmc_pipr), pcmp->pcmc_pipr);
  50. if (pcmp->pcmc_pipr & 0x98000000) {
  51. printf (" No Card found\n");
  52. return (1);
  53. }
  54. mask = PCMCIA_VS1 (slot) | PCMCIA_VS2 (slot);
  55. reg = pcmp->pcmc_pipr;
  56. debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
  57. reg,
  58. (reg & PCMCIA_VS1 (slot)) ? "n" : "ff",
  59. (reg & PCMCIA_VS2 (slot)) ? "n" : "ff");
  60. debug ("Enable PCMCIA buffers and stop RESET\n");
  61. reg = PCMCIA_PGCRX (_slot_);
  62. reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
  63. reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
  64. PCMCIA_PGCRX (_slot_) = reg;
  65. udelay (250000); /* some cards need >150 ms to come up :-( */
  66. debug ("# hardware_enable done\n");
  67. return 0;
  68. }
  69. #if defined(CONFIG_CMD_PCMCIA)
  70. int pcmcia_hardware_disable(int slot)
  71. {
  72. return 0; /* No hardware to disable */
  73. }
  74. #endif
  75. #endif /* CONFIG_PCMCIA */