Skip to contentSkip to conversation

OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set

PATCH New Janusz Krzysztofik 4 participants 17 messages Oct 29, 2009 – Nov 27, 2009

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set

With CONFIG_PM=y, the omapfb/lcd device on Amstrad Delta, after initially starting correctly, breaks with the following error messages:

omapfb omapfb: resetting (status 0xffffff96,reset count 1)
...
omapfb omapfb: resetting (status 0xffffff96,reset count 100) omapfb omapfb: too many reset attempts, giving up.

Looking closer at this I have found that it had been broken almost 2 years ago with commit 2418996e3b100114edb2ae110d5d4acb928909d2, PM fixes for OMAP1.

The definite reason for broken omapfb/lcd_ams_delta in PM mode appeared to be ARM_IDLECT1:IDLIF_ARM (bit 6) put into idle. The patch below fixes it.

Created and tested against linux-2.6.32-rc5

---
Hi,

I already reported this issue a few months ago, when drivers/video/omap/lcd_ams_delta.c was proposed to get into mainline - see
http://www.spinics.net/lists/linux-omap/msg14546.html. Now I've found some time to look at it again.

Since PM area is quite new to me, I am not sure if there may be a better solution. AFAICS, the standard way to prevent an ARM_CLKCT1 bit being switched to idle is to enable a clock that uses it (tipb_ck, dma_ck, or tc_ck or one of its children in this case, right?).

I assume there is no bug in omapfb nor lcdc, as that would be already detected. Maybe it would be better to fix drivers/video/omap/lcd_ams_delta.c (or arch/arm/mach-omap1/board-ams-delta), but I don't know what clock should I enable, if any.

arch/arm/mach-omap1/pm.c renamed from arch/arm/mach-omap1/pm.c.orig +2 -1
@@ -45,6 +45,7 @@
 
 #include <asm/irq.h>
 #include <asm/atomic.h>
+#include <asm/mach-types.h>
 #include <asm/mach/time.h>
 #include <asm/mach/irq.h>
 
@@ -139,7 +140,7 @@ void omap1_pm_idle(void)
 	use_idlect1 = omap_dm_timer_modify_idlect_mask(use_idlect1);
 #endif
 
