ARM: omap1: move lcd_dma code into omapfb driver
authorArnd Bergmann <arnd@arndb.de>
Mon, 5 Aug 2019 21:15:37 +0000 (23:15 +0200)
committerArnd Bergmann <arnd@arndb.de>
Thu, 21 Apr 2022 13:00:45 +0000 (15:00 +0200)
The omapfb driver is split into platform specific code for omap1, and
driver code that is also specific to omap1.

Moving both parts into the driver directory simplifies the structure
and avoids the dependency on certain omap machine header files.

As mach/lcd_dma.h can not be included from include/linux/omap-dma.h
any more now, move the omap_lcd_dma_running() declaration into the
omap-dma header, which matches where it is defined.

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
12 files changed:
arch/arm/mach-omap1/Makefile
arch/arm/mach-omap1/include/mach/lcd_dma.h [deleted file]
arch/arm/mach-omap1/include/mach/lcdc.h [deleted file]
arch/arm/mach-omap1/lcd_dma.c [deleted file]
drivers/video/fbdev/Makefile
drivers/video/fbdev/omap/Makefile
drivers/video/fbdev/omap/lcd_dma.c [new file with mode: 0644]
drivers/video/fbdev/omap/lcd_dma.h [new file with mode: 0644]
drivers/video/fbdev/omap/lcdc.c
drivers/video/fbdev/omap/lcdc.h
drivers/video/fbdev/omap/sossi.c
include/linux/omap-dma.h

index c757a52d080136b91cd3fa50890d839eb5e00e80..450bbf552b571b768c14666978c9d5114daf087c 100644 (file)
@@ -57,7 +57,3 @@ obj-$(CONFIG_ARCH_OMAP730)            += gpio7xx.o
 obj-$(CONFIG_ARCH_OMAP850)             += gpio7xx.o
 obj-$(CONFIG_ARCH_OMAP15XX)            += gpio15xx.o
 obj-$(CONFIG_ARCH_OMAP16XX)            += gpio16xx.o
