Add support for friendly-arm SBC-2410X board
[oweals/u-boot.git] / drivers / rpx_pcmcia.c
1 /* -------------------------------------------------------------------- */
2 /* RPX Boards from Embedded Planet                                      */
3 /* -------------------------------------------------------------------- */
4 #include <common.h>
5 #include <mpc8xx.h>
6 #include <pcmcia.h>
7
8 #undef  CONFIG_PCMCIA
9
10 #if     CONFIG_COMMANDS & CFG_CMD_PCMCIA
11 #define CONFIG_PCMCIA
12 #endif
13
14 #if     (CONFIG_COMMANDS & CFG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
15 #define CONFIG_PCMCIA
16 #endif
17
18 #if     defined(CONFIG_PCMCIA)  \
19         && (defined(CONFIG_RPXCLASSIC) || defined(CONFIG_RPXLITE))
20
21 #define PCMCIA_BOARD_MSG        "RPX CLASSIC or RPX LITE"
22
23 int pcmcia_voltage_set(int slot, int vcc, int vpp)
24 {
25         u_long reg = 0;
26
27         switch(vcc) {
28                 case 0: break;
29                 case 33: reg |= BCSR1_PCVCTL4; break;
30                 case 50: reg |= BCSR1_PCVCTL5; break;
31                 default: return 1;
32         }
33
34         switch(vpp) {
35                 case 0: break;
36                 case 33:
37                 case 50:
38                         if(vcc == vpp)
39                                 reg |= BCSR1_PCVCTL6;
40                         else
41                                 return 1;
42                         break;
43                 case 120:
44                         reg |= BCSR1_PCVCTL7;
45                         default: return 1;
46         }
47
48         /* first, turn off all power */
49         *((uint *)RPX_CSR_ADDR) &= ~(BCSR1_PCVCTL4 | BCSR1_PCVCTL5
50                         | BCSR1_PCVCTL6 | BCSR1_PCVCTL7);
51
52         /* enable new powersettings */
53         *((uint *)RPX_CSR_ADDR) |= reg;
54
55         return 0;
56 }
57
58 int pcmcia_hardware_enable (int slot)
59 {
60         return 0;       /* No hardware to enable */
61 }
62
63 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
64 static int pcmcia_hardware_disable(int slot)
65 {
66         return 0;       /* No hardware to disable */
67 }
68 #endif  /* CONFIG_COMMANDS & CFG_CMD_PCMCIA */
69
70
71 #endif  /* CONFIG_PCMCIA && (CONFIG_RPXCLASSIC || CONFIG_RPXLITE) */