-	if (omap_dma_running())
+	if ((omap_dma_running()) || (machine_is_ams_delta()))
 		use_idlect1 &= ~(1 << 6);
 
 	/* We should be able to remove the do_sleep variable and multiple
#1 lore raw

PATCH 1/1 OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set

Thursday 29 October 2009 23:39:44 Janusz Krzysztofik napisa?(a):

Quoted 3 lines

Since PM area is quite new to me, I am not sure if there may be a better solution. AFAICS, the standard way to prevent an ARM_CLKCT1 bit being

s/ARM_CLKCT1/ARM_IDLECT1/

Quoted 2 lines

switched to idle is to enable a clock that uses it (tipb_ck, dma_ck, or tc_ck or one of its children in this case, right?).

Janusz

#2 lore raw

PATCH 1/1 OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set

In reply to Janusz Krzysztofik

Thursday 29 October 2009 23:39:44 Janusz Krzysztofik napisa?(a):

Quoted 20 lines

With CONFIG_PM=y, the omapfb/lcd device on Amstrad Delta, after initially starting correctly, breaks with the following error messages:

omapfb omapfb: resetting (status 0xffffff96,reset count 1)
...
omapfb omapfb: resetting (status 0xffffff96,reset count 100) omapfb omapfb: too many reset attempts, giving up.

Looking closer at this I have found that it had been broken almost 2 years ago with commit 2418996e3b100114edb2ae110d5d4acb928909d2, PM fixes for OMAP1.

The definite reason for broken omapfb/lcd_ams_delta in PM mode appeared to be ARM_IDLECT1:IDLIF_ARM (bit 6) put into idle. The patch below fixes it.

Since PM area is quite new to me, I am not sure if there may be a better solution. AFAICS, the standard way to prevent an ARM_CLKCT1 bit being switched to idle is to enable a clock that uses it (tipb_ck, dma_ck, or tc_ck or one of its children in this case, right?).

Quoted 5 lines

I assume there is no bug in omapfb nor lcdc, as that would be already detected. Maybe it would be better to fix drivers/video/omap/lcd_ams_delta.c (or arch/arm/mach-omap1/board-ams-delta), but I don't know what clock should I enable, if any.

More looking at it, I found that might be omap_dma_running() from arch/arm/plat-omap/dma.c that needs correction. It already checks for LCD dma running for OMAP1610, but does nothing similiar for 1510. I have revisited
http://focus.ti.com/lit/ug/spru674/spru674.pdf, but found no hint how to do that in a 1610 similiar way.

Thanks,
Janusz

reviewer
#3 lore raw

PATCH 1/1 OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set

Quoted 27 lines · Janusz Krzysztofik

Thursday 29 October 2009 23:39:44 Janusz Krzysztofik napisa?(a):

Quoted 20 lines

With CONFIG_PM=y, the omapfb/lcd device on Amstrad Delta, after initially starting correctly, breaks with the following error messages:

omapfb omapfb: resetting (status 0xffffff96,reset count 1)
...
omapfb omapfb: resetting (status 0xffffff96,reset count 100) omapfb omapfb: too many reset attempts, giving up.

Looking closer at this I have found that it had been broken almost 2 years ago with commit 2418996e3b100114edb2ae110d5d4acb928909d2, PM fixes for OMAP1.

The definite reason for broken omapfb/lcd_ams_delta in PM mode appeared to be ARM_IDLECT1:IDLIF_ARM (bit 6) put into idle. The patch below fixes it.

Since PM area is quite new to me, I am not sure if there may be a better solution. AFAICS, the standard way to prevent an ARM_CLKCT1 bit being switched to idle is to enable a clock that uses it (tipb_ck, dma_ck, or tc_ck or one of its children in this case, right?).

Quoted 5 lines

I assume there is no bug in omapfb nor lcdc, as that would be already detected. Maybe it would be better to fix drivers/video/omap/lcd_ams_delta.c (or arch/arm/mach-omap1/board-ams-delta), but I don't know what clock should I enable, if any.

Quoted 5 lines

More looking at it, I found that might be omap_dma_running() from arch/arm/plat-omap/dma.c that needs correction. It already checks for LCD dma running for OMAP1610, but does nothing similiar for 1510. I have revisited
http://focus.ti.com/lit/ug/spru674/spru674.pdf, but found no hint how to do that in a 1610 similiar way.

Hmm to me it looks like the OMAP_DMA_CCR_EN should be set in one of the channels if enabled. Maybe you need add a similar check somewhere in the *_lcd_dma_* functions too in dma.c?

Regards,

Tony

#4 lore raw

PATCH 1/1 OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set

Friday 30 October 2009 18:33:18 Tony Lindgren napisa?(a):

Quoted 35 lines · Janusz Krzysztofik
Quoted 28 lines

Thursday 29 October 2009 23:39:44 Janusz Krzysztofik napisa?(a):

Quoted 21 lines

With CONFIG_PM=y, the omapfb/lcd device on Amstrad Delta, after initially starting correctly, breaks with the following error messages:

omapfb omapfb: resetting (status 0xffffff96,reset count 1)
...
omapfb omapfb: resetting (status 0xffffff96,reset count 100) omapfb omapfb: too many reset attempts, giving up.

Looking closer at this I have found that it had been broken almost 2 years ago with commit 2418996e3b100114edb2ae110d5d4acb928909d2, PM fixes for OMAP1.

The definite reason for broken omapfb/lcd_ams_delta in PM mode appeared to be ARM_IDLECT1:IDLIF_ARM (bit 6) put into idle. The patch below fixes it.

Since PM area is quite new to me, I am not sure if there may be a better solution. AFAICS, the standard way to prevent an ARM_CLKCT1 bit being switched to idle is to enable a clock that uses it (tipb_ck, dma_ck, or tc_ck or one of its children in this case, right?).

Quoted 5 lines

I assume there is no bug in omapfb nor lcdc, as that would be already detected. Maybe it would be better to fix drivers/video/omap/lcd_ams_delta.c (or arch/arm/mach-omap1/board-ams-delta), but I don't know what clock should I enable, if any.

Quoted 5 lines

More looking at it, I found that might be omap_dma_running() from arch/arm/plat-omap/dma.c that needs correction. It already checks for LCD dma running for OMAP1610, but does nothing similiar for 1510. I have revisited http://focus.ti.com/lit/ug/spru674/spru674.pdf, but found no hint how to do that in a 1610 similiar way.

Quoted 3 lines

Hmm to me it looks like the OMAP_DMA_CCR_EN should be set in one of the channels if enabled. Maybe you need add a similar check somewhere in the *_lcd_dma_* functions too in dma.c?

Tony,
It sounds reasonable, but the problem is that in the OMAP5910 documentation I can find no DMA_CCR equivalent in the LCD dedicated DMA channel register set, nor EN equivalent in the DMA_LCD_CTRL register.

I have had a look at *_lcd_dma_*, as you suggested, and found this:

        /*
         * 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 (enable_1510_mode || !lcd_dma.ext_ctrl)
                return;

That may suggest checking for LCD controller, not DMA channel, enable bit could give an answer if LCD DMA is likely to be running or not. So maybe adding a function to drivers/video/omap/lcdc.c that would check for OMAP_LCDC_CONTROL:OMAP_LCDC_CTRL_LCD_EN, then invoke that function from omap_dma_running() in case of omap1510 could be a proper solution.

However, that would affect not only Amstrad Delta, but all 1510 based machines. Since there were no reports about broken LCD DMA on 1510, I'd rather get a confirmation from omap guys, more experienced than me, that the solution proposed is correct and should work not only for my Amstrad Delta before I get that way.

Thanks,
Janusz

reviewer
#5 lore raw

PATCH 1/1 OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set

Quoted 61 lines · Janusz Krzysztofik

Friday 30 October 2009 18:33:18 Tony Lindgren napisa?(a):

Quoted 35 lines · Janusz Krzysztofik
Quoted 28 lines

Thursday 29 October 2009 23:39:44 Janusz Krzysztofik napisa?(a):

Quoted 21 lines

With CONFIG_PM=y, the omapfb/lcd device on Amstrad Delta, after initially starting correctly, breaks with the following error messages:

omapfb omapfb: resetting (status 0xffffff96,reset count 1)
...
omapfb omapfb: resetting (status 0xffffff96,reset count 100) omapfb omapfb: too many reset attempts, giving up.

Looking closer at this I have found that it had been broken almost 2 years ago with commit 2418996e3b100114edb2ae110d5d4acb928909d2, PM fixes for OMAP1.

The definite reason for broken omapfb/lcd_ams_delta in PM mode appeared to be ARM_IDLECT1:IDLIF_ARM (bit 6) put into idle. The patch below fixes it.

Since PM area is quite new to me, I am not sure if there may be a better solution. AFAICS, the standard way to prevent an ARM_CLKCT1 bit being switched to idle is to enable a clock that uses it (tipb_ck, dma_ck, or tc_ck or one of its children in this case, right?).

Quoted 5 lines

I assume there is no bug in omapfb nor lcdc, as that would be already detected. Maybe it would be better to fix drivers/video/omap/lcd_ams_delta.c (or arch/arm/mach-omap1/board-ams-delta), but I don't know what clock should I enable, if any.

Quoted 5 lines

More looking at it, I found that might be omap_dma_running() from arch/arm/plat-omap/dma.c that needs correction. It already checks for LCD dma running for OMAP1610, but does nothing similiar for 1510. I have revisited http://focus.ti.com/lit/ug/spru674/spru674.pdf, but found no hint how to do that in a 1610 similiar way.

Quoted 3 lines

Hmm to me it looks like the OMAP_DMA_CCR_EN should be set in one of the channels if enabled. Maybe you need add a similar check somewhere in the *_lcd_dma_* functions too in dma.c?

Tony,
It sounds reasonable, but the problem is that in the OMAP5910 documentation I can find no DMA_CCR equivalent in the LCD dedicated DMA channel register set, nor EN equivalent in the DMA_LCD_CTRL register.

I have had a look at *_lcd_dma_*, as you suggested, and found this:

        /*
         * 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 (enable_1510_mode || !lcd_dma.ext_ctrl)
                return;

That may suggest checking for LCD controller, not DMA channel, enable bit could give an answer if LCD DMA is likely to be running or not. So maybe adding a function to drivers/video/omap/lcdc.c that would check for OMAP_LCDC_CONTROL:OMAP_LCDC_CTRL_LCD_EN, then invoke that function from omap_dma_running() in case of omap1510 could be a proper solution.

Quoted 5 lines

However, that would affect not only Amstrad Delta, but all 1510 based machines. Since there were no reports about broken LCD DMA on 1510, I'd rather get a confirmation from omap guys, more experienced than me, that the solution proposed is correct and should work not only for my Amstrad Delta before I get that way.

That sounds like a reasonable way to fix it to me.

Regards,

Tony

#6 lore raw

PATCH 1/1 OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set

In reply to Janusz Krzysztofik

Hello Janusz et al,

Quoted 5 lines · Janusz Krzysztofik

More looking at it, I found that might be omap_dma_running() from arch/arm/plat-omap/dma.c that needs correction. It already checks for LCD dma running for OMAP1610, but does nothing similiar for 1510. I have revisited
http://focus.ti.com/lit/ug/spru674/spru674.pdf, but found no hint how to do that in a 1610 similiar way.

Speaking of this code, here's a project suggestion if someone has some spare time. All of the LCD DMA code in plat-omap/dma.c appears to be OMAP1-only (and apparently only is available on a subset of OMAP1 chips). It would be great if this code could be moved to mach-omap1/lcd_dma.c or a similar place.

- Paul

#7 lore raw

PATCH 1/1 OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set

Tuesday 10 November 2009 11:50:52 Paul Walmsley napisa?(a):

Quoted 9 lines

Hello Janusz et al,

Quoted 5 lines · Janusz Krzysztofik

More looking at it, I found that might be omap_dma_running() from arch/arm/plat-omap/dma.c that needs correction. It already checks for LCD dma running for OMAP1610, but does nothing similiar for 1510. I have revisited http://focus.ti.com/lit/ug/spru674/spru674.pdf, but found no hint how to do that in a 1610 similiar way.

Quoted 5 lines

Speaking of this code, here's a project suggestion if someone has some spare time. All of the LCD DMA code in plat-omap/dma.c appears to be OMAP1-only (and apparently only is available on a subset of OMAP1 chips). It would be great if this code could be moved to mach-omap1/lcd_dma.c or a similar place.

Paul,

Thank you for putting me into right direction (I hope :-)). If there are no more comments, I'll try to take care of what you suggest after the situation with my pending patches AND Tomi Valkeinen's DSS2 patch series, that both more or less fiddle with LCD DMA related files, gets clear.

Thanks,
Janusz

#8 lore raw

RFC PATCH 1/1 OMAP: DMA: move LCD DMA related code from plat-omap to mach-omap1 (Re: [PATCH] OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set)

In reply to Paul Walmsley

(probably less interested persons and lists dropped)

Quoted 4 lines · Tuesday 10 November 2009 11:50:52 Paul Walmsley wrote:

... All of the LCD DMA code in plat-omap/dma.c appears to be OMAP1-only (and apparently only is available on a subset of OMAP1 chips). It would be great if this code could be moved to mach-omap1/lcd_dma.c or a similar place.

The patch just tries to implement this idea.

Created against linux-omap for-next,
commit 2963c21fab52bfa8227da7f22864db393ebbc858

Tested on OMAP1510 Amstrad Delta.
Compile tested using omap_generic_2420_defconfig.

---
Hi Paul,

I hope the patch meets your suggestion closely enough.

Thanks,
Janusz

arch/arm/mach-omap1/Makefile +1 -1
diff -uprN git.orig/arch/arm/mach-omap1/Makefile git/arch/arm/mach-omap1/Makefile
@@ -3,7 +3,7 @@
 #
 
 # Common support
-obj-y := io.o id.o sram.o clock.o irq.o mux.o serial.o devices.o
+obj-y := io.o id.o sram.o clock.o irq.o lcd_dma.o mux.o serial.o devices.o
 
 obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 
arch/arm/mach-omap1/include/mach/lcd_dma.h +78 -0

78 lines not on this page · raw message

arch/arm/mach-omap1/lcd_dma.c +447 -0

447 lines not on this page · raw message

arch/arm/plat-omap/dma.c +2 -408

446 lines not on this page · raw message

arch/arm/plat-omap/include/plat/dma.h +10 -50

83 lines not on this page · raw message

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

Re: [RFC] [PATCH] OMAP: DMA: move LCD DMA related code from plat-omap to mach-omap1 (Re: [PATCH] OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set)

Hello Janusz,

Quoted 16 lines · Janusz Krzysztofik

(probably less interested persons and lists dropped)

Quoted 4 lines · Tuesday 10 November 2009 11:50:52 Paul Walmsley wrote:

... All of the LCD DMA code in plat-omap/dma.c appears to be OMAP1-only (and apparently only is available on a subset of OMAP1 chips). It would be great if this code could be moved to mach-omap1/lcd_dma.c or a similar place.

The patch just tries to implement this idea.

Created against linux-omap for-next,
commit 2963c21fab52bfa8227da7f22864db393ebbc858

Tested on OMAP1510 Amstrad Delta.
Compile tested using omap_generic_2420_defconfig.

Quoted 6 lines

---
Hi Paul,

I hope the patch meets your suggestion closely enough.

Thanks, just scanned it quickly and it looks carefully done. Two suggestions below, both minor:

arch/arm/mach-omap1/Makefile line 6

Quoted 12 lines

Thanks,
Janusz

diff -uprN git.orig/arch/arm/mach-omap1/Makefile git/arch/arm/mach-omap1/Makefile

arch/arm/mach-omap1/Makefile +1 -1
@@ -3,7 +3,7 @@
 #
 
 # Common support
-obj-y := io.o id.o sram.o clock.o irq.o mux.o serial.o devices.o
+obj-y := io.o id.o sram.o clock.o irq.o lcd_dma.o mux.o serial.o devices.o

It seems that this LCD DMA controller is not present on OMAPs prior to the 1510, given all the references in the LCD DMA code to 1510 and 1610, etc. It might be good to add a Kconfig option so OMAP730/850 users can skip compiling it and save some memory. The drivers that use these routines can then include Kconfig dependencies on that option so it is automatically included when those drivers are built.

Quoted 18 lines
arch/arm/mach-omap1/Makefile +0 -0
 obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 

diff -uprN git.orig/arch/arm/mach-omap1/include/mach/lcd_dma.h git/arch/arm/mach-omap1/include/mach/lcd_dma.h

arch/arm/mach-omap1/include/mach/lcd_dma.h +12 -0
@@ -0,0 +1,78 @@
+/*
+ *  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ä <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *

arch/arm/mach-omap1/include/mach/lcd_dma.h line 22

Quoted 10 lines
arch/arm/mach-omap1/include/mach/lcd_dma.h +10 -0
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef __MACH_LCD_DMA_H__

Consider adding _OMAP1_ in this macro name. I doubt that name collisions here will be a serious issue, but adding a few extra bytes here might avoid some bug-hunting frustration in the long run...

Quoted 1,043 lines
arch/arm/mach-omap1/include/mach/lcd_dma.h +56 -0
+#define __MACH_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_LCD_DMA_H__ */

