1/* SPDX-License-Identifier: GPL-2.0-only 2 * 3 * Copyright (C) 2020-21 Intel Corporation. 4 */ 5 6#ifndef IOSM_IPC_IMEM_OPS_H 7#define IOSM_IPC_IMEM_OPS_H 8 9#include "iosm_ipc_mux_codec.h" 10 11/* Maximum wait time for blocking read */ 12#define IPC_READ_TIMEOUT 500 13 14/* The delay in ms for defering the unregister */ 15#define SIO_UNREGISTER_DEFER_DELAY_MS 1 16 17/* Default delay till CP PSI image is running and modem updates the 18 * execution stage. 19 * unit : milliseconds 20 */ 21#define PSI_START_DEFAULT_TIMEOUT 3000 22 23/* Default time out when closing SIO, till the modem is in 24 * running state. 25 * unit : milliseconds 26 */ 27#define BOOT_CHECK_DEFAULT_TIMEOUT 400 28 29/* IP MUX channel range */ 30#define IP_MUX_SESSION_START 0 31#define IP_MUX_SESSION_END 7 32 33/* Default IP MUX channel */ 34#define IP_MUX_SESSION_DEFAULT 0 35 36/** 37 * ipc_imem_sys_port_open - Open a port link to CP. 38 * @ipc_imem: Imem instance. 39 * @chl_id: Channel Indentifier. 40 * @hp_id: HP Indentifier. 41 * 42 * Return: channel instance on success, NULL for failure 43 */ 44struct ipc_mem_channel *ipc_imem_sys_port_open(struct iosm_imem *ipc_imem, 45 int chl_id, int hp_id); 46 47/** 48 * ipc_imem_sys_cdev_close - Release a sio link to CP. 49 * @ipc_cdev: iosm sio instance. 50 */ 51void ipc_imem_sys_cdev_close(struct iosm_cdev *ipc_cdev); 52 53/** 54 * ipc_imem_sys_cdev_write - Route the uplink buffer to CP. 55 * @ipc_cdev: iosm_cdev instance. 56 * @skb: Pointer to skb. 57 * 58 * Return: 0 on success and failure value on error 59 */ 60int ipc_imem_sys_cdev_write(struct iosm_cdev *ipc_cdev, struct sk_buff *skb); 61 62/** 63 * ipc_imem_sys_wwan_open - Open packet data online channel between network 64 * layer and CP. 65 * @ipc_imem: Imem instance. 66 * @if_id: ip link tag of the net device. 67 * 68 * Return: Channel ID on success and failure value on error 69 */ 70int ipc_imem_sys_wwan_open(struct iosm_imem *ipc_imem, int if_id); 71 72/** 73 * ipc_imem_sys_wwan_close - Close packet data online channel between network 74 * layer and CP. 75 * @ipc_imem: Imem instance. 76 * @if_id: IP link id net device. 77 * @channel_id: Channel ID to be closed. 78 */ 79void ipc_imem_sys_wwan_close(struct iosm_imem *ipc_imem, int if_id, 80 int channel_id); 81 82/** 83 * ipc_imem_sys_wwan_transmit - Function for transfer UL data 84 * @ipc_imem: Imem instance. 85 * @if_id: link ID of the device. 86 * @channel_id: Channel ID used 87 * @skb: Pointer to sk buffer 88 * 89 * Return: 0 on success and failure value on error 90 */ 91int ipc_imem_sys_wwan_transmit(struct iosm_imem *ipc_imem, int if_id, 92 int channel_id, struct sk_buff *skb); 93/** 94 * ipc_imem_wwan_channel_init - Initializes WWAN channels and the channel for 95 * MUX. 96 * @ipc_imem: Pointer to iosm_imem struct. 97 * @mux_type: Type of mux protocol. 98 */ 99void ipc_imem_wwan_channel_init(struct iosm_imem *ipc_imem, 100 enum ipc_mux_protocol mux_type); 101#endif 102