aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/phone_svn/svnet/sipc4.h
blob: 40e67149e19a49bfcd9de57df8bc766f710f681f (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
/**
 * SAMSUNG MODEM IPC header version 4
 *
 * Copyright (C) 2010 Samsung Electronics. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef __SAMSUNG_IPC_V4_H__
#define __SAMSUNG_IPC_V4_H__

/* IPC4.1 NEW PARTITION MAP
 * This map is seen by AP side

	0x00_0000       ===========================================
			MAGIC(4)| ACCESS(4)     |       RESERVED(8)
	0x00_0010       -------------------------------------------
			FMT_OUT_PTR             |       FMT_IN_PTR
			HEAD(4) | TAIL(4)       | HEAD(4) | TAIL(4)
	0x00_0020       -------------------------------------------
			RAW_OUT_PTR             |       RAW_IN_PTR
			HEAD(4) | TAIL(4)       | HEAD(4) | TAIL(4)
	0x00_0030       -------------------------------------------
			RFS_OUT_PTR             |       RFS_IN_PTR
			HEAD(4) | TAIL(4)       | HEAD(4) | TAIL(4)
	0x00_0040       -------------------------------------------
			RESERVED                        (4KB - 64B)
	0x00_1000       -------------------------------------------
			CP Fatal Display                (160B)
	0x00_10A0       -------------------------------------------
			RESERVED        (1MB - 4kb-4kb-4kb - 160B)
	0x0F_E000       -------------------------------------------
			Formatted Out                   (64KB)
	0x10_E000       -------------------------------------------
			Formatted In                    (64KB)
	0x11_E000       ===========================================
			Raw Out                         (1MB)
	0x21_E000       ===========================================
			Raw In                          (1MB)
	0x31_E000       ===========================================
			RemoteFS Out                    (1MB)
	0x41_E000       ===========================================
			RemoteFS In                     (1MB)
	0x51_E000       ===========================================

	0xFF_FFFF       ===========================================
*/

#if defined(CONFIG_PHONE_IPC_SPI)
#define FMT_OUT	0x0FE000
#define FMT_IN		0x10E000
#define FMT_SZ		0x10000   /* 65536 bytes */

#define RAW_OUT	0x11E000
#define RAW_IN		0x21E000
#define RAW_SZ		0x100000 /* 1 MB */

#define RFS_OUT	0x31E000
#define RFS_IN		0x41E000
#define RFS_SZ		0x100000 /* 1 MB */
#else
#if defined(CONFIG_PHONE_IPC_HSI)
#define FMT_OUT	0x0FE000
#define FMT_IN		0x10E000
#define FMT_SZ		0x10000   /* 65536 bytes */

#define RAW_OUT	0x11E000
#define RAW_IN		0x21E000
#define RAW_SZ		0x100000 /* 1 MB */

#define RFS_OUT	0x31E000
#define RFS_IN		0x41E000
#define RFS_SZ		0x100000 /* 1 MB */
#endif
#endif

#define FATAL_DISP     0x001000
#define FATAL_DISP_SZ  0xA0  /* 160 bytes */

#define SIPC_MAP_SIZE (RFS_IN + RFS_SZ)
#define SIPC_NAME "IPCv4.1"

enum {
	IPCIDX_FMT = 0,
	IPCIDX_RAW,
	IPCIDX_RFS,
	IPCIDX_MAX
};

struct ringbuf_cont {
	u32 out_head;
	u32 out_tail;
	u32 in_head;
	u32 in_tail;
};

struct sipc_mapped { /* map to the onedram start addr */
	u32 magic;
	u32 access;
	u32 reserved[2];

	struct ringbuf_cont rbcont[IPCIDX_MAX];
};


#define PN_CMD 0x00
#define PN_FMT 0x01
#define PN_RFS 0x41
#define PN_RAW(chid) (0x20 | (chid))
#define CHID(x) ((x) & 0x1F)

#define res_to_ridx(x) ((x) >> 5)

/*
 * IPC Frame Format
 */
#define HDLC_START	0x7F
#define HDLC_END	0x7E

/* Formatted IPC Frame */
struct fmt_hdr {
	u16 len;
	u8 control;
} __packed;

#define FMT_ID_MASK 0x7F /* Information ID mask */
#define FMT_ID_SIZE 0x80 /* = 128 ( 0 ~ 127 ) */
#define FMT_MB_MASK 0x80 /* More bit mask */

#define FMT_TX_MIN 5 /* ??? */

#define is_fmt_last(x) (!((x) & FMT_MB_MASK))

/* RAW IPC Frame */
struct raw_hdr {
	u32 len;
	u8 channel;
	u8 control;
} __packed;


/* RFS IPC Frame */
struct rfs_hdr {
	u32 len;
	u8 cmd;
	u8 id;
} __packed;

/*
 * RAW frame channel ID
 */
enum {
	CHID_0 = 0,
	CHID_CSD_VT_DATA,
	CHID_PDS_PVT_CONTROL,
	CHID_PDS_VT_AUDIO,
	CHID_PDS_VT_VIDEO,
	CHID_5,                /* 5 */
	CHID_6,
	CHID_CDMA_DATA,
	CHID_PCM_DATA,
	CHID_TRANSFER_SCREEN,
	CHID_PSD_DATA1,        /* 10 */
	CHID_PSD_DATA2,
	CHID_PSD_DATA3,
	CHID_PSD_DATA4,
	CHID_PSD_DATA5,
	CHID_PSD_DATA6,        /* 15 */
	CHID_PSD_DATA7,
	CHID_PSD_DATA8,
	CHID_PSD_DATA9,
	CHID_PSD_DATA10,
	CHID_PSD_DATA11,       /* 20 */
	CHID_PSD_DATA12,
	CHID_PSD_DATA13,
	CHID_PSD_DATA14,
	CHID_PSD_DATA15,
	CHID_BT_DUN,           /* 25 */
	CHID_CIQ_BRIDGE_DATA,
	CHID_27,
	CHID_CP_LOG1,
	CHID_CP_LOG2,
	CHID_30,               /* 30 */
	CHID_31,
	CHID_MAX
};

#define PDP_MAX 15
#define PN_PDP_START PN_RAW(CHID_PSD_DATA1)
#define PN_PDP_END PN_RAW(CHID_PSD_DATA15)

#define PN_PDP(chid) (0x20 | ((chid) + CHID_PSD_DATA1 - 1))
#define PDP_ID(res) ((res) - PN_PDP_START)


/*
 * IPC 4.0 Mailbox message definition
 */
#define MB_VALID          0x0080
#define MB_COMMAND        0x0040

#define MB_CMD(x)         (MB_VALID | MB_COMMAND | x)
#define MB_DATA(x)        (MB_VALID | x)

/*
 * If not command
 */
#define MBD_SEND_FMT      0x0002
#define MBD_SEND_RAW      0x0001
#define MBD_SEND_RFS      0x0100
#define MBD_REQ_ACK_FMT   0x0020
#define MBD_REQ_ACK_RAW   0x0010
#define MBD_REQ_ACK_RFS   0x0400
#define MBD_RES_ACK_FMT   0x0008
#define MBD_RES_ACK_RAW   0x0004
#define MBD_RES_ACK_RFS   0x0200

/*
 * If command
 */
enum {
	MBC_NONE = 0,
	MBC_INIT_START,
	MBC_INIT_END,
	MBC_REQ_ACTIVE,
	MBC_RES_ACTIVE,
	MBC_TIME_SYNC,
	MBC_POWER_OFF,
	MBC_RESET,
	MBC_PHONE_START,
	MBC_ERR_DISPLAY,
	MBC_POWER_SAVE,
	MBC_NV_REBUILD,
	MBC_EMER_DOWN,
	MBC_REQ_SEM,
	MBC_RES_SEM,
	MBC_MAX
};
#define MBC_MASK 0xFF

/* CMD_INIT_END extended bit */
#define CP_BOOT_ONLINE     0x0000
#define CP_BOOT_AIRPLANE   0x1000
#define AP_OS_ANDROID      0x0100
#define AP_OS_WINMOBILE    0x0200
#define AP_OS_LINUX        0x0300
#define AP_OS_SYMBIAN      0x0400

/* CMD_PHONE_START extended bit */
#define CP_QUALCOMM        0x0100
#define CP_INFINEON        0x0200
#define CP_BROADCOM        0x0300


#endif /* __SAMSUNG_IPC_V4_H__ */