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