-
-ifneq ($(CONFIG_FB_OMAP),)
-obj-y += lcd_dma.o
-endif
diff --git a/arch/arm/mach-omap1/include/mach/lcd_dma.h b/arch/arm/mach-omap1/include/mach/lcd_dma.h
deleted file mode 100644 (file)
index 1a3c0cf..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- *  arch/arm/mach-omap1/include/mach/lcd_dma.h
- *
- * Extracted from arch/arm/plat-omap/include/plat/dma.h
- *  Copyright (C) 2003 Nokia Corporation
- *  Author: Juha Yrjölä <juha.yrjola@nokia.com>
- */
-#ifndef __MACH_OMAP1_LCD_DMA_H__
-#define __MACH_OMAP1_LCD_DMA_H__
-
-/* Hardware registers for LCD DMA */
-#define OMAP1510_DMA_LCD_BASE          (0xfffedb00)
-#define OMAP1510_DMA_LCD_CTRL          (OMAP1510_DMA_LCD_BASE + 0x00)
-#define OMAP1510_DMA_LCD_TOP_F1_L      (OMAP1510_DMA_LCD_BASE + 0x02)
-#define OMAP1510_DMA_LCD_TOP_F1_U      (OMAP1510_DMA_LCD_BASE + 0x04)
-#define OMAP1510_DMA_LCD_BOT_F1_L      (OMAP1510_DMA_LCD_BASE + 0x06)
-#define OMAP1510_DMA_LCD_BOT_F1_U      (OMAP1510_DMA_LCD_BASE + 0x08)
-
-#define OMAP1610_DMA_LCD_BASE          (0xfffee300)
-#define OMAP1610_DMA_LCD_CSDP          (OMAP1610_DMA_LCD_BASE + 0xc0)
-#define OMAP1610_DMA_LCD_CCR           (OMAP1610_DMA_LCD_BASE + 0xc2)
-#define OMAP1610_DMA_LCD_CTRL          (OMAP1610_DMA_LCD_BASE + 0xc4)
-#define OMAP1610_DMA_LCD_TOP_B1_L      (OMAP1610_DMA_LCD_BASE + 0xc8)
-#define OMAP1610_DMA_LCD_TOP_B1_U      (OMAP1610_DMA_LCD_BASE + 0xca)
-#define OMAP1610_DMA_LCD_BOT_B1_L      (OMAP1610_DMA_LCD_BASE + 0xcc)
-#define OMAP1610_DMA_LCD_BOT_B1_U      (OMAP1610_DMA_LCD_BASE + 0xce)
-#define OMAP1610_DMA_LCD_TOP_B2_L      (OMAP1610_DMA_LCD_BASE + 0xd0)
-#define OMAP1610_DMA_LCD_TOP_B2_U      (OMAP1610_DMA_LCD_BASE + 0xd2)
-#define OMAP1610_DMA_LCD_BOT_B2_L      (OMAP1610_DMA_LCD_BASE + 0xd4)
-#define OMAP1610_DMA_LCD_BOT_B2_U      (OMAP1610_DMA_LCD_BASE + 0xd6)
-#define OMAP1610_DMA_LCD_SRC_EI_B1     (OMAP1610_DMA_LCD_BASE + 0xd8)
-#define OMAP1610_DMA_LCD_SRC_FI_B1_L   (OMAP1610_DMA_LCD_BASE + 0xda)
-#define OMAP1610_DMA_LCD_SRC_EN_B1     (OMAP1610_DMA_LCD_BASE + 0xe0)
-#define OMAP1610_DMA_LCD_SRC_FN_B1     (OMAP1610_DMA_LCD_BASE + 0xe4)
-#define OMAP1610_DMA_LCD_LCH_CTRL      (OMAP1610_DMA_LCD_BASE + 0xea)
-#define OMAP1610_DMA_LCD_SRC_FI_B1_U   (OMAP1610_DMA_LCD_BASE + 0xf4)
-
-/* LCD DMA block numbers */
-enum {
-       OMAP_LCD_DMA_B1_TOP,
-       OMAP_LCD_DMA_B1_BOTTOM,
-       OMAP_LCD_DMA_B2_TOP,
-       OMAP_LCD_DMA_B2_BOTTOM
-};
-
-/* LCD DMA functions */
-extern int omap_request_lcd_dma(void (*callback)(u16 status, void *data),
-                               void *data);
-extern void omap_free_lcd_dma(void);
-extern void omap_setup_lcd_dma(void);
-extern void omap_enable_lcd_dma(void);
-extern void omap_stop_lcd_dma(void);
-extern void omap_set_lcd_dma_ext_controller(int external);
-extern void omap_set_lcd_dma_single_transfer(int single);
-extern void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
-                               int data_type);
-extern void omap_set_lcd_dma_b1_rotation(int rotate);
-extern void omap_set_lcd_dma_b1_vxres(unsigned long vxres);
-extern void omap_set_lcd_dma_b1_mirror(int mirror);
-extern void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale);
-
-extern int omap_lcd_dma_running(void);
-
-#endif /* __MACH_OMAP1_LCD_DMA_H__ */
diff --git a/arch/arm/mach-omap1/include/mach/lcdc.h b/arch/arm/mach-omap1/include/mach/lcdc.h
deleted file mode 100644 (file)
index 7152db1..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * arch/arm/mach-omap1/include/mach/lcdc.h
- *
- * Extracted from drivers/video/omap/lcdc.c
- * Copyright (C) 2004 Nokia Corporation
- * Author: Imre Deak <imre.deak@nokia.com>
- */
-#ifndef __MACH_LCDC_H__
-#define __MACH_LCDC_H__
-
-#define OMAP_LCDC_BASE                 0xfffec000
-#define OMAP_LCDC_SIZE                 256
-#define OMAP_LCDC_IRQ                  INT_LCD_CTRL
-
-#define OMAP_LCDC_CONTROL              (OMAP_LCDC_BASE + 0x00)
-#define OMAP_LCDC_TIMING0              (OMAP_LCDC_BASE + 0x04)
-#define OMAP_LCDC_TIMING1              (OMAP_LCDC_BASE + 0x08)
-#define OMAP_LCDC_TIMING2              (OMAP_LCDC_BASE + 0x0c)
-#define OMAP_LCDC_STATUS               (OMAP_LCDC_BASE + 0x10)
-#define OMAP_LCDC_SUBPANEL             (OMAP_LCDC_BASE + 0x14)
-#define OMAP_LCDC_LINE_INT             (OMAP_LCDC_BASE + 0x18)
-#define OMAP_LCDC_DISPLAY_STATUS       (OMAP_LCDC_BASE + 0x1c)
-
-#define OMAP_LCDC_STAT_DONE            (1 << 0)
-#define OMAP_LCDC_STAT_VSYNC           (1 << 1)
-#define OMAP_LCDC_STAT_SYNC_LOST       (1 << 2)
-#define OMAP_LCDC_STAT_ABC             (1 << 3)
-#define OMAP_LCDC_STAT_LINE_INT                (1 << 4)
-#define OMAP_LCDC_STAT_FUF             (1 << 5)
-#define OMAP_LCDC_STAT_LOADED_PALETTE  (1 << 6)
-
-#define OMAP_LCDC_CTRL_LCD_EN          (1 << 0)
-#define OMAP_LCDC_CTRL_LCD_TFT         (1 << 7)
-#define OMAP_LCDC_CTRL_LINE_IRQ_CLR_SEL        (1 << 10)
-
-#define OMAP_LCDC_IRQ_VSYNC            (1 << 2)
-#define OMAP_LCDC_IRQ_DONE             (1 << 3)
-#define OMAP_LCDC_IRQ_LOADED_PALETTE   (1 << 4)
-#define OMAP_LCDC_IRQ_LINE_NIRQ                (1 << 5)
-#define OMAP_LCDC_IRQ_LINE             (1 << 6)
-#define OMAP_LCDC_IRQ_MASK             (((1 << 5) - 1) << 2)
-
-#endif /* __MACH_LCDC_H__ */
diff --git a/arch/arm/mach-omap1/lcd_dma.c b/arch/arm/mach-omap1/lcd_dma.c
deleted file mode 100644 (file)
index a72ac0c..0000000
+++ /dev/null
@@ -1,441 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * linux/arch/arm/mach-omap1/lcd_dma.c
- *
- * Extracted from arch/arm/plat-omap/dma.c
- * Copyright (C) 2003 - 2008 Nokia Corporation
- * Author: Juha Yrjölä <juha.yrjola@nokia.com>
- * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com>
- * Graphics DMA and LCD DMA graphics tranformations
- * by Imre Deak <imre.deak@nokia.com>
- * OMAP2/3 support Copyright (C) 2004-2007 Texas Instruments, Inc.
- * Merged to support both OMAP1 and OMAP2 by Tony Lindgren <tony@atomide.com>
- * Some functions based on earlier dma-omap.c Copyright (C) 2001 RidgeRun, Inc.
- *
- * Copyright (C) 2009 Texas Instruments
- * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
- *
- * Support functions for the OMAP internal DMA channels.
- */
-
-#include <linux/module.h>
-#include <linux/spinlock.h>
-#include <linux/interrupt.h>
-#include <linux/io.h>
-
-#include <linux/omap-dma.h>
-
-#include <mach/hardware.h>
-#include <mach/lcdc.h>
-
-int omap_lcd_dma_running(void)
-{
-       /*
-        * On OMAP1510, internal LCD controller will start the transfer
-        * when it gets enabled, so assume DMA running if LCD enabled.
-        */
-       if (cpu_is_omap15xx())
-               if (omap_readw(OMAP_LCDC_CONTROL) & OMAP_LCDC_CTRL_LCD_EN)
-                       return 1;
-
-       /* Check if LCD DMA is running */
-       if (cpu_is_omap16xx())
-               if (omap_readw(OMAP1610_DMA_LCD_CCR) & OMAP_DMA_CCR_EN)
-                       return 1;
-
-       return 0;
-}
-
-static struct lcd_dma_info {
-       spinlock_t lock;
-       int reserved;
-       void (*callback)(u16 status, void *data);
-       void *cb_data;
-
-       int active;
-       unsigned long addr;
-       int rotate, data_type, xres, yres;
-       int vxres;
-       int mirror;
-       int xscale, yscale;
-       int ext_ctrl;
-       int src_port;
-       int single_transfer;
-} lcd_dma;
-
-void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
-                        int data_type)
-{
-       lcd_dma.addr = addr;
-       lcd_dma.data_type = data_type;
-       lcd_dma.xres = fb_xres;
-       lcd_dma.yres = fb_yres;
-}
-EXPORT_SYMBOL(omap_set_lcd_dma_b1);
-
-void omap_set_lcd_dma_ext_controller(int external)
-{
-       lcd_dma.ext_ctrl = external;
-}
-EXPORT_SYMBOL(omap_set_lcd_dma_ext_controller);
-
-void omap_set_lcd_dma_single_transfer(int single)
-{
-       lcd_dma.single_transfer = single;
-}
-EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer);
-
-void omap_set_lcd_dma_b1_rotation(int rotate)
-{
-       if (cpu_is_omap15xx()) {
-               printk(KERN_ERR "DMA rotation is not supported in 1510 mode\n");
-               BUG();
-               return;
-       }
-       lcd_dma.rotate = rotate;
-}
-EXPORT_SYMBOL(omap_set_lcd_dma_b1_rotation);
-
-void omap_set_lcd_dma_b1_mirror(int mirror)
-{
-       if (cpu_is_omap15xx()) {
-               printk(KERN_ERR "DMA mirror is not supported in 1510 mode\n");
-               BUG();
-       }
-       lcd_dma.mirror = mirror;
-}
-EXPORT_SYMBOL(omap_set_lcd_dma_b1_mirror);
-
-void omap_set_lcd_dma_b1_vxres(unsigned long vxres)
-{
-       if (cpu_is_omap15xx()) {
-               pr_err("DMA virtual resolution is not supported in 1510 mode\n");
-               BUG();
-       }
-       lcd_dma.vxres = vxres;
-}
-EXPORT_SYMBOL(omap_set_lcd_dma_b1_vxres);
-
-void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale)
-{
-       if (cpu_is_omap15xx()) {
-               printk(KERN_ERR "DMA scale is not supported in 1510 mode\n");
-               BUG();
-       }
-       lcd_dma.xscale = xscale;
-       lcd_dma.yscale = yscale;
-}
-EXPORT_SYMBOL(omap_set_lcd_dma_b1_scale);
-
-static void set_b1_regs(void)
-{
-       unsigned long top, bottom;
-       int es;
-       u16 w;
-       unsigned long en, fn;
-       long ei, fi;
-       unsigned long vxres;
-       unsigned int xscale, yscale;
-
-       switch (lcd_dma.data_type) {
-       case OMAP_DMA_DATA_TYPE_S8:
-               es = 1;
-               break;
-       case OMAP_DMA_DATA_TYPE_S16:
-               es = 2;
-               break;
-       case OMAP_DMA_DATA_TYPE_S32:
-               es = 4;
-               break;
-       default:
-               BUG();
-               return;
-       }
-
-       vxres = lcd_dma.vxres ? lcd_dma.vxres : lcd_dma.xres;
-       xscale = lcd_dma.xscale ? lcd_dma.xscale : 1;
-       yscale = lcd_dma.yscale ? lcd_dma.yscale : 1;
-       BUG_ON(vxres < lcd_dma.xres);
-
-#define PIXADDR(x, y) (lcd_dma.addr +                                  \
-               ((y) * vxres * yscale + (x) * xscale) * es)
-#define PIXSTEP(sx, sy, dx, dy) (PIXADDR(dx, dy) - PIXADDR(sx, sy) - es + 1)
-
-       switch (lcd_dma.rotate) {
-       case 0:
-               if (!lcd_dma.mirror) {
-                       top = PIXADDR(0, 0);
-                       bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
-                       /* 1510 DMA requires the bottom address to be 2 more
-                        * than the actual last memory access location. */
-                       if (cpu_is_omap15xx() &&
-                               lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32)
-                                       bottom += 2;
-                       ei = PIXSTEP(0, 0, 1, 0);
-                       fi = PIXSTEP(lcd_dma.xres - 1, 0, 0, 1);
-               } else {
-                       top = PIXADDR(lcd_dma.xres - 1, 0);
-                       bottom = PIXADDR(0, lcd_dma.yres - 1);
-                       ei = PIXSTEP(1, 0, 0, 0);
-                       fi = PIXSTEP(0, 0, lcd_dma.xres - 1, 1);
-               }
-               en = lcd_dma.xres;
-               fn = lcd_dma.yres;
-               break;
-       case 90:
-               if (!lcd_dma.mirror) {
-                       top = PIXADDR(0, lcd_dma.yres - 1);
-                       bottom = PIXADDR(lcd_dma.xres - 1, 0);
-                       ei = PIXSTEP(0, 1, 0, 0);
-                       fi = PIXSTEP(0, 0, 1, lcd_dma.yres - 1);
-               } else {
-                       top = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
-                       bottom = PIXADDR(0, 0);
-                       ei = PIXSTEP(0, 1, 0, 0);
-                       fi = PIXSTEP(1, 0, 0, lcd_dma.yres - 1);
-               }
-               en = lcd_dma.yres;
-               fn = lcd_dma.xres;
-               break;
-       case 180:
-               if (!lcd_dma.mirror) {
-                       top = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
-                       bottom = PIXADDR(0, 0);
-                       ei = PIXSTEP(1, 0, 0, 0);
-                       fi = PIXSTEP(0, 1, lcd_dma.xres - 1, 0);
-               } else {
-                       top = PIXADDR(0, lcd_dma.yres - 1);
-                       bottom = PIXADDR(lcd_dma.xres - 1, 0);
-                       ei = PIXSTEP(0, 0, 1, 0);
-                       fi = PIXSTEP(lcd_dma.xres - 1, 1, 0, 0);
-               }
-               en = lcd_dma.xres;
-               fn = lcd_dma.yres;
-               break;
-       case 270:
-               if (!lcd_dma.mirror) {
-                       top = PIXADDR(lcd_dma.xres - 1, 0);
-                       bottom = PIXADDR(0, lcd_dma.yres - 1);
-                       ei = PIXSTEP(0, 0, 0, 1);
-                       fi = PIXSTEP(1, lcd_dma.yres - 1, 0, 0);
-               } else {
-                       top = PIXADDR(0, 0);
-                       bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
-                       ei = PIXSTEP(0, 0, 0, 1);
-                       fi = PIXSTEP(0, lcd_dma.yres - 1, 1, 0);
-               }
-               en = lcd_dma.yres;
-               fn = lcd_dma.xres;
-               break;
-       default:
-               BUG();
-               return; /* Suppress warning about uninitialized vars */
-       }
-
-       if (cpu_is_omap15xx()) {
-               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);
-
-void omap_setup_lcd_dma(void)
-{
-       BUG_ON(lcd_dma.active);
-       if (!cpu_is_omap15xx()) {
-               /* Set some reasonable defaults */
-               omap_writew(0x5440, OMAP1610_DMA_LCD_CCR);
-               omap_writew(0x9102, OMAP1610_DMA_LCD_CSDP);
-               omap_writew(0x0004, OMAP1610_DMA_LCD_LCH_CTRL);
-       }
-       set_b1_regs();
-       if (!cpu_is_omap15xx()) {
-               u16 w;
-
-               w = omap_readw(OMAP1610_DMA_LCD_CCR);
-               /*
-                * If DMA was already active set the end_prog bit to have
-                * the programmed register set loaded into the active
-                * register set.
-                */
-               w |= 1 << 11;           /* End_prog */
-               if (!lcd_dma.single_transfer)
-                       w |= (3 << 8);  /* Auto_init, repeat */
-               omap_writew(w, OMAP1610_DMA_LCD_CCR);
-       }
-}
-EXPORT_SYMBOL(omap_setup_lcd_dma);
-
-void omap_stop_lcd_dma(void)
-{
-       u16 w;
-
-       lcd_dma.active = 0;
-       if (cpu_is_omap15xx() || !lcd_dma.ext_ctrl)
-               return;
-
-       w = omap_readw(OMAP1610_DMA_LCD_CCR);
-       w &= ~(1 << 7);
-       omap_writew(w, OMAP1610_DMA_LCD_CCR);
-
-       w = omap_readw(OMAP1610_DMA_LCD_CTRL);
-       w &= ~(1 << 8);
-       omap_writew(w, OMAP1610_DMA_LCD_CTRL);
-}
-EXPORT_SYMBOL(omap_stop_lcd_dma);
-
-static int __init omap_init_lcd_dma(void)
-{
-       int r;
-
-       if (!cpu_class_is_omap1())
-               return -ENODEV;
-
-       if (cpu_is_omap16xx()) {
-               u16 w;
-
-               /* this would prevent OMAP sleep */
-               w = omap_readw(OMAP1610_DMA_LCD_CTRL);
-               w &= ~(1 << 8);
-               omap_writew(w, OMAP1610_DMA_LCD_CTRL);
-       }
-
-       spin_lock_init(&lcd_dma.lock);
-
-       r = request_irq(INT_DMA_LCD, lcd_dma_irq_handler, 0,
-                       "LCD DMA", NULL);
-       if (r != 0)
-               pr_err("unable to request IRQ for LCD DMA (error %d)\n", r);
-
-       return r;
-}
-
-arch_initcall(omap_init_lcd_dma);
-
index 477b9624b70333b0bc44626faadc73ce5161fabd..7795c4126706fd7bb832d94da5d14b0060849d1f 100644 (file)
@@ -110,7 +110,7 @@ obj-$(CONFIG_FB_UDL)                  += udlfb.o
 obj-$(CONFIG_FB_SMSCUFX)         += smscufx.o
 obj-$(CONFIG_FB_XILINX)           += xilinxfb.o
 obj-$(CONFIG_FB_SH_MOBILE_LCDC)          += sh_mobile_lcdcfb.o
