aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-msm/smd_private.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-msm/smd_private.h')
-rw-r--r--arch/arm/mach-msm/smd_private.h58
1 files changed, 56 insertions, 2 deletions
diff --git a/arch/arm/mach-msm/smd_private.h b/arch/arm/mach-msm/smd_private.h
index 33a33f1b01f8..3d337ce35a61 100644
--- a/arch/arm/mach-msm/smd_private.h
+++ b/arch/arm/mach-msm/smd_private.h
@@ -61,7 +61,7 @@ struct smem_shared {
61#define SMSM_V1_SIZE (sizeof(unsigned) * 8) 61#define SMSM_V1_SIZE (sizeof(unsigned) * 8)
62#define SMSM_V2_SIZE (sizeof(unsigned) * 4) 62#define SMSM_V2_SIZE (sizeof(unsigned) * 4)
63 63
64#ifndef CONFIG_ARCH_MSM_SCORPION 64#ifdef CONFIG_MSM_SMD_PKG3
65struct smsm_interrupt_info { 65struct smsm_interrupt_info {
66 uint32_t interrupt_mask; 66 uint32_t interrupt_mask;
67 uint32_t pending_interrupts; 67 uint32_t pending_interrupts;
@@ -123,7 +123,7 @@ struct msm_dem_slave_data {
123#define SMSM_WKUP_REASON_ALARM 0x00000010 123#define SMSM_WKUP_REASON_ALARM 0x00000010
124#define SMSM_WKUP_REASON_RESET 0x00000020 124#define SMSM_WKUP_REASON_RESET 0x00000020
125 125
126#ifndef CONFIG_ARCH_MSM_SCORPION 126#ifdef CONFIG_ARCH_MSM7X00A
127enum smsm_state_item { 127enum smsm_state_item {
128 SMSM_STATE_APPS = 1, 128 SMSM_STATE_APPS = 1,
129 SMSM_STATE_MODEM = 3, 129 SMSM_STATE_MODEM = 3,
@@ -265,6 +265,7 @@ struct smd_half_channel {
265 unsigned head; 265 unsigned head;
266} __attribute__(( aligned(4), packed )); 266} __attribute__(( aligned(4), packed ));
267 267
268/* Only used on SMD package v3 on msm7201a */
268struct smd_shared_v1 { 269struct smd_shared_v1 {
269 struct smd_half_channel ch0; 270 struct smd_half_channel ch0;
270 unsigned char data0[SMD_BUF_SIZE]; 271 unsigned char data0[SMD_BUF_SIZE];
@@ -272,6 +273,7 @@ struct smd_shared_v1 {
272 unsigned char data1[SMD_BUF_SIZE]; 273 unsigned char data1[SMD_BUF_SIZE];
273}; 274};
274 275
276/* Used on SMD package v4 */
275struct smd_shared_v2 { 277struct smd_shared_v2 {
276 struct smd_half_channel ch0; 278 struct smd_half_channel ch0;
277 struct smd_half_channel ch1; 279 struct smd_half_channel ch1;
@@ -330,4 +332,56 @@ uint32_t raw_smsm_get_state(enum smsm_state_item item);
330 332
331extern void msm_init_last_radio_log(struct module *); 333extern void msm_init_last_radio_log(struct module *);
332 334
335#ifdef CONFIG_MSM_SMD_PKG3
336/*
337 * This allocator assumes an SMD Package v3 which only exists on
338 * MSM7x00 SoC's.
339 */
340static inline int _smd_alloc_channel(struct smd_channel *ch)
341{
342 struct smd_shared_v1 *shared1;
343
344 shared1 = smem_alloc(ID_SMD_CHANNELS + ch->n, sizeof(*shared1));
345 if (!shared1) {
346 pr_err("smd_alloc_channel() cid %d does not exist\n", ch->n);
347 return -1;
348 }
349 ch->send = &shared1->ch0;
350 ch->recv = &shared1->ch1;
351 ch->send_data = shared1->data0;
352 ch->recv_data = shared1->data1;
353 ch->fifo_size = SMD_BUF_SIZE;
354 return 0;
355}
356#else
357/*
358 * This allocator assumes an SMD Package v4, the most common
359 * and the default.
360 */
361static inline int _smd_alloc_channel(struct smd_channel *ch)
362{
363 struct smd_shared_v2 *shared2;
364 void *buffer;
365 unsigned buffer_sz;
366
367 shared2 = smem_alloc(SMEM_SMD_BASE_ID + ch->n, sizeof(*shared2));
368 buffer = smem_item(SMEM_SMD_FIFO_BASE_ID + ch->n, &buffer_sz);
369
370 if (!buffer)
371 return -1;
372
373 /* buffer must be a power-of-two size */
374 if (buffer_sz & (buffer_sz - 1))
375 return -1;
376
377 buffer_sz /= 2;
378 ch->send = &shared2->ch0;
379 ch->recv = &shared2->ch1;
380 ch->send_data = buffer;
381 ch->recv_data = buffer + buffer_sz;
382 ch->fifo_size = buffer_sz;
383 return 0;
384}
385#endif /* CONFIG_MSM_SMD_PKG3 */
386
333#endif 387#endif