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 1 31 #define IP_MUX_SESSION_END 8 32 33 /** 34 * ipc_imem_sys_port_open - Open a port link to CP. 35 * @ipc_imem: Imem instance. 36 * @chl_id: Channel Indentifier. 37 * @hp_id: HP Indentifier. 38 * 39 * Return: channel instance on success, NULL for failure 40 */ 41 struct ipc_mem_channel *ipc_imem_sys_port_open(struct iosm_imem *ipc_imem, 42 int chl_id, int hp_id); 43 44 /** 45 * ipc_imem_sys_cdev_close - Release a sio link to CP. 46 * @ipc_cdev: iosm sio instance. 47 */ 48 void ipc_imem_sys_cdev_close(struct iosm_cdev *ipc_cdev); 49 50 /** 51 * ipc_imem_sys_cdev_write - Route the uplink buffer to CP. 52 * @ipc_cdev: iosm_cdev instance. 53 * @skb: Pointer to skb. 54 * 55 * Return: 0 on success and failure value on error 56 */ 57 int ipc_imem_sys_cdev_write(struct iosm_cdev *ipc_cdev, struct sk_buff *skb); 58 59 /** 60 * ipc_imem_sys_wwan_open - Open packet data online channel between network 61 * layer and CP. 62 * @ipc_imem: Imem instance. 63 * @if_id: ip link tag of the net device. 64 * 65 * Return: Channel ID on success and failure value on error 66 */ 67 int ipc_imem_sys_wwan_open(struct iosm_imem *ipc_imem, int if_id); 68 69 /** 70 * ipc_imem_sys_wwan_close - Close packet data online channel between network 71 * layer and CP. 72 * @ipc_imem: Imem instance. 73 * @if_id: IP link id net device. 74 * @channel_id: Channel ID to be closed. 75 */ 76 void ipc_imem_sys_wwan_close(struct iosm_imem *ipc_imem, int if_id, 77 int channel_id); 78 79 /** 80 * ipc_imem_sys_wwan_transmit - Function for transfer UL data 81 * @ipc_imem: Imem instance. 82 * @if_id: link ID of the device. 83 * @channel_id: Channel ID used 84 * @skb: Pointer to sk buffer 85 * 86 * Return: 0 on success and failure value on error 87 */ 88 int ipc_imem_sys_wwan_transmit(struct iosm_imem *ipc_imem, int if_id, 89 int channel_id, struct sk_buff *skb); 90 /** 91 * ipc_imem_wwan_channel_init - Initializes WWAN channels and the channel for 92 * MUX. 93 * @ipc_imem: Pointer to iosm_imem struct. 94 * @mux_type: Type of mux protocol. 95 */ 96 void ipc_imem_wwan_channel_init(struct iosm_imem *ipc_imem, 97 enum ipc_mux_protocol mux_type); 98 #endif 99