xref: /openbmc/linux/arch/mips/cavium-octeon/executive/cvmx-helper-errata.c (revision 0337966d121ebebf73a1c346123e8112796e684e)
1e8635b48SDavid Daney /***********************license start***************
2e8635b48SDavid Daney  * Author: Cavium Networks
3e8635b48SDavid Daney  *
4e8635b48SDavid Daney  * Contact: support@caviumnetworks.com
5e8635b48SDavid Daney  * This file is part of the OCTEON SDK
6e8635b48SDavid Daney  *
7e8635b48SDavid Daney  * Copyright (c) 2003-2008 Cavium Networks
8e8635b48SDavid Daney  *
9e8635b48SDavid Daney  * This file is free software; you can redistribute it and/or modify
10e8635b48SDavid Daney  * it under the terms of the GNU General Public License, Version 2, as
11e8635b48SDavid Daney  * published by the Free Software Foundation.
12e8635b48SDavid Daney  *
13e8635b48SDavid Daney  * This file is distributed in the hope that it will be useful, but
14e8635b48SDavid Daney  * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15e8635b48SDavid Daney  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16e8635b48SDavid Daney  * NONINFRINGEMENT.  See the GNU General Public License for more
17e8635b48SDavid Daney  * details.
18e8635b48SDavid Daney  *
19e8635b48SDavid Daney  * You should have received a copy of the GNU General Public License
20e8635b48SDavid Daney  * along with this file; if not, write to the Free Software
21e8635b48SDavid Daney  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22e8635b48SDavid Daney  * or visit http://www.gnu.org/licenses/.
23e8635b48SDavid Daney  *
24e8635b48SDavid Daney  * This file may also be available under a different license from Cavium.
25e8635b48SDavid Daney  * Contact Cavium Networks for more information
26e8635b48SDavid Daney  ***********************license end**************************************/
27e8635b48SDavid Daney 
28e8635b48SDavid Daney /**
29e8635b48SDavid Daney  *
30e8635b48SDavid Daney  * Fixes and workaround for Octeon chip errata. This file
31e8635b48SDavid Daney  * contains functions called by cvmx-helper to workaround known
32e8635b48SDavid Daney  * chip errata. For the most part, code doesn't need to call
33e8635b48SDavid Daney  * these functions directly.
34e8635b48SDavid Daney  *
35e8635b48SDavid Daney  */
36*26dd3e4fSPaul Gortmaker #include <linux/export.h>
3738295fb2SDavid Daney 
38e8635b48SDavid Daney #include <asm/octeon/octeon.h>
39e8635b48SDavid Daney 
40e8635b48SDavid Daney #include <asm/octeon/cvmx-helper-jtag.h>
41e8635b48SDavid Daney 
42e8635b48SDavid Daney /**
43e8635b48SDavid Daney  * Due to errata G-720, the 2nd order CDR circuit on CN52XX pass
44e8635b48SDavid Daney  * 1 doesn't work properly. The following code disables 2nd order
45e8635b48SDavid Daney  * CDR for the specified QLM.
46e8635b48SDavid Daney  *
47e8635b48SDavid Daney  * @qlm:    QLM to disable 2nd order CDR for.
48e8635b48SDavid Daney  */
__cvmx_helper_errata_qlm_disable_2nd_order_cdr(int qlm)49e8635b48SDavid Daney void __cvmx_helper_errata_qlm_disable_2nd_order_cdr(int qlm)
50e8635b48SDavid Daney {
51e8635b48SDavid Daney 	int lane;
52e8635b48SDavid Daney 	cvmx_helper_qlm_jtag_init();
53e8635b48SDavid Daney 	/* We need to load all four lanes of the QLM, a total of 1072 bits */
54e8635b48SDavid Daney 	for (lane = 0; lane < 4; lane++) {
55e8635b48SDavid Daney 		/*
56e8635b48SDavid Daney 		 * Each lane has 268 bits. We need to set
57e8635b48SDavid Daney 		 * cfg_cdr_incx<67:64> = 3 and cfg_cdr_secord<77> =
58e8635b48SDavid Daney 		 * 1. All other bits are zero. Bits go in LSB first,
59e8635b48SDavid Daney 		 * so start off with the zeros for bits <63:0>.
60e8635b48SDavid Daney 		 */
61e8635b48SDavid Daney 		cvmx_helper_qlm_jtag_shift_zeros(qlm, 63 - 0 + 1);
62e8635b48SDavid Daney 		/* cfg_cdr_incx<67:64>=3 */
63e8635b48SDavid Daney 		cvmx_helper_qlm_jtag_shift(qlm, 67 - 64 + 1, 3);
64e8635b48SDavid Daney 		/* Zeros for bits <76:68> */
65e8635b48SDavid Daney 		cvmx_helper_qlm_jtag_shift_zeros(qlm, 76 - 68 + 1);
66e8635b48SDavid Daney 		/* cfg_cdr_secord<77>=1 */
67e8635b48SDavid Daney 		cvmx_helper_qlm_jtag_shift(qlm, 77 - 77 + 1, 1);
68e8635b48SDavid Daney 		/* Zeros for bits <267:78> */
69e8635b48SDavid Daney 		cvmx_helper_qlm_jtag_shift_zeros(qlm, 267 - 78 + 1);
70e8635b48SDavid Daney 	}
71e8635b48SDavid Daney 	cvmx_helper_qlm_jtag_update(qlm);
72e8635b48SDavid Daney }
7338295fb2SDavid Daney EXPORT_SYMBOL(__cvmx_helper_errata_qlm_disable_2nd_order_cdr);
74