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