27 #include <linux/kernel.h>
28 #include <linux/netdevice.h>
44 static int number_spi_ports;
45 static int need_retrain[2] = { 0, 0 };
54 if (rsl_int_blocks.s.spx1) {
61 if (!need_retrain[1]) {
64 if (spx_int_reg.s.spf)
65 pr_err(
"SPI1: SRX Spi4 interface down\n");
66 if (spx_int_reg.s.calerr)
67 pr_err(
"SPI1: SRX Spi4 Calendar table "
69 if (spx_int_reg.s.syncerr)
70 pr_err(
"SPI1: SRX Consecutive Spi4 DIP4 "
71 "errors have exceeded "
72 "SPX_ERR_CTL[ERRCNT]\n");
73 if (spx_int_reg.s.diperr)
74 pr_err(
"SPI1: SRX Spi4 DIP4 error\n");
75 if (spx_int_reg.s.tpaovr)
76 pr_err(
"SPI1: SRX Selected port has hit "
78 if (spx_int_reg.s.rsverr)
79 pr_err(
"SPI1: SRX Spi4 reserved control "
81 if (spx_int_reg.s.drwnng)
82 pr_err(
"SPI1: SRX Spi4 receive FIFO "
83 "drowning/overflow\n");
84 if (spx_int_reg.s.clserr)
85 pr_err(
"SPI1: SRX Spi4 packet closed on "
86 "non-16B alignment without EOP\n");
87 if (spx_int_reg.s.spiovr)
88 pr_err(
"SPI1: SRX Spi4 async FIFO overflow\n");
89 if (spx_int_reg.s.abnorm)
90 pr_err(
"SPI1: SRX Abnormal packet "
91 "termination (ERR bit)\n");
92 if (spx_int_reg.s.prtnxa)
93 pr_err(
"SPI1: SRX Port out of range\n");
98 if (!need_retrain[1]) {
101 if (stx_int_reg.s.syncerr)
102 pr_err(
"SPI1: STX Interface encountered a "
104 if (stx_int_reg.s.frmerr)
105 pr_err(
"SPI1: STX FRMCNT has exceeded "
106 "STX_DIP_CNT[MAXFRM]\n");
107 if (stx_int_reg.s.unxfrm)
108 pr_err(
"SPI1: STX Unexpected framing "
110 if (stx_int_reg.s.nosync)
111 pr_err(
"SPI1: STX ERRCNT has exceeded "
112 "STX_DIP_CNT[MAXDIP]\n");
113 if (stx_int_reg.s.diperr)
114 pr_err(
"SPI1: STX DIP2 error on the Spi4 "
116 if (stx_int_reg.s.datovr)
117 pr_err(
"SPI1: STX Spi4 FIFO overflow error\n");
118 if (stx_int_reg.s.ovrbst)
119 pr_err(
"SPI1: STX Transmit packet burst "
121 if (stx_int_reg.s.calpar1)
122 pr_err(
"SPI1: STX Calendar Table Parity "
124 if (stx_int_reg.s.calpar0)
125 pr_err(
"SPI1: STX Calendar Table Parity "
135 if (rsl_int_blocks.s.spx0) {
141 if (!need_retrain[0]) {
144 if (spx_int_reg.s.spf)
145 pr_err(
"SPI0: SRX Spi4 interface down\n");
146 if (spx_int_reg.s.calerr)
147 pr_err(
"SPI0: SRX Spi4 Calendar table "
149 if (spx_int_reg.s.syncerr)
150 pr_err(
"SPI0: SRX Consecutive Spi4 DIP4 "
151 "errors have exceeded "
152 "SPX_ERR_CTL[ERRCNT]\n");
153 if (spx_int_reg.s.diperr)
154 pr_err(
"SPI0: SRX Spi4 DIP4 error\n");
155 if (spx_int_reg.s.tpaovr)
156 pr_err(
"SPI0: SRX Selected port has hit "
158 if (spx_int_reg.s.rsverr)
159 pr_err(
"SPI0: SRX Spi4 reserved control "
161 if (spx_int_reg.s.drwnng)
162 pr_err(
"SPI0: SRX Spi4 receive FIFO "
163 "drowning/overflow\n");
164 if (spx_int_reg.s.clserr)
165 pr_err(
"SPI0: SRX Spi4 packet closed on "
166 "non-16B alignment without EOP\n");
167 if (spx_int_reg.s.spiovr)
168 pr_err(
"SPI0: SRX Spi4 async FIFO overflow\n");
169 if (spx_int_reg.s.abnorm)
170 pr_err(
"SPI0: SRX Abnormal packet "
171 "termination (ERR bit)\n");
172 if (spx_int_reg.s.prtnxa)
173 pr_err(
"SPI0: SRX Port out of range\n");
178 if (!need_retrain[0]) {
181 if (stx_int_reg.s.syncerr)
182 pr_err(
"SPI0: STX Interface encountered a "
184 if (stx_int_reg.s.frmerr)
185 pr_err(
"SPI0: STX FRMCNT has exceeded "
186 "STX_DIP_CNT[MAXFRM]\n");
187 if (stx_int_reg.s.unxfrm)
188 pr_err(
"SPI0: STX Unexpected framing "
190 if (stx_int_reg.s.nosync)
191 pr_err(
"SPI0: STX ERRCNT has exceeded "
192 "STX_DIP_CNT[MAXDIP]\n");
193 if (stx_int_reg.s.diperr)
194 pr_err(
"SPI0: STX DIP2 error on the Spi4 "
196 if (stx_int_reg.s.datovr)
197 pr_err(
"SPI0: STX Spi4 FIFO overflow error\n");
198 if (stx_int_reg.s.ovrbst)
199 pr_err(
"SPI0: STX Transmit packet burst "
201 if (stx_int_reg.s.calpar1)
202 pr_err(
"SPI0: STX Calendar Table Parity "
204 if (stx_int_reg.s.calpar0)
205 pr_err(
"SPI0: STX Calendar Table Parity "
215 return return_status;
218 static void cvm_oct_spi_enable_error_reporting(
int interface)
224 spxx_int_msk.s.calerr = 1;
225 spxx_int_msk.s.syncerr = 1;
226 spxx_int_msk.s.diperr = 1;
227 spxx_int_msk.s.tpaovr = 1;
228 spxx_int_msk.s.rsverr = 1;
229 spxx_int_msk.s.drwnng = 1;
230 spxx_int_msk.s.clserr = 1;
231 spxx_int_msk.s.spiovr = 1;
232 spxx_int_msk.s.abnorm = 1;
233 spxx_int_msk.s.prtnxa = 1;
237 stxx_int_msk.s.frmerr = 1;
238 stxx_int_msk.s.unxfrm = 1;
239 stxx_int_msk.s.nosync = 1;
240 stxx_int_msk.s.diperr = 1;
241 stxx_int_msk.s.datovr = 1;
242 stxx_int_msk.s.ovrbst = 1;
243 stxx_int_msk.s.calpar1 = 1;
244 stxx_int_msk.s.calpar0 = 1;
250 static int spi4000_port;
254 for (interface = 0;
interface < 2; interface++) {
256 if ((priv->
port == interface * 16) && need_retrain[interface]) {
261 cvm_oct_spi_enable_error_reporting(interface);
273 if (priv->
port == spi4000_port) {
278 cvmx_spi4000_check_speed(interface, priv->
port);
284 if (spi4000_port < 0)
295 if (number_spi_ports == 0) {
303 if ((priv->
port == 0) || (priv->
port == 16)) {
305 priv->
poll = cvm_oct_spi_poll;
317 if (number_spi_ports == 0) {
318 for (interface = 0;
interface < 2; interface++) {