diff -uprN git.orig/arch/arm/mach-omap1/lcd_dma.c git/arch/arm/mach-omap1/lcd_dma.c

arch/arm/mach-omap1/lcd_dma.c +447 -0
@@ -0,0 +1,447 @@
+/*
+ * 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ä <[email protected]>
+ * DMA channel linking for 1610 by Samuel Ortiz <[email protected]>
+ * Graphics DMA and LCD DMA graphics tranformations
+ * by Imre Deak <[email protected]>
+ * OMAP2/3 support Copyright (C) 2004-2007 Texas Instruments, Inc.
+ * Merged to support both OMAP1 and OMAP2 by Tony Lindgren <[email protected]>
+ * Some functions based on earlier dma-omap.c Copyright (C) 2001 RidgeRun, Inc.
+ *
+ * Copyright (C) 2009 Texas Instruments
+ * Added OMAP4 support - Santosh Shilimkar <[email protected]>
+ *
+ * Support functions for the OMAP internal DMA channels.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/spinlock.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+
+#include <mach/hardware.h>
+#include <plat/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_omap1510())
+		if (omap_readw(0xfffec000 + 0x00) & (1 << 0))
+			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, size;
+	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_src_port(int port)
+{
+	lcd_dma.src_port = port;
+}
+
+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_omap1510()) {
+		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_omap1510()) {
+		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_omap1510()) {
+		printk(KERN_ERR "DMA virtual resulotion 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_omap1510()) {
+		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_omap1510() &&
+				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_omap1510()) {
+		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_omap1510())
+		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_omap1510() || !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_omap1510()) {
+		/* 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_omap1510()) {
+		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_omap1510() || !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_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)
+		printk(KERN_ERR "unable to request IRQ for LCD DMA "
+			       "(error %d)\n", r);
+
+	return r;
+}
+
+arch_initcall(omap_init_lcd_dma);
+

diff -uprN git.orig/arch/arm/plat-omap/dma.c git/arch/arm/plat-omap/dma.c

arch/arm/plat-omap/dma.c +2 -408
@@ -47,7 +47,6 @@ enum { DMA_CHAIN_STARTED, DMA_CHAIN_NOTS
 #endif
 
 #define OMAP_DMA_ACTIVE			0x01
-#define OMAP_DMA_CCR_EN			(1 << 7)
 #define OMAP2_DMA_CSR_CLEAR_MASK	0xffe
 
 #define OMAP_FUNC_MUX_ARM_BASE		(0xfffe1000 + 0xec)
@@ -1120,17 +1119,8 @@ int omap_dma_running(void)
 {
 	int lch;
 
-	/*
-	 * On OMAP1510, internal LCD controller will start the transfer
-	 * when it gets enabled, so assume DMA running if LCD enabled.
-	 */
-	if (cpu_is_omap1510())
-		if (omap_readw(0xfffec000 + 0x00) & (1 << 0))
-			return 1;
-
-	/* Check if LCD DMA is running */
-	if (cpu_is_omap16xx())
-		if (omap_readw(OMAP1610_DMA_LCD_CCR) & OMAP_DMA_CCR_EN)
+	if (cpu_class_is_omap1())
+		if (omap_lcd_dma_running())
 			return 1;
 
 	for (lch = 0; lch < dma_chan_count; lch++)
