pxa_pcmcia.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #include <common.h>
  2. #include <config.h>
  3. #include <pcmcia.h>
  4. #include <asm/arch/pxa-regs.h>
  5. #include <asm/io.h>
  6. static inline void msWait(unsigned msVal)
  7. {
  8. udelay(msVal*1000);
  9. }
  10. int pcmcia_on (void)
  11. {
  12. unsigned int reg_arr[] = {
  13. 0x48000028, CONFIG_SYS_MCMEM0_VAL,
  14. 0x4800002c, CONFIG_SYS_MCMEM1_VAL,
  15. 0x48000030, CONFIG_SYS_MCATT0_VAL,
  16. 0x48000034, CONFIG_SYS_MCATT1_VAL,
  17. 0x48000038, CONFIG_SYS_MCIO0_VAL,
  18. 0x4800003c, CONFIG_SYS_MCIO1_VAL,
  19. 0, 0
  20. };
  21. int i, rc;
  22. #ifdef CONFIG_EXADRON1
  23. int cardDetect;
  24. volatile unsigned int *v_pBCRReg =
  25. (volatile unsigned int *) 0x08000000;
  26. #endif
  27. debug ("%s\n", __FUNCTION__);
  28. i = 0;
  29. while (reg_arr[i]) {
  30. (*(volatile unsigned int *) reg_arr[i]) |= reg_arr[i + 1];
  31. i += 2;
  32. }
  33. udelay (1000);
  34. debug ("%s: programmed mem controller \n", __FUNCTION__);
  35. #ifdef CONFIG_EXADRON1
  36. /*define useful BCR masks */
  37. #define BCR_CF_INIT_VAL 0x00007230
  38. #define BCR_CF_PWRON_BUSOFF_RESETOFF_VAL 0x00007231
  39. #define BCR_CF_PWRON_BUSOFF_RESETON_VAL 0x00007233
  40. #define BCR_CF_PWRON_BUSON_RESETON_VAL 0x00007213
  41. #define BCR_CF_PWRON_BUSON_RESETOFF_VAL 0x00007211
  42. /* we see from the GPIO bit if the card is present */
  43. cardDetect = !(GPLR0 & GPIO_bit (14));
  44. if (cardDetect) {
  45. printf ("No PCMCIA card found!\n");
  46. }
  47. /* reset the card via the BCR line */
  48. *v_pBCRReg = (unsigned) BCR_CF_INIT_VAL;
  49. msWait (500);
  50. *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETOFF_VAL;
  51. msWait (500);
  52. *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETON_VAL;
  53. msWait (500);
  54. *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETON_VAL;
  55. msWait (500);
  56. *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETOFF_VAL;
  57. msWait (1500);
  58. /* enable address bus */
  59. GPCR1 = 0x01;
  60. /* and the first CF slot */
  61. MECR = 0x00000002;
  62. #endif /* EXADRON 1 */
  63. rc = check_ide_device (0); /* use just slot 0 */
  64. return rc;
  65. }
  66. #if defined(CONFIG_CMD_PCMCIA)
  67. int pcmcia_off (void)
  68. {
  69. return 0;
  70. }
  71. #endif