|
@@ -242,3 +242,133 @@ static void set_b1_regs(void)
|
|
|
omap_writew(top >> 16, OMAP1510_DMA_LCD_TOP_F1_U);
|
|
|
omap_writew(top, OMAP1510_DMA_LCD_TOP_F1_L);
|
|
|
omap_writew(bottom >> 16, OMAP1510_DMA_LCD_BOT_F1_U);
|
|
|
+ omap_writew(bottom, OMAP1510_DMA_LCD_BOT_F1_L);
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 1610 regs */
|
|
|
+ omap_writew(top >> 16, OMAP1610_DMA_LCD_TOP_B1_U);
|
|
|
+ omap_writew(top, OMAP1610_DMA_LCD_TOP_B1_L);
|
|
|
+ omap_writew(bottom >> 16, OMAP1610_DMA_LCD_BOT_B1_U);
|
|
|
+ omap_writew(bottom, OMAP1610_DMA_LCD_BOT_B1_L);
|
|
|
+
|
|
|
+ omap_writew(en, OMAP1610_DMA_LCD_SRC_EN_B1);
|
|
|
+ omap_writew(fn, OMAP1610_DMA_LCD_SRC_FN_B1);
|
|
|
+
|
|
|
+ w = omap_readw(OMAP1610_DMA_LCD_CSDP);
|
|
|
+ w &= ~0x03;
|
|
|
+ w |= lcd_dma.data_type;
|
|
|
+ omap_writew(w, OMAP1610_DMA_LCD_CSDP);
|
|
|
+
|
|
|
+ w = omap_readw(OMAP1610_DMA_LCD_CTRL);
|
|
|
+ /* Always set the source port as SDRAM for now*/
|
|
|
+ w &= ~(0x03 << 6);
|
|
|
+ if (lcd_dma.callback != NULL)
|
|
|
+ w |= 1 << 1; /* Block interrupt enable */
|
|
|
+ else
|
|
|
+ w &= ~(1 << 1);
|
|
|
+ omap_writew(w, OMAP1610_DMA_LCD_CTRL);
|
|
|
+
|
|
|
+ if (!(lcd_dma.rotate || lcd_dma.mirror ||
|
|
|
+ lcd_dma.vxres || lcd_dma.xscale || lcd_dma.yscale))
|
|
|
+ return;
|
|
|
+
|
|
|
+ w = omap_readw(OMAP1610_DMA_LCD_CCR);
|
|
|
+ /* Set the double-indexed addressing mode */
|
|
|
+ w |= (0x03 << 12);
|
|
|
+ omap_writew(w, OMAP1610_DMA_LCD_CCR);
|
|
|
+
|
|
|
+ omap_writew(ei, OMAP1610_DMA_LCD_SRC_EI_B1);
|
|
|
+ omap_writew(fi >> 16, OMAP1610_DMA_LCD_SRC_FI_B1_U);
|
|
|
+ omap_writew(fi, OMAP1610_DMA_LCD_SRC_FI_B1_L);
|
|
|
+}
|
|
|
+
|
|
|
+static irqreturn_t lcd_dma_irq_handler(int irq, void *dev_id)
|
|
|
+{
|
|
|
+ u16 w;
|
|
|
+
|
|
|
+ w = omap_readw(OMAP1610_DMA_LCD_CTRL);
|
|
|
+ if (unlikely(!(w & (1 << 3)))) {
|
|
|
+ printk(KERN_WARNING "Spurious LCD DMA IRQ\n");
|
|
|
+ return IRQ_NONE;
|
|
|
+ }
|
|
|
+ /* Ack the IRQ */
|
|
|
+ w |= (1 << 3);
|
|
|
+ omap_writew(w, OMAP1610_DMA_LCD_CTRL);
|
|
|
+ lcd_dma.active = 0;
|
|
|
+ if (lcd_dma.callback != NULL)
|
|
|
+ lcd_dma.callback(w, lcd_dma.cb_data);
|
|
|
+
|
|
|
+ return IRQ_HANDLED;
|
|
|
+}
|
|
|
+
|
|
|
+int omap_request_lcd_dma(void (*callback)(u16 status, void *data),
|
|
|
+ void *data)
|
|
|
+{
|
|
|
+ spin_lock_irq(&lcd_dma.lock);
|
|
|
+ if (lcd_dma.reserved) {
|
|
|
+ spin_unlock_irq(&lcd_dma.lock);
|
|
|
+ printk(KERN_ERR "LCD DMA channel already reserved\n");
|
|
|
+ BUG();
|
|
|
+ return -EBUSY;
|
|
|
+ }
|
|
|
+ lcd_dma.reserved = 1;
|
|
|
+ spin_unlock_irq(&lcd_dma.lock);
|
|
|
+ lcd_dma.callback = callback;
|
|
|
+ lcd_dma.cb_data = data;
|
|
|
+ lcd_dma.active = 0;
|
|
|
+ lcd_dma.single_transfer = 0;
|
|
|
+ lcd_dma.rotate = 0;
|
|
|
+ lcd_dma.vxres = 0;
|
|
|
+ lcd_dma.mirror = 0;
|
|
|
+ lcd_dma.xscale = 0;
|
|
|
+ lcd_dma.yscale = 0;
|
|
|
+ lcd_dma.ext_ctrl = 0;
|
|
|
+ lcd_dma.src_port = 0;
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(omap_request_lcd_dma);
|
|
|
+
|
|
|
+void omap_free_lcd_dma(void)
|
|
|
+{
|
|
|
+ spin_lock(&lcd_dma.lock);
|
|
|
+ if (!lcd_dma.reserved) {
|
|
|
+ spin_unlock(&lcd_dma.lock);
|
|
|
+ printk(KERN_ERR "LCD DMA is not reserved\n");
|
|
|
+ BUG();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!cpu_is_omap15xx())
|
|
|
+ omap_writew(omap_readw(OMAP1610_DMA_LCD_CCR) & ~1,
|
|
|
+ OMAP1610_DMA_LCD_CCR);
|
|
|
+ lcd_dma.reserved = 0;
|
|
|
+ spin_unlock(&lcd_dma.lock);
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(omap_free_lcd_dma);
|
|
|
+
|
|
|
+void omap_enable_lcd_dma(void)
|
|
|
+{
|
|
|
+ u16 w;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Set the Enable bit only if an external controller is
|
|
|
+ * connected. Otherwise the OMAP internal controller will
|
|
|
+ * start the transfer when it gets enabled.
|
|
|
+ */
|
|
|
+ if (cpu_is_omap15xx() || !lcd_dma.ext_ctrl)
|
|
|
+ return;
|
|
|
+
|
|
|
+ w = omap_readw(OMAP1610_DMA_LCD_CTRL);
|
|
|
+ w |= 1 << 8;
|
|
|
+ omap_writew(w, OMAP1610_DMA_LCD_CTRL);
|
|
|
+
|
|
|
+ lcd_dma.active = 1;
|
|
|
+
|
|
|
+ w = omap_readw(OMAP1610_DMA_LCD_CCR);
|
|
|
+ w |= 1 << 7;
|
|
|
+ omap_writew(w, OMAP1610_DMA_LCD_CCR);
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(omap_enable_lcd_dma);
|
|
|
+
|