High Speed Syncronous Interface (HSI) is a fullduplex, low latency protocol, that is optimized for die-level interconnect between an Application Processor and a Baseband chipset. It has been specified by the MIPI alliance in 2003 and implemented by multiple vendors since then.
The HSI interface supports full duplex communication over multiple channels (typically 8) and is capable of reaching speeds up to 200 Mbit/s.
The serial protocol uses two signals, DATA and FLAG as combined data and clock signals and an additional READY signal for flow control. An additional WAKE signal can be used to wakeup the chips from standby modes. The signals are commonly prefixed by AC for signals going from the application die to the cellular die and CA for signals going the other way around.
+------------+ +---------------+
| Cellular | | Application |
| Die | | Die |
| | - - - - - - CAWAKE - - - - - - >| |
| T|------------ CADATA ------------>|R |
| X|------------ CAFLAG ------------>|X |
| |<----------- ACREADY ------------| |
| | | |
| | | |
| |< - - - - - ACWAKE - - - - - - -| |
| R|<----------- ACDATA -------------|T |
| X|<----------- ACFLAG -------------|X |
| |------------ CAREADY ----------->| |
| | | |
| | | |
+------------+ +---------------+
In the Linux kernel the hsi subsystem is supposed to be used for HSI devices. The hsi subsystem contains drivers for hsi controllers including support for multi-port controllers and provides a generic API for using the HSI ports.
It also contains HSI client drivers, which make use of the generic API to implement a protocol used on the HSI interface. These client drivers can use an arbitrary number of channels.
Each port automatically registers a generic client driver called hsi_char, which provides a charecter device for userspace representing the HSI port. It can be used to communicate via HSI from userspace. Userspace may configure the hsi_char device using the following ioctl commands:
channel resource used by the hsi clients
Definition
struct hsi_channel {
unsigned int id;
const char * name;
};
Members
Configuration for RX/TX HSI modules
Definition
struct hsi_config {
unsigned int mode;
struct hsi_channel * channels;
unsigned int num_channels;
unsigned int num_hw_channels;
unsigned int speed;
union {unnamed_union};
};
Members
HSI client board info
Definition
struct hsi_board_info {
const char * name;
unsigned int hsi_id;
unsigned int port;
struct hsi_config tx_cfg;
struct hsi_config rx_cfg;
void * platform_data;
struct dev_archdata * archdata;
};
Members
HSI client attached to an HSI port
Definition
struct hsi_client {
struct device device;
struct hsi_config tx_cfg;
struct hsi_config rx_cfg;
};
Members
Driver associated to an HSI client
Definition
struct hsi_client_driver {
struct device_driver driver;
};
Members
HSI message descriptor
Definition
struct hsi_msg {
struct list_head link;
struct hsi_client * cl;
struct sg_table sgt;
void * context;
void (* complete) (struct hsi_msg *msg);
void (* destructor) (struct hsi_msg *msg);
int status;
unsigned int actual_len;
unsigned int channel;
unsigned int ttype:1;
unsigned int break_frame:1;
};
Members
HSI port device
Definition
struct hsi_port {
struct device device;
struct hsi_config tx_cfg;
struct hsi_config rx_cfg;
unsigned int num;
unsigned int shared:1;
int claimed;
struct mutex lock;
int (* async) (struct hsi_msg *msg);
int (* setup) (struct hsi_client *cl);
int (* flush) (struct hsi_client *cl);
int (* start_tx) (struct hsi_client *cl);
int (* stop_tx) (struct hsi_client *cl);
int (* release) (struct hsi_client *cl);
struct blocking_notifier_head n_head;
};
Members
HSI controller device
Definition
struct hsi_controller {
struct device device;
struct module * owner;
unsigned int id;
unsigned int num_ports;
struct hsi_port ** port;
};
Members
Get HSI controller ID associated to a client
Parameters
Description
Return the controller id where the client is attached to
Gets the port number a client is attached to
Parameters
Description
Return the port number associated to the client
Configure the client’s port
Parameters
Description
When sharing ports, clients should either relay on a single client setup or have the same setup for all of them.
Return -errno on failure, 0 on success
Flush all pending transactions on the client’s port
Parameters
Description
This function will destroy all pending hsi_msg in the port and reset the HW port so it is ready to receive and transmit from a clean state.
Return -errno on failure, 0 on success
Submit a read transfer
Parameters
Description
Return -errno on failure, 0 on success
Submit a write transfer
Parameters
Description
Return -errno on failure, 0 on success
Signal the port that the client wants to start a TX
Parameters
Description
Return -errno on failure, 0 on success
Signal the port that the client no longer wants to transmit
Parameters
Description
Return -errno on failure, 0 on success
Parameters
Unregister an HSI controller
Parameters
Register an HSI controller and its ports
Parameters
Description
Returns -errno on failure, 0 on success.
Register an HSI client to the HSI bus
Parameters
Description
Returns -errno on failure, 0 on success.
Free an HSI controller
Parameters
Description
HSI controller drivers should only use this function if they need to free their allocated hsi_controller structures before a successful call to hsi_register_controller. Other use is not allowed.
Allocate an HSI controller and its ports
Parameters
Description
Return NULL on failure or a pointer to an hsi_controller on success.
Parameters
Description
Client is responsible to free the buffers pointed by the scatterlists.
Parameters
Description
nents can be 0. This mainly makes sense for read transfer. In that case, HSI drivers will call the complete callback when there is data to be read without consuming it.
Return NULL on failure or a pointer to an hsi_msg on success.
Submit an HSI transfer to the controller
Parameters
Description
The HSI message must have the channel, ttype, complete and destructor fields set beforehand. If nents > 0 then the client has to initialize also the scatterlists to point to the buffers to write to or read from.
HSI controllers relay on pre-allocated buffers from their clients and they do not allocate buffers on their own.
Once the HSI message transfer finishes, the HSI controller calls the complete callback with the status and actual_len fields of the HSI message updated. The complete callback can be called before returning from hsi_async.
Returns -errno on failure or 0 on success
Claim the HSI client’s port
Parameters
Description
Returns -errno on failure, 0 on success.
Release the HSI client’s port
Parameters
Register a client to receive port events
Parameters
Description
Clients should register a callback to be able to receive events from the ports. Registration should happen after claiming the port. The handler can be called in interrupt context.
Returns -errno on error, or 0 on success.
Stop receiving port events for a client
Parameters
Description
Clients should call this function before releasing their associated port.
Returns -errno on error, or 0 on success.
Parameters
Description
Clients should not be concerned about wake line behavior. However, due to a race condition in HSI HW protocol, clients need to be notified about wake line changes, so they can implement a workaround for it.
Events: HSI_EVENT_START_RX - Incoming wake line high HSI_EVENT_STOP_RX - Incoming wake line down
Returns -errno on error, or 0 on success.
acquire channel id by channel name
Parameters
Description
Clients can call this function to get the hsi channel ids similar to requesting IRQs or GPIOs by name. This function assumes the same channel configuration is used for RX and TX.
Returns -errno on error or channel id on success.