Lines Matching +full:rx +full:- +full:mode
7 * Copyright (c) 2003-2008 Cavium Networks
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
34 #include <asm/octeon/cvmx-config.h>
36 #include <asm/octeon/cvmx-pko.h>
37 #include <asm/octeon/cvmx-spi.h>
39 #include <asm/octeon/cvmx-spxx-defs.h>
40 #include <asm/octeon/cvmx-stxx-defs.h>
41 #include <asm/octeon/cvmx-srxx-defs.h>
54 { "UNKNOWN", "TX Halfplex", "Rx Halfplex", "Duplex" };
96 * @mode: The operating mode for the SPI interface. The interface
97 * can operate as a full duplex (both Tx and Rx data paths
99 * active or the Rx data path is active, but not both).
105 int cvmx_spi_start_interface(int interface, cvmx_spi_mode_t mode, int timeout, in cvmx_spi_start_interface() argument
108 int res = -1; in cvmx_spi_start_interface()
114 INVOKE_CB(cvmx_spi_callbacks.reset_cb, interface, mode); in cvmx_spi_start_interface()
117 INVOKE_CB(cvmx_spi_callbacks.calendar_setup_cb, interface, mode, in cvmx_spi_start_interface()
121 INVOKE_CB(cvmx_spi_callbacks.clock_detect_cb, interface, mode, timeout); in cvmx_spi_start_interface()
124 INVOKE_CB(cvmx_spi_callbacks.training_cb, interface, mode, timeout); in cvmx_spi_start_interface()
127 INVOKE_CB(cvmx_spi_callbacks.calendar_sync_cb, interface, mode, in cvmx_spi_start_interface()
131 INVOKE_CB(cvmx_spi_callbacks.interface_up_cb, interface, mode); in cvmx_spi_start_interface()
142 * @mode: The operating mode for the SPI interface. The interface
143 * can operate as a full duplex (both Tx and Rx data paths
145 * active or the Rx data path is active, but not both).
150 int cvmx_spi_restart_interface(int interface, cvmx_spi_mode_t mode, int timeout) in cvmx_spi_restart_interface() argument
152 int res = -1; in cvmx_spi_restart_interface()
157 cvmx_dprintf("SPI%d: Restart %s\n", interface, modes[mode]); in cvmx_spi_restart_interface()
160 INVOKE_CB(cvmx_spi_callbacks.reset_cb, interface, mode); in cvmx_spi_restart_interface()
166 INVOKE_CB(cvmx_spi_callbacks.clock_detect_cb, interface, mode, timeout); in cvmx_spi_restart_interface()
169 INVOKE_CB(cvmx_spi_callbacks.training_cb, interface, mode, timeout); in cvmx_spi_restart_interface()
172 INVOKE_CB(cvmx_spi_callbacks.calendar_sync_cb, interface, mode, in cvmx_spi_restart_interface()
176 INVOKE_CB(cvmx_spi_callbacks.interface_up_cb, interface, mode); in cvmx_spi_restart_interface()
187 * @mode: The operating mode for the SPI interface. The interface
188 * can operate as a full duplex (both Tx and Rx data paths
190 * active or the Rx data path is active, but not both).
192 * Returns Zero on success, non-zero error code on failure (will cause
195 int cvmx_spi_reset_cb(int interface, cvmx_spi_mode_t mode) in cvmx_spi_reset_cb() argument
204 uint64_t MS = cvmx_sysinfo_get()->cpu_clock_hz / 1000; in cvmx_spi_reset_cb()
225 cvmx_dprintf("ERROR SPI%d: BIST failed on RX calendar table\n", in cvmx_spi_reset_cb()
274 /* Waiting for Inf0 Spi4 RX DLL to lock */ in cvmx_spi_reset_cb()
302 * @mode: The operating mode for the SPI interface. The interface
303 * can operate as a full duplex (both Tx and Rx data paths
305 * active or the Rx data path is active, but not both).
308 * Returns Zero on success, non-zero error code on failure (will cause
311 int cvmx_spi_calendar_setup_cb(int interface, cvmx_spi_mode_t mode, in cvmx_spi_calendar_setup_cb() argument
316 if (mode & CVMX_SPI_MODE_RX_HALFPLEX) { in cvmx_spi_calendar_setup_cb()
322 srxx_com_ctl.s.prts = num_ports - 1; in cvmx_spi_calendar_setup_cb()
350 if (mode & CVMX_SPI_MODE_TX_HALFPLEX) { in cvmx_spi_calendar_setup_cb()
421 * @mode: The operating mode for the SPI interface. The interface
422 * can operate as a full duplex (both Tx and Rx data paths
424 * active or the Rx data path is active, but not both).
427 * Returns Zero on success, non-zero error code on failure (will cause
430 int cvmx_spi_clock_detect_cb(int interface, cvmx_spi_mode_t mode, int timeout) in cvmx_spi_clock_detect_cb() argument
435 uint64_t MS = cvmx_sysinfo_get()->cpu_clock_hz / 1000; in cvmx_spi_clock_detect_cb()
438 * Regardless of operating mode, both Tx and Rx clocks must be in cvmx_spi_clock_detect_cb()
455 clock_transitions--; in cvmx_spi_clock_detect_cb()
462 return -1; in cvmx_spi_clock_detect_cb()
480 clock_transitions--; in cvmx_spi_clock_detect_cb()
487 return -1; in cvmx_spi_clock_detect_cb()
499 * @mode: The operating mode for the SPI interface. The interface
500 * can operate as a full duplex (both Tx and Rx data paths
502 * active or the Rx data path is active, but not both).
505 * Returns Zero on success, non-zero error code on failure (will cause
508 int cvmx_spi_training_cb(int interface, cvmx_spi_mode_t mode, int timeout) in cvmx_spi_training_cb() argument
512 uint64_t MS = cvmx_sysinfo_get()->cpu_clock_hz / 1000; in cvmx_spi_training_cb()
516 /* SRX0 & STX0 Inf0 Links are configured - begin training */ in cvmx_spi_training_cb()
550 rx_training_needed--; in cvmx_spi_training_cb()
556 return -1; in cvmx_spi_training_cb()
568 * @mode: The operating mode for the SPI interface. The interface
569 * can operate as a full duplex (both Tx and Rx data paths
571 * active or the Rx data path is active, but not both).
574 * Returns Zero on success, non-zero error code on failure (will cause
577 int cvmx_spi_calendar_sync_cb(int interface, cvmx_spi_mode_t mode, int timeout) in cvmx_spi_calendar_sync_cb() argument
579 uint64_t MS = cvmx_sysinfo_get()->cpu_clock_hz / 1000; in cvmx_spi_calendar_sync_cb()
580 if (mode & CVMX_SPI_MODE_RX_HALFPLEX) { in cvmx_spi_calendar_sync_cb()
584 ("SPI%d: Rx is synchronized, start sending calendar data\n", in cvmx_spi_calendar_sync_cb()
592 if (mode & CVMX_SPI_MODE_TX_HALFPLEX) { in cvmx_spi_calendar_sync_cb()
607 /* SPX0_CLK_STAT - SPX0_CLK_STAT[STXCAL] should be 1 (bit10) */ in cvmx_spi_calendar_sync_cb()
612 return -1; in cvmx_spi_calendar_sync_cb()
625 * @mode: The operating mode for the SPI interface. The interface
626 * can operate as a full duplex (both Tx and Rx data paths
628 * active or the Rx data path is active, but not both).
630 * Returns Zero on success, non-zero error code on failure (will cause
633 int cvmx_spi_interface_up_cb(int interface, cvmx_spi_mode_t mode) in cvmx_spi_interface_up_cb() argument
639 if (mode & CVMX_SPI_MODE_RX_HALFPLEX) { in cvmx_spi_interface_up_cb()
644 cvmx_dprintf("SPI%d: Rx is now up\n", interface); in cvmx_spi_interface_up_cb()
647 if (mode & CVMX_SPI_MODE_TX_HALFPLEX) { in cvmx_spi_interface_up_cb()
660 gmxx_rxx_frm_max.s.len = 64 * 1024 - 4; in cvmx_spi_interface_up_cb()
664 gmxx_rxx_jabber.s.cnt = 64 * 1024 - 4; in cvmx_spi_interface_up_cb()