|
@@ -312,3 +312,92 @@ struct smd_channel {
|
|
|
struct platform_device pdev;
|
|
|
};
|
|
|
|
|
|
+#define SMD_TYPE_MASK 0x0FF
|
|
|
+#define SMD_TYPE_APPS_MODEM 0x000
|
|
|
+#define SMD_TYPE_APPS_DSP 0x001
|
|
|
+#define SMD_TYPE_MODEM_DSP 0x002
|
|
|
+
|
|
|
+#define SMD_KIND_MASK 0xF00
|
|
|
+#define SMD_KIND_UNKNOWN 0x000
|
|
|
+#define SMD_KIND_STREAM 0x100
|
|
|
+#define SMD_KIND_PACKET 0x200
|
|
|
+
|
|
|
+extern struct list_head smd_ch_closed_list;
|
|
|
+extern struct list_head smd_ch_list_modem;
|
|
|
+extern struct list_head smd_ch_list_dsp;
|
|
|
+
|
|
|
+extern spinlock_t smd_lock;
|
|
|
+extern spinlock_t smem_lock;
|
|
|
+
|
|
|
+void *smem_find(unsigned id, unsigned size);
|
|
|
+void *smem_item(unsigned id, unsigned *size);
|
|
|
+uint32_t raw_smsm_get_state(enum smsm_state_item item);
|
|
|
+
|
|
|
+extern void msm_init_last_radio_log(struct module *);
|
|
|
+
|
|
|
+#ifdef CONFIG_MSM_SMD_PKG3
|
|
|
+/*
|
|
|
+ * This allocator assumes an SMD Package v3 which only exists on
|
|
|
+ * MSM7x00 SoC's.
|
|
|
+ */
|
|
|
+static inline int _smd_alloc_channel(struct smd_channel *ch)
|
|
|
+{
|
|
|
+ struct smd_shared_v1 *shared1;
|
|
|
+
|
|
|
+ shared1 = smem_alloc(ID_SMD_CHANNELS + ch->n, sizeof(*shared1));
|
|
|
+ if (!shared1) {
|
|
|
+ pr_err("smd_alloc_channel() cid %d does not exist\n", ch->n);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ ch->send = &shared1->ch0;
|
|
|
+ ch->recv = &shared1->ch1;
|
|
|
+ ch->send_data = shared1->data0;
|
|
|
+ ch->recv_data = shared1->data1;
|
|
|
+ ch->fifo_size = SMD_BUF_SIZE;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+#else
|
|
|
+/*
|
|
|
+ * This allocator assumes an SMD Package v4, the most common
|
|
|
+ * and the default.
|
|
|
+ */
|
|
|
+static inline int _smd_alloc_channel(struct smd_channel *ch)
|
|
|
+{
|
|
|
+ struct smd_shared_v2 *shared2;
|
|
|
+ void *buffer;
|
|
|
+ unsigned buffer_sz;
|
|
|
+
|
|
|
+ shared2 = smem_alloc(SMEM_SMD_BASE_ID + ch->n, sizeof(*shared2));
|
|
|
+ buffer = smem_item(SMEM_SMD_FIFO_BASE_ID + ch->n, &buffer_sz);
|
|
|
+
|
|
|
+ if (!buffer)
|
|
|
+ return -1;
|
|
|
+
|
|
|
+ /* buffer must be a power-of-two size */
|
|
|
+ if (buffer_sz & (buffer_sz - 1))
|
|
|
+ return -1;
|
|
|
+
|
|
|
+ buffer_sz /= 2;
|
|
|
+ ch->send = &shared2->ch0;
|
|
|
+ ch->recv = &shared2->ch1;
|
|
|
+ ch->send_data = buffer;
|
|
|
+ ch->recv_data = buffer + buffer_sz;
|
|
|
+ ch->fifo_size = buffer_sz;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+#endif /* CONFIG_MSM_SMD_PKG3 */
|
|
|
+
|
|
|
+#if defined(CONFIG_ARCH_MSM7X30)
|
|
|
+static inline void msm_a2m_int(uint32_t irq)
|
|
|
+{
|
|
|
+ writel(1 << irq, MSM_GCC_BASE + 0x8);
|
|
|
+}
|
|
|
+#else
|
|
|
+static inline void msm_a2m_int(uint32_t irq)
|
|
|
+{
|
|
|
+ writel(1, MSM_CSR_BASE + 0x400 + (irq * 4));
|
|
|
+}
|
|
|
+#endif /* CONFIG_ARCH_MSM7X30 */
|
|
|
+
|
|
|
+
|
|
|
+#endif
|