1 /***********************license start***************
2 * Author: Cavium Networks
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
7 * Copyright (c) 2003-2008 Cavium Networks
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
29 * Utility functions to decode Octeon's RSL_INT_BLOCKS
30 * interrupts into error messages.
33 #include <asm/octeon/octeon.h>
35 #include "cvmx-asxx-defs.h"
36 #include "cvmx-gmxx-defs.h"
39 #define PRINT_ERROR(format, ...)
42 void __cvmx_interrupt_gmxx_rxx_int_en_enable(int index, int block);
45 * Enable ASX error interrupts that exist on CN3XXX, CN50XX, and
48 * @block: Interface to enable 0-1
50 void __cvmx_interrupt_asxx_enable(int block)
53 union cvmx_asxx_int_en csr;
55 * CN38XX and CN58XX have two interfaces with 4 ports per
56 * interface. All other chips have a max of 3 ports on
59 if (OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX))
60 mask = 0xf; /* Set enables for 4 ports */
62 mask = 0x7; /* Set enables for 3 ports */
64 /* Enable interface interrupts */
65 csr.u64 = cvmx_read_csr(CVMX_ASXX_INT_EN(block));
69 cvmx_write_csr(CVMX_ASXX_INT_EN(block), csr.u64);
72 * Enable GMX error reporting for the supplied interface
74 * @interface: Interface to enable
76 void __cvmx_interrupt_gmxx_enable(int interface)
78 union cvmx_gmxx_inf_mode mode;
79 union cvmx_gmxx_tx_int_en gmx_tx_int_en;
83 mode.u64 = cvmx_read_csr(CVMX_GMXX_INF_MODE(interface));
85 if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN52XX)) {
87 switch (mode.cn56xx.mode) {
95 default: /* Disabled */
103 if (OCTEON_IS_MODEL(OCTEON_CN38XX)
104 || OCTEON_IS_MODEL(OCTEON_CN58XX)) {
106 * SPI on CN38XX and CN58XX report all
107 * errors through port 0. RGMII needs
108 * to check all 4 ports
116 * CN30XX, CN31XX, and CN50XX have two
117 * or three ports. GMII and MII has 2,
129 gmx_tx_int_en.u64 = 0;
131 if (OCTEON_IS_MODEL(OCTEON_CN38XX)
132 || OCTEON_IS_MODEL(OCTEON_CN58XX))
133 gmx_tx_int_en.s.ncb_nxa = 1;
134 gmx_tx_int_en.s.pko_nxa = 1;
136 gmx_tx_int_en.s.undflw = (1 << num_ports) - 1;
137 cvmx_write_csr(CVMX_GMXX_TX_INT_EN(interface), gmx_tx_int_en.u64);
138 for (index = 0; index < num_ports; index++)
139 __cvmx_interrupt_gmxx_rxx_int_en_enable(index, interface);