wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2000 |
| 3 | * Subodh Nijsure, SkyStream Networks, snijsure@skystream.com |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <command.h> |
Heiko Schocher | 65d94db | 2017-06-07 17:33:09 +0200 | [diff] [blame^] | 10 | #if defined (CONFIG_4xx) |
Niklaus Giger | d4c6154 | 2009-10-04 20:04:21 +0200 | [diff] [blame] | 11 | extern void ppc4xx_reginfo(void); |
wdenk | 359733b | 2003-03-31 17:27:09 +0000 | [diff] [blame] | 12 | #elif defined (CONFIG_5xx) |
| 13 | #include <mpc5xx.h> |
wdenk | 6451936 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 14 | #elif defined (CONFIG_MPC5200) |
| 15 | #include <mpc5xxx.h> |
Becky Bruce | b0b3094 | 2008-01-23 16:31:06 -0600 | [diff] [blame] | 16 | #elif defined (CONFIG_MPC86xx) |
| 17 | extern void mpc86xx_reginfo(void); |
Becky Bruce | ee888da | 2010-06-17 11:37:25 -0500 | [diff] [blame] | 18 | #elif defined(CONFIG_MPC85xx) |
| 19 | extern void mpc85xx_reginfo(void); |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 20 | #endif |
Jon Loeliger | 3de8b24 | 2007-06-11 19:01:54 -0500 | [diff] [blame] | 21 | |
Kim Phillips | dc00a68 | 2012-10-29 13:34:31 +0000 | [diff] [blame] | 22 | static int do_reginfo(cmd_tbl_t *cmdtp, int flag, int argc, |
| 23 | char * const argv[]) |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 24 | { |
Heiko Schocher | 65d94db | 2017-06-07 17:33:09 +0200 | [diff] [blame^] | 25 | #if defined (CONFIG_4xx) |
Niklaus Giger | d4c6154 | 2009-10-04 20:04:21 +0200 | [diff] [blame] | 26 | ppc4xx_reginfo(); |
wdenk | 359733b | 2003-03-31 17:27:09 +0000 | [diff] [blame] | 27 | #elif defined(CONFIG_5xx) |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 28 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 29 | volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR; |
wdenk | 359733b | 2003-03-31 17:27:09 +0000 | [diff] [blame] | 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 | |
wdenk | 42c0547 | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 36 | puts ("\nSystem Configuration registers\n"); |
wdenk | 359733b | 2003-03-31 17:27:09 +0000 | [diff] [blame] | 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 | |
wdenk | 42c0547 | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 43 | puts ("\nMemory Controller Registers\n"); |
wdenk | 359733b | 2003-03-31 17:27:09 +0000 | [diff] [blame] | 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 | |
wdenk | 42c0547 | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 51 | puts ("\nSystem Integration Timers\n"); |
wdenk | 359733b | 2003-03-31 17:27:09 +0000 | [diff] [blame] | 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 | |
wdenk | 42c0547 | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 55 | puts ("\nClocks and Reset\n"); |
wdenk | 359733b | 2003-03-31 17:27:09 +0000 | [diff] [blame] | 56 | printf("\tSCCR\t0x%08X\tPLPRCR\t0x%08X \n", car->car_sccr, car->car_plprcr); |
| 57 | |
wdenk | 42c0547 | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 58 | puts ("\nU-Bus to IMB3 Bus Interface\n"); |
wdenk | 359733b | 2003-03-31 17:27:09 +0000 | [diff] [blame] | 59 | printf("\tUMCR\t0x%08X\tUIPEND\t0x%08X \n", uimb->uimb_umcr, uimb->uimb_uipend); |
wdenk | 42c0547 | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 60 | puts ("\n\n"); |
wdenk | 6451936 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 61 | |
| 62 | #elif defined(CONFIG_MPC5200) |
| 63 | puts ("\nMPC5200 registers\n"); |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 64 | printf ("MBAR=%08x\n", CONFIG_SYS_MBAR); |
wdenk | 6451936 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 65 | puts ("Memory map registers\n"); |
Wolfgang Denk | 12cec0a | 2008-07-11 01:16:00 +0200 | [diff] [blame] | 66 | printf ("\tCS0: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n", |
wdenk | 6451936 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 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); |
Wolfgang Denk | 12cec0a | 2008-07-11 01:16:00 +0200 | [diff] [blame] | 71 | printf ("\tCS1: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n", |
wdenk | 6451936 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 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); |
Wolfgang Denk | 12cec0a | 2008-07-11 01:16:00 +0200 | [diff] [blame] | 76 | printf ("\tCS2: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n", |
wdenk | 6451936 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 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); |
Wolfgang Denk | 12cec0a | 2008-07-11 01:16:00 +0200 | [diff] [blame] | 81 | printf ("\tCS3: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n", |
wdenk | 6451936 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 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); |
Wolfgang Denk | 12cec0a | 2008-07-11 01:16:00 +0200 | [diff] [blame] | 86 | printf ("\tCS4: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n", |
wdenk | 6451936 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 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); |
Wolfgang Denk | 12cec0a | 2008-07-11 01:16:00 +0200 | [diff] [blame] | 91 | printf ("\tCS5: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n", |
wdenk | 6451936 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 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); |
Wolfgang Denk | 12cec0a | 2008-07-11 01:16:00 +0200 | [diff] [blame] | 96 | printf ("\tCS6: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n", |
wdenk | 6451936 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 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); |
Wolfgang Denk | 12cec0a | 2008-07-11 01:16:00 +0200 | [diff] [blame] | 101 | printf ("\tCS7: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n", |
wdenk | 6451936 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 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); |
Wolfgang Denk | 12cec0a | 2008-07-11 01:16:00 +0200 | [diff] [blame] | 106 | printf ("\tBOOTCS: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n", |
wdenk | 6451936 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 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); |
Wolfgang Denk | 12cec0a | 2008-07-11 01:16:00 +0200 | [diff] [blame] | 111 | printf ("\tSDRAMCS0: %08lX\n", |
wdenk | 6451936 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 112 | *(volatile ulong*)MPC5XXX_SDRAM_CS0CFG); |
Wolfgang Denk | 12cec0a | 2008-07-11 01:16:00 +0200 | [diff] [blame] | 113 | printf ("\tSDRAMCS1: %08lX\n", |
wdenk | 6451936 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 114 | *(volatile ulong*)MPC5XXX_SDRAM_CS1CFG); |
Becky Bruce | b0b3094 | 2008-01-23 16:31:06 -0600 | [diff] [blame] | 115 | #elif defined(CONFIG_MPC86xx) |
| 116 | mpc86xx_reginfo(); |
Mike Frysinger | 030f345 | 2008-02-04 19:26:56 -0500 | [diff] [blame] | 117 | |
Becky Bruce | ee888da | 2010-06-17 11:37:25 -0500 | [diff] [blame] | 118 | #elif defined(CONFIG_MPC85xx) |
| 119 | mpc85xx_reginfo(); |
Sonic Zhang | a99f03e | 2012-08-16 11:56:14 +0800 | [diff] [blame] | 120 | #endif |
Becky Bruce | b0b3094 | 2008-01-23 16:31:06 -0600 | [diff] [blame] | 121 | |
wdenk | e887afc | 2002-08-27 09:44:07 +0000 | [diff] [blame] | 122 | return 0; |
| 123 | } |
| 124 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 125 | /**************************************************/ |
| 126 | |
Mike Frysinger | 030f345 | 2008-02-04 19:26:56 -0500 | [diff] [blame] | 127 | #if defined(CONFIG_CMD_REGINFO) |
wdenk | f287a24 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 128 | U_BOOT_CMD( |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 129 | reginfo, 2, 1, do_reginfo, |
Peter Tyser | dfb72b8 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 130 | "print register information", |
Wolfgang Denk | c54781c | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 131 | "" |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 132 | ); |
| 133 | #endif |