aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper-sgmii.c6
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper-spi.c10
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c22
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper.c93
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-loop.h1
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-npi.h1
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-rgmii.h1
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-sgmii.h1
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-spi.h1
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-xaui.h1
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper.h1
11 files changed, 114 insertions, 24 deletions
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-sgmii.c b/arch/mips/cavium-octeon/executive/cvmx-helper-sgmii.c
index 464347ffd362..0c0bf5d30e70 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-sgmii.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-sgmii.c
@@ -326,6 +326,10 @@ static int __cvmx_helper_sgmii_hardware_init(int interface, int num_ports)
326 return 0; 326 return 0;
327} 327}
328 328
329int __cvmx_helper_sgmii_enumerate(int interface)
330{
331 return 4;
332}
329/** 333/**
330 * Probe a SGMII interface and determine the number of ports 334 * Probe a SGMII interface and determine the number of ports
331 * connected to it. The SGMII interface should still be down after 335 * connected to it. The SGMII interface should still be down after
@@ -347,7 +351,7 @@ int __cvmx_helper_sgmii_probe(int interface)
347 mode.u64 = cvmx_read_csr(CVMX_GMXX_INF_MODE(interface)); 351 mode.u64 = cvmx_read_csr(CVMX_GMXX_INF_MODE(interface));
348 mode.s.en = 1; 352 mode.s.en = 1;
349 cvmx_write_csr(CVMX_GMXX_INF_MODE(interface), mode.u64); 353 cvmx_write_csr(CVMX_GMXX_INF_MODE(interface), mode.u64);
350 return 4; 354 return __cvmx_helper_sgmii_enumerate(interface);
351} 355}
352 356
353/** 357/**
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-spi.c b/arch/mips/cavium-octeon/executive/cvmx-helper-spi.c
index 02a444230ef7..2830e4bdf7f3 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-spi.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-spi.c
@@ -51,6 +51,16 @@ void __cvmx_interrupt_stxx_int_msk_enable(int index);
51#define CVMX_HELPER_SPI_TIMEOUT 10 51#define CVMX_HELPER_SPI_TIMEOUT 10
52#endif 52#endif
53 53
54int __cvmx_helper_spi_enumerate(int interface)
55{
56 if ((cvmx_sysinfo_get()->board_type != CVMX_BOARD_TYPE_SIM) &&
57 cvmx_spi4000_is_present(interface)) {
58 return 10;
59 } else {
60 return 16;
61 }
62}
63
54/** 64/**
55 * Probe a SPI interface and determine the number of ports 65 * Probe a SPI interface and determine the number of ports
56 * connected to it. The SPI interface should still be down after 66 * connected to it. The SPI interface should still be down after
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c b/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c
index 667a8e3cb142..1723248e987d 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c
@@ -44,6 +44,19 @@
44void __cvmx_interrupt_gmxx_enable(int interface); 44void __cvmx_interrupt_gmxx_enable(int interface);
45void __cvmx_interrupt_pcsx_intx_en_reg_enable(int index, int block); 45void __cvmx_interrupt_pcsx_intx_en_reg_enable(int index, int block);
46void __cvmx_interrupt_pcsxx_int_en_reg_enable(int index); 46void __cvmx_interrupt_pcsxx_int_en_reg_enable(int index);
47
48int __cvmx_helper_xaui_enumerate(int interface)
49{
50 union cvmx_gmxx_hg2_control gmx_hg2_control;
51
52 /* If HiGig2 is enabled return 16 ports, otherwise return 1 port */
53 gmx_hg2_control.u64 = cvmx_read_csr(CVMX_GMXX_HG2_CONTROL(interface));
54 if (gmx_hg2_control.s.hg2tx_en)
55 return 16;
56 else
57 return 1;
58}
59
47/** 60/**
48 * Probe a XAUI interface and determine the number of ports 61 * Probe a XAUI interface and determine the number of ports
49 * connected to it. The XAUI interface should still be down 62 * connected to it. The XAUI interface should still be down
@@ -56,7 +69,6 @@ void __cvmx_interrupt_pcsxx_int_en_reg_enable(int index);
56int __cvmx_helper_xaui_probe(int interface) 69int __cvmx_helper_xaui_probe(int interface)
57{ 70{
58 int i; 71 int i;
59 union cvmx_gmxx_hg2_control gmx_hg2_control;
60 union cvmx_gmxx_inf_mode mode; 72 union cvmx_gmxx_inf_mode mode;
61 73
62 /* 74 /*
@@ -90,13 +102,7 @@ int __cvmx_helper_xaui_probe(int interface)
90 pko_mem_port_ptrs.s.pid = interface * 16 + i; 102 pko_mem_port_ptrs.s.pid = interface * 16 + i;
91 cvmx_write_csr(CVMX_PKO_MEM_PORT_PTRS, pko_mem_port_ptrs.u64); 103 cvmx_write_csr(CVMX_PKO_MEM_PORT_PTRS, pko_mem_port_ptrs.u64);
92 } 104 }
93 105 return __cvmx_helper_xaui_enumerate(interface);
94 /* If HiGig2 is enabled return 16 ports, otherwise return 1 port */
95 gmx_hg2_control.u64 = cvmx_read_csr(CVMX_GMXX_HG2_CONTROL(interface));
96 if (gmx_hg2_control.s.hg2tx_en)
97 return 16;
98 else
99 return 1;
100} 106}
101 107
102/** 108/**
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper.c b/arch/mips/cavium-octeon/executive/cvmx-helper.c
index daa8c8bbcfe4..fa4963856353 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper.c
@@ -234,21 +234,16 @@ static int __cvmx_helper_port_setup_ipd(int ipd_port)
234} 234}
235 235
236/** 236/**
237 * This function probes an interface to determine the actual 237 * This function sets the interface_port_count[interface] correctly,
238 * number of hardware ports connected to it. It doesn't setup the 238 * without modifying any hardware configuration. Hardware setup of
239 * ports or enable them. The main goal here is to set the global 239 * the ports will be performed later.
240 * interface_port_count[interface] correctly. Hardware setup of the
241 * ports will be performed later.
242 * 240 *
243 * @interface: Interface to probe 241 * @interface: Interface to probe
244 * 242 *
245 * Returns Zero on success, negative on failure 243 * Returns Zero on success, negative on failure
246 */ 244 */
247int cvmx_helper_interface_probe(int interface) 245int cvmx_helper_interface_enumerate(int interface)
248{ 246{
249 /* At this stage in the game we don't want packets to be moving yet.
250 The following probe calls should perform hardware setup
251 needed to determine port counts. Receive must still be disabled */
252 switch (cvmx_helper_interface_get_mode(interface)) { 247 switch (cvmx_helper_interface_get_mode(interface)) {
253 /* These types don't support ports to IPD/PKO */ 248 /* These types don't support ports to IPD/PKO */
254 case CVMX_HELPER_INTERFACE_MODE_DISABLED: 249 case CVMX_HELPER_INTERFACE_MODE_DISABLED:
@@ -258,7 +253,7 @@ int cvmx_helper_interface_probe(int interface)
258 /* XAUI is a single high speed port */ 253 /* XAUI is a single high speed port */
259 case CVMX_HELPER_INTERFACE_MODE_XAUI: 254 case CVMX_HELPER_INTERFACE_MODE_XAUI:
260 interface_port_count[interface] = 255 interface_port_count[interface] =
261 __cvmx_helper_xaui_probe(interface); 256 __cvmx_helper_xaui_enumerate(interface);
262 break; 257 break;
263 /* 258 /*
264 * RGMII/GMII/MII are all treated about the same. Most 259 * RGMII/GMII/MII are all treated about the same. Most
@@ -267,7 +262,7 @@ int cvmx_helper_interface_probe(int interface)
267 case CVMX_HELPER_INTERFACE_MODE_RGMII: 262 case CVMX_HELPER_INTERFACE_MODE_RGMII:
268 case CVMX_HELPER_INTERFACE_MODE_GMII: 263 case CVMX_HELPER_INTERFACE_MODE_GMII:
269 interface_port_count[interface] = 264 interface_port_count[interface] =
270 __cvmx_helper_rgmii_probe(interface); 265 __cvmx_helper_rgmii_enumerate(interface);
271 break; 266 break;
272 /* 267 /*
273 * SPI4 can have 1-16 ports depending on the device at 268 * SPI4 can have 1-16 ports depending on the device at
@@ -275,7 +270,7 @@ int cvmx_helper_interface_probe(int interface)
275 */ 270 */
276 case CVMX_HELPER_INTERFACE_MODE_SPI: 271 case CVMX_HELPER_INTERFACE_MODE_SPI:
277 interface_port_count[interface] = 272 interface_port_count[interface] =
278 __cvmx_helper_spi_probe(interface); 273 __cvmx_helper_spi_enumerate(interface);
279 break; 274 break;
280 /* 275 /*
281 * SGMII can have 1-4 ports depending on how many are 276 * SGMII can have 1-4 ports depending on how many are
@@ -284,12 +279,12 @@ int cvmx_helper_interface_probe(int interface)
284 case CVMX_HELPER_INTERFACE_MODE_SGMII: 279 case CVMX_HELPER_INTERFACE_MODE_SGMII:
285 case CVMX_HELPER_INTERFACE_MODE_PICMG: 280 case CVMX_HELPER_INTERFACE_MODE_PICMG:
286 interface_port_count[interface] = 281 interface_port_count[interface] =
287 __cvmx_helper_sgmii_probe(interface); 282 __cvmx_helper_sgmii_enumerate(interface);
288 break; 283 break;
289 /* PCI target Network Packet Interface */ 284 /* PCI target Network Packet Interface */
290 case CVMX_HELPER_INTERFACE_MODE_NPI: 285 case CVMX_HELPER_INTERFACE_MODE_NPI:
291 interface_port_count[interface] = 286 interface_port_count[interface] =
292 __cvmx_helper_npi_probe(interface); 287 __cvmx_helper_npi_enumerate(interface);
293 break; 288 break;
294 /* 289 /*
295 * Special loopback only ports. These are not the same 290 * Special loopback only ports. These are not the same
@@ -297,7 +292,7 @@ int cvmx_helper_interface_probe(int interface)
297 */ 292 */
298 case CVMX_HELPER_INTERFACE_MODE_LOOP: 293 case CVMX_HELPER_INTERFACE_MODE_LOOP:
299 interface_port_count[interface] = 294 interface_port_count[interface] =
300 __cvmx_helper_loop_probe(interface); 295 __cvmx_helper_loop_enumerate(interface);
301 break; 296 break;
302 } 297 }
303 298
@@ -313,6 +308,74 @@ int cvmx_helper_interface_probe(int interface)
313} 308}
314 309
315/** 310/**
311 * This function probes an interface to determine the actual
312 * number of hardware ports connected to it. It doesn't setup the
313 * ports or enable them. The main goal here is to set the global
314 * interface_port_count[interface] correctly. Hardware setup of the
315 * ports will be performed later.
316 *
317 * @interface: Interface to probe
318 *
319 * Returns Zero on success, negative on failure
320 */
321int cvmx_helper_interface_probe(int interface)
322{
323 cvmx_helper_interface_enumerate(interface);
324 /* At this stage in the game we don't want packets to be moving yet.
325 The following probe calls should perform hardware setup
326 needed to determine port counts. Receive must still be disabled */
327 switch (cvmx_helper_interface_get_mode(interface)) {
328 /* These types don't support ports to IPD/PKO */
329 case CVMX_HELPER_INTERFACE_MODE_DISABLED:
330 case CVMX_HELPER_INTERFACE_MODE_PCIE:
331 break;
332 /* XAUI is a single high speed port */
333 case CVMX_HELPER_INTERFACE_MODE_XAUI:
334 __cvmx_helper_xaui_probe(interface);
335 break;
336 /*
337 * RGMII/GMII/MII are all treated about the same. Most
338 * functions refer to these ports as RGMII.
339 */
340 case CVMX_HELPER_INTERFACE_MODE_RGMII:
341 case CVMX_HELPER_INTERFACE_MODE_GMII:
342 __cvmx_helper_rgmii_probe(interface);
343 break;
344 /*
345 * SPI4 can have 1-16 ports depending on the device at
346 * the other end.
347 */
348 case CVMX_HELPER_INTERFACE_MODE_SPI:
349 __cvmx_helper_spi_probe(interface);
350 break;
351 /*
352 * SGMII can have 1-4 ports depending on how many are
353 * hooked up.
354 */
355 case CVMX_HELPER_INTERFACE_MODE_SGMII:
356 case CVMX_HELPER_INTERFACE_MODE_PICMG:
357 __cvmx_helper_sgmii_probe(interface);
358 break;
359 /* PCI target Network Packet Interface */
360 case CVMX_HELPER_INTERFACE_MODE_NPI:
361 __cvmx_helper_npi_probe(interface);
362 break;
363 /*
364 * Special loopback only ports. These are not the same
365 * as other ports in loopback mode.
366 */
367 case CVMX_HELPER_INTERFACE_MODE_LOOP:
368 __cvmx_helper_loop_probe(interface);
369 break;
370 }
371
372 /* Make sure all global variables propagate to other cores */
373 CVMX_SYNCWS;
374
375 return 0;
376}
377
378/**
316 * Setup the IPD/PIP for the ports on an interface. Packet 379 * Setup the IPD/PIP for the ports on an interface. Packet
317 * classification and tagging are set for every port on the 380 * classification and tagging are set for every port on the
318 * interface. The number of ports on the interface must already 381 * interface. The number of ports on the interface must already
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-loop.h b/arch/mips/include/asm/octeon/cvmx-helper-loop.h
index e646a6ccce75..077f0e9d3b2d 100644
--- a/arch/mips/include/asm/octeon/cvmx-helper-loop.h
+++ b/arch/mips/include/asm/octeon/cvmx-helper-loop.h
@@ -44,6 +44,7 @@
44 * Returns Number of ports on the interface. Zero to disable. 44 * Returns Number of ports on the interface. Zero to disable.
45 */ 45 */
46extern int __cvmx_helper_loop_probe(int interface); 46extern int __cvmx_helper_loop_probe(int interface);
47static inline int __cvmx_helper_loop_enumerate(int interface) {return 4; }
47 48
48/** 49/**
49 * Bringup and enable a LOOP interface. After this call packet 50 * Bringup and enable a LOOP interface. After this call packet
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-npi.h b/arch/mips/include/asm/octeon/cvmx-helper-npi.h
index 908e7b08c214..8df4c7fafdba 100644
--- a/arch/mips/include/asm/octeon/cvmx-helper-npi.h
+++ b/arch/mips/include/asm/octeon/cvmx-helper-npi.h
@@ -45,6 +45,7 @@
45 * Returns Number of ports on the interface. Zero to disable. 45 * Returns Number of ports on the interface. Zero to disable.
46 */ 46 */
47extern int __cvmx_helper_npi_probe(int interface); 47extern int __cvmx_helper_npi_probe(int interface);
48#define __cvmx_helper_npi_enumerate __cvmx_helper_npi_probe
48 49
49/** 50/**
50 * Bringup and enable a NPI interface. After this call packet 51 * Bringup and enable a NPI interface. After this call packet
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-rgmii.h b/arch/mips/include/asm/octeon/cvmx-helper-rgmii.h
index ea2652604a57..78295ba0050f 100644
--- a/arch/mips/include/asm/octeon/cvmx-helper-rgmii.h
+++ b/arch/mips/include/asm/octeon/cvmx-helper-rgmii.h
@@ -43,6 +43,7 @@
43 * Returns Number of RGMII/GMII/MII ports (0-4). 43 * Returns Number of RGMII/GMII/MII ports (0-4).
44 */ 44 */
45extern int __cvmx_helper_rgmii_probe(int interface); 45extern int __cvmx_helper_rgmii_probe(int interface);
46#define __cvmx_helper_rgmii_enumerate __cvmx_helper_rgmii_probe
46 47
47/** 48/**
48 * Put an RGMII interface in loopback mode. Internal packets sent 49 * Put an RGMII interface in loopback mode. Internal packets sent
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-sgmii.h b/arch/mips/include/asm/octeon/cvmx-helper-sgmii.h
index 19b48d60857f..9a9b6c103ede 100644
--- a/arch/mips/include/asm/octeon/cvmx-helper-sgmii.h
+++ b/arch/mips/include/asm/octeon/cvmx-helper-sgmii.h
@@ -45,6 +45,7 @@
45 * Returns Number of ports on the interface. Zero to disable. 45 * Returns Number of ports on the interface. Zero to disable.
46 */ 46 */
47extern int __cvmx_helper_sgmii_probe(int interface); 47extern int __cvmx_helper_sgmii_probe(int interface);
48extern int __cvmx_helper_sgmii_enumerate(int interface);
48 49
49/** 50/**
50 * Bringup and enable a SGMII interface. After this call packet 51 * Bringup and enable a SGMII interface. After this call packet
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-spi.h b/arch/mips/include/asm/octeon/cvmx-helper-spi.h
index 69bac036d10e..9f1c6b968f91 100644
--- a/arch/mips/include/asm/octeon/cvmx-helper-spi.h
+++ b/arch/mips/include/asm/octeon/cvmx-helper-spi.h
@@ -42,6 +42,7 @@
42 * Returns Number of ports on the interface. Zero to disable. 42 * Returns Number of ports on the interface. Zero to disable.
43 */ 43 */
44extern int __cvmx_helper_spi_probe(int interface); 44extern int __cvmx_helper_spi_probe(int interface);
45extern int __cvmx_helper_spi_enumerate(int interface);
45 46
46/** 47/**
47 * Bringup and enable a SPI interface. After this call packet I/O 48 * Bringup and enable a SPI interface. After this call packet I/O
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-xaui.h b/arch/mips/include/asm/octeon/cvmx-helper-xaui.h
index 4b4db2f93cd4..f6fbc4f45b56 100644
--- a/arch/mips/include/asm/octeon/cvmx-helper-xaui.h
+++ b/arch/mips/include/asm/octeon/cvmx-helper-xaui.h
@@ -45,6 +45,7 @@
45 * Returns Number of ports on the interface. Zero to disable. 45 * Returns Number of ports on the interface. Zero to disable.
46 */ 46 */
47extern int __cvmx_helper_xaui_probe(int interface); 47extern int __cvmx_helper_xaui_probe(int interface);
48extern int __cvmx_helper_xaui_enumerate(int interface);
48 49
49/** 50/**
50 * Bringup and enable a XAUI interface. After this call packet 51 * Bringup and enable a XAUI interface. After this call packet
diff --git a/arch/mips/include/asm/octeon/cvmx-helper.h b/arch/mips/include/asm/octeon/cvmx-helper.h
index 51916f3cc40c..3169cd79f2ac 100644
--- a/arch/mips/include/asm/octeon/cvmx-helper.h
+++ b/arch/mips/include/asm/octeon/cvmx-helper.h
@@ -207,6 +207,7 @@ extern int cvmx_helper_link_set(int ipd_port,
207 * Returns Zero on success, negative on failure 207 * Returns Zero on success, negative on failure
208 */ 208 */
209extern int cvmx_helper_interface_probe(int interface); 209extern int cvmx_helper_interface_probe(int interface);
210extern int cvmx_helper_interface_enumerate(int interface);
210 211
211/** 212/**
212 * Configure a port for internal and/or external loopback. Internal loopback 213 * Configure a port for internal and/or external loopback. Internal loopback