Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx
[pandora-kernel.git] / arch / arm / mach-msm / smd.c
index 2e32d9a..cf11d41 100644 (file)
 #include <linux/slab.h>
 #include <linux/debugfs.h>
 #include <linux/delay.h>
-#include <linux/io.h>
 
 #include <mach/msm_smd.h>
-#include <mach/msm_iomap.h>
 #include <mach/system.h>
 
 #include "smd_private.h"
@@ -64,21 +62,8 @@ static struct shared_info smd_info = {
 module_param_named(debug_mask, msm_smd_debug_mask,
                   int, S_IRUGO | S_IWUSR | S_IWGRP);
 
-void *smem_item(unsigned id, unsigned *size);
-static void smd_diag(void);
-
 static unsigned last_heap_free = 0xffffffff;
 
-static inline void msm_a2m_int(uint32_t irq)
-{
-#if defined(CONFIG_ARCH_MSM7X30)
-       writel(1 << irq, MSM_GCC_BASE + 0x8);
-#else
-       writel(1, MSM_CSR_BASE + 0x400 + (irq * 4));
-#endif
-}
-
-
 static inline void notify_other_smsm(void)
 {
        msm_a2m_int(5);
@@ -159,44 +144,6 @@ LIST_HEAD(smd_ch_list_dsp);
 static unsigned char smd_ch_allocated[64];
 static struct work_struct probe_work;
 
-static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type);
-
-static void smd_channel_probe_worker(struct work_struct *work)
-{
-       struct smd_alloc_elm *shared;
-       unsigned ctype;
-       unsigned type;
-       unsigned n;
-
-       shared = smem_find(ID_CH_ALLOC_TBL, sizeof(*shared) * 64);
-       if (!shared) {
-               pr_err("smd: cannot find allocation table\n");
-               return;
-       }
-       for (n = 0; n < 64; n++) {
-               if (smd_ch_allocated[n])
-                       continue;
-               if (!shared[n].ref_count)
-                       continue;
-               if (!shared[n].name[0])
-                       continue;
-               ctype = shared[n].ctype;
-               type = ctype & SMD_TYPE_MASK;
-
-               /* DAL channels are stream but neither the modem,
-                * nor the DSP correctly indicate this.  Fixup manually.
-                */
-               if (!memcmp(shared[n].name, "DAL", 3))
-                       ctype = (ctype & (~SMD_KIND_MASK)) | SMD_KIND_STREAM;
-
-               type = shared[n].ctype & SMD_TYPE_MASK;
-               if ((type == SMD_TYPE_APPS_MODEM) ||
-                   (type == SMD_TYPE_APPS_DSP))
-                       if (!smd_alloc_channel(shared[n].name, shared[n].cid, ctype))
-                               smd_ch_allocated[n] = 1;
-       }
-}
-
 /* how many bytes are available for reading */
 static int smd_stream_read_avail(struct smd_channel *ch)
 {
@@ -431,11 +378,13 @@ static irqreturn_t smd_modem_irq_handler(int irq, void *data)
        return IRQ_HANDLED;
 }
 
+#if defined(CONFIG_QDSP6)
 static irqreturn_t smd_dsp_irq_handler(int irq, void *data)
 {
        handle_smd_irq(&smd_ch_list_dsp, notify_dsp_smd);
        return IRQ_HANDLED;
 }
+#endif
 
 static void smd_fake_irq_handler(unsigned long arg)
 {
@@ -663,6 +612,42 @@ static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type)
        return 0;
 }
 
+static void smd_channel_probe_worker(struct work_struct *work)
+{
+       struct smd_alloc_elm *shared;
+       unsigned ctype;
+       unsigned type;
+       unsigned n;
+
+       shared = smem_find(ID_CH_ALLOC_TBL, sizeof(*shared) * 64);
+       if (!shared) {
+               pr_err("smd: cannot find allocation table\n");
+               return;
+       }
+       for (n = 0; n < 64; n++) {
+               if (smd_ch_allocated[n])
+                       continue;
+               if (!shared[n].ref_count)
+                       continue;
+               if (!shared[n].name[0])
+                       continue;
+               ctype = shared[n].ctype;
+               type = ctype & SMD_TYPE_MASK;
+
+               /* DAL channels are stream but neither the modem,
+                * nor the DSP correctly indicate this.  Fixup manually.
+                */
+               if (!memcmp(shared[n].name, "DAL", 3))
+                       ctype = (ctype & (~SMD_KIND_MASK)) | SMD_KIND_STREAM;
+
+               type = shared[n].ctype & SMD_TYPE_MASK;
+               if ((type == SMD_TYPE_APPS_MODEM) ||
+                   (type == SMD_TYPE_APPS_DSP))
+                       if (!smd_alloc_channel(shared[n].name, shared[n].cid, ctype))
+                               smd_ch_allocated[n] = 1;
+       }
+}
+
 static void do_nothing_notify(void *priv, unsigned flags)
 {
 }
@@ -1016,6 +1001,13 @@ static int __init msm_smd_probe(struct platform_device *pdev)
 {
        pr_info("smd_init()\n");
 
+       /*
+        * If we haven't waited for the ARM9 to boot up till now,
+        * then we need to wait here. Otherwise this should just
+        * return immediately.
+        */
+       proc_comm_boot_wait();
+
        INIT_WORK(&probe_work, smd_channel_probe_worker);
 
        if (smd_core_init()) {