pxa_pcmcia.c 1.9 KB

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