wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 1 | /* |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 2 | * (C) Copyright 2000-2003 |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | /* |
| 25 | * MPC8xx/MPC8260 Internal Memory Map Functions |
| 26 | */ |
| 27 | |
| 28 | #include <common.h> |
| 29 | #include <command.h> |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 30 | |
| 31 | #if (CONFIG_COMMANDS & CFG_CMD_IMMAP) && \ |
| 32 | (defined(CONFIG_8xx) || defined(CONFIG_8260)) |
| 33 | |
| 34 | #if defined(CONFIG_8xx) |
| 35 | #include <asm/8xx_immap.h> |
| 36 | #include <commproc.h> |
Wolfgang Denk | e6f2228 | 2005-09-26 00:44:15 +0200 | [diff] [blame] | 37 | #include <asm/iopin_8xx.h> |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 38 | #elif defined(CONFIG_8260) |
| 39 | #include <asm/immap_8260.h> |
| 40 | #include <asm/cpm_8260.h> |
| 41 | #include <asm/iopin_8260.h> |
| 42 | #endif |
| 43 | |
| 44 | static void |
| 45 | unimplemented ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 46 | { |
| 47 | printf ("Sorry, but the '%s' command has not been implemented\n", |
| 48 | cmdtp->name); |
| 49 | } |
| 50 | |
| 51 | int |
| 52 | do_siuinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 53 | { |
| 54 | volatile immap_t *immap = (immap_t *) CFG_IMMR; |
| 55 | |
| 56 | #if defined(CONFIG_8xx) |
| 57 | volatile sysconf8xx_t *sc = &immap->im_siu_conf; |
| 58 | #elif defined(CONFIG_8260) |
| 59 | volatile sysconf8260_t *sc = &immap->im_siu_conf; |
| 60 | #endif |
| 61 | |
| 62 | printf ("SIUMCR= %08x SYPCR = %08x\n", sc->sc_siumcr, sc->sc_sypcr); |
| 63 | #if defined(CONFIG_8xx) |
| 64 | printf ("SWT = %08x\n", sc->sc_swt); |
| 65 | printf ("SIPEND= %08x SIMASK= %08x\n", sc->sc_sipend, sc->sc_simask); |
| 66 | printf ("SIEL = %08x SIVEC = %08x\n", sc->sc_siel, sc->sc_sivec); |
| 67 | printf ("TESR = %08x SDCR = %08x\n", sc->sc_tesr, sc->sc_sdcr); |
| 68 | #elif defined(CONFIG_8260) |
| 69 | printf ("BCR = %08x\n", sc->sc_bcr); |
| 70 | printf ("P_ACR = %02x P_ALRH= %08x P_ALRL= %08x\n", |
| 71 | sc->sc_ppc_acr, sc->sc_ppc_alrh, sc->sc_ppc_alrl); |
| 72 | printf ("L_ACR = %02x L_ALRH= %08x L_ALRL= %08x\n", |
| 73 | sc->sc_lcl_acr, sc->sc_lcl_alrh, sc->sc_lcl_alrl); |
| 74 | printf ("PTESR1= %08x PTESR2= %08x\n", sc->sc_tescr1, sc->sc_tescr2); |
| 75 | printf ("LTESR1= %08x LTESR2= %08x\n", sc->sc_ltescr1, sc->sc_ltescr2); |
| 76 | printf ("PDTEA = %08x PDTEM = %02x\n", sc->sc_pdtea, sc->sc_pdtem); |
| 77 | printf ("LDTEA = %08x LDTEM = %02x\n", sc->sc_ldtea, sc->sc_ldtem); |
| 78 | #endif |
| 79 | return 0; |
| 80 | } |
| 81 | |
| 82 | int |
| 83 | do_memcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 84 | { |
| 85 | volatile immap_t *immap = (immap_t *) CFG_IMMR; |
| 86 | |
| 87 | #if defined(CONFIG_8xx) |
| 88 | volatile memctl8xx_t *memctl = &immap->im_memctl; |
| 89 | int nbanks = 8; |
| 90 | #elif defined(CONFIG_8260) |
| 91 | volatile memctl8260_t *memctl = &immap->im_memctl; |
| 92 | int nbanks = 12; |
| 93 | #endif |
| 94 | volatile uint *p = &memctl->memc_br0; |
| 95 | int i; |
| 96 | |
| 97 | for (i = 0; i < nbanks; i++, p += 2) { |
| 98 | if (i < 10) { |
| 99 | printf ("BR%d = %08x OR%d = %08x\n", |
| 100 | i, p[0], i, p[1]); |
| 101 | } else { |
| 102 | printf ("BR%d = %08x OR%d = %08x\n", |
| 103 | i, p[0], i, p[1]); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | printf ("MAR = %08x", memctl->memc_mar); |
| 108 | #if defined(CONFIG_8xx) |
| 109 | printf (" MCR = %08x\n", memctl->memc_mcr); |
| 110 | #elif defined(CONFIG_8260) |
wdenk | 4b9206e | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 111 | putc ('\n'); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 112 | #endif |
| 113 | printf ("MAMR = %08x MBMR = %08x", |
| 114 | memctl->memc_mamr, memctl->memc_mbmr); |
| 115 | #if defined(CONFIG_8xx) |
| 116 | printf ("\nMSTAT = %04x\n", memctl->memc_mstat); |
| 117 | #elif defined(CONFIG_8260) |
| 118 | printf (" MCMR = %08x\n", memctl->memc_mcmr); |
| 119 | #endif |
| 120 | printf ("MPTPR = %04x MDR = %08x\n", |
| 121 | memctl->memc_mptpr, memctl->memc_mdr); |
| 122 | #if defined(CONFIG_8260) |
| 123 | printf ("PSDMR = %08x LSDMR = %08x\n", |
| 124 | memctl->memc_psdmr, memctl->memc_lsdmr); |
| 125 | printf ("PURT = %02x PSRT = %02x\n", |
| 126 | memctl->memc_purt, memctl->memc_psrt); |
| 127 | printf ("LURT = %02x LSRT = %02x\n", |
| 128 | memctl->memc_lurt, memctl->memc_lsrt); |
| 129 | printf ("IMMR = %08x\n", memctl->memc_immr); |
| 130 | #endif |
| 131 | return 0; |
| 132 | } |
| 133 | |
| 134 | int |
| 135 | do_sitinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 136 | { |
| 137 | unimplemented (cmdtp, flag, argc, argv); |
| 138 | return 0; |
| 139 | } |
| 140 | |
| 141 | #ifdef CONFIG_8260 |
| 142 | int |
| 143 | do_icinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 144 | { |
| 145 | unimplemented (cmdtp, flag, argc, argv); |
| 146 | return 0; |
| 147 | } |
| 148 | #endif |
| 149 | |
| 150 | int |
| 151 | do_carinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 152 | { |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 153 | volatile immap_t *immap = (immap_t *) CFG_IMMR; |
| 154 | |
| 155 | #if defined(CONFIG_8xx) |
| 156 | volatile car8xx_t *car = &immap->im_clkrst; |
| 157 | #elif defined(CONFIG_8260) |
| 158 | volatile car8260_t *car = &immap->im_clkrst; |
| 159 | #endif |
| 160 | |
| 161 | #if defined(CONFIG_8xx) |
| 162 | printf ("SCCR = %08x\n", car->car_sccr); |
| 163 | printf ("PLPRCR= %08x\n", car->car_plprcr); |
| 164 | printf ("RSR = %08x\n", car->car_rsr); |
| 165 | #elif defined(CONFIG_8260) |
| 166 | printf ("SCCR = %08x\n", car->car_sccr); |
| 167 | printf ("SCMR = %08x\n", car->car_scmr); |
| 168 | printf ("RSR = %08x\n", car->car_rsr); |
| 169 | printf ("RMR = %08x\n", car->car_rmr); |
| 170 | #endif |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 171 | return 0; |
| 172 | } |
| 173 | |
| 174 | static int counter; |
| 175 | |
| 176 | static void |
| 177 | header(void) |
| 178 | { |
| 179 | char *data = "\ |
| 180 | -------------------------------- --------------------------------\ |
| 181 | 00000000001111111111222222222233 00000000001111111111222222222233\ |
| 182 | 01234567890123456789012345678901 01234567890123456789012345678901\ |
| 183 | -------------------------------- --------------------------------\ |
| 184 | "; |
| 185 | int i; |
| 186 | |
| 187 | if (counter % 2) |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 188 | putc('\n'); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 189 | counter = 0; |
| 190 | |
| 191 | for (i = 0; i < 4; i++, data += 79) |
| 192 | printf("%.79s\n", data); |
| 193 | } |
| 194 | |
| 195 | static void binary (char *label, uint value, int nbits) |
| 196 | { |
| 197 | uint mask = 1 << (nbits - 1); |
| 198 | int i, second = (counter++ % 2); |
| 199 | |
| 200 | if (second) |
| 201 | putc (' '); |
| 202 | puts (label); |
| 203 | for (i = 32 + 1; i != nbits; i--) |
| 204 | putc (' '); |
| 205 | |
| 206 | while (mask != 0) { |
| 207 | if (value & mask) |
| 208 | putc ('1'); |
| 209 | else |
| 210 | putc ('0'); |
| 211 | mask >>= 1; |
| 212 | } |
| 213 | |
| 214 | if (second) |
| 215 | putc ('\n'); |
| 216 | } |
| 217 | |
| 218 | #if defined(CONFIG_8xx) |
| 219 | #define PA_NBITS 16 |
| 220 | #define PA_NB_ODR 8 |
| 221 | #define PB_NBITS 18 |
| 222 | #define PB_NB_ODR 16 |
| 223 | #define PC_NBITS 12 |
| 224 | #define PD_NBITS 13 |
| 225 | #elif defined(CONFIG_8260) |
| 226 | #define PA_NBITS 32 |
| 227 | #define PA_NB_ODR 32 |
| 228 | #define PB_NBITS 28 |
| 229 | #define PB_NB_ODR 28 |
| 230 | #define PC_NBITS 32 |
| 231 | #define PD_NBITS 28 |
| 232 | #endif |
| 233 | |
| 234 | int |
| 235 | do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 236 | { |
| 237 | volatile immap_t *immap = (immap_t *) CFG_IMMR; |
| 238 | |
| 239 | #if defined(CONFIG_8xx) |
| 240 | volatile iop8xx_t *iop = &immap->im_ioport; |
| 241 | volatile ushort *l, *r; |
| 242 | #elif defined(CONFIG_8260) |
| 243 | volatile iop8260_t *iop = &immap->im_ioport; |
| 244 | volatile uint *l, *r; |
| 245 | #endif |
| 246 | volatile uint *R; |
| 247 | |
| 248 | counter = 0; |
| 249 | header (); |
| 250 | |
| 251 | /* |
| 252 | * Ports A & B |
| 253 | */ |
| 254 | |
| 255 | #if defined(CONFIG_8xx) |
| 256 | l = &iop->iop_padir; |
| 257 | R = &immap->im_cpm.cp_pbdir; |
| 258 | #elif defined(CONFIG_8260) |
| 259 | l = &iop->iop_pdira; |
| 260 | R = &iop->iop_pdirb; |
| 261 | #endif |
| 262 | binary ("PA_DIR", *l++, PA_NBITS); |
| 263 | binary ("PB_DIR", *R++, PB_NBITS); |
| 264 | binary ("PA_PAR", *l++, PA_NBITS); |
| 265 | binary ("PB_PAR", *R++, PB_NBITS); |
| 266 | #if defined(CONFIG_8260) |
| 267 | binary ("PA_SOR", *l++, PA_NBITS); |
| 268 | binary ("PB_SOR", *R++, PB_NBITS); |
| 269 | #endif |
| 270 | binary ("PA_ODR", *l++, PA_NB_ODR); |
| 271 | binary ("PB_ODR", *R++, PB_NB_ODR); |
| 272 | binary ("PA_DAT", *l++, PA_NBITS); |
| 273 | binary ("PB_DAT", *R++, PB_NBITS); |
| 274 | |
| 275 | header (); |
| 276 | |
| 277 | /* |
| 278 | * Ports C & D |
| 279 | */ |
| 280 | |
| 281 | #if defined(CONFIG_8xx) |
| 282 | l = &iop->iop_pcdir; |
| 283 | r = &iop->iop_pddir; |
| 284 | #elif defined(CONFIG_8260) |
| 285 | l = &iop->iop_pdirc; |
| 286 | r = &iop->iop_pdird; |
| 287 | #endif |
| 288 | binary ("PC_DIR", *l++, PC_NBITS); |
| 289 | binary ("PD_DIR", *r++, PD_NBITS); |
| 290 | binary ("PC_PAR", *l++, PC_NBITS); |
| 291 | binary ("PD_PAR", *r++, PD_NBITS); |
| 292 | #if defined(CONFIG_8xx) |
| 293 | binary ("PC_SO ", *l++, PC_NBITS); |
| 294 | binary (" ", 0, 0); |
| 295 | r++; |
| 296 | #elif defined(CONFIG_8260) |
| 297 | binary ("PC_SOR", *l++, PC_NBITS); |
| 298 | binary ("PD_SOR", *r++, PD_NBITS); |
| 299 | binary ("PC_ODR", *l++, PC_NBITS); |
| 300 | binary ("PD_ODR", *r++, PD_NBITS); |
| 301 | #endif |
| 302 | binary ("PC_DAT", *l++, PC_NBITS); |
| 303 | binary ("PD_DAT", *r++, PD_NBITS); |
| 304 | #if defined(CONFIG_8xx) |
| 305 | binary ("PC_INT", *l++, PC_NBITS); |
| 306 | #endif |
| 307 | |
| 308 | header (); |
| 309 | return 0; |
| 310 | } |
| 311 | |
| 312 | /* |
| 313 | * set the io pins |
| 314 | * this needs a clean up for smaller tighter code |
| 315 | * use *uint and set the address based on cmd + port |
| 316 | */ |
| 317 | int |
| 318 | do_iopset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 319 | { |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 320 | uint rcode = 0; |
| 321 | static uint port = 0; |
| 322 | static uint pin = 0; |
| 323 | static uint value = 0; |
Wolfgang Denk | e6f2228 | 2005-09-26 00:44:15 +0200 | [diff] [blame] | 324 | static enum { DIR, PAR, SOR, ODR, DAT, INT } cmd = DAT; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 325 | iopin_t iopin; |
| 326 | |
| 327 | if (argc != 5) { |
wdenk | 4b9206e | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 328 | puts ("iopset PORT PIN CMD VALUE\n"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 329 | return 1; |
| 330 | } |
| 331 | port = argv[1][0] - 'A'; |
| 332 | if (port > 3) |
| 333 | port -= 0x20; |
| 334 | if (port > 3) |
| 335 | rcode = 1; |
| 336 | pin = simple_strtol (argv[2], NULL, 10); |
| 337 | if (pin > 31) |
| 338 | rcode = 1; |
| 339 | |
| 340 | |
| 341 | switch (argv[3][0]) { |
| 342 | case 'd': |
| 343 | if (argv[3][1] == 'a') |
| 344 | cmd = DAT; |
| 345 | else if (argv[3][1] == 'i') |
| 346 | cmd = DIR; |
| 347 | else |
| 348 | rcode = 1; |
| 349 | break; |
| 350 | case 'p': |
| 351 | cmd = PAR; |
| 352 | break; |
| 353 | case 'o': |
| 354 | cmd = ODR; |
| 355 | break; |
| 356 | case 's': |
| 357 | cmd = SOR; |
| 358 | break; |
Wolfgang Denk | e6f2228 | 2005-09-26 00:44:15 +0200 | [diff] [blame] | 359 | #if defined(CONFIG_8xx) |
| 360 | case 'i': |
| 361 | cmd = INT; |
| 362 | break; |
| 363 | #endif |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 364 | default: |
| 365 | printf ("iopset: unknown command %s\n", argv[3]); |
| 366 | rcode = 1; |
| 367 | } |
| 368 | if (argv[4][0] == '1') |
| 369 | value = 1; |
| 370 | else if (argv[4][0] == '0') |
| 371 | value = 0; |
| 372 | else |
| 373 | rcode = 1; |
| 374 | if (rcode == 0) { |
| 375 | iopin.port = port; |
| 376 | iopin.pin = pin; |
| 377 | switch (cmd) { |
| 378 | case DIR: |
| 379 | if (value) |
| 380 | iopin_set_out (&iopin); |
| 381 | else |
| 382 | iopin_set_in (&iopin); |
| 383 | break; |
| 384 | case PAR: |
| 385 | if (value) |
| 386 | iopin_set_ded (&iopin); |
| 387 | else |
| 388 | iopin_set_gen (&iopin); |
| 389 | break; |
| 390 | case SOR: |
| 391 | if (value) |
| 392 | iopin_set_opt2 (&iopin); |
| 393 | else |
| 394 | iopin_set_opt1 (&iopin); |
| 395 | break; |
| 396 | case ODR: |
| 397 | if (value) |
| 398 | iopin_set_odr (&iopin); |
| 399 | else |
| 400 | iopin_set_act (&iopin); |
| 401 | break; |
| 402 | case DAT: |
| 403 | if (value) |
| 404 | iopin_set_high (&iopin); |
| 405 | else |
| 406 | iopin_set_low (&iopin); |
| 407 | break; |
Wolfgang Denk | e6f2228 | 2005-09-26 00:44:15 +0200 | [diff] [blame] | 408 | #if defined(CONFIG_8xx) |
| 409 | case INT: |
| 410 | if (value) |
| 411 | iopin_set_falledge (&iopin); |
| 412 | else |
| 413 | iopin_set_anyedge (&iopin); |
| 414 | break; |
| 415 | #endif |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 416 | } |
| 417 | |
| 418 | } |
| 419 | return rcode; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 420 | } |
| 421 | |
| 422 | int |
| 423 | do_dmainfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 424 | { |
| 425 | unimplemented (cmdtp, flag, argc, argv); |
| 426 | return 0; |
| 427 | } |
| 428 | |
| 429 | int |
| 430 | do_fccinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 431 | { |
| 432 | unimplemented (cmdtp, flag, argc, argv); |
| 433 | return 0; |
| 434 | } |
| 435 | |
| 436 | static void prbrg (int n, uint val) |
| 437 | { |
| 438 | uint extc = (val >> 14) & 3; |
| 439 | uint cd = (val & CPM_BRG_CD_MASK) >> 1; |
| 440 | uint div16 = (val & CPM_BRG_DIV16) != 0; |
| 441 | |
| 442 | #if defined(CONFIG_8xx) |
| 443 | DECLARE_GLOBAL_DATA_PTR; |
| 444 | ulong clock = gd->cpu_clk; |
| 445 | #elif defined(CONFIG_8260) |
| 446 | DECLARE_GLOBAL_DATA_PTR; |
| 447 | ulong clock = gd->brg_clk; |
| 448 | #endif |
| 449 | |
| 450 | printf ("BRG%d:", n); |
| 451 | |
| 452 | if (val & CPM_BRG_RST) |
| 453 | puts (" RESET"); |
| 454 | else |
| 455 | puts (" "); |
| 456 | |
| 457 | if (val & CPM_BRG_EN) |
| 458 | puts (" ENABLED"); |
| 459 | else |
| 460 | puts (" DISABLED"); |
| 461 | |
| 462 | printf (" EXTC=%d", extc); |
| 463 | |
| 464 | if (val & CPM_BRG_ATB) |
| 465 | puts (" ATB"); |
| 466 | else |
| 467 | puts (" "); |
| 468 | |
| 469 | printf (" DIVIDER=%4d", cd); |
| 470 | if (extc == 0 && cd != 0) { |
| 471 | uint baudrate; |
| 472 | |
| 473 | if (div16) |
| 474 | baudrate = (clock / 16) / (cd + 1); |
| 475 | else |
| 476 | baudrate = clock / (cd + 1); |
| 477 | |
| 478 | printf ("=%6d bps", baudrate); |
| 479 | } else { |
| 480 | puts (" "); |
| 481 | } |
| 482 | |
| 483 | if (val & CPM_BRG_DIV16) |
| 484 | puts (" DIV16"); |
| 485 | else |
| 486 | puts (" "); |
| 487 | |
| 488 | putc ('\n'); |
| 489 | } |
| 490 | |
| 491 | int |
| 492 | do_brginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 493 | { |
| 494 | volatile immap_t *immap = (immap_t *) CFG_IMMR; |
| 495 | |
| 496 | #if defined(CONFIG_8xx) |
| 497 | volatile cpm8xx_t *cp = &immap->im_cpm; |
| 498 | volatile uint *p = &cp->cp_brgc1; |
| 499 | #elif defined(CONFIG_8260) |
| 500 | volatile uint *p = &immap->im_brgc1; |
| 501 | #endif |
| 502 | int i = 1; |
| 503 | |
| 504 | while (i <= 4) |
| 505 | prbrg (i++, *p++); |
| 506 | |
| 507 | #if defined(CONFIG_8260) |
| 508 | p = &immap->im_brgc5; |
| 509 | while (i <= 8) |
| 510 | prbrg (i++, *p++); |
| 511 | #endif |
| 512 | return 0; |
| 513 | } |
| 514 | |
| 515 | int |
| 516 | do_i2cinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 517 | { |
| 518 | volatile immap_t *immap = (immap_t *) CFG_IMMR; |
| 519 | |
| 520 | #if defined(CONFIG_8xx) |
| 521 | volatile i2c8xx_t *i2c = &immap->im_i2c; |
| 522 | volatile cpm8xx_t *cp = &immap->im_cpm; |
| 523 | volatile iic_t *iip = (iic_t *) & cp->cp_dparam[PROFF_IIC]; |
| 524 | #elif defined(CONFIG_8260) |
| 525 | volatile i2c8260_t *i2c = &immap->im_i2c; |
| 526 | volatile iic_t *iip; |
| 527 | uint dpaddr; |
| 528 | |
| 529 | dpaddr = *((unsigned short *) (&immap->im_dprambase[PROFF_I2C_BASE])); |
| 530 | if (dpaddr == 0) |
| 531 | iip = NULL; |
| 532 | else |
| 533 | iip = (iic_t *) & immap->im_dprambase[dpaddr]; |
| 534 | #endif |
| 535 | |
| 536 | printf ("I2MOD = %02x I2ADD = %02x\n", i2c->i2c_i2mod, i2c->i2c_i2add); |
| 537 | printf ("I2BRG = %02x I2COM = %02x\n", i2c->i2c_i2brg, i2c->i2c_i2com); |
| 538 | printf ("I2CER = %02x I2CMR = %02x\n", i2c->i2c_i2cer, i2c->i2c_i2cmr); |
| 539 | |
| 540 | if (iip == NULL) |
wdenk | 4b9206e | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 541 | puts ("i2c parameter ram not allocated\n"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 542 | else { |
| 543 | printf ("RBASE = %08x TBASE = %08x\n", |
| 544 | iip->iic_rbase, iip->iic_tbase); |
| 545 | printf ("RFCR = %02x TFCR = %02x\n", |
| 546 | iip->iic_rfcr, iip->iic_tfcr); |
| 547 | printf ("MRBLR = %04x\n", iip->iic_mrblr); |
| 548 | printf ("RSTATE= %08x RDP = %08x\n", |
| 549 | iip->iic_rstate, iip->iic_rdp); |
| 550 | printf ("RBPTR = %04x RBC = %04x\n", |
| 551 | iip->iic_rbptr, iip->iic_rbc); |
| 552 | printf ("RXTMP = %08x\n", iip->iic_rxtmp); |
| 553 | printf ("TSTATE= %08x TDP = %08x\n", |
| 554 | iip->iic_tstate, iip->iic_tdp); |
| 555 | printf ("TBPTR = %04x TBC = %04x\n", |
| 556 | iip->iic_tbptr, iip->iic_tbc); |
| 557 | printf ("TXTMP = %08x\n", iip->iic_txtmp); |
| 558 | } |
| 559 | return 0; |
| 560 | } |
| 561 | |
| 562 | int |
| 563 | do_sccinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 564 | { |
| 565 | unimplemented (cmdtp, flag, argc, argv); |
| 566 | return 0; |
| 567 | } |
| 568 | |
| 569 | int |
| 570 | do_smcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 571 | { |
| 572 | unimplemented (cmdtp, flag, argc, argv); |
| 573 | return 0; |
| 574 | } |
| 575 | |
| 576 | int |
| 577 | do_spiinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 578 | { |
| 579 | unimplemented (cmdtp, flag, argc, argv); |
| 580 | return 0; |
| 581 | } |
| 582 | |
| 583 | int |
| 584 | do_muxinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 585 | { |
| 586 | unimplemented (cmdtp, flag, argc, argv); |
| 587 | return 0; |
| 588 | } |
| 589 | |
| 590 | int |
| 591 | do_siinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 592 | { |
| 593 | unimplemented (cmdtp, flag, argc, argv); |
| 594 | return 0; |
| 595 | } |
| 596 | |
| 597 | int |
| 598 | do_mccinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 599 | { |
| 600 | unimplemented (cmdtp, flag, argc, argv); |
| 601 | return 0; |
| 602 | } |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 603 | |
| 604 | /***************************************************/ |
| 605 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 606 | U_BOOT_CMD( |
| 607 | siuinfo, 1, 1, do_siuinfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 608 | "siuinfo - print System Interface Unit (SIU) registers\n", |
| 609 | NULL |
| 610 | ); |
| 611 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 612 | U_BOOT_CMD( |
| 613 | memcinfo, 1, 1, do_memcinfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 614 | "memcinfo- print Memory Controller registers\n", |
| 615 | NULL |
| 616 | ); |
| 617 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 618 | U_BOOT_CMD( |
| 619 | sitinfo, 1, 1, do_sitinfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 620 | "sitinfo - print System Integration Timers (SIT) registers\n", |
| 621 | NULL |
| 622 | ); |
| 623 | |
| 624 | #ifdef CONFIG_8260 |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 625 | U_BOOT_CMD( |
| 626 | icinfo, 1, 1, do_icinfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 627 | "icinfo - print Interrupt Controller registers\n", |
| 628 | NULL |
| 629 | ); |
| 630 | #endif |
| 631 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 632 | U_BOOT_CMD( |
| 633 | carinfo, 1, 1, do_carinfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 634 | "carinfo - print Clocks and Reset registers\n", |
| 635 | NULL |
| 636 | ); |
| 637 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 638 | U_BOOT_CMD( |
| 639 | iopinfo, 1, 1, do_iopinfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 640 | "iopinfo - print I/O Port registers\n", |
| 641 | NULL |
| 642 | ); |
| 643 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 644 | U_BOOT_CMD( |
| 645 | iopset, 5, 0, do_iopset, |
wdenk | 206c60c | 2003-09-18 10:02:25 +0000 | [diff] [blame] | 646 | "iopset - set I/O Port registers\n", |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 647 | "PORT PIN CMD VALUE\nPORT: A-D, PIN: 0-31, CMD: [dat|dir|odr|sor], VALUE: 0|1" |
| 648 | ); |
| 649 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 650 | U_BOOT_CMD( |
| 651 | dmainfo, 1, 1, do_dmainfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 652 | "dmainfo - print SDMA/IDMA registers\n", |
| 653 | NULL |
| 654 | ); |
| 655 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 656 | U_BOOT_CMD( |
| 657 | fccinfo, 1, 1, do_fccinfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 658 | "fccinfo - print FCC registers\n", |
| 659 | NULL |
| 660 | ); |
| 661 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 662 | U_BOOT_CMD( |
| 663 | brginfo, 1, 1, do_brginfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 664 | "brginfo - print Baud Rate Generator (BRG) registers\n", |
| 665 | NULL |
| 666 | ); |
| 667 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 668 | U_BOOT_CMD( |
| 669 | i2cinfo, 1, 1, do_i2cinfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 670 | "i2cinfo - print I2C registers\n", |
| 671 | NULL |
| 672 | ); |
| 673 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 674 | U_BOOT_CMD( |
| 675 | sccinfo, 1, 1, do_sccinfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 676 | "sccinfo - print SCC registers\n", |
| 677 | NULL |
| 678 | ); |
| 679 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 680 | U_BOOT_CMD( |
| 681 | smcinfo, 1, 1, do_smcinfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 682 | "smcinfo - print SMC registers\n", |
| 683 | NULL |
| 684 | ); |
| 685 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 686 | U_BOOT_CMD( |
| 687 | spiinfo, 1, 1, do_spiinfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 688 | "spiinfo - print Serial Peripheral Interface (SPI) registers\n", |
| 689 | NULL |
| 690 | ); |
| 691 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 692 | U_BOOT_CMD( |
| 693 | muxinfo, 1, 1, do_muxinfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 694 | "muxinfo - print CPM Multiplexing registers\n", |
| 695 | NULL |
| 696 | ); |
| 697 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 698 | U_BOOT_CMD( |
| 699 | siinfo, 1, 1, do_siinfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 700 | "siinfo - print Serial Interface (SI) registers\n", |
| 701 | NULL |
| 702 | ); |
| 703 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 704 | U_BOOT_CMD( |
| 705 | mccinfo, 1, 1, do_mccinfo, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 706 | "mccinfo - print MCC registers\n", |
| 707 | NULL |
| 708 | ); |
| 709 | |
| 710 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 711 | #endif /* CFG_CMD_IMMAP && (CONFIG_8xx || CONFIG_8260) */ |