18c2ecf20Sopenharmony_ci/***********************license start*************** 28c2ecf20Sopenharmony_ci * Author: Cavium Networks 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Contact: support@caviumnetworks.com 58c2ecf20Sopenharmony_ci * This file is part of the OCTEON SDK 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (c) 2003-2008 Cavium Networks 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * This file is free software; you can redistribute it and/or modify 108c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License, Version 2, as 118c2ecf20Sopenharmony_ci * published by the Free Software Foundation. 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * This file is distributed in the hope that it will be useful, but 148c2ecf20Sopenharmony_ci * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty 158c2ecf20Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or 168c2ecf20Sopenharmony_ci * NONINFRINGEMENT. See the GNU General Public License for more 178c2ecf20Sopenharmony_ci * details. 188c2ecf20Sopenharmony_ci * 198c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License 208c2ecf20Sopenharmony_ci * along with this file; if not, write to the Free Software 218c2ecf20Sopenharmony_ci * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 228c2ecf20Sopenharmony_ci * or visit http://www.gnu.org/licenses/. 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * This file may also be available under a different license from Cavium. 258c2ecf20Sopenharmony_ci * Contact Cavium Networks for more information 268c2ecf20Sopenharmony_ci ***********************license end**************************************/ 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci/** 298c2ecf20Sopenharmony_ci * 308c2ecf20Sopenharmony_ci * Fixes and workaround for Octeon chip errata. This file 318c2ecf20Sopenharmony_ci * contains functions called by cvmx-helper to workaround known 328c2ecf20Sopenharmony_ci * chip errata. For the most part, code doesn't need to call 338c2ecf20Sopenharmony_ci * these functions directly. 348c2ecf20Sopenharmony_ci * 358c2ecf20Sopenharmony_ci */ 368c2ecf20Sopenharmony_ci#include <linux/export.h> 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#include <asm/octeon/octeon.h> 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#include <asm/octeon/cvmx-helper-jtag.h> 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci/** 438c2ecf20Sopenharmony_ci * Due to errata G-720, the 2nd order CDR circuit on CN52XX pass 448c2ecf20Sopenharmony_ci * 1 doesn't work properly. The following code disables 2nd order 458c2ecf20Sopenharmony_ci * CDR for the specified QLM. 468c2ecf20Sopenharmony_ci * 478c2ecf20Sopenharmony_ci * @qlm: QLM to disable 2nd order CDR for. 488c2ecf20Sopenharmony_ci */ 498c2ecf20Sopenharmony_civoid __cvmx_helper_errata_qlm_disable_2nd_order_cdr(int qlm) 508c2ecf20Sopenharmony_ci{ 518c2ecf20Sopenharmony_ci int lane; 528c2ecf20Sopenharmony_ci cvmx_helper_qlm_jtag_init(); 538c2ecf20Sopenharmony_ci /* We need to load all four lanes of the QLM, a total of 1072 bits */ 548c2ecf20Sopenharmony_ci for (lane = 0; lane < 4; lane++) { 558c2ecf20Sopenharmony_ci /* 568c2ecf20Sopenharmony_ci * Each lane has 268 bits. We need to set 578c2ecf20Sopenharmony_ci * cfg_cdr_incx<67:64> = 3 and cfg_cdr_secord<77> = 588c2ecf20Sopenharmony_ci * 1. All other bits are zero. Bits go in LSB first, 598c2ecf20Sopenharmony_ci * so start off with the zeros for bits <63:0>. 608c2ecf20Sopenharmony_ci */ 618c2ecf20Sopenharmony_ci cvmx_helper_qlm_jtag_shift_zeros(qlm, 63 - 0 + 1); 628c2ecf20Sopenharmony_ci /* cfg_cdr_incx<67:64>=3 */ 638c2ecf20Sopenharmony_ci cvmx_helper_qlm_jtag_shift(qlm, 67 - 64 + 1, 3); 648c2ecf20Sopenharmony_ci /* Zeros for bits <76:68> */ 658c2ecf20Sopenharmony_ci cvmx_helper_qlm_jtag_shift_zeros(qlm, 76 - 68 + 1); 668c2ecf20Sopenharmony_ci /* cfg_cdr_secord<77>=1 */ 678c2ecf20Sopenharmony_ci cvmx_helper_qlm_jtag_shift(qlm, 77 - 77 + 1, 1); 688c2ecf20Sopenharmony_ci /* Zeros for bits <267:78> */ 698c2ecf20Sopenharmony_ci cvmx_helper_qlm_jtag_shift_zeros(qlm, 267 - 78 + 1); 708c2ecf20Sopenharmony_ci } 718c2ecf20Sopenharmony_ci cvmx_helper_qlm_jtag_update(qlm); 728c2ecf20Sopenharmony_ci} 738c2ecf20Sopenharmony_ciEXPORT_SYMBOL(__cvmx_helper_errata_qlm_disable_2nd_order_cdr); 74