@@ -1990,377 +1980,6 @@ static struct irqaction omap24xx_dma_irq
 
 /*----------------------------------------------------------------------------*/
 
-static struct lcd_dma_info {
-	spinlock_t lock;
-	int reserved;
-	void (*callback)(u16 status, void *data);
-	void *cb_data;
-
-	int active;
-	unsigned long addr, size;
-	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_src_port(int port)
-{
-	lcd_dma.src_port = port;
-}
-
-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 (omap_dma_in_1510_mode()) {
-		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 (omap_dma_in_1510_mode()) {
-		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 (omap_dma_in_1510_mode()) {
-		printk(KERN_ERR "DMA virtual resulotion 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 (omap_dma_in_1510_mode()) {
-		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 (omap_dma_in_1510_mode() &&
-				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 (omap_dma_in_1510_mode()) {
-		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 (!enable_1510_mode)
-		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 (enable_1510_mode || !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 (!enable_1510_mode) {
-		/* 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 (!enable_1510_mode) {
-		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 (enable_1510_mode || !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);
-
 void omap_dma_global_context_save(void)
 {
 	omap_dma_global_context.dma_irqenable_l0 =
@@ -2465,14 +2084,6 @@ static int __init omap_init_dma(void)
 			dma_chan_count = 16;
 		} else
 			dma_chan_count = 9;
-		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);
-		}
 	} else if (cpu_class_is_omap2()) {
 		u8 revision = dma_read(REVISION) & 0xff;
 		printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n",
@@ -2483,7 +2094,6 @@ static int __init omap_init_dma(void)
 		return 0;
 	}
 
-	spin_lock_init(&lcd_dma.lock);
 	spin_lock_init(&dma_chan_lock);
 
 	for (ch = 0; ch < dma_chan_count; ch++) {
@@ -2548,22 +2158,6 @@ static int __init omap_init_dma(void)
 		}
 	}
 
-
-	/* FIXME: Update LCD DMA to work on 24xx */
-	if (cpu_class_is_omap1()) {
-		r = request_irq(INT_DMA_LCD, lcd_dma_irq_handler, 0,
-				"LCD DMA", NULL);
-		if (r != 0) {
-			int i;
-
-			printk(KERN_ERR "unable to request IRQ for LCD DMA "
-			       "(error %d)\n", r);
-			for (i = 0; i < dma_chan_count; i++)
-				free_irq(omap1_dma_irq[i], (void *) (i + 1));
-			goto out_free;
-		}
-	}
-
 	return 0;
 
 out_free:

diff -uprN git.orig/arch/arm/plat-omap/include/plat/dma.h git/arch/arm/plat-omap/include/plat/dma.h

arch/arm/plat-omap/include/plat/dma.h +2 -50
@@ -401,33 +401,6 @@
 
 /*----------------------------------------------------------------------------*/
 
-/* 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)
-
 #define OMAP1_DMA_TOUT_IRQ		(1 << 0)
 #define OMAP_DMA_DROP_IRQ		(1 << 1)
 #define OMAP_DMA_HALF_IRQ		(1 << 2)
@@ -441,6 +414,8 @@
 #define OMAP2_DMA_SUPERVISOR_ERR_IRQ	(1 << 10)
 #define OMAP2_DMA_MISALIGNED_ERR_IRQ	(1 << 11)
 
+#define OMAP_DMA_CCR_EN			(1 << 7)
+
 #define OMAP_DMA_DATA_TYPE_S8		0x00
 #define OMAP_DMA_DATA_TYPE_S16		0x01
 #define OMAP_DMA_DATA_TYPE_S32		0x02
@@ -503,14 +478,6 @@
 #define DMA_CH_PRIO_HIGH		0x1
 #define DMA_CH_PRIO_LOW			0x0 /* Def */
 
-/* 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
-};
-
 enum omap_dma_burst_mode {
 	OMAP_DMA_DATA_BURST_DIS = 0,
 	OMAP_DMA_DATA_BURST_4,
@@ -661,20 +628,13 @@ extern int omap_modify_dma_chain_params(
 extern int omap_dma_chain_status(int chain_id);
 #endif
 
-/* 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);

arch/arm/plat-omap/include/plat/dma.h extern int omap_modify_dma_chain_params( · line 640

Quoted 10 lines
arch/arm/plat-omap/include/plat/dma.h +8 -0
+#ifdef CONFIG_ARCH_OMAP1
+#include <mach/lcd_dma.h>
+#else
+static inline int omap_lcd_dma_running(void)
+{
+	return 0;
+}
+#endif
 
 #endif /* __ASM_ARCH_DMA_H */

- Paul

#10 lore raw

Re: [RFC] [PATCH] OMAP: DMA: move LCD DMA related code from plat-omap to mach-omap1 (Re: [PATCH] OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set)

Wednesday 25 November 2009 10:02:52 Paul Walmsley napisał(a):

Quoted 21 lines

Hello Janusz,

Quoted 18 lines · Janusz Krzysztofik

(probably less interested persons and lists dropped)

Quoted 4 lines · Tuesday 10 November 2009 11:50:52 Paul Walmsley wrote:

... All of the LCD DMA code in plat-omap/dma.c appears to be OMAP1-only (and apparently only is available on a subset of OMAP1 chips). It would be great if this code could be moved to mach-omap1/lcd_dma.c or a similar place.

The patch just tries to implement this idea.

Created against linux-omap for-next,
commit 2963c21fab52bfa8227da7f22864db393ebbc858

Tested on OMAP1510 Amstrad Delta.
Compile tested using omap_generic_2420_defconfig.

Quoted 7 lines
Quoted 4 lines

---
Hi Paul,

I hope the patch meets your suggestion closely enough.

Thanks, just scanned it quickly and it looks carefully done. Two suggestions below, both minor:

Paul,
Thanks for your review time.

Since I started with just duplicating files and then removing unnecessary sections, I wondered how I could split that work into several subsequent patches so it is more easy to verify how those chunks put into a new file differ from those extracted from the old one, but didn't find a good solution yet.

Quoted 6 lines
Quoted 6 lines

diff -uprN git.orig/arch/arm/mach-omap1/Makefile git/arch/arm/mach-omap1/Makefile

arch/arm/mach-omap1/Makefile +0 -0
@@ -3,7 +3,7 @@
 #
 
Quoted 10 lines

arch/arm/mach-omap1/Makefile line 6

Quoted 3 lines
arch/arm/mach-omap1/Makefile +1 -1
 # Common support
-obj-y := io.o id.o sram.o clock.o irq.o mux.o serial.o devices.o
+obj-y := io.o id.o sram.o clock.o irq.o lcd_dma.o mux.o serial.o devices.o

It seems that this LCD DMA controller is not present on OMAPs prior to the 1510, given all the references in the LCD DMA code to 1510 and 1610, etc. It might be good to add a Kconfig option so OMAP730/850 users can skip compiling it and save some memory. The drivers that use these routines can then include Kconfig dependencies on that option so it is automatically included when those drivers are built.

OK, will prepare that for next iteration.

Quoted 4 lines
Quoted 4 lines

diff -uprN git.orig/arch/arm/mach-omap1/include/mach/lcd_dma.h git/arch/arm/mach-omap1/include/mach/lcd_dma.h

arch/arm/mach-omap1/include/mach/lcd_dma.h +0 -0
@@ -0,0 +1,78 @@ 

[snip]

Quoted 5 lines
Quoted 1 line

+#ifndef __MACH_LCD_DMA_H__

Consider adding _OMAP1_ in this macro name. I doubt that name collisions here will be a serious issue, but adding a few extra bytes here might avoid some bug-hunting frustration in the long run...

OK, will do that too.

Thanks,
Janusz
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw

Re: [RFC] [PATCH] OMAP: DMA: move LCD DMA related code from plat-omap to mach-omap1 (Re: [PATCH] OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set)

Quoted 1 line · Janusz Krzysztofik

Thanks for your review time.

Thank you for doing this work :-)

Quoted 5 lines

Since I started with just duplicating files and then removing unnecessary sections, I wondered how I could split that work into several subsequent patches so it is more easy to verify how those chunks put into a new file differ from those extracted from the old one, but didn't find a good solution yet.

Looking through the code, you've cleaned up several things that indicate that you've put some thought and care into doing it (e.g., all the cpu_class_is_omap1(), for example). Plus, you mention that you've tested the code on OMAP1 and compile-tested on OMAP2. So it seems fine to me after those two minor changes are made that I mentioned in the last E-mail.

- Paul

#12 lore raw

Re: [RFC] [PATCH] OMAP: DMA: move LCD DMA related code from plat-omap to mach-omap1 (Re: [PATCH] OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set)

In reply to Janusz Krzysztofik

Wednesday 25 November 2009 14:54:47 Janusz Krzysztofik napisał(a):

Quoted 20 lines

Wednesday 25 November 2009 10:02:52 Paul Walmsley napisał(a):

Quoted 8 lines · Janusz Krzysztofik
Quoted 7 lines

diff -uprN git.orig/arch/arm/mach-omap1/Makefile git/arch/arm/mach-omap1/Makefile

arch/arm/mach-omap1/Makefile +0 -0
@@ -3,7 +3,7 @@ 
 #
 
Quoted 10 lines

arch/arm/mach-omap1/Makefile line 6

Quoted 3 lines
arch/arm/mach-omap1/Makefile +1 -1
 # Common support
-obj-y := io.o id.o sram.o clock.o irq.o mux.o serial.o devices.o
+obj-y := io.o id.o sram.o clock.o irq.o lcd_dma.o mux.o serial.o devices.o

It seems that this LCD DMA controller is not present on OMAPs prior to the 1510, given all the references in the LCD DMA code to 1510 and 1610, etc. It might be good to add a Kconfig option so OMAP730/850 users can skip compiling it and save some memory. The drivers that use these routines can then include Kconfig dependencies on that option so it is automatically included when those drivers are built.

Quoted 1 line

OK, will prepare that for next iteration.

Paul,

It turned out not that simple. Since arch/arm/mach-omap1/lcd_dma.c exports several functions that are called unconditionaly from drivers/video/omap/lcdc.c AND the latter is linked into the omapfb driver based on CONFIG_ARCH_OMAP1=y, linking in the former can't be limited to selected OMAP1 subarchs unless at least drivers/video/omap/{Kconfig,Makefile}, if not drivers/video/omap/lcdc.c itself either, are modified for that as well. Am I missing something?

If not, I can see two options:
1. Keep arch/arm/mach-omap1/lcd_dma.c linked in for any OMAP1 subarch unless CONFIG_FB_OMAP is not set. That can be cleaned up further after the drivers/video/omap/* stuff is ever modified.
2. Include drivers/video/omap/* modifications into this series.

What do you suggest?

Thanks,
Janusz
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#13 lore raw

Re: [RFC] [PATCH] OMAP: DMA: move LCD DMA related code from plat-omap to mach-omap1 (Re: [PATCH] OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set)

Hello Janusz,

Quoted 8 lines · Janusz Krzysztofik

It turned out not that simple. Since arch/arm/mach-omap1/lcd_dma.c exports several functions that are called unconditionaly from drivers/video/omap/lcdc.c AND the latter is linked into the omapfb driver based on CONFIG_ARCH_OMAP1=y, linking in the former can't be limited to selected OMAP1 subarchs unless at least drivers/video/omap/{Kconfig,Makefile}, if not drivers/video/omap/lcdc.c itself either, are modified for that as well. Am I missing something?

Quoted 7 lines

If not, I can see two options:
1. Keep arch/arm/mach-omap1/lcd_dma.c linked in for any OMAP1 subarch unless CONFIG_FB_OMAP is not set. That can be cleaned up further after the drivers/video/omap/* stuff is ever modified.
2. Include drivers/video/omap/* modifications into this series.

What do you suggest?

Let's take option 1 for right now. Maybe one of the htcwizard people might take that project up after the LCD DMA split is merged.

- Paul

#14 lore raw

Re: [RFC] [PATCH] OMAP: DMA: move LCD DMA related code from plat-omap to mach-omap1 (Re: [PATCH] OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set)

Thursday 26 November 2009 03:08:30 Paul Walmsley napisał(a):

Quoted 15 lines · Janusz Krzysztofik
Quoted 14 lines

It turned out not that simple. Since arch/arm/mach-omap1/lcd_dma.c exports several functions that are called unconditionaly from drivers/video/omap/lcdc.c AND the latter is linked into the omapfb driver based on CONFIG_ARCH_OMAP1=y, linking in the former can't be limited to selected OMAP1 subarchs unless at least drivers/video/omap/{Kconfig,Makefile}, if not drivers/video/omap/lcdc.c itself either, are modified for that as well. Am I missing something?

If not, I can see two options:
1. Keep arch/arm/mach-omap1/lcd_dma.c linked in for any OMAP1 subarch unless CONFIG_FB_OMAP is not set. That can be cleaned up further after the drivers/video/omap/* stuff is ever modified.
2. Include drivers/video/omap/* modifications into this series.

Quoted 4 lines
Quoted 1 line

What do you suggest?

Let's take option 1 for right now. Maybe one of the htcwizard people might take that project up after the LCD DMA split is merged.

Paul,

I probably missed a third option: conditionally replacing declarations of those functions required by lcdc.c with coresponding fake static inline definitions inside an #ifdef block in lcd_dma.h. What do you think?

Thanks,
Janusz
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#15 lore raw

Re: [RFC] [PATCH] OMAP: DMA: move LCD DMA related code from plat-omap to mach-omap1 (Re: [PATCH] OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set)

Quoted 16 lines · Janusz Krzysztofik

Thursday 26 November 2009 03:08:30 Paul Walmsley napisał(a):

Quoted 15 lines · Janusz Krzysztofik
Quoted 14 lines

It turned out not that simple. Since arch/arm/mach-omap1/lcd_dma.c exports several functions that are called unconditionaly from drivers/video/omap/lcdc.c AND the latter is linked into the omapfb driver based on CONFIG_ARCH_OMAP1=y, linking in the former can't be limited to selected OMAP1 subarchs unless at least drivers/video/omap/{Kconfig,Makefile}, if not drivers/video/omap/lcdc.c itself either, are modified for that as well. Am I missing something?

If not, I can see two options:
1. Keep arch/arm/mach-omap1/lcd_dma.c linked in for any OMAP1 subarch unless CONFIG_FB_OMAP is not set. That can be cleaned up further after the drivers/video/omap/* stuff is ever modified.
2. Include drivers/video/omap/* modifications into this series.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

What do you suggest?

Let's take option 1 for right now. Maybe one of the htcwizard people might take that project up after the LCD DMA split is merged.

I probably missed a third option: conditionally replacing declarations of those functions required by lcdc.c with coresponding fake static inline definitions inside an #ifdef block in lcd_dma.h. What do you think?

Just took a quick look at that lcdc.c file; I think we'd better leave those functions in, since they are so tightly integrated to the code. Hopefully one of the OMAP730/750/850 people can tease them out, since they've got a platform to test on. Sound reasonable? Less work for us, anyway :-)

- Paul

#16 lore raw

Re: [RFC] [PATCH] OMAP: DMA: move LCD DMA related code from plat-omap to mach-omap1 (Re: [PATCH] OMAP1: PM: Fix omapfb/lcd on Amstrad Delta broken when PM set)

Hi,

Quoted 27 lines · Paul Walmsley
Quoted 16 lines · Janusz Krzysztofik

Thursday 26 November 2009 03:08:30 Paul Walmsley napisał(a):

Quoted 15 lines · Janusz Krzysztofik
Quoted 14 lines

It turned out not that simple. Since arch/arm/mach-omap1/lcd_dma.c exports several functions that are called unconditionaly from drivers/video/omap/lcdc.c AND the latter is linked into the omapfb driver based on CONFIG_ARCH_OMAP1=y, linking in the former can't be limited to selected OMAP1 subarchs unless at least drivers/video/omap/{Kconfig,Makefile}, if not drivers/video/omap/lcdc.c itself either, are modified for that as well. Am I missing something?

If not, I can see two options:
1. Keep arch/arm/mach-omap1/lcd_dma.c linked in for any OMAP1 subarch unless CONFIG_FB_OMAP is not set. That can be cleaned up further after the drivers/video/omap/* stuff is ever modified.
2. Include drivers/video/omap/* modifications into this series.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

What do you suggest?

Let's take option 1 for right now.  Maybe one of the htcwizard people might take that project up after the LCD DMA split is merged.

I probably missed a third option: conditionally replacing declarations of those functions required by lcdc.c with coresponding fake static inline definitions inside an #ifdef block in lcd_dma.h. What do you think?

Quoted 5 lines

Just took a quick look at that lcdc.c file; I think we'd better leave those functions in, since they are so tightly integrated to the code. Hopefully one of the OMAP730/750/850 people can tease them out, since they've got a platform to test on.  Sound reasonable?  Less work for us, anyway :-)

I have htc wizard with omap850 I can test if patch will be finished :-)

Quoted 2 lines

- Paul

Marek
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html