blob: 996f032f644a7565e96ab374676986e7c1ae1868 [file] [log] [blame]
Wolfgang Denk9d407992006-07-10 23:07:28 +02001#include <common.h>
2#include <mpc8xx.h>
3#include <pcmcia.h>
4
5#undef CONFIG_PCMCIA
6
Jon Loeligerc508a4c2007-07-09 18:31:28 -05007#if defined(CONFIG_CMD_PCMCIA)
Wolfgang Denk9d407992006-07-10 23:07:28 +02008#define CONFIG_PCMCIA
9#endif
10
Jon Loeligerc508a4c2007-07-09 18:31:28 -050011#if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
Wolfgang Denk9d407992006-07-10 23:07:28 +020012#define CONFIG_PCMCIA
13#endif
14
15#ifdef CONFIG_PCMCIA
16
Wolfgang Denk9d407992006-07-10 23:07:28 +020017#define PCMCIA_BOARD_MSG "FADS"
Wolfgang Denk9d407992006-07-10 23:07:28 +020018
19int pcmcia_voltage_set(int slot, int vcc, int vpp)
20{
21 u_long reg = 0;
22
23 switch(vpp) {
24 case 0: reg = 0; break;
25 case 50: reg = 1; break;
26 case 120: reg = 2; break;
27 default: return 1;
28 }
29
30 switch(vcc) {
31 case 0: reg = 0; break;
Wolfgang Denk9d407992006-07-10 23:07:28 +020032#ifdef CONFIG_FADS
33 case 33: reg = BCSR1_PCCVCC0 | BCSR1_PCCVCC1; break;
34 case 50: reg = BCSR1_PCCVCC1; break;
35#endif
36 default: return 1;
37 }
38
39 /* first, turn off all power */
40
Wolfgang Denk9d407992006-07-10 23:07:28 +020041#ifdef CONFIG_FADS
42 *((uint *)BCSR1) &= ~(BCSR1_PCCVCC0 | BCSR1_PCCVCC1);
43#endif
44 *((uint *)BCSR1) &= ~BCSR1_PCCVPP_MASK;
45
46 /* enable new powersettings */
47
Wolfgang Denk9d407992006-07-10 23:07:28 +020048#ifdef CONFIG_FADS
49 *((uint *)BCSR1) |= reg;
50#endif
51
Wolfgang Denk53677ef2008-05-20 16:00:29 +020052 *((uint *)BCSR1) |= reg << 20;
Wolfgang Denk9d407992006-07-10 23:07:28 +020053
54 return 0;
55}
56
57int pcmcia_hardware_enable(int slot)
58{
59 *((uint *)BCSR1) &= ~BCSR1_PCCEN;
60 return 0;
61}
62
Jon Loeligerc508a4c2007-07-09 18:31:28 -050063#if defined(CONFIG_CMD_PCMCIA)
Wolfgang Denk9d407992006-07-10 23:07:28 +020064int pcmcia_hardware_disable(int slot)
65{
66 *((uint *)BCSR1) &= ~BCSR1_PCCEN;
67 return 0;
68}
Jon Loeligerc508a4c2007-07-09 18:31:28 -050069#endif
Wolfgang Denk9d407992006-07-10 23:07:28 +020070
71#endif /* CONFIG_PCMCIA */