xref: /openbmc/u-boot/cmd/reginfo.c (revision 2eb48ff7a210ddd2a39bac23b3b9b39c60c32aef)
1 /*
2  * (C) Copyright 2000
3  * Subodh Nijsure, SkyStream Networks, snijsure@skystream.com
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #include <common.h>
9 #include <command.h>
10 #if defined (CONFIG_4xx)
11 extern void ppc4xx_reginfo(void);
12 #elif defined (CONFIG_5xx)
13 #include <mpc5xx.h>
14 #elif defined (CONFIG_MPC5200)
15 #include <mpc5xxx.h>
16 #elif defined (CONFIG_MPC86xx)
17 extern void mpc86xx_reginfo(void);
18 #elif defined(CONFIG_MPC85xx)
19 extern void mpc85xx_reginfo(void);
20 #endif
21 
22 static int do_reginfo(cmd_tbl_t *cmdtp, int flag, int argc,
23 		       char * const argv[])
24 {
25 #if defined (CONFIG_4xx)
26 	ppc4xx_reginfo();
27 #elif defined(CONFIG_5xx)
28 
29 	volatile immap_t	*immap  = (immap_t *)CONFIG_SYS_IMMR;
30 	volatile memctl5xx_t	*memctl = &immap->im_memctl;
31 	volatile sysconf5xx_t	*sysconf = &immap->im_siu_conf;
32 	volatile sit5xx_t	*timers = &immap->im_sit;
33 	volatile car5xx_t	*car = &immap->im_clkrst;
34 	volatile uimb5xx_t	*uimb = &immap->im_uimb;
35 
36 	puts ("\nSystem Configuration registers\n");
37 	printf("\tIMMR\t0x%08X\tSIUMCR\t0x%08X \n", get_immr(0), sysconf->sc_siumcr);
38 	printf("\tSYPCR\t0x%08X\tSWSR\t0x%04X \n" ,sysconf->sc_sypcr, sysconf->sc_swsr);
39 	printf("\tSIPEND\t0x%08X\tSIMASK\t0x%08X \n", sysconf->sc_sipend, sysconf->sc_simask);
40 	printf("\tSIEL\t0x%08X\tSIVEC\t0x%08X \n", sysconf->sc_siel, sysconf->sc_sivec);
41 	printf("\tTESR\t0x%08X\n", sysconf->sc_tesr);
42 
43 	puts ("\nMemory Controller Registers\n");
44 	printf("\tBR0\t0x%08X\tOR0\t0x%08X \n", memctl->memc_br0, memctl->memc_or0);
45 	printf("\tBR1\t0x%08X\tOR1\t0x%08X \n", memctl->memc_br1, memctl->memc_or1);
46 	printf("\tBR2\t0x%08X\tOR2\t0x%08X \n", memctl->memc_br2, memctl->memc_or2);
47 	printf("\tBR3\t0x%08X\tOR3\t0x%08X \n", memctl->memc_br3, memctl->memc_or3);
48 	printf("\tDMBR\t0x%08X\tDMOR\t0x%08X \n", memctl->memc_dmbr, memctl->memc_dmor );
49 	printf("\tMSTAT\t0x%08X\n", memctl->memc_mstat);
50 
51 	puts ("\nSystem Integration Timers\n");
52 	printf("\tTBSCR\t0x%08X\tRTCSC\t0x%08X \n", timers->sit_tbscr, timers->sit_rtcsc);
53 	printf("\tPISCR\t0x%08X \n", timers->sit_piscr);
54 
55 	puts ("\nClocks and Reset\n");
56 	printf("\tSCCR\t0x%08X\tPLPRCR\t0x%08X \n", car->car_sccr, car->car_plprcr);
57 
58 	puts ("\nU-Bus to IMB3 Bus Interface\n");
59 	printf("\tUMCR\t0x%08X\tUIPEND\t0x%08X \n", uimb->uimb_umcr, uimb->uimb_uipend);
60 	puts ("\n\n");
61 
62 #elif defined(CONFIG_MPC5200)
63 	puts ("\nMPC5200 registers\n");
64 	printf ("MBAR=%08x\n", CONFIG_SYS_MBAR);
65 	puts ("Memory map registers\n");
66 	printf ("\tCS0: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n",
67 		*(volatile ulong*)MPC5XXX_CS0_START,
68 		*(volatile ulong*)MPC5XXX_CS0_STOP,
69 		*(volatile ulong*)MPC5XXX_CS0_CFG,
70 		(*(volatile ulong*)MPC5XXX_ADDECR & 0x00010000) ? 1 : 0);
71 	printf ("\tCS1: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n",
72 		*(volatile ulong*)MPC5XXX_CS1_START,
73 		*(volatile ulong*)MPC5XXX_CS1_STOP,
74 		*(volatile ulong*)MPC5XXX_CS1_CFG,
75 		(*(volatile ulong*)MPC5XXX_ADDECR & 0x00020000) ? 1 : 0);
76 	printf ("\tCS2: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n",
77 		*(volatile ulong*)MPC5XXX_CS2_START,
78 		*(volatile ulong*)MPC5XXX_CS2_STOP,
79 		*(volatile ulong*)MPC5XXX_CS2_CFG,
80 		(*(volatile ulong*)MPC5XXX_ADDECR & 0x00040000) ? 1 : 0);
81 	printf ("\tCS3: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n",
82 		*(volatile ulong*)MPC5XXX_CS3_START,
83 		*(volatile ulong*)MPC5XXX_CS3_STOP,
84 		*(volatile ulong*)MPC5XXX_CS3_CFG,
85 		(*(volatile ulong*)MPC5XXX_ADDECR & 0x00080000) ? 1 : 0);
86 	printf ("\tCS4: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n",
87 		*(volatile ulong*)MPC5XXX_CS4_START,
88 		*(volatile ulong*)MPC5XXX_CS4_STOP,
89 		*(volatile ulong*)MPC5XXX_CS4_CFG,
90 		(*(volatile ulong*)MPC5XXX_ADDECR & 0x00100000) ? 1 : 0);
91 	printf ("\tCS5: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n",
92 		*(volatile ulong*)MPC5XXX_CS5_START,
93 		*(volatile ulong*)MPC5XXX_CS5_STOP,
94 		*(volatile ulong*)MPC5XXX_CS5_CFG,
95 		(*(volatile ulong*)MPC5XXX_ADDECR & 0x00200000) ? 1 : 0);
96 	printf ("\tCS6: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n",
97 		*(volatile ulong*)MPC5XXX_CS6_START,
98 		*(volatile ulong*)MPC5XXX_CS6_STOP,
99 		*(volatile ulong*)MPC5XXX_CS6_CFG,
100 		(*(volatile ulong*)MPC5XXX_ADDECR & 0x04000000) ? 1 : 0);
101 	printf ("\tCS7: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n",
102 		*(volatile ulong*)MPC5XXX_CS7_START,
103 		*(volatile ulong*)MPC5XXX_CS7_STOP,
104 		*(volatile ulong*)MPC5XXX_CS7_CFG,
105 		(*(volatile ulong*)MPC5XXX_ADDECR & 0x08000000) ? 1 : 0);
106 	printf ("\tBOOTCS: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n",
107 		*(volatile ulong*)MPC5XXX_BOOTCS_START,
108 		*(volatile ulong*)MPC5XXX_BOOTCS_STOP,
109 		*(volatile ulong*)MPC5XXX_BOOTCS_CFG,
110 		(*(volatile ulong*)MPC5XXX_ADDECR & 0x02000000) ? 1 : 0);
111 	printf ("\tSDRAMCS0: %08lX\n",
112 		*(volatile ulong*)MPC5XXX_SDRAM_CS0CFG);
113 	printf ("\tSDRAMCS1: %08lX\n",
114 		*(volatile ulong*)MPC5XXX_SDRAM_CS1CFG);
115 #elif defined(CONFIG_MPC86xx)
116 	mpc86xx_reginfo();
117 
118 #elif defined(CONFIG_MPC85xx)
119 	mpc85xx_reginfo();
120 #endif
121 
122 	return 0;
123 }
124 
125  /**************************************************/
126 
127 #if defined(CONFIG_CMD_REGINFO)
128 U_BOOT_CMD(
129 	reginfo,	2,	1,	do_reginfo,
130 	"print register information",
131 	""
132 );
133 #endif
134