blob: 53bfdf790b4565d3f93cb319abf1c5c677820dcc [file] [log] [blame]
Stefan Roese8d982302007-01-18 10:25:34 +01001/*
2 * (C) Copyright 2007
3 * Stefan Roese, DENX Software Engineering, sr@denx.de.
4 *
Wolfgang Denkbd8ec7e2013-10-07 13:07:26 +02005 * SPDX-License-Identifier: GPL-2.0+
Stefan Roese8d982302007-01-18 10:25:34 +01006 */
7
8#include <config.h>
9#include <common.h>
10#include <command.h>
11#include <asm/processor.h>
12#include <pci.h>
13
14void show_reset_reg(void)
15{
16 unsigned long reg;
17
18 /* read clock regsiter */
19 printf("===== Display reset and initialize register Start =========\n");
Stefan Roese918010a2009-09-09 16:25:29 +020020 mfcpr(CPR0_PLLC,reg);
Wolfgang Denk5ef47212008-07-11 22:56:11 +020021 printf("cpr_pllc = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010022
Stefan Roese918010a2009-09-09 16:25:29 +020023 mfcpr(CPR0_PLLD,reg);
Wolfgang Denk5ef47212008-07-11 22:56:11 +020024 printf("cpr_plld = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010025
Niklaus Giger728bd0a2009-10-04 20:04:20 +020026 mfcpr(CPR0_PRIMAD0,reg);
Wolfgang Denk5ef47212008-07-11 22:56:11 +020027 printf("cpr_primad = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010028
Niklaus Giger728bd0a2009-10-04 20:04:20 +020029 mfcpr(CPR0_PRIMBD0,reg);
Wolfgang Denk5ef47212008-07-11 22:56:11 +020030 printf("cpr_primbd = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010031
Niklaus Giger728bd0a2009-10-04 20:04:20 +020032 mfcpr(CPR0_OPBD0,reg);
Wolfgang Denk5ef47212008-07-11 22:56:11 +020033 printf("cpr_opbd = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010034
Stefan Roese918010a2009-09-09 16:25:29 +020035 mfcpr(CPR0_PERD,reg);
Wolfgang Denk5ef47212008-07-11 22:56:11 +020036 printf("cpr_perd = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010037
Stefan Roese918010a2009-09-09 16:25:29 +020038 mfcpr(CPR0_MALD,reg);
Wolfgang Denk5ef47212008-07-11 22:56:11 +020039 printf("cpr_mald = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010040
41 /* read sdr register */
Stefan Roese918010a2009-09-09 16:25:29 +020042 mfsdr(SDR0_EBC,reg);
43 printf("SDR0_EBC = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010044
Stefan Roese918010a2009-09-09 16:25:29 +020045 mfsdr(SDR0_CP440,reg);
46 printf("SDR0_CP440 = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010047
Stefan Roese918010a2009-09-09 16:25:29 +020048 mfsdr(SDR0_XCR,reg);
49 printf("SDR0_XCR = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010050
Stefan Roese918010a2009-09-09 16:25:29 +020051 mfsdr(SDR0_XPLLC,reg);
52 printf("SDR0_XPLLC = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010053
Stefan Roese918010a2009-09-09 16:25:29 +020054 mfsdr(SDR0_XPLLD,reg);
55 printf("SDR0_XPLLD = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010056
Stefan Roese918010a2009-09-09 16:25:29 +020057 mfsdr(SDR0_PFC0,reg);
58 printf("SDR0_PFC0 = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010059
Stefan Roese918010a2009-09-09 16:25:29 +020060 mfsdr(SDR0_PFC1,reg);
61 printf("SDR0_PFC1 = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010062
Stefan Roese918010a2009-09-09 16:25:29 +020063 mfsdr(SDR0_CUST0,reg);
64 printf("SDR0_CUST0 = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010065
Stefan Roese918010a2009-09-09 16:25:29 +020066 mfsdr(SDR0_CUST1,reg);
67 printf("SDR0_CUST1 = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010068
Stefan Roese918010a2009-09-09 16:25:29 +020069 mfsdr(SDR0_UART0,reg);
70 printf("SDR0_UART0 = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010071
Stefan Roese918010a2009-09-09 16:25:29 +020072 mfsdr(SDR0_UART1,reg);
73 printf("SDR0_UART1 = %#010lx\n",reg);
Stefan Roese8d982302007-01-18 10:25:34 +010074
75 printf("===== Display reset and initialize register End =========\n");
76}
77
78void show_xbridge_info(void)
79{
80 unsigned long reg;
81
82 printf("PCI-X chip control registers\n");
Stefan Roese918010a2009-09-09 16:25:29 +020083 mfsdr(SDR0_XCR, reg);
84 printf("SDR0_XCR = %#010lx\n", reg);
Stefan Roese8d982302007-01-18 10:25:34 +010085
Stefan Roese918010a2009-09-09 16:25:29 +020086 mfsdr(SDR0_XPLLC, reg);
87 printf("SDR0_XPLLC = %#010lx\n", reg);
Stefan Roese8d982302007-01-18 10:25:34 +010088
Stefan Roese918010a2009-09-09 16:25:29 +020089 mfsdr(SDR0_XPLLD, reg);
90 printf("SDR0_XPLLD = %#010lx\n", reg);
Stefan Roese8d982302007-01-18 10:25:34 +010091
92 printf("PCI-X Bridge Configure registers\n");
Niklaus Giger728bd0a2009-10-04 20:04:20 +020093 printf("PCIL0_VENDID = %#06x\n", in16r(PCIL0_VENDID));
94 printf("PCIL0_DEVID = %#06x\n", in16r(PCIL0_DEVID));
95 printf("PCIL0_CMD = %#06x\n", in16r(PCIL0_CMD));
96 printf("PCIL0_STATUS = %#06x\n", in16r(PCIL0_STATUS));
97 printf("PCIL0_REVID = %#04x\n", in8(PCIL0_REVID));
98 printf("PCIL0_CACHELS = %#04x\n", in8(PCIL0_CACHELS));
99 printf("PCIL0_LATTIM = %#04x\n", in8(PCIL0_LATTIM));
100 printf("PCIL0_HDTYPE = %#04x\n", in8(PCIL0_HDTYPE));
101 printf("PCIL0_BIST = %#04x\n", in8(PCIL0_BIST));
Stefan Roese8d982302007-01-18 10:25:34 +0100102
Niklaus Giger728bd0a2009-10-04 20:04:20 +0200103 printf("PCIL0_BAR0 = %#010lx\n", in32r(PCIL0_BAR0));
104 printf("PCIL0_BAR1 = %#010lx\n", in32r(PCIL0_BAR1));
105 printf("PCIL0_BAR2 = %#010lx\n", in32r(PCIL0_BAR2));
106 printf("PCIL0_BAR3 = %#010lx\n", in32r(PCIL0_BAR3));
107 printf("PCIL0_BAR4 = %#010lx\n", in32r(PCIL0_BAR4));
108 printf("PCIL0_BAR5 = %#010lx\n", in32r(PCIL0_BAR5));
Stefan Roese8d982302007-01-18 10:25:34 +0100109
Niklaus Giger728bd0a2009-10-04 20:04:20 +0200110 printf("PCIL0_CISPTR = %#010lx\n", in32r(PCIL0_CISPTR));
111 printf("PCIL0_SBSSYSVID = %#010x\n", in16r(PCIL0_SBSYSVID));
112 printf("PCIL0_SBSSYSID = %#010x\n", in16r(PCIL0_SBSYSID));
113 printf("PCIL0_EROMBA = %#010lx\n", in32r(PCIL0_EROMBA));
114 printf("PCIL0_CAP = %#04x\n", in8(PCIL0_CAP));
115 printf("PCIL0_INTLN = %#04x\n", in8(PCIL0_INTLN));
116 printf("PCIL0_INTPN = %#04x\n", in8(PCIL0_INTPN));
117 printf("PCIL0_MINGNT = %#04x\n", in8(PCIL0_MINGNT));
118 printf("PCIL0_MAXLTNCY = %#04x\n", in8(PCIL0_MAXLTNCY));
Stefan Roese8d982302007-01-18 10:25:34 +0100119
Niklaus Giger728bd0a2009-10-04 20:04:20 +0200120 printf("PCIL0_BRDGOPT1 = %#010lx\n", in32r(PCIL0_BRDGOPT1));
121 printf("PCIL0_BRDGOPT2 = %#010lx\n", in32r(PCIL0_BRDGOPT2));
Stefan Roese8d982302007-01-18 10:25:34 +0100122
Niklaus Giger728bd0a2009-10-04 20:04:20 +0200123 printf("PCIL0_POM0LAL = %#010lx\n", in32r(PCIL0_POM0LAL));
124 printf("PCIL0_POM0LAH = %#010lx\n", in32r(PCIL0_POM0LAH));
125 printf("PCIL0_POM0SA = %#010lx\n", in32r(PCIL0_POM0SA));
126 printf("PCIL0_POM0PCILAL = %#010lx\n", in32r(PCIL0_POM0PCIAL));
127 printf("PCIL0_POM0PCILAH = %#010lx\n", in32r(PCIL0_POM0PCIAH));
128 printf("PCIL0_POM1LAL = %#010lx\n", in32r(PCIL0_POM1LAL));
129 printf("PCIL0_POM1LAH = %#010lx\n", in32r(PCIL0_POM1LAH));
130 printf("PCIL0_POM1SA = %#010lx\n", in32r(PCIL0_POM1SA));
131 printf("PCIL0_POM1PCILAL = %#010lx\n", in32r(PCIL0_POM1PCIAL));
132 printf("PCIL0_POM1PCILAH = %#010lx\n", in32r(PCIL0_POM1PCIAH));
133 printf("PCIL0_POM2SA = %#010lx\n", in32r(PCIL0_POM2SA));
Stefan Roese8d982302007-01-18 10:25:34 +0100134
Niklaus Giger728bd0a2009-10-04 20:04:20 +0200135 printf("PCIL0_PIM0SA = %#010lx\n", in32r(PCIL0_PIM0SA));
136 printf("PCIL0_PIM0LAL = %#010lx\n", in32r(PCIL0_PIM0LAL));
137 printf("PCIL0_PIM0LAH = %#010lx\n", in32r(PCIL0_PIM0LAH));
138 printf("PCIL0_PIM1SA = %#010lx\n", in32r(PCIL0_PIM1SA));
139 printf("PCIL0_PIM1LAL = %#010lx\n", in32r(PCIL0_PIM1LAL));
140 printf("PCIL0_PIM1LAH = %#010lx\n", in32r(PCIL0_PIM1LAH));
141 printf("PCIL0_PIM2SA = %#010lx\n", in32r(PCIL0_PIM1SA));
142 printf("PCIL0_PIM2LAL = %#010lx\n", in32r(PCIL0_PIM1LAL));
143 printf("PCIL0_PIM2LAH = %#010lx\n", in32r(PCIL0_PIM1LAH));
Stefan Roese8d982302007-01-18 10:25:34 +0100144
Niklaus Giger728bd0a2009-10-04 20:04:20 +0200145 printf("PCIL0_XSTS = %#010lx\n", in32r(PCIL0_STS));
Stefan Roese8d982302007-01-18 10:25:34 +0100146}
147
Wolfgang Denk6262d0212010-06-28 22:00:46 +0200148int do_show_xbridge_info(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
Stefan Roese8d982302007-01-18 10:25:34 +0100149{
150 show_xbridge_info();
151 return 0;
152}
153
154U_BOOT_CMD(xbriinfo, 1, 1, do_show_xbridge_info,
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200155 "Show PCIX bridge info", "");
Stefan Roese8d982302007-01-18 10:25:34 +0100156
157#define TAISHAN_PCI_DEV_ID0 0x800
158#define TAISHAN_PCI_DEV_ID1 0x1000
159
160void show_pcix_device_info(void)
161{
162 int ii;
163 int dev;
164 u8 capp;
165 u8 xcapid;
166 u16 status;
167 u16 xcommand;
168 u32 xstatus;
169
170 for (ii = 0; ii < 2; ii++) {
171 if (ii == 0)
172 dev = TAISHAN_PCI_DEV_ID0;
173 else
174 dev = TAISHAN_PCI_DEV_ID1;
175
176 pci_read_config_word(dev, PCI_STATUS, &status);
177 if (status & PCI_STATUS_CAP_LIST) {
178 pci_read_config_byte(dev, PCI_CAPABILITY_LIST, &capp);
179
180 pci_read_config_byte(dev, (int)(capp), &xcapid);
181 if (xcapid == 0x07) {
182 pci_read_config_word(dev, (int)(capp + 2),
183 &xcommand);
184 pci_read_config_dword(dev, (int)(capp + 4),
185 &xstatus);
186 printf("BUS0 dev%d Xcommand=%#06x,Xstatus=%#010x\n",
187 (ii + 1), xcommand, xstatus);
188 } else {
189 printf("BUS0 dev%d PCI-X CAP ID error,"
190 "CAP=%#04x,XCAPID=%#04x\n",
191 (ii + 1), capp, xcapid);
192 }
193 } else {
194 printf("BUS0 dev%d not found PCI_STATUS_CAP_LIST supporting\n",
195 ii + 1);
196 }
197 }
198
199}
200
201int do_show_pcix_device_info(cmd_tbl_t * cmdtp, int flag, int argc,
Wolfgang Denk6262d0212010-06-28 22:00:46 +0200202 char * const argv[])
Stefan Roese8d982302007-01-18 10:25:34 +0100203{
204 show_pcix_device_info();
205 return 0;
206}
207
208U_BOOT_CMD(xdevinfo, 1, 1, do_show_pcix_device_info,
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200209 "Show PCIX Device info", "");
Stefan Roese8d982302007-01-18 10:25:34 +0100210
211extern void show_reset_reg(void);
212
Wolfgang Denk6262d0212010-06-28 22:00:46 +0200213int do_show_reset_reg_info(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
Stefan Roese8d982302007-01-18 10:25:34 +0100214{
215 show_reset_reg();
216 return 0;
217}
218
219U_BOOT_CMD(resetinfo, 1, 1, do_show_reset_reg_info,
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200220 "Show Reset REG info", "");