16df55ce10
Remove all kernel-doc notation in arch/mips/cavium-octeon/executive/. This removes dozens of kernel-doc warnings. Most of these functions are static and don't need to be documented with kernel-doc. The function comments are still present for anyone who wants to read them. These files are part of the OCTEON SDK so presumably they are documented there as well. arch/mips/cavium-octeon/executive/cvmx-bootmem.c:61: warning: Function parameter or member 'addr' not described in 'CVMX_BOOTMEM_NAMED_GET_FIELD' arch/mips/cavium-octeon/executive/cvmx-bootmem.c:61: warning: Function parameter or member 'field' not described in 'CVMX_BOOTMEM_NAMED_GET_FIELD' arch/mips/cavium-octeon/executive/cvmx-bootmem.c:61: warning: expecting prototype for This macro returns a member of the(). Prototype was for CVMX_BOOTMEM_NAMED_GET_FIELD() instead arch/mips/cavium-octeon/executive/cvmx-bootmem.c:77: warning: Function parameter or member 'base' not described in '__cvmx_bootmem_desc_get' arch/mips/cavium-octeon/executive/cvmx-bootmem.c:77: warning: Function parameter or member 'offset' not described in '__cvmx_bootmem_desc_get' arch/mips/cavium-octeon/executive/cvmx-bootmem.c:77: warning: Function parameter or member 'size' not described in '__cvmx_bootmem_desc_get' arch/mips/cavium-octeon/executive/cvmx-bootmem.c:77: warning: expecting prototype for This function is the implementation of the get macros defined(). Prototype was for __cvmx_bootmem_desc_get() instead arch/mips/cavium-octeon/executive/cvmx-bootmem.c:133: warning: expecting prototype for Allocate a block of memory from the free list that was(). Prototype was for cvmx_bootmem_alloc_range() instead arch/mips/cavium-octeon/executive/cvmx-bootmem.c:554: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Finds a named memory block by name. arch/mips/cavium-octeon/executive/cvmx-bootmem.c:661: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Frees a named block. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/mips/cavium-octeon/executive/cvmx-helper-board.c:64: warning: expecting prototype for Return the MII PHY address associated with the given IPD(). Prototype was for cvmx_helper_board_get_mii_address() instead arch/mips/cavium-octeon/executive/cvmx-helper-board.c:211: warning: expecting prototype for This function is the board specific method of determining an(). Prototype was for __cvmx_helper_board_link_get() instead arch/mips/cavium-octeon/executive/cvmx-helper-board.c:278: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * This function is called by cvmx_helper_interface_probe() after it arch/mips/cavium-octeon/executive/cvmx-helper-board.c:324: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Get the clock type used for the USB block based on board type. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/mips/cavium-octeon/executive/cvmx-spi.c:77: warning: expecting prototype for Get current SPI4 initialization callbacks(). Prototype was for cvmx_spi_get_callbacks() instead arch/mips/cavium-octeon/executive/cvmx-spi.c:87: warning: expecting prototype for Set new SPI4 initialization callbacks(). Prototype was for cvmx_spi_set_callbacks() instead arch/mips/cavium-octeon/executive/cvmx-spi.c:92: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Initialize and start the SPI interface. arch/mips/cavium-octeon/executive/cvmx-spi.c:151: warning: expecting prototype for This routine restarts the SPI interface after it has lost synchronization(). Prototype was for cvmx_spi_restart_interface() instead arch/mips/cavium-octeon/executive/cvmx-spi.c:196: warning: expecting prototype for Callback to perform SPI4 reset(). Prototype was for cvmx_spi_reset_cb() instead arch/mips/cavium-octeon/executive/cvmx-spi.c:313: warning: expecting prototype for Callback to setup calendar and miscellaneous settings before clock detection(). Prototype was for cvmx_spi_calendar_setup_cb() instead arch/mips/cavium-octeon/executive/cvmx-spi.c:431: warning: expecting prototype for Callback to perform clock detection(). Prototype was for cvmx_spi_clock_detect_cb() instead arch/mips/cavium-octeon/executive/cvmx-spi.c:509: warning: expecting prototype for Callback to perform link training(). Prototype was for cvmx_spi_training_cb() instead arch/mips/cavium-octeon/executive/cvmx-spi.c:578: warning: expecting prototype for Callback to perform calendar data synchronization(). Prototype was for cvmx_spi_calendar_sync_cb() instead arch/mips/cavium-octeon/executive/cvmx-spi.c:634: warning: expecting prototype for Callback to handle interface up(). Prototype was for cvmx_spi_interface_up_cb() instead ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c:67: warning: expecting prototype for Probe a XAUI interface and determine the number of ports(). Prototype was for __cvmx_helper_xaui_probe() instead arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c:106: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Bringup and enable a XAUI interface. After this call packet arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c:253: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Return the link state of an IPD/PKO port as returned by arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c:292: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Configure an IPD/PKO port for the specified link state. This ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/mips/cavium-octeon/executive/cvmx-pko.c:43: warning: Function parameter or member 'interface' not described in '__cvmx_pko_int' arch/mips/cavium-octeon/executive/cvmx-pko.c:43: warning: Function parameter or member 'index' not described in '__cvmx_pko_int' arch/mips/cavium-octeon/executive/cvmx-pko.c:43: warning: expecting prototype for Internal state of packet output(). Prototype was for __cvmx_pko_int() instead arch/mips/cavium-octeon/executive/cvmx-pko.c:186: warning: expecting prototype for Call before any other calls to initialize the packet(). Prototype was for cvmx_pko_initialize_global() instead arch/mips/cavium-octeon/executive/cvmx-pko.c:241: warning: expecting prototype for This function does per(). Prototype was for cvmx_pko_initialize_local() instead arch/mips/cavium-octeon/executive/cvmx-pko.c:247: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Enables the packet output hardware. It must already be arch/mips/cavium-octeon/executive/cvmx-pko.c:270: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Disables the packet output. Does not affect any configuration. arch/mips/cavium-octeon/executive/cvmx-pko.c:282: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Reset the packet output. arch/mips/cavium-octeon/executive/cvmx-pko.c:293: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Shutdown and free resources required by packet output. arch/mips/cavium-octeon/executive/cvmx-pko.c:324: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Configure a output port and the associated queues for use. arch/mips/cavium-octeon/executive/cvmx-pko.c:555: warning: expecting prototype for Show map of ports(). Prototype was for cvmx_pko_show_queue_map() instead arch/mips/cavium-octeon/executive/cvmx-pko.c:577: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Rate limit a PKO port to a max packets/sec. This function is only arch/mips/cavium-octeon/executive/cvmx-pko.c:610: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Rate limit a PKO port to a max bits/sec. This function is only ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c:49: warning: cannot understand function prototype: '__cvmx_cmd_queue_all_state_t *__cvmx_cmd_queue_state_ptr; ' arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c:53: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Initialize the Global queue state pointer. arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c:101: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Initialize a command queue for use. The initial FPA buffer is arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c:199: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Shutdown a queue a free it's command buffers to the FPA. The arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c:235: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Return the number of command words pending in the queue. This arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c:291: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Return the command buffer to be written to. The purpose of this ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/mips/cavium-octeon/executive/cvmx-helper-rgmii.c:53: warning: expecting prototype for Probe RGMII ports and determine the number present(). Prototype was for __cvmx_helper_rgmii_probe() instead arch/mips/cavium-octeon/executive/cvmx-helper-rgmii.c:92: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Put an RGMII interface in loopback mode. Internal packets sent arch/mips/cavium-octeon/executive/cvmx-helper-rgmii.c:135: warning: expecting prototype for Workaround ASX setup errata with CN38XX pass1(). Prototype was for __cvmx_helper_errata_asx_pass1() instead arch/mips/cavium-octeon/executive/cvmx-helper-rgmii.c:152: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Configure all of the ASX, GMX, and PKO registers required arch/mips/cavium-octeon/executive/cvmx-helper-rgmii.c:255: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Return the link state of an IPD/PKO port as returned by arch/mips/cavium-octeon/executive/cvmx-helper-rgmii.c:284: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Configure an IPD/PKO port for the specified link state. This -- arch/mips/cavium-octeon/executive/cvmx-l2c.c:768: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Return log base 2 of the number of sets in the L2 cache arch/mips/cavium-octeon/executive/cvmx-l2c.c:861: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Flush a line from the L2 cache Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reported-by: kernel test robot <lkp@intel.com> Cc: Aditya Srivastava <yashsri421@gmail.com> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: linux-mips@vger.kernel.org Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
322 lines
11 KiB
C
322 lines
11 KiB
C
/***********************license start***************
|
|
* Author: Cavium Networks
|
|
*
|
|
* Contact: support@caviumnetworks.com
|
|
* This file is part of the OCTEON SDK
|
|
*
|
|
* Copyright (C) 2003-2018 Cavium, Inc.
|
|
*
|
|
* This file is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License, Version 2, as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This file is distributed in the hope that it will be useful, but
|
|
* AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
|
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
|
|
* NONINFRINGEMENT. See the GNU General Public License for more
|
|
* details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this file; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
* or visit http://www.gnu.org/licenses/.
|
|
*
|
|
* This file may also be available under a different license from Cavium.
|
|
* Contact Cavium Networks for more information
|
|
***********************license end**************************************/
|
|
|
|
/*
|
|
* Functions for XAUI initialization, configuration,
|
|
* and monitoring.
|
|
*
|
|
*/
|
|
|
|
#include <asm/octeon/octeon.h>
|
|
|
|
#include <asm/octeon/cvmx-config.h>
|
|
|
|
#include <asm/octeon/cvmx-helper.h>
|
|
|
|
#include <asm/octeon/cvmx-pko-defs.h>
|
|
#include <asm/octeon/cvmx-gmxx-defs.h>
|
|
#include <asm/octeon/cvmx-pcsx-defs.h>
|
|
#include <asm/octeon/cvmx-pcsxx-defs.h>
|
|
|
|
int __cvmx_helper_xaui_enumerate(int interface)
|
|
{
|
|
union cvmx_gmxx_hg2_control gmx_hg2_control;
|
|
|
|
/* If HiGig2 is enabled return 16 ports, otherwise return 1 port */
|
|
gmx_hg2_control.u64 = cvmx_read_csr(CVMX_GMXX_HG2_CONTROL(interface));
|
|
if (gmx_hg2_control.s.hg2tx_en)
|
|
return 16;
|
|
else
|
|
return 1;
|
|
}
|
|
|
|
/*
|
|
* Probe a XAUI interface and determine the number of ports
|
|
* connected to it. The XAUI interface should still be down
|
|
* after this call.
|
|
*
|
|
* @interface: Interface to probe
|
|
*
|
|
* Returns Number of ports on the interface. Zero to disable.
|
|
*/
|
|
int __cvmx_helper_xaui_probe(int interface)
|
|
{
|
|
int i;
|
|
union cvmx_gmxx_inf_mode mode;
|
|
|
|
/*
|
|
* Due to errata GMX-700 on CN56XXp1.x and CN52XXp1.x, the
|
|
* interface needs to be enabled before IPD otherwise per port
|
|
* backpressure may not work properly.
|
|
*/
|
|
mode.u64 = cvmx_read_csr(CVMX_GMXX_INF_MODE(interface));
|
|
mode.s.en = 1;
|
|
cvmx_write_csr(CVMX_GMXX_INF_MODE(interface), mode.u64);
|
|
|
|
__cvmx_helper_setup_gmx(interface, 1);
|
|
|
|
/*
|
|
* Setup PKO to support 16 ports for HiGig2 virtual
|
|
* ports. We're pointing all of the PKO packet ports for this
|
|
* interface to the XAUI. This allows us to use HiGig2
|
|
* backpressure per port.
|
|
*/
|
|
for (i = 0; i < 16; i++) {
|
|
union cvmx_pko_mem_port_ptrs pko_mem_port_ptrs;
|
|
pko_mem_port_ptrs.u64 = 0;
|
|
/*
|
|
* We set each PKO port to have equal priority in a
|
|
* round robin fashion.
|
|
*/
|
|
pko_mem_port_ptrs.s.static_p = 0;
|
|
pko_mem_port_ptrs.s.qos_mask = 0xff;
|
|
/* All PKO ports map to the same XAUI hardware port */
|
|
pko_mem_port_ptrs.s.eid = interface * 4;
|
|
pko_mem_port_ptrs.s.pid = interface * 16 + i;
|
|
cvmx_write_csr(CVMX_PKO_MEM_PORT_PTRS, pko_mem_port_ptrs.u64);
|
|
}
|
|
return __cvmx_helper_xaui_enumerate(interface);
|
|
}
|
|
|
|
/*
|
|
* Bringup and enable a XAUI interface. After this call packet
|
|
* I/O should be fully functional. This is called with IPD
|
|
* enabled but PKO disabled.
|
|
*
|
|
* @interface: Interface to bring up
|
|
*
|
|
* Returns Zero on success, negative on failure
|
|
*/
|
|
int __cvmx_helper_xaui_enable(int interface)
|
|
{
|
|
union cvmx_gmxx_prtx_cfg gmx_cfg;
|
|
union cvmx_pcsxx_control1_reg xauiCtl;
|
|
union cvmx_pcsxx_misc_ctl_reg xauiMiscCtl;
|
|
union cvmx_gmxx_tx_xaui_ctl gmxXauiTxCtl;
|
|
union cvmx_gmxx_rxx_int_en gmx_rx_int_en;
|
|
union cvmx_gmxx_tx_int_en gmx_tx_int_en;
|
|
union cvmx_pcsxx_int_en_reg pcsx_int_en_reg;
|
|
|
|
/* Setup PKND */
|
|
if (octeon_has_feature(OCTEON_FEATURE_PKND)) {
|
|
gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(0, interface));
|
|
gmx_cfg.s.pknd = cvmx_helper_get_ipd_port(interface, 0);
|
|
cvmx_write_csr(CVMX_GMXX_PRTX_CFG(0, interface), gmx_cfg.u64);
|
|
}
|
|
|
|
/* (1) Interface has already been enabled. */
|
|
|
|
/* (2) Disable GMX. */
|
|
xauiMiscCtl.u64 = cvmx_read_csr(CVMX_PCSXX_MISC_CTL_REG(interface));
|
|
xauiMiscCtl.s.gmxeno = 1;
|
|
cvmx_write_csr(CVMX_PCSXX_MISC_CTL_REG(interface), xauiMiscCtl.u64);
|
|
|
|
/* (3) Disable GMX and PCSX interrupts. */
|
|
gmx_rx_int_en.u64 = cvmx_read_csr(CVMX_GMXX_RXX_INT_EN(0, interface));
|
|
cvmx_write_csr(CVMX_GMXX_RXX_INT_EN(0, interface), 0x0);
|
|
gmx_tx_int_en.u64 = cvmx_read_csr(CVMX_GMXX_TX_INT_EN(interface));
|
|
cvmx_write_csr(CVMX_GMXX_TX_INT_EN(interface), 0x0);
|
|
pcsx_int_en_reg.u64 = cvmx_read_csr(CVMX_PCSXX_INT_EN_REG(interface));
|
|
cvmx_write_csr(CVMX_PCSXX_INT_EN_REG(interface), 0x0);
|
|
|
|
/* (4) Bring up the PCSX and GMX reconciliation layer. */
|
|
/* (4)a Set polarity and lane swapping. */
|
|
/* (4)b */
|
|
gmxXauiTxCtl.u64 = cvmx_read_csr(CVMX_GMXX_TX_XAUI_CTL(interface));
|
|
/* Enable better IFG packing and improves performance */
|
|
gmxXauiTxCtl.s.dic_en = 1;
|
|
gmxXauiTxCtl.s.uni_en = 0;
|
|
cvmx_write_csr(CVMX_GMXX_TX_XAUI_CTL(interface), gmxXauiTxCtl.u64);
|
|
|
|
/* (4)c Aply reset sequence */
|
|
xauiCtl.u64 = cvmx_read_csr(CVMX_PCSXX_CONTROL1_REG(interface));
|
|
xauiCtl.s.lo_pwr = 0;
|
|
|
|
/* Issuing a reset here seems to hang some CN68XX chips. */
|
|
if (!OCTEON_IS_MODEL(OCTEON_CN68XX_PASS1_X) &&
|
|
!OCTEON_IS_MODEL(OCTEON_CN68XX_PASS2_X))
|
|
xauiCtl.s.reset = 1;
|
|
|
|
cvmx_write_csr(CVMX_PCSXX_CONTROL1_REG(interface), xauiCtl.u64);
|
|
|
|
/* Wait for PCS to come out of reset */
|
|
if (CVMX_WAIT_FOR_FIELD64
|
|
(CVMX_PCSXX_CONTROL1_REG(interface), union cvmx_pcsxx_control1_reg,
|
|
reset, ==, 0, 10000))
|
|
return -1;
|
|
/* Wait for PCS to be aligned */
|
|
if (CVMX_WAIT_FOR_FIELD64
|
|
(CVMX_PCSXX_10GBX_STATUS_REG(interface),
|
|
union cvmx_pcsxx_10gbx_status_reg, alignd, ==, 1, 10000))
|
|
return -1;
|
|
/* Wait for RX to be ready */
|
|
if (CVMX_WAIT_FOR_FIELD64
|
|
(CVMX_GMXX_RX_XAUI_CTL(interface), union cvmx_gmxx_rx_xaui_ctl,
|
|
status, ==, 0, 10000))
|
|
return -1;
|
|
|
|
/* (6) Configure GMX */
|
|
gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(0, interface));
|
|
gmx_cfg.s.en = 0;
|
|
cvmx_write_csr(CVMX_GMXX_PRTX_CFG(0, interface), gmx_cfg.u64);
|
|
|
|
/* Wait for GMX RX to be idle */
|
|
if (CVMX_WAIT_FOR_FIELD64
|
|
(CVMX_GMXX_PRTX_CFG(0, interface), union cvmx_gmxx_prtx_cfg,
|
|
rx_idle, ==, 1, 10000))
|
|
return -1;
|
|
/* Wait for GMX TX to be idle */
|
|
if (CVMX_WAIT_FOR_FIELD64
|
|
(CVMX_GMXX_PRTX_CFG(0, interface), union cvmx_gmxx_prtx_cfg,
|
|
tx_idle, ==, 1, 10000))
|
|
return -1;
|
|
|
|
/* GMX configure */
|
|
gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(0, interface));
|
|
gmx_cfg.s.speed = 1;
|
|
gmx_cfg.s.speed_msb = 0;
|
|
gmx_cfg.s.slottime = 1;
|
|
cvmx_write_csr(CVMX_GMXX_TX_PRTS(interface), 1);
|
|
cvmx_write_csr(CVMX_GMXX_TXX_SLOT(0, interface), 512);
|
|
cvmx_write_csr(CVMX_GMXX_TXX_BURST(0, interface), 8192);
|
|
cvmx_write_csr(CVMX_GMXX_PRTX_CFG(0, interface), gmx_cfg.u64);
|
|
|
|
/* (7) Clear out any error state */
|
|
cvmx_write_csr(CVMX_GMXX_RXX_INT_REG(0, interface),
|
|
cvmx_read_csr(CVMX_GMXX_RXX_INT_REG(0, interface)));
|
|
cvmx_write_csr(CVMX_GMXX_TX_INT_REG(interface),
|
|
cvmx_read_csr(CVMX_GMXX_TX_INT_REG(interface)));
|
|
cvmx_write_csr(CVMX_PCSXX_INT_REG(interface),
|
|
cvmx_read_csr(CVMX_PCSXX_INT_REG(interface)));
|
|
|
|
/* Wait for receive link */
|
|
if (CVMX_WAIT_FOR_FIELD64
|
|
(CVMX_PCSXX_STATUS1_REG(interface), union cvmx_pcsxx_status1_reg,
|
|
rcv_lnk, ==, 1, 10000))
|
|
return -1;
|
|
if (CVMX_WAIT_FOR_FIELD64
|
|
(CVMX_PCSXX_STATUS2_REG(interface), union cvmx_pcsxx_status2_reg,
|
|
xmtflt, ==, 0, 10000))
|
|
return -1;
|
|
if (CVMX_WAIT_FOR_FIELD64
|
|
(CVMX_PCSXX_STATUS2_REG(interface), union cvmx_pcsxx_status2_reg,
|
|
rcvflt, ==, 0, 10000))
|
|
return -1;
|
|
|
|
cvmx_write_csr(CVMX_GMXX_RXX_INT_EN(0, interface), gmx_rx_int_en.u64);
|
|
cvmx_write_csr(CVMX_GMXX_TX_INT_EN(interface), gmx_tx_int_en.u64);
|
|
cvmx_write_csr(CVMX_PCSXX_INT_EN_REG(interface), pcsx_int_en_reg.u64);
|
|
|
|
/* (8) Enable packet reception */
|
|
xauiMiscCtl.s.gmxeno = 0;
|
|
cvmx_write_csr(CVMX_PCSXX_MISC_CTL_REG(interface), xauiMiscCtl.u64);
|
|
|
|
gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(0, interface));
|
|
gmx_cfg.s.en = 1;
|
|
cvmx_write_csr(CVMX_GMXX_PRTX_CFG(0, interface), gmx_cfg.u64);
|
|
|
|
__cvmx_interrupt_pcsx_intx_en_reg_enable(0, interface);
|
|
__cvmx_interrupt_pcsx_intx_en_reg_enable(1, interface);
|
|
__cvmx_interrupt_pcsx_intx_en_reg_enable(2, interface);
|
|
__cvmx_interrupt_pcsx_intx_en_reg_enable(3, interface);
|
|
__cvmx_interrupt_pcsxx_int_en_reg_enable(interface);
|
|
__cvmx_interrupt_gmxx_enable(interface);
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Return the link state of an IPD/PKO port as returned by
|
|
* auto negotiation. The result of this function may not match
|
|
* Octeon's link config if auto negotiation has changed since
|
|
* the last call to cvmx_helper_link_set().
|
|
*
|
|
* @ipd_port: IPD/PKO port to query
|
|
*
|
|
* Returns Link state
|
|
*/
|
|
union cvmx_helper_link_info __cvmx_helper_xaui_link_get(int ipd_port)
|
|
{
|
|
int interface = cvmx_helper_get_interface_num(ipd_port);
|
|
union cvmx_gmxx_tx_xaui_ctl gmxx_tx_xaui_ctl;
|
|
union cvmx_gmxx_rx_xaui_ctl gmxx_rx_xaui_ctl;
|
|
union cvmx_pcsxx_status1_reg pcsxx_status1_reg;
|
|
union cvmx_helper_link_info result;
|
|
|
|
gmxx_tx_xaui_ctl.u64 = cvmx_read_csr(CVMX_GMXX_TX_XAUI_CTL(interface));
|
|
gmxx_rx_xaui_ctl.u64 = cvmx_read_csr(CVMX_GMXX_RX_XAUI_CTL(interface));
|
|
pcsxx_status1_reg.u64 =
|
|
cvmx_read_csr(CVMX_PCSXX_STATUS1_REG(interface));
|
|
result.u64 = 0;
|
|
|
|
/* Only return a link if both RX and TX are happy */
|
|
if ((gmxx_tx_xaui_ctl.s.ls == 0) && (gmxx_rx_xaui_ctl.s.status == 0) &&
|
|
(pcsxx_status1_reg.s.rcv_lnk == 1)) {
|
|
result.s.link_up = 1;
|
|
result.s.full_duplex = 1;
|
|
result.s.speed = 10000;
|
|
} else {
|
|
/* Disable GMX and PCSX interrupts. */
|
|
cvmx_write_csr(CVMX_GMXX_RXX_INT_EN(0, interface), 0x0);
|
|
cvmx_write_csr(CVMX_GMXX_TX_INT_EN(interface), 0x0);
|
|
cvmx_write_csr(CVMX_PCSXX_INT_EN_REG(interface), 0x0);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/*
|
|
* Configure an IPD/PKO port for the specified link state. This
|
|
* function does not influence auto negotiation at the PHY level.
|
|
* The passed link state must always match the link state returned
|
|
* by cvmx_helper_link_get().
|
|
*
|
|
* @ipd_port: IPD/PKO port to configure
|
|
* @link_info: The new link state
|
|
*
|
|
* Returns Zero on success, negative on failure
|
|
*/
|
|
int __cvmx_helper_xaui_link_set(int ipd_port, union cvmx_helper_link_info link_info)
|
|
{
|
|
int interface = cvmx_helper_get_interface_num(ipd_port);
|
|
union cvmx_gmxx_tx_xaui_ctl gmxx_tx_xaui_ctl;
|
|
union cvmx_gmxx_rx_xaui_ctl gmxx_rx_xaui_ctl;
|
|
|
|
gmxx_tx_xaui_ctl.u64 = cvmx_read_csr(CVMX_GMXX_TX_XAUI_CTL(interface));
|
|
gmxx_rx_xaui_ctl.u64 = cvmx_read_csr(CVMX_GMXX_RX_XAUI_CTL(interface));
|
|
|
|
/* If the link shouldn't be up, then just return */
|
|
if (!link_info.s.link_up)
|
|
return 0;
|
|
|
|
/* Do nothing if both RX and TX are happy */
|
|
if ((gmxx_tx_xaui_ctl.s.ls == 0) && (gmxx_rx_xaui_ctl.s.status == 0))
|
|
return 0;
|
|
|
|
/* Bring the link up */
|
|
return __cvmx_helper_xaui_enable(interface);
|
|
}
|