blob: 383699f1f3ee96df79656c4a1e74834635a6532d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
/*
* Copyright (C) ST-Ericsson SA 2011
*
* Author: Chris Blair <chris.blair@stericsson.com> for ST-Ericsson
* based on shrm_driver.h
*
* License terms: GNU General Public License (GPL) version 2
*
* Modem IPC driver protocol interface header:
* private data
*/
#ifndef _MODEM_PRIVATE_H_
#define _MODEM_PRIVATE_H_
#include <linux/kernel.h>
#include <linux/spi/spi.h>
#include <linux/atomic.h>
#include <linux/interrupt.h>
#include <linux/timer.h>
#include <linux/list.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/uaccess.h>
#include "modem_protocol.h"
#include "modem_statemachine.h"
#define IPC_DRIVER_VERSION (0x03) /* APE protocol version */
#define IPC_DRIVER_MODEM_MIN_VER (0x03) /* version required from modem */
#define IPC_NBR_SUPPORTED_SPI_LINKS (2)
#define IPC_LINK_COMMON (0)
#define IPC_LINK_AUDIO (1)
#define IPC_TX_QUEUE_MAX_SIZE (1024*1024)
#define IPC_L1_HDR_SIZE (4)
#define IPC_L2_HDR_SIZE (4)
/* tx queue item (frame) */
struct ipc_tx_queue {
struct list_head node;
int actual_len;
int len;
void *data;
int counter;
};
/* context structure for an spi link */
struct ipc_link_context {
struct modem_m6718_spi_link_platform_data *link;
struct spi_device *sdev;
atomic_t gpio_configured;
atomic_t state_int;
spinlock_t sm_lock;
spinlock_t tx_q_update_lock;
atomic_t tx_q_count;
int tx_q_free;
struct list_head tx_q;
int tx_frame_counter;
const struct ipc_sm_state *state;
u32 cmd;
struct ipc_tx_queue *frame;
struct spi_message spi_message;
struct spi_transfer spi_transfer;
struct timer_list comms_timer;
struct timer_list slave_stable_timer;
#ifdef CONFIG_MODEM_M6718_SPI_ENABLE_FEATURE_VERIFY_FRAMES
struct ipc_tx_queue *last_frame;
#endif
#ifdef CONFIG_MODEM_M6718_SPI_ENABLE_FEATURE_THROUGHPUT_MEASUREMENT
u32 tx_bytes;
u32 rx_bytes;
unsigned long idl_measured_at;
unsigned long idl_idle_enter;
unsigned long idl_idle_total;
#endif
#ifdef CONFIG_DEBUG_FS
struct dentry *debugfsfile;
u8 lastevent;
u8 lastignored;
enum ipc_sm_state_id lastignored_in;
bool lastignored_inthis;
int tx_q_min;
unsigned long statesince;
#endif
};
/* context structure for the spi driver */
struct ipc_l1_context {
bool init_done;
atomic_t boot_sync_done;
struct ipc_link_context device_context[IPC_NBR_SUPPORTED_SPI_LINKS];
#ifdef CONFIG_MODEM_M6718_SPI_ENABLE_FEATURE_THROUGHPUT_MEASUREMENT
struct timer_list tp_timer;
#endif
#ifdef CONFIG_DEBUG_FS
struct dentry *debugfsdir;
struct dentry *debugfs_silentreset;
bool msr_disable;
#endif
};
#endif /* _MODEM_PRIVATE_H_ */
|