Merge branch 'topic/asoc' into for-linus
[safe/jmp/linux-2.6] / arch / arm / plat-omap / mcbsp.c
index 4ff7a11..7e669c9 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/slab.h>
 
 #include <plat/dma.h>
 #include <plat/mcbsp.h>
@@ -488,7 +489,7 @@ void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
 {
        struct omap_mcbsp *mcbsp;
 
-       if (!cpu_is_omap34xx())
+       if (!cpu_is_omap34xx() && !cpu_is_omap44xx())
                return;
 
        if (!omap_mcbsp_check_valid_id(id)) {
@@ -510,7 +511,7 @@ void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
 {
        struct omap_mcbsp *mcbsp;
 
-       if (!cpu_is_omap34xx())
+       if (!cpu_is_omap34xx() && !cpu_is_omap44xx())
                return;
 
        if (!omap_mcbsp_check_valid_id(id)) {
@@ -641,7 +642,7 @@ static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp)
         * Enable wakup behavior, smart idle and all wakeups
         * REVISIT: some wakeups may be unnecessary
         */
-       if (cpu_is_omap34xx()) {
+       if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
                u16 syscon;
 
                syscon = MCBSP_READ(mcbsp, SYSCON);
@@ -664,7 +665,7 @@ static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp)
        /*
         * Disable wakup behavior, smart idle and all wakeups
         */
-       if (cpu_is_omap34xx()) {
+       if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
                u16 syscon;
 
                syscon = MCBSP_READ(mcbsp, SYSCON);
@@ -778,14 +779,17 @@ int omap_mcbsp_request(unsigned int id)
                        goto err_clk_disable;
                }
 
-               init_completion(&mcbsp->rx_irq_completion);
-               err = request_irq(mcbsp->rx_irq, omap_mcbsp_rx_irq_handler,
+               if (mcbsp->rx_irq) {
+                       init_completion(&mcbsp->rx_irq_completion);
+                       err = request_irq(mcbsp->rx_irq,
+                                       omap_mcbsp_rx_irq_handler,
                                        0, "McBSP", (void *)mcbsp);
-               if (err != 0) {
-                       dev_err(mcbsp->dev, "Unable to request RX IRQ %d "
-                                       "for McBSP%d\n", mcbsp->rx_irq,
-                                       mcbsp->id);
-                       goto err_free_irq;
+                       if (err != 0) {
+                               dev_err(mcbsp->dev, "Unable to request RX IRQ %d "
+                                               "for McBSP%d\n", mcbsp->rx_irq,
+                                               mcbsp->id);
+                               goto err_free_irq;
+                       }
                }
        }
 
@@ -835,7 +839,8 @@ void omap_mcbsp_free(unsigned int id)
 
        if (mcbsp->io_type == OMAP_MCBSP_IRQ_IO) {
                /* Free IRQs */
-               free_irq(mcbsp->rx_irq, (void *)mcbsp);
+               if (mcbsp->rx_irq)
+                       free_irq(mcbsp->rx_irq, (void *)mcbsp);
                free_irq(mcbsp->tx_irq, (void *)mcbsp);
        }
 
@@ -909,7 +914,7 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
                MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7));
        }
 
-       if (cpu_is_omap2430() || cpu_is_omap34xx()) {
+       if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
                /* Release the transmitter and receiver */
                w = MCBSP_READ_CACHE(mcbsp, XCCR);
                w &= ~(tx ? XDISABLE : 0);
@@ -939,7 +944,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
 
        /* Reset transmitter */
        tx &= 1;
-       if (cpu_is_omap2430() || cpu_is_omap34xx()) {
+       if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
                w = MCBSP_READ_CACHE(mcbsp, XCCR);
                w |= (tx ? XDISABLE : 0);
                MCBSP_WRITE(mcbsp, XCCR, w);
@@ -949,7 +954,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
 
        /* Reset receiver */
        rx &= 1;
-       if (cpu_is_omap2430() || cpu_is_omap34xx()) {
+       if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
                w = MCBSP_READ_CACHE(mcbsp, RCCR);
                w |= (rx ? RDISABLE : 0);
                MCBSP_WRITE(mcbsp, RCCR, w);