Blame view

common/cmd_immap.c 14.3 KB
c609719b8   wdenk   Initial revision
1
  /*
2abbe0754   wdenk   * Patch by Nicola...
2
   * (C) Copyright 2000-2003
c609719b8   wdenk   Initial revision
3
4
   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
   *
1a4596601   Wolfgang Denk   Add GPL-2.0+ SPDX...
5
   * SPDX-License-Identifier:	GPL-2.0+
c609719b8   wdenk   Initial revision
6
7
8
9
10
11
12
13
   */
  
  /*
   * MPC8xx/MPC8260 Internal Memory Map Functions
   */
  
  #include <common.h>
  #include <command.h>
c609719b8   wdenk   Initial revision
14

58dac3276   Masahiro Yamada   powerpc: mpc8260:...
15
  #if defined(CONFIG_8xx) || defined(CONFIG_MPC8260)
c609719b8   wdenk   Initial revision
16
17
18
19
  
  #if defined(CONFIG_8xx)
  #include <asm/8xx_immap.h>
  #include <commproc.h>
e6f222815   Wolfgang Denk   Add iopset comman...
20
  #include <asm/iopin_8xx.h>
58dac3276   Masahiro Yamada   powerpc: mpc8260:...
21
  #elif defined(CONFIG_MPC8260)
c609719b8   wdenk   Initial revision
22
23
24
25
  #include <asm/immap_8260.h>
  #include <asm/cpm_8260.h>
  #include <asm/iopin_8260.h>
  #endif
d87080b72   Wolfgang Denk   GCC-4.x fixes: cl...
26
  DECLARE_GLOBAL_DATA_PTR;
d87080b72   Wolfgang Denk   GCC-4.x fixes: cl...
27

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