arch/mips/include/asm/octeon/cvmx-spi.h
Source file repositories/reference/linux-study-clean/arch/mips/include/asm/octeon/cvmx-spi.h
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/include/asm/octeon/cvmx-spi.h- Extension
.h- Size
- 9142 bytes
- Lines
- 270
- Domain
- Architecture Layer
- Bucket
- arch/mips
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
Dependency Surface
asm/octeon/cvmx-gmxx-defs.h
Detected Declarations
function cvmx_spi_is_spi_interfacefunction cvmx_spi4000_is_presentfunction cvmx_spi4000_initializefunction cvmx_spi4000_check_speed
Annotated Snippet
#ifndef __CVMX_SPI_H__
#define __CVMX_SPI_H__
#include <asm/octeon/cvmx-gmxx-defs.h>
/* CSR typedefs have been moved to cvmx-csr-*.h */
typedef enum {
CVMX_SPI_MODE_UNKNOWN = 0,
CVMX_SPI_MODE_TX_HALFPLEX = 1,
CVMX_SPI_MODE_RX_HALFPLEX = 2,
CVMX_SPI_MODE_DUPLEX = 3
} cvmx_spi_mode_t;
/** Callbacks structure to customize SPI4 initialization sequence */
typedef struct {
/** Called to reset SPI4 DLL */
int (*reset_cb) (int interface, cvmx_spi_mode_t mode);
/** Called to setup calendar */
int (*calendar_setup_cb) (int interface, cvmx_spi_mode_t mode,
int num_ports);
/** Called for Tx and Rx clock detection */
int (*clock_detect_cb) (int interface, cvmx_spi_mode_t mode,
int timeout);
/** Called to perform link training */
int (*training_cb) (int interface, cvmx_spi_mode_t mode, int timeout);
/** Called for calendar data synchronization */
int (*calendar_sync_cb) (int interface, cvmx_spi_mode_t mode,
int timeout);
/** Called when interface is up */
int (*interface_up_cb) (int interface, cvmx_spi_mode_t mode);
} cvmx_spi_callbacks_t;
/**
* Return true if the supplied interface is configured for SPI
*
* @interface: Interface to check
* Returns True if interface is SPI
*/
static inline int cvmx_spi_is_spi_interface(int interface)
{
uint64_t gmxState = cvmx_read_csr(CVMX_GMXX_INF_MODE(interface));
return (gmxState & 0x2) && (gmxState & 0x1);
}
/**
* 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.
*/
extern int cvmx_spi_start_interface(int interface, cvmx_spi_mode_t mode,
int timeout, int num_ports);
/**
* This routine restarts the SPI interface after it has lost synchronization
* with its corespondant 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.
*/
extern int cvmx_spi_restart_interface(int interface, cvmx_spi_mode_t mode,
int timeout);
/**
* Return non-zero if the SPI interface has a SPI4000 attached
*
* @interface: SPI interface the SPI4000 is connected to
*
* Returns
Annotation
- Immediate include surface: `asm/octeon/cvmx-gmxx-defs.h`.
- Detected declarations: `function cvmx_spi_is_spi_interface`, `function cvmx_spi4000_is_present`, `function cvmx_spi4000_initialize`, `function cvmx_spi4000_check_speed`.
- Atlas domain: Architecture Layer / arch/mips.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.