Lines Matching +full:timeout +full:- +full:active +full:- +full:ms

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>
98 * active) or as a halfplex (either the Tx data path is
99 * active or the Rx data path is active, but not both).
100 * @timeout: Timeout to wait for clock synchronization in seconds
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()
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()
128 timeout); in cvmx_spi_start_interface()
144 * active) or as a halfplex (either the Tx data path is
145 * active or the Rx data path is active, but not both).
146 * @timeout: Timeout to wait for clock synchronization in seconds
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()
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()
173 timeout); in cvmx_spi_restart_interface()
189 * active) or as a halfplex (either the Tx data path is
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
204 uint64_t MS = cvmx_sysinfo_get()->cpu_clock_hz / 1000; in cvmx_spi_reset_cb() local
218 __delay(10 * MS); in cvmx_spi_reset_cb()
268 __delay(100 * MS); in cvmx_spi_reset_cb()
275 __delay(100 * MS); in cvmx_spi_reset_cb()
304 * active) or as a halfplex (either the Tx data path is
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
322 srxx_com_ctl.s.prts = num_ports - 1; in cvmx_spi_calendar_setup_cb()
423 * active) or as a halfplex (either the Tx data path is
424 * active or the Rx data path is active, but not both).
425 * @timeout: Timeout to wait for clock synchronization in seconds
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() local
442 timeout_time = cvmx_get_cycle() + 1000ull * MS * timeout; in cvmx_spi_clock_detect_cb()
455 clock_transitions--; in cvmx_spi_clock_detect_cb()
461 cvmx_dprintf("SPI%d: Timeout\n", interface); in cvmx_spi_clock_detect_cb()
462 return -1; in cvmx_spi_clock_detect_cb()
467 timeout_time = cvmx_get_cycle() + 1000ull * MS * timeout; in cvmx_spi_clock_detect_cb()
480 clock_transitions--; in cvmx_spi_clock_detect_cb()
486 cvmx_dprintf("SPI%d: Timeout\n", interface); in cvmx_spi_clock_detect_cb()
487 return -1; in cvmx_spi_clock_detect_cb()
501 * active) or as a halfplex (either the Tx data path is
502 * active or the Rx data path is active, but not both).
503 * @timeout: Timeout to wait for link to be trained (in seconds)
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() local
513 uint64_t timeout_time = cvmx_get_cycle() + 1000ull * MS * timeout; in cvmx_spi_training_cb()
516 /* SRX0 & STX0 Inf0 Links are configured - begin training */ in cvmx_spi_training_cb()
530 __delay(1000 * MS); in cvmx_spi_training_cb()
539 __delay(1000 * MS); in cvmx_spi_training_cb()
541 timeout_time = cvmx_get_cycle() + 1000ull * MS * 600; in cvmx_spi_training_cb()
550 rx_training_needed--; in cvmx_spi_training_cb()
555 cvmx_dprintf("SPI%d: Timeout\n", interface); in cvmx_spi_training_cb()
556 return -1; in cvmx_spi_training_cb()
570 * active) or as a halfplex (either the Tx data path is
571 * active or the Rx data path is active, but not both).
572 * @timeout: Timeout to wait for calendar data in seconds
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() local
606 timeout_time = cvmx_get_cycle() + 1000ull * MS * timeout; in cvmx_spi_calendar_sync_cb()
607 /* SPX0_CLK_STAT - SPX0_CLK_STAT[STXCAL] should be 1 (bit10) */ in cvmx_spi_calendar_sync_cb()
611 cvmx_dprintf("SPI%d: Timeout\n", interface); in cvmx_spi_calendar_sync_cb()
612 return -1; in cvmx_spi_calendar_sync_cb()
627 * active) or as a halfplex (either the Tx data path is
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
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()