wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 1 | /* |
| 2 | * genietv/genietv.c |
| 3 | * |
| 4 | * The GENIETV is using the following physical memorymap (copied from |
| 5 | * the FADS configuration): |
| 6 | * |
| 7 | * ff020000 -> ff02ffff : pcmcia |
| 8 | * ff010000 -> ff01ffff : BCSR connected to CS1, setup by 8xxROM |
| 9 | * ff000000 -> ff00ffff : IMAP internal in the cpu |
| 10 | * 02800000 -> 0287ffff : flash connected to CS0 |
| 11 | * 00000000 -> nnnnnnnn : sdram setup by U-Boot |
| 12 | * |
| 13 | * CS pins are connected as follows: |
| 14 | * |
| 15 | * CS0 -512Kb boot flash |
| 16 | * CS1 - SDRAM #1 |
| 17 | * CS2 - SDRAM #2 |
| 18 | * CS3 - Flash #1 |
| 19 | * CS4 - Flash #2 |
| 20 | * CS5 - LON (if present) |
| 21 | * CS6 - PCMCIA #1 |
| 22 | * CS7 - PCMCIA #2 |
| 23 | * |
| 24 | * Ports are configured as follows: |
| 25 | * |
| 26 | * PA7 - SDRAM banks enable |
| 27 | */ |
| 28 | |
| 29 | #include <common.h> |
| 30 | #include <mpc8xx.h> |
| 31 | |
| 32 | #define CFG_PA7 0x0100 |
| 33 | |
| 34 | /* ------------------------------------------------------------------------- */ |
| 35 | |
| 36 | static long int dram_size (long int, long int *, long int); |
| 37 | |
| 38 | /* ------------------------------------------------------------------------- */ |
| 39 | |
| 40 | #define _NOT_USED_ 0xFFFFFFFF |
| 41 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 42 | const uint sdram_table[] = { |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 43 | /* |
| 44 | * Single Read. (Offset 0 in UPMB RAM) |
| 45 | */ |
| 46 | 0x1F0DFC04, 0xEEAFBC04, 0x11AF7C04, 0xEFBEEC00, |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 47 | 0x1FFDDC47, /* last */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 48 | /* |
| 49 | * SDRAM Initialization (offset 5 in UPMB RAM) |
| 50 | * |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 51 | * This is no UPM entry point. The following definition uses |
| 52 | * the remaining space to establish an initialization |
| 53 | * sequence, which is executed by a RUN command. |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 54 | * |
| 55 | */ |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 56 | 0x1FFDDC34, 0xEFEEAC34, 0x1FBD5C35, /* last */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 57 | /* |
| 58 | * Burst Read. (Offset 8 in UPMB RAM) |
| 59 | */ |
| 60 | 0x1F0DFC04, 0xEEAFBC04, 0x10AF7C04, 0xF0AFFC00, |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 61 | 0xF0AFFC00, 0xF1AFFC00, 0xEFBEEC00, 0x1FFDDC47, /* last */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 62 | _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, |
| 63 | _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, |
| 64 | /* |
| 65 | * Single Write. (Offset 18 in UPMB RAM) |
| 66 | */ |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 67 | 0x1F2DFC04, 0xEEAFAC00, 0x01BE4C04, 0x1FFDDC47, /* last */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 68 | _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, |
| 69 | /* |
| 70 | * Burst Write. (Offset 20 in UPMB RAM) |
| 71 | */ |
| 72 | 0x1F0DFC04, 0xEEAFAC00, 0x10AF5C00, 0xF0AFFC00, |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 73 | 0xF0AFFC00, 0xE1BEEC04, 0x1FFDDC47, /* last */ |
| 74 | _NOT_USED_, |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 75 | _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, |
| 76 | _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, |
| 77 | /* |
| 78 | * Refresh (Offset 30 in UPMB RAM) |
| 79 | */ |
| 80 | 0x1FFD7C84, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC04, |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 81 | 0xFFFFFC84, 0xFFFFFC07, /* last */ |
| 82 | _NOT_USED_, _NOT_USED_, |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 83 | _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, |
| 84 | /* |
| 85 | * Exception. (Offset 3c in UPMB RAM) |
| 86 | */ |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 87 | 0x7FFFFC07, /* last */ |
| 88 | _NOT_USED_, _NOT_USED_, _NOT_USED_, |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | /* ------------------------------------------------------------------------- */ |
| 92 | |
| 93 | |
| 94 | /* |
| 95 | * Check Board Identity |
| 96 | */ |
| 97 | |
| 98 | int checkboard (void) |
| 99 | { |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 100 | puts ("Board: GenieTV\n"); |
| 101 | return 0; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | #if 0 |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 105 | static void PrintState (void) |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 106 | { |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 107 | volatile immap_t *im = (immap_t *) CFG_IMMR; |
| 108 | volatile memctl8xx_t *memctl = &im->im_memctl; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 109 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 110 | printf ("\n0 - FLASH: B=%08x O=%08x", memctl->memc_br0, |
| 111 | memctl->memc_or0); |
| 112 | printf ("\n1 - SDRAM: B=%08x O=%08x", memctl->memc_br1, |
| 113 | memctl->memc_or1); |
| 114 | printf ("\n2 - SDRAM: B=%08x O=%08x", memctl->memc_br2, |
| 115 | memctl->memc_or2); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 116 | } |
| 117 | #endif |
| 118 | |
| 119 | /* ------------------------------------------------------------------------- */ |
| 120 | |
| 121 | long int initdram (int board_type) |
| 122 | { |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 123 | volatile immap_t *im = (immap_t *) CFG_IMMR; |
| 124 | volatile memctl8xx_t *memctl = &im->im_memctl; |
| 125 | long int size_b0, size_b1, size8; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 126 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 127 | /* Enable SDRAM */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 128 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 129 | /* Configuring PA7 for general purpouse output pin */ |
| 130 | im->im_ioport.iop_papar &= ~CFG_PA7; /* 0 = general purpouse */ |
| 131 | im->im_ioport.iop_padir |= CFG_PA7; /* 1 = output */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 132 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 133 | /* Enable SDRAM - PA7 = 1 */ |
| 134 | im->im_ioport.iop_padat |= CFG_PA7; /* value of PA7 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 135 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 136 | /* |
| 137 | * Preliminary prescaler for refresh (depends on number of |
| 138 | * banks): This value is selected for four cycles every 62.4 us |
| 139 | * with two SDRAM banks or four cycles every 31.2 us with one |
| 140 | * bank. It will be adjusted after memory sizing. |
| 141 | */ |
| 142 | memctl->memc_mptpr = CFG_MPTPR_2BK_4K; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 143 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 144 | memctl->memc_mbmr = CFG_MBMR_8COL; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 145 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 146 | upmconfig (UPMB, (uint *) sdram_table, |
| 147 | sizeof (sdram_table) / sizeof (uint)); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 148 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 149 | /* |
| 150 | * Map controller banks 1 and 2 to the SDRAM banks 1 and 2 at |
| 151 | * preliminary addresses - these have to be modified after the |
| 152 | * SDRAM size has been determined. |
| 153 | */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 154 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 155 | memctl->memc_or1 = 0xF0000000 | CFG_OR_TIMING_SDRAM; |
| 156 | memctl->memc_br1 = |
| 157 | ((SDRAM_BASE1_PRELIM & BR_BA_MSK) | BR_MS_UPMB | BR_V); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 158 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 159 | memctl->memc_or2 = 0xF0000000 | CFG_OR_TIMING_SDRAM; |
| 160 | memctl->memc_br2 = |
| 161 | ((SDRAM_BASE2_PRELIM & BR_BA_MSK) | BR_MS_UPMB | BR_V); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 162 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 163 | /* perform SDRAM initialization sequence */ |
| 164 | memctl->memc_mar = 0x00000088; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 165 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 166 | memctl->memc_mcr = 0x80802105; /* SDRAM bank 0 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 167 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 168 | memctl->memc_mcr = 0x80804105; /* SDRAM bank 1 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 169 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 170 | /* Execute refresh 8 times */ |
| 171 | memctl->memc_mbmr = (CFG_MBMR_8COL & ~MBMR_TLFB_MSK) | MBMR_TLFB_8X; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 172 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 173 | memctl->memc_mcr = 0x80802130; /* SDRAM bank 0 - execute twice */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 174 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 175 | memctl->memc_mcr = 0x80804130; /* SDRAM bank 1 - execute twice */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 176 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 177 | /* Execute refresh 4 times */ |
| 178 | memctl->memc_mbmr = CFG_MBMR_8COL; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 179 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 180 | /* |
| 181 | * Check Bank 0 Memory Size for re-configuration |
| 182 | * |
| 183 | * try 8 column mode |
| 184 | */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 185 | |
| 186 | #if 0 |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 187 | PrintState (); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 188 | #endif |
| 189 | /* printf ("\nChecking bank1..."); */ |
Wolfgang Denk | 7fb5266 | 2005-10-13 16:45:02 +0200 | [diff] [blame] | 190 | size8 = dram_size (CFG_MBMR_8COL, (long *) SDRAM_BASE1_PRELIM, |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 191 | SDRAM_MAX_SIZE); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 192 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 193 | size_b0 = size8; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 194 | |
| 195 | /* printf ("\nChecking bank2..."); */ |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 196 | size_b1 = |
Wolfgang Denk | 7fb5266 | 2005-10-13 16:45:02 +0200 | [diff] [blame] | 197 | dram_size (memctl->memc_mbmr, (long *) SDRAM_BASE2_PRELIM, |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 198 | SDRAM_MAX_SIZE); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 199 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 200 | /* |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 201 | * Final mapping: map bigger bank first |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 202 | */ |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 203 | |
| 204 | memctl->memc_or1 = ((-size_b0) & 0xFFFF0000) | CFG_OR_TIMING_SDRAM; |
| 205 | memctl->memc_br1 = (CFG_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMB | BR_V; |
| 206 | |
| 207 | if (size_b1 > 0) { |
| 208 | /* |
| 209 | * Position Bank 1 immediately above Bank 0 |
| 210 | */ |
| 211 | memctl->memc_or2 = |
| 212 | ((-size_b1) & 0xFFFF0000) | CFG_OR_TIMING_SDRAM; |
| 213 | memctl->memc_br2 = |
| 214 | ((CFG_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMB | BR_V) + |
| 215 | (size_b0 & BR_BA_MSK); |
| 216 | } else { |
| 217 | /* |
| 218 | * No bank 1 |
| 219 | * |
| 220 | * invalidate bank |
| 221 | */ |
| 222 | memctl->memc_br2 = 0; |
| 223 | /* adjust refresh rate depending on SDRAM type, one bank */ |
| 224 | memctl->memc_mptpr = CFG_MPTPR_1BK_4K; |
| 225 | } |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 226 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 227 | /* If no memory detected, disable SDRAM */ |
| 228 | if ((size_b0 + size_b1) == 0) { |
| 229 | printf ("disabling SDRAM!\n"); |
| 230 | /* Disable SDRAM - PA7 = 1 */ |
| 231 | im->im_ioport.iop_padat &= ~CFG_PA7; /* value of PA7 */ |
| 232 | } |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 233 | /* else */ |
| 234 | /* printf("done! (%08lx)\n", size_b0 + size_b1); */ |
| 235 | |
| 236 | #if 0 |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 237 | PrintState (); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 238 | #endif |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 239 | return (size_b0 + size_b1); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | /* ------------------------------------------------------------------------- */ |
| 243 | |
| 244 | /* |
| 245 | * Check memory range for valid RAM. A simple memory test determines |
| 246 | * the actually available RAM size between addresses `base' and |
| 247 | * `base + maxsize'. Some (not all) hardware errors are detected: |
| 248 | * - short between address lines |
| 249 | * - short between data lines |
| 250 | */ |
| 251 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 252 | static long int dram_size (long int mbmr_value, long int *base, |
| 253 | long int maxsize) |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 254 | { |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 255 | long size; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 256 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 257 | /*memctl->memc_mbmr = mbmr_value; */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 258 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 259 | size = get_ram_size (base, maxsize); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 260 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 261 | if (size) { |
| 262 | /* printf("(%08lx)", size); */ |
| 263 | } else { |
| 264 | printf ("(0)"); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 265 | } |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 266 | |
| 267 | return (size); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 268 | } |
| 269 | |
Jon Loeliger | 96892a9 | 2007-07-09 18:31:28 -0500 | [diff] [blame] | 270 | #if defined(CONFIG_CMD_PCMCIA) |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 271 | |
| 272 | #ifdef CFG_PCMCIA_MEM_ADDR |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 273 | volatile unsigned char *pcmcia_mem = (unsigned char *) CFG_PCMCIA_MEM_ADDR; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 274 | #endif |
| 275 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 276 | int pcmcia_init (void) |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 277 | { |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 278 | volatile pcmconf8xx_t *pcmp; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 279 | uint v, slota, slotb; |
| 280 | |
| 281 | /* |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 282 | ** Enable the PCMCIA for a Flash card. |
| 283 | */ |
| 284 | pcmp = (pcmconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_pcmcia)); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 285 | |
| 286 | #if 0 |
| 287 | pcmp->pcmc_pbr0 = CFG_PCMCIA_MEM_ADDR; |
| 288 | pcmp->pcmc_por0 = 0xc00ff05d; |
| 289 | #endif |
| 290 | |
| 291 | /* Set all slots to zero by default. */ |
| 292 | pcmp->pcmc_pgcra = 0; |
| 293 | pcmp->pcmc_pgcrb = 0; |
| 294 | #ifdef PCMCIA_SLOT_A |
| 295 | pcmp->pcmc_pgcra = 0x40; |
| 296 | #endif |
| 297 | #ifdef PCMCIA_SLOT_B |
| 298 | pcmp->pcmc_pgcrb = 0x40; |
| 299 | #endif |
| 300 | |
| 301 | /* Check if any PCMCIA card is luged in. */ |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 302 | slota = (pcmp->pcmc_pipr & 0x18000000) == 0; |
| 303 | slotb = (pcmp->pcmc_pipr & 0x00001800) == 0; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 304 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 305 | if (!(slota || slotb)) { |
| 306 | printf ("No card present\n"); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 307 | #ifdef PCMCIA_SLOT_A |
| 308 | pcmp->pcmc_pgcra = 0; |
| 309 | #endif |
| 310 | #ifdef PCMCIA_SLOT_B |
| 311 | pcmp->pcmc_pgcrb = 0; |
| 312 | #endif |
| 313 | return -1; |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 314 | } else |
| 315 | printf ("Unknown card ("); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 316 | |
| 317 | v = 0; |
| 318 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 319 | switch ((pcmp->pcmc_pipr >> 14) & 3) { |
| 320 | case 0x00: |
| 321 | printf ("5V"); |
| 322 | v = 5; |
| 323 | break; |
| 324 | case 0x01: |
| 325 | printf ("5V and 3V"); |
| 326 | v = 3; |
| 327 | break; |
| 328 | case 0x03: |
| 329 | printf ("5V, 3V and x.xV"); |
| 330 | v = 3; |
| 331 | break; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 332 | } |
| 333 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 334 | switch (v) { |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 335 | case 3: |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 336 | printf ("; using 3V"); |
| 337 | /* Enable 3 volt Vcc. */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 338 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 339 | break; |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 340 | |
| 341 | default: |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 342 | printf ("; unknown voltage"); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 343 | return -1; |
| 344 | } |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 345 | printf (")\n"); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 346 | /* disable pcmcia reset after a while */ |
| 347 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 348 | udelay (20); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 349 | |
| 350 | pcmp->pcmc_pgcrb = 0; |
| 351 | |
| 352 | /* If you using a real hd you should give a short |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 353 | * spin-up time. */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 354 | #ifdef CONFIG_DISK_SPINUP_TIME |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 355 | udelay (CONFIG_DISK_SPINUP_TIME); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 356 | #endif |
| 357 | |
| 358 | return 0; |
| 359 | } |
Jon Loeliger | 13f7599 | 2007-07-10 10:39:10 -0500 | [diff] [blame] | 360 | #endif |