/** * This routine restarts the SPI interface after it has lost synchronization * with its correspondent system. * * @interface: The identifier of the packet interface to configure and * use as a SPI interface. * @mode: The operating mode for the SPI interface. The interface * can operate as a full duplex (both Tx and Rx data paths * active) or as a halfplex (either the Tx data path is * active or the Rx data path is active, but not both). * @timeout: Timeout to wait for clock synchronization in seconds * * Returns Zero on success, negative of failure. */ int cvmx_spi_restart_interface(int interface, cvmx_spi_mode_t mode, int timeout) { int res = -1; if (!(OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX))) return res; cvmx_dprintf("SPI%d: Restart %s\n", interface, modes[mode]); /* Callback to perform SPI4 reset */ INVOKE_CB(cvmx_spi_callbacks.reset_cb, interface, mode); /* NOTE: Calendar setup is not performed during restart */ /* Refer to cvmx_spi_start_interface() for the full sequence */ /* Callback to perform clock detection */ INVOKE_CB(cvmx_spi_callbacks.clock_detect_cb, interface, mode, timeout); /* Callback to perform SPI4 link training */ INVOKE_CB(cvmx_spi_callbacks.training_cb, interface, mode, timeout); /* Callback to perform calendar sync */ INVOKE_CB(cvmx_spi_callbacks.calendar_sync_cb, interface, mode, timeout); /* Callback to handle interface coming up */ INVOKE_CB(cvmx_spi_callbacks.interface_up_cb, interface, mode); return res; }
int cvmx_spi_restart_interface(int interface, cvmx_spi_mode_t mode, int timeout) { int res = -1; if (!(OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX))) return res; cvmx_dprintf("SPI%d: Restart %s\n", interface, modes[mode]); INVOKE_CB(cvmx_spi_callbacks.reset_cb, interface, mode); INVOKE_CB(cvmx_spi_callbacks.clock_detect_cb, interface, mode, timeout); INVOKE_CB(cvmx_spi_callbacks.training_cb, interface, mode, timeout); INVOKE_CB(cvmx_spi_callbacks.calendar_sync_cb, interface, mode, timeout); INVOKE_CB(cvmx_spi_callbacks.interface_up_cb, interface, mode); return res; }
/** * Initialize and start the SPI interface. * * @interface: The identifier of the packet interface to configure and * use as a SPI interface. * @mode: The operating mode for the SPI interface. The interface * can operate as a full duplex (both Tx and Rx data paths * active) or as a halfplex (either the Tx data path is * active or the Rx data path is active, but not both). * @timeout: Timeout to wait for clock synchronization in seconds * @num_ports: Number of SPI ports to configure * * Returns Zero on success, negative of failure. */ int cvmx_spi_start_interface(int interface, cvmx_spi_mode_t mode, int timeout, int num_ports) { int res = -1; if (!(OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX))) return res; /* Callback to perform SPI4 reset */ INVOKE_CB(cvmx_spi_callbacks.reset_cb, interface, mode); /* Callback to perform calendar setup */ INVOKE_CB(cvmx_spi_callbacks.calendar_setup_cb, interface, mode, num_ports); /* Callback to perform clock detection */ INVOKE_CB(cvmx_spi_callbacks.clock_detect_cb, interface, mode, timeout); /* Callback to perform SPI4 link training */ INVOKE_CB(cvmx_spi_callbacks.training_cb, interface, mode, timeout); /* Callback to perform calendar sync */ INVOKE_CB(cvmx_spi_callbacks.calendar_sync_cb, interface, mode, timeout); /* Callback to handle interface coming up */ INVOKE_CB(cvmx_spi_callbacks.interface_up_cb, interface, mode); return res; }
int cvmx_spi_start_interface(int interface, cvmx_spi_mode_t mode, int timeout, int num_ports) { int res = -1; if (!(OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX))) return res; INVOKE_CB(cvmx_spi_callbacks.reset_cb, interface, mode); INVOKE_CB(cvmx_spi_callbacks.calendar_setup_cb, interface, mode, num_ports); INVOKE_CB(cvmx_spi_callbacks.clock_detect_cb, interface, mode, timeout); INVOKE_CB(cvmx_spi_callbacks.training_cb, interface, mode, timeout); INVOKE_CB(cvmx_spi_callbacks.calendar_sync_cb, interface, mode, timeout); INVOKE_CB(cvmx_spi_callbacks.interface_up_cb, interface, mode); return res; }