-obj-$(CONFIG_FB_OMAP)             += omap/
+obj-y                            += omap/
 obj-y                             += omap2/
 obj-$(CONFIG_XEN_FBDEV_FRONTEND)  += xen-fbfront.o
 obj-$(CONFIG_FB_CARMINE)          += carminefb.o
index daaa73a94e7fdcb1d236788252f54c8ae98b4f3e..b88e02f5cb1ff00f17138822b3f12ee4114bcebe 100644 (file)
@@ -5,6 +5,11 @@
 
 obj-$(CONFIG_FB_OMAP) += omapfb.o
 
+ifdef CONFIG_FB_OMAP
+# must be built-in
+obj-y += lcd_dma.o
+endif
+
 objs-yy := omapfb_main.o lcdc.o
 
 objs-y$(CONFIG_FB_OMAP_LCDC_EXTERNAL) += sossi.o
diff --git a/drivers/video/fbdev/omap/lcd_dma.c b/drivers/video/fbdev/omap/lcd_dma.c
new file mode 100644 (file)
index 0000000..867a63c
--- /dev/null
@@ -0,0 +1,443 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * linux/arch/arm/mach-omap1/lcd_dma.c
+ *
+ * Extracted from arch/arm/plat-omap/dma.c
+ * Copyright (C) 2003 - 2008 Nokia Corporation
+ * Author: Juha Yrjölä <juha.yrjola@nokia.com>
+ * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com>
+ * Graphics DMA and LCD DMA graphics tranformations
+ * by Imre Deak <imre.deak@nokia.com>
+ * OMAP2/3 support Copyright (C) 2004-2007 Texas Instruments, Inc.
+ * Merged to support both OMAP1 and OMAP2 by Tony Lindgren <tony@atomide.com>
+ * Some functions based on earlier dma-omap.c Copyright (C) 2001 RidgeRun, Inc.
+ *
+ * Copyright (C) 2009 Texas Instruments
+ * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
+ *
+ * Support functions for the OMAP internal DMA channels.
+ */
+
+#include <linux/module.h>
+#include <linux/spinlock.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+
+#include <linux/omap-dma.h>
+
+#include <mach/hardware.h>
+
+#include "lcdc.h"
+#include "lcd_dma.h"
+
+int omap_lcd_dma_running(void)
+{
+       /*
+        * On OMAP1510, internal LCD controller will start the transfer
+        * when it gets enabled, so assume DMA running if LCD enabled.
+        */
+       if (cpu_is_omap15xx())
+               if (omap_readw(OMAP_LCDC_CONTROL) & OMAP_LCDC_CTRL_LCD_EN)
+                       return 1;
+
+       /* Check if LCD DMA is running */
+       if (cpu_is_omap16xx())
+               if (omap_readw(OMAP1610_DMA_LCD_CCR) & OMAP_DMA_CCR_EN)
+                       return 1;
+
+       return 0;
+}
+
+static struct lcd_dma_info {
+       spinlock_t lock;
+       int reserved;
+       void (*callback)(u16 status, void *data);
+       void *cb_data;
+
+       int active;
+       unsigned long addr;
+       int rotate, data_type, xres, yres;
+       int vxres;
+       int mirror;
+       int xscale, yscale;
+       int ext_ctrl;
+       int src_port;
+       int single_transfer;
+} lcd_dma;
+
+void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
+                        int data_type)
+{
+       lcd_dma.addr = addr;
+       lcd_dma.data_type = data_type;
+       lcd_dma.xres = fb_xres;
+       lcd_dma.yres = fb_yres;
+}
+EXPORT_SYMBOL(omap_set_lcd_dma_b1);
+
+void omap_set_lcd_dma_ext_controller(int external)
+{
+       lcd_dma.ext_ctrl = external;
+}
+EXPORT_SYMBOL(omap_set_lcd_dma_ext_controller);
+
+void omap_set_lcd_dma_single_transfer(int single)
+{
+       lcd_dma.single_transfer = single;
+}
+EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer);
+
+void omap_set_lcd_dma_b1_rotation(int rotate)
+{
+       if (cpu_is_omap15xx()) {
+               printk(KERN_ERR "DMA rotation is not supported in 1510 mode\n");
+               BUG();
+               return;
+       }
+       lcd_dma.rotate = rotate;
+}
+EXPORT_SYMBOL(omap_set_lcd_dma_b1_rotation);
+
+void omap_set_lcd_dma_b1_mirror(int mirror)
+{
+       if (cpu_is_omap15xx()) {
+               printk(KERN_ERR "DMA mirror is not supported in 1510 mode\n");
+               BUG();
+       }
+       lcd_dma.mirror = mirror;
+}
+EXPORT_SYMBOL(omap_set_lcd_dma_b1_mirror);
+
+void omap_set_lcd_dma_b1_vxres(unsigned long vxres)
+{
+       if (cpu_is_omap15xx()) {
+               pr_err("DMA virtual resolution is not supported in 1510 mode\n");
+               BUG();
+       }
+       lcd_dma.vxres = vxres;
+}
+EXPORT_SYMBOL(omap_set_lcd_dma_b1_vxres);
+
+void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale)
+{
+       if (cpu_is_omap15xx()) {
+               printk(KERN_ERR "DMA scale is not supported in 1510 mode\n");
+               BUG();
+       }
+       lcd_dma.xscale = xscale;
+       lcd_dma.yscale = yscale;
+}
+EXPORT_SYMBOL(omap_set_lcd_dma_b1_scale);
+
+static void set_b1_regs(void)
+{
+       unsigned long top, bottom;
+       int es;
+       u16 w;
+       unsigned long en, fn;
+       long ei, fi;
+       unsigned long vxres;
+       unsigned int xscale, yscale;
+
+       switch (lcd_dma.data_type) {
+       case OMAP_DMA_DATA_TYPE_S8:
+               es = 1;
+               break;
+       case OMAP_DMA_DATA_TYPE_S16:
+               es = 2;
+               break;
+       case OMAP_DMA_DATA_TYPE_S32:
+               es = 4;
+               break;
+       default:
+               BUG();
+               return;
+       }
+
+       vxres = lcd_dma.vxres ? lcd_dma.vxres : lcd_dma.xres;
+       xscale = lcd_dma.xscale ? lcd_dma.xscale : 1;
+       yscale = lcd_dma.yscale ? lcd_dma.yscale : 1;
+       BUG_ON(vxres < lcd_dma.xres);
+
+#define PIXADDR(x, y) (lcd_dma.addr +                                  \
+               ((y) * vxres * yscale + (x) * xscale) * es)
+#define PIXSTEP(sx, sy, dx, dy) (PIXADDR(dx, dy) - PIXADDR(sx, sy) - es + 1)
+
+       switch (lcd_dma.rotate) {
+       case 0:
+               if (!lcd_dma.mirror) {
+                       top = PIXADDR(0, 0);
+                       bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
+                       /* 1510 DMA requires the bottom address to be 2 more
+                        * than the actual last memory access location. */
+                       if (cpu_is_omap15xx() &&
+                               lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32)
+                                       bottom += 2;
+                       ei = PIXSTEP(0, 0, 1, 0);
+                       fi = PIXSTEP(lcd_dma.xres - 1, 0, 0, 1);
+               } else {
+                       top = PIXADDR(lcd_dma.xres - 1, 0);
+                       bottom = PIXADDR(0, lcd_dma.yres - 1);
+                       ei = PIXSTEP(1, 0, 0, 0);
+                       fi = PIXSTEP(0, 0, lcd_dma.xres - 1, 1);
+               }
+               en = lcd_dma.xres;
+               fn = lcd_dma.yres;
+               break;
+       case 90:
+               if (!lcd_dma.mirror) {
+                       top = PIXADDR(0, lcd_dma.yres - 1);
+                       bottom = PIXADDR(lcd_dma.xres - 1, 0);
+                       ei = PIXSTEP(0, 1, 0, 0);
+                       fi = PIXSTEP(0, 0, 1, lcd_dma.yres - 1);
+               } else {
+                       top = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
+                       bottom = PIXADDR(0, 0);
+                       ei = PIXSTEP(0, 1, 0, 0);
+                       fi = PIXSTEP(1, 0, 0, lcd_dma.yres - 1);
+               }
+               en = lcd_dma.yres;
+               fn = lcd_dma.xres;
+               break;
+       case 180:
+               if (!lcd_dma.mirror) {
+                       top = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
+                       bottom = PIXADDR(0, 0);
+                       ei = PIXSTEP(1, 0, 0, 0);
+                       fi = PIXSTEP(0, 1, lcd_dma.xres - 1, 0);
+               } else {
+                       top = PIXADDR(0, lcd_dma.yres - 1);
+                       bottom = PIXADDR(lcd_dma.xres - 1, 0);
+                       ei = PIXSTEP(0, 0, 1, 0);
+                       fi = PIXSTEP(lcd_dma.xres - 1, 1, 0, 0);
+               }
+               en = lcd_dma.xres;
+               fn = lcd_dma.yres;
+               break;
+       case 270:
+               if (!lcd_dma.mirror) {
+                       top = PIXADDR(lcd_dma.xres - 1, 0);
+                       bottom = PIXADDR(0, lcd_dma.yres - 1);
+                       ei = PIXSTEP(0, 0, 0, 1);
+                       fi = PIXSTEP(1, lcd_dma.yres - 1, 0, 0);
+               } else {
+                       top = PIXADDR(0, 0);
+                       bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
+                       ei = PIXSTEP(0, 0, 0, 1);
+                       fi = PIXSTEP(0, lcd_dma.yres - 1, 1, 0);
+               }
+               en = lcd_dma.yres;
+               fn = lcd_dma.xres;
+               break;
+       default:
+               BUG();
+               return; /* Suppress warning about uninitialized vars */
+       }
+
+       if (cpu_is_omap15xx()) {
+               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);
+
+void omap_setup_lcd_dma(void)
+{
+       BUG_ON(lcd_dma.active);
+       if (!cpu_is_omap15xx()) {
+               /* Set some reasonable defaults */
+               omap_writew(0x5440, OMAP1610_DMA_LCD_CCR);
+               omap_writew(0x9102, OMAP1610_DMA_LCD_CSDP);
+               omap_writew(0x0004, OMAP1610_DMA_LCD_LCH_CTRL);
+       }
+       set_b1_regs();
+       if (!cpu_is_omap15xx()) {
+               u16 w;
+
+               w = omap_readw(OMAP1610_DMA_LCD_CCR);
+               /*
+                * If DMA was already active set the end_prog bit to have
+                * the programmed register set loaded into the active
+                * register set.
+                */
+               w |= 1 << 11;           /* End_prog */
+               if (!lcd_dma.single_transfer)
+                       w |= (3 << 8);  /* Auto_init, repeat */
+               omap_writew(w, OMAP1610_DMA_LCD_CCR);
+       }
+}
+EXPORT_SYMBOL(omap_setup_lcd_dma);
+
+void omap_stop_lcd_dma(void)
+{
+       u16 w;
+
+       lcd_dma.active = 0;
+       if (cpu_is_omap15xx() || !lcd_dma.ext_ctrl)
+               return;
+
+       w = omap_readw(OMAP1610_DMA_LCD_CCR);
+       w &= ~(1 << 7);
+       omap_writew(w, OMAP1610_DMA_LCD_CCR);
+
+       w = omap_readw(OMAP1610_DMA_LCD_CTRL);
+       w &= ~(1 << 8);
+       omap_writew(w, OMAP1610_DMA_LCD_CTRL);
+}
+EXPORT_SYMBOL(omap_stop_lcd_dma);
+
+static int __init omap_init_lcd_dma(void)
+{
+       int r;
+
+       if (!cpu_class_is_omap1())
+               return -ENODEV;
+
+       if (cpu_is_omap16xx()) {
+               u16 w;
+
+               /* this would prevent OMAP sleep */
+               w = omap_readw(OMAP1610_DMA_LCD_CTRL);
+               w &= ~(1 << 8);
+               omap_writew(w, OMAP1610_DMA_LCD_CTRL);
+       }
+
+       spin_lock_init(&lcd_dma.lock);
+
+       r = request_irq(INT_DMA_LCD, lcd_dma_irq_handler, 0,
+                       "LCD DMA", NULL);
+       if (r != 0)
+               pr_err("unable to request IRQ for LCD DMA (error %d)\n", r);
+
+       return r;
+}
+
+arch_initcall(omap_init_lcd_dma);
+
diff --git a/drivers/video/fbdev/omap/lcd_dma.h b/drivers/video/fbdev/omap/lcd_dma.h
new file mode 100644 (file)
index 0000000..1b47801
--- /dev/null
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ *  arch/arm/mach-omap1/include/mach/lcd_dma.h
+ *
+ * Extracted from arch/arm/plat-omap/include/plat/dma.h
+ *  Copyright (C) 2003 Nokia Corporation
+ *  Author: Juha Yrjölä <juha.yrjola@nokia.com>
+ */
+#ifndef __MACH_OMAP1_LCD_DMA_H__
+#define __MACH_OMAP1_LCD_DMA_H__
+
+/* Hardware registers for LCD DMA */
+#define OMAP1510_DMA_LCD_BASE          (0xfffedb00)
+#define OMAP1510_DMA_LCD_CTRL          (OMAP1510_DMA_LCD_BASE + 0x00)
+#define OMAP1510_DMA_LCD_TOP_F1_L      (OMAP1510_DMA_LCD_BASE + 0x02)
+#define OMAP1510_DMA_LCD_TOP_F1_U      (OMAP1510_DMA_LCD_BASE + 0x04)
+#define OMAP1510_DMA_LCD_BOT_F1_L      (OMAP1510_DMA_LCD_BASE + 0x06)
+#define OMAP1510_DMA_LCD_BOT_F1_U      (OMAP1510_DMA_LCD_BASE + 0x08)
+
+#define OMAP1610_DMA_LCD_BASE          (0xfffee300)
+#define OMAP1610_DMA_LCD_CSDP          (OMAP1610_DMA_LCD_BASE + 0xc0)
+#define OMAP1610_DMA_LCD_CCR           (OMAP1610_DMA_LCD_BASE + 0xc2)
+#define OMAP1610_DMA_LCD_CTRL          (OMAP1610_DMA_LCD_BASE + 0xc4)
+#define OMAP1610_DMA_LCD_TOP_B1_L      (OMAP1610_DMA_LCD_BASE + 0xc8)
+#define OMAP1610_DMA_LCD_TOP_B1_U      (OMAP1610_DMA_LCD_BASE + 0xca)
+#define OMAP1610_DMA_LCD_BOT_B1_L      (OMAP1610_DMA_LCD_BASE + 0xcc)
+#define OMAP1610_DMA_LCD_BOT_B1_U      (OMAP1610_DMA_LCD_BASE + 0xce)
+#define OMAP1610_DMA_LCD_TOP_B2_L      (OMAP1610_DMA_LCD_BASE + 0xd0)
+#define OMAP1610_DMA_LCD_TOP_B2_U      (OMAP1610_DMA_LCD_BASE + 0xd2)
+#define OMAP1610_DMA_LCD_BOT_B2_L      (OMAP1610_DMA_LCD_BASE + 0xd4)
+#define OMAP1610_DMA_LCD_BOT_B2_U      (OMAP1610_DMA_LCD_BASE + 0xd6)
+#define OMAP1610_DMA_LCD_SRC_EI_B1     (OMAP1610_DMA_LCD_BASE + 0xd8)
+#define OMAP1610_DMA_LCD_SRC_FI_B1_L   (OMAP1610_DMA_LCD_BASE + 0xda)
+#define OMAP1610_DMA_LCD_SRC_EN_B1     (OMAP1610_DMA_LCD_BASE + 0xe0)
+#define OMAP1610_DMA_LCD_SRC_FN_B1     (OMAP1610_DMA_LCD_BASE + 0xe4)
+#define OMAP1610_DMA_LCD_LCH_CTRL      (OMAP1610_DMA_LCD_BASE + 0xea)
+#define OMAP1610_DMA_LCD_SRC_FI_B1_U   (OMAP1610_DMA_LCD_BASE + 0xf4)
+
+/* LCD DMA block numbers */
+enum {
+       OMAP_LCD_DMA_B1_TOP,
+       OMAP_LCD_DMA_B1_BOTTOM,
+       OMAP_LCD_DMA_B2_TOP,
+       OMAP_LCD_DMA_B2_BOTTOM
+};
+
+/* LCD DMA functions */
+extern int omap_request_lcd_dma(void (*callback)(u16 status, void *data),
+                               void *data);
+extern void omap_free_lcd_dma(void);
+extern void omap_setup_lcd_dma(void);
+extern void omap_enable_lcd_dma(void);
+extern void omap_stop_lcd_dma(void);
+extern void omap_set_lcd_dma_ext_controller(int external);
+extern void omap_set_lcd_dma_single_transfer(int single);
+extern void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
+                               int data_type);
+extern void omap_set_lcd_dma_b1_rotation(int rotate);
+extern void omap_set_lcd_dma_b1_vxres(unsigned long vxres);
+extern void omap_set_lcd_dma_b1_mirror(int mirror);
+extern void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale);
+
+#endif /* __MACH_OMAP1_LCD_DMA_H__ */
index 7317c9aad677232545e75b7dbc78ad648c674fcb..d9a23f6cf7fc7cffd1fcaca4969340fab7a9e071 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/clk.h>
 #include <linux/gfp.h>
 
