Wolfgang Denk | 50440e7 | 2006-07-10 23:07:28 +0200 | [diff] [blame] | 1 | #include <common.h> |
| 2 | #include <mpc8xx.h> |
| 3 | #include <pcmcia.h> |
| 4 | |
| 5 | #undef CONFIG_PCMCIA |
| 6 | |
Jon Loeliger | 96892a9 | 2007-07-09 18:31:28 -0500 | [diff] [blame] | 7 | #if defined(CONFIG_CMD_PCMCIA) |
Wolfgang Denk | 50440e7 | 2006-07-10 23:07:28 +0200 | [diff] [blame] | 8 | #define CONFIG_PCMCIA |
| 9 | #endif |
| 10 | |
Jon Loeliger | 96892a9 | 2007-07-09 18:31:28 -0500 | [diff] [blame] | 11 | #if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD) |
Wolfgang Denk | 50440e7 | 2006-07-10 23:07:28 +0200 | [diff] [blame] | 12 | #define CONFIG_PCMCIA |
| 13 | #endif |
| 14 | |
| 15 | #ifdef CONFIG_PCMCIA |
| 16 | |
Wolfgang Denk | 50440e7 | 2006-07-10 23:07:28 +0200 | [diff] [blame] | 17 | #define PCMCIA_BOARD_MSG "FADS" |
Wolfgang Denk | 50440e7 | 2006-07-10 23:07:28 +0200 | [diff] [blame] | 18 | |
| 19 | int 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 Denk | 50440e7 | 2006-07-10 23:07:28 +0200 | [diff] [blame] | 32 | #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 Denk | 50440e7 | 2006-07-10 23:07:28 +0200 | [diff] [blame] | 41 | #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 Denk | 50440e7 | 2006-07-10 23:07:28 +0200 | [diff] [blame] | 48 | #ifdef CONFIG_FADS |
| 49 | *((uint *)BCSR1) |= reg; |
| 50 | #endif |
| 51 | |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 52 | *((uint *)BCSR1) |= reg << 20; |
Wolfgang Denk | 50440e7 | 2006-07-10 23:07:28 +0200 | [diff] [blame] | 53 | |
| 54 | return 0; |
| 55 | } |
| 56 | |
| 57 | int pcmcia_hardware_enable(int slot) |
| 58 | { |
| 59 | *((uint *)BCSR1) &= ~BCSR1_PCCEN; |
| 60 | return 0; |
| 61 | } |
| 62 | |
Jon Loeliger | 96892a9 | 2007-07-09 18:31:28 -0500 | [diff] [blame] | 63 | #if defined(CONFIG_CMD_PCMCIA) |
Wolfgang Denk | 50440e7 | 2006-07-10 23:07:28 +0200 | [diff] [blame] | 64 | int pcmcia_hardware_disable(int slot) |
| 65 | { |
| 66 | *((uint *)BCSR1) &= ~BCSR1_PCCEN; |
| 67 | return 0; |
| 68 | } |
Jon Loeliger | 96892a9 | 2007-07-09 18:31:28 -0500 | [diff] [blame] | 69 | #endif |
Wolfgang Denk | 50440e7 | 2006-07-10 23:07:28 +0200 | [diff] [blame] | 70 | |
| 71 | #endif /* CONFIG_PCMCIA */ |