pxa_pcmcia.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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++];
  32. udelay (1000);
  33. debug ("%s: programmed mem controller \n", __FUNCTION__);
  34. #ifdef CONFIG_EXADRON1
  35. /*define useful BCR masks */
  36. #define BCR_CF_INIT_VAL 0x00007230
  37. #define BCR_CF_PWRON_BUSOFF_RESETOFF_VAL 0x00007231
  38. #define BCR_CF_PWRON_BUSOFF_RESETON_VAL 0x00007233
  39. #define BCR_CF_PWRON_BUSON_RESETON_VAL 0x00007213
  40. #define BCR_CF_PWRON_BUSON_RESETOFF_VAL 0x00007211
  41. /* we see from the GPIO bit if the card is present */
  42. cardDetect = !(GPLR0 & GPIO_bit (14));
  43. if (cardDetect) {
  44. printf ("No PCMCIA card found!\n");
  45. }
  46. /* reset the card via the BCR line */
  47. *v_pBCRReg = (unsigned) BCR_CF_INIT_VAL;
  48. msWait (500);
  49. *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETOFF_VAL;
  50. msWait (500);
  51. *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETON_VAL;
  52. msWait (500);
  53. *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETON_VAL;
  54. msWait (500);
  55. *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETOFF_VAL;
  56. msWait (1500);
  57. /* enable address bus */
  58. GPCR1 = 0x01;
  59. /* and the first CF slot */
  60. MECR = 0x00000002;
  61. #endif /* EXADRON 1 */
  62. rc = check_ide_device (0); /* use just slot 0 */
  63. return rc;
  64. }
  65. #if defined(CONFIG_CMD_PCMCIA)
  66. int pcmcia_off (void)
  67. {
  68. return 0;
  69. }
  70. #endif
  71. #endif /* CONFIG_PXA_PCMCIA */