-#include <mach/lcdc.h>
 #include <linux/omap-dma.h>
 
 #include <asm/mach-types.h>
@@ -25,6 +24,7 @@
 #include "omapfb.h"
 
 #include "lcdc.h"
+#include "lcd_dma.h"
 
 #define MODULE_NAME                    "lcdc"
 
index 8a7607d861c13819278df2f476cca890a561c898..cbbfd9b9e949860ef1a38c317c4d46fd913908cf 100644 (file)
@@ -1,6 +1,41 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #ifndef LCDC_H
 #define LCDC_H
+/*
+ * Copyright (C) 2004 Nokia Corporation
+ * Author: Imre Deak <imre.deak@nokia.com>
+ */
+#define OMAP_LCDC_BASE                 0xfffec000
+#define OMAP_LCDC_SIZE                 256
+#define OMAP_LCDC_IRQ                  INT_LCD_CTRL
+
+#define OMAP_LCDC_CONTROL              (OMAP_LCDC_BASE + 0x00)
+#define OMAP_LCDC_TIMING0              (OMAP_LCDC_BASE + 0x04)
+#define OMAP_LCDC_TIMING1              (OMAP_LCDC_BASE + 0x08)
+#define OMAP_LCDC_TIMING2              (OMAP_LCDC_BASE + 0x0c)
+#define OMAP_LCDC_STATUS               (OMAP_LCDC_BASE + 0x10)
+#define OMAP_LCDC_SUBPANEL             (OMAP_LCDC_BASE + 0x14)
+#define OMAP_LCDC_LINE_INT             (OMAP_LCDC_BASE + 0x18)
+#define OMAP_LCDC_DISPLAY_STATUS       (OMAP_LCDC_BASE + 0x1c)
+
+#define OMAP_LCDC_STAT_DONE            (1 << 0)
+#define OMAP_LCDC_STAT_VSYNC           (1 << 1)
+#define OMAP_LCDC_STAT_SYNC_LOST       (1 << 2)
+#define OMAP_LCDC_STAT_ABC             (1 << 3)
+#define OMAP_LCDC_STAT_LINE_INT                (1 << 4)
+#define OMAP_LCDC_STAT_FUF             (1 << 5)
+#define OMAP_LCDC_STAT_LOADED_PALETTE  (1 << 6)
+
+#define OMAP_LCDC_CTRL_LCD_EN          (1 << 0)
+#define OMAP_LCDC_CTRL_LCD_TFT         (1 << 7)
+#define OMAP_LCDC_CTRL_LINE_IRQ_CLR_SEL        (1 << 10)
+
+#define OMAP_LCDC_IRQ_VSYNC            (1 << 2)
+#define OMAP_LCDC_IRQ_DONE             (1 << 3)
+#define OMAP_LCDC_IRQ_LOADED_PALETTE   (1 << 4)
+#define OMAP_LCDC_IRQ_LINE_NIRQ                (1 << 5)
+#define OMAP_LCDC_IRQ_LINE             (1 << 6)
+#define OMAP_LCDC_IRQ_MASK             (((1 << 5) - 1) << 2)
 
 int omap_lcdc_set_dma_callback(void (*callback)(void *data), void *data);
 void omap_lcdc_free_dma_callback(void);
index 80ac67f27f0da11223183efb1b87d5df8d965622..d3c755b293ea1132d435042c348830e44eccd30a 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/omap-dma.h>
 
 #include "omapfb.h"
+#include "lcd_dma.h"
 #include "lcdc.h"
 
 #define MODULE_NAME            "omapfb-sossi"
index 5c5c93ad6b500bfcfb165d9ebe3307e9bdde5689..441f5f0919c6976c1d0db16d5d8c2f7ba5b1ee48 100644 (file)
@@ -328,8 +328,8 @@ extern dma_addr_t omap_get_dma_dst_pos(int lch);
 extern int omap_get_dma_active_status(int lch);
 extern int omap_dma_running(void);
 
-#if defined(CONFIG_ARCH_OMAP1) && IS_ENABLED(CONFIG_FB_OMAP)
-#include <mach/lcd_dma.h>
+#if IS_ENABLED(CONFIG_FB_OMAP)
+extern int omap_lcd_dma_running(void);
 #else
 static inline int omap_lcd_dma_running(void)
 {