The following series adds i.MX51 framebuffer support based on the IPUv3. It
is not perfect but I decided it is good enough to open it for a wider audience
and collect first reviews. I tested this on a babbage board using both outputs
(VGA/DVI) with different resolutions up to 1680x1050 and different colour depths.
I also tested it on one custom board using a fixed display setting.
Changes since v1:
- added full overlay support for i.MX51
- more data structures protection
- IPU clock now gets disabled when unused
- many minor cleanups due to comments received from the first round.
The following changes since commit 28a4f908acb342350b9ecbfcdf0a999cb83e05aa:
ARM: mx5: check for error in ioremap (2010-12-14 09:55:53 +0100)
are available in the git repository at:
git://git.pengutronix.de/git/imx/linux-2.6.git ipuv3
Sascha Hauer (9):
ARM i.MX51: Add ipu clock support
ARM i.MX51: rename IPU irqs
Add a mfd IPUv3 driver
fb: export fb mode db table
Add i.MX5 framebuffer driver
ARM i.MX51: Add IPU device support
ARM i.MX5: Allow to increase max zone order
ARM i.MX5: increase dma consistent size for IPU support
ARM i.MX51 babbage: Add framebuffer support
arch/arm/Kconfig | 4 +-
arch/arm/mach-mx5/Kconfig | 1 +
arch/arm/mach-mx5/board-mx51_babbage.c | 74 ++
arch/arm/mach-mx5/clock-mx51-mx53.c | 140 ++++
arch/arm/mach-mx5/devices-imx51.h | 4 +
arch/arm/plat-mxc/devices/Kconfig | 4 +
arch/arm/plat-mxc/devices/Makefile | 1 +
arch/arm/plat-mxc/devices/platform-imx_ipuv3.c | 47 ++
arch/arm/plat-mxc/include/mach/devices-common.h | 10 +
arch/arm/plat-mxc/include/mach/ipu-v3.h | 49 ++
arch/arm/plat-mxc/include/mach/memory.h | 3 +-
arch/arm/plat-mxc/include/mach/mx51.h | 4 +-
drivers/mfd/Kconfig | 7 +
...Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- arch/arm/plat-mxc/include/mach/memory.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/arm/plat-mxc/include/mach/memory.h b/arch/arm/plat-mxc/include/mach/memory.h index 9a9a000..987b42a 100644 --- a/arch/arm/plat-mxc/include/mach/memory.h +++ b/arch/arm/plat-mxc/include/mach/memory.h @@ -40,7 +40,8 @@ # endif #endif -#if defined(CONFIG_MX3_VIDEO) +#if defined(CONFIG_MX3_VIDEO) || defined(CONFIG_MFD_IMX_IPU_V3) || \ + defined(CONFIG_MFD_IMX_IPU_V3_MODULE) /* * Increase size of DMA-consistent memory region. * This is required for mx3 camera driver to capture at least two QXGA frames. -- 1.7.2.3 --
The IPU is the Image Processing Unit found on i.MX50/51/53 SoCs. It features several units for image processing, this patch adds support for the units needed for Framebuffer support, namely: - Display Controller (dc) - Display Interface (di) - Display Multi Fifo Controller (dmfc) - Display Processor (dp) - Image DMA Controller (idmac) This patch is based on the Freescale driver, but follows a different approach. The Freescale code implements logical idmac channels and the handling of the subunits is hidden in common idmac code pathes in big switch/case statements. This patch instead just provides code and resource management for the different subunits. The user, in this case the framebuffer driver, decides how the different units play together. The IPU has other units missing in this patch: - CMOS Sensor Interface (csi) - Video Deinterlacer (vdi) - Sensor Multi FIFO Controler (smfc) - Image Converter (ic) - Image Rotator (irt) So expect more files to come in this directory. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- arch/arm/plat-mxc/include/mach/ipu-v3.h | 49 +++ drivers/mfd/Kconfig | 7 + drivers/mfd/Makefile | 1 + drivers/mfd/imx-ipu-v3/Makefile | 3 + drivers/mfd/imx-ipu-v3/ipu-common.c | 708 +++++++++++++++++++++++++++++++ drivers/mfd/imx-ipu-v3/ipu-cpmem.c | 612 ++++++++++++++++++++++++++ drivers/mfd/imx-ipu-v3/ipu-dc.c | 364 ++++++++++++++++ drivers/mfd/imx-ipu-v3/ipu-di.c | 550 ++++++++++++++++++++++++ drivers/mfd/imx-ipu-v3/ipu-dmfc.c | 355 ++++++++++++++++ drivers/mfd/imx-ipu-v3/ipu-dp.c | 476 +++++++++++++++++++++ drivers/mfd/imx-ipu-v3/ipu-prv.h | 216 ++++++++++ include/linux/mfd/imx-ipu-v3.h | 219 ++++++++++ 12 files changed, 3560 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-mxc/include/mach/ipu-v3.h create mode 100644 drivers/mfd/imx-ipu-v3/Makefile create mode 100644 ...
Hello Samuel, I see no further comments on this series. Does this mean you are ok with the patch or didn't you find the time looking at it? This patch can go via the mfd tree or I can push this via my i.MX tree. Going via the i.MX tree makes life a bit easier for me because we do not run into merge order dependencies. Please let me know what you prefer. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | --
This patch adds framebuffer support to the Freescale i.MX SoCs equipped with an IPU v3, so far these are the i.MX50/51/53. This driver has been tested on the i.MX51 babbage board with both DVI and analog VGA in different resolutions and color depths. It has also been tested on a custom i.MX51 board using a fixed resolution panel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/video/Kconfig | 11 + drivers/video/Makefile | 1 + drivers/video/mx5fb.c | 934 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 946 insertions(+), 0 deletions(-) create mode 100644 drivers/video/mx5fb.c diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 27c1fb4..1901915 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -2236,6 +2236,17 @@ config FB_MX3 far only synchronous displays are supported. If you plan to use an LCD display with your i.MX31 system, say Y here. +config FB_MX5 + tristate "MX5 Framebuffer support" + depends on FB && MFD_IMX_IPU_V3 + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT + select FB_MODE_HELPERS + help + This is a framebuffer device for the i.MX51 LCD Controller. If you + plan to use an LCD display with your i.MX51 system, say Y here. + config FB_BROADSHEET tristate "E-Ink Broadsheet/Epson S1D13521 controller support" depends on FB diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 485e8ed..ad408d2 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -145,6 +145,7 @@ obj-$(CONFIG_FB_BF54X_LQ043) += bf54x-lq043fb.o obj-$(CONFIG_FB_BFIN_LQ035Q1) += bfin-lq035q1-fb.o obj-$(CONFIG_FB_BFIN_T350MCQB) += bfin-t350mcqb-fb.o obj-$(CONFIG_FB_MX3) += mx3fb.o +obj-$(CONFIG_FB_MX5) += mx5fb.o obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o # the test framebuffer is last diff --git a/drivers/video/mx5fb.c b/drivers/video/mx5fb.c new file mode 100644 index 0000000..f7824c9 --- /dev/null +++ ...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- arch/arm/mach-mx5/devices-imx51.h | 4 ++ arch/arm/plat-mxc/devices/Kconfig | 4 ++ arch/arm/plat-mxc/devices/Makefile | 1 + arch/arm/plat-mxc/devices/platform-imx_ipuv3.c | 47 +++++++++++++++++++++++ arch/arm/plat-mxc/include/mach/devices-common.h | 10 +++++ 5 files changed, 66 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-mxc/devices/platform-imx_ipuv3.c diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h index 6302e46..851c114 100644 --- a/arch/arm/mach-mx5/devices-imx51.h +++ b/arch/arm/mach-mx5/devices-imx51.h @@ -47,3 +47,7 @@ extern const struct imx_spi_imx_data imx51_ecspi_data[] __initconst; extern const struct imx_imx2_wdt_data imx51_imx2_wdt_data[] __initconst; #define imx51_add_imx2_wdt(id, pdata) \ imx_add_imx2_wdt(&imx51_imx2_wdt_data[id]) + +extern const struct imx_ipuv3_data imx51_ipuv3_data __initconst; +#define imx51_add_ipuv3(pdata) \ + imx_add_ipuv3(&imx51_ipuv3_data, pdata) diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig index 2537166..262d9c5 100644 --- a/arch/arm/plat-mxc/devices/Kconfig +++ b/arch/arm/plat-mxc/devices/Kconfig @@ -71,3 +71,7 @@ config IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX config IMX_HAVE_PLATFORM_SPI_IMX bool + +config IMX_HAVE_PLATFORM_IMX_IPUV3 + bool + diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile index 75cd2ec..0a6be0a 100644 --- a/arch/arm/plat-mxc/devices/Makefile +++ b/arch/arm/plat-mxc/devices/Makefile @@ -22,3 +22,4 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RNGA) += platform-mxc_rnga.o obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o +obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_IPUV3) += platform-imx_ipuv3.o diff --git ...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-mx5/Kconfig | 1 +
arch/arm/mach-mx5/board-mx51_babbage.c | 74 ++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
index 5011f42..2a936b7 100644
--- a/arch/arm/mach-mx5/Kconfig
+++ b/arch/arm/mach-mx5/Kconfig
@@ -22,6 +22,7 @@ config MACH_MX51_BABBAGE
select IMX_HAVE_PLATFORM_IMX_UART
select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
select IMX_HAVE_PLATFORM_SPI_IMX
+ select IMX_HAVE_PLATFORM_IMX_IPUV3
help
Include support for MX51 Babbage platform, also known as MX51EVK in
u-boot. This includes specific configurations for the board and its
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index 368a315..6c1576c 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -22,11 +22,13 @@
#include <linux/input.h>
#include <linux/spi/flash.h>
#include <linux/spi/spi.h>
+#include <linux/mfd/imx-ipu-v3.h>
#include <mach/common.h>
#include <mach/hardware.h>
#include <mach/iomux-mx51.h>
#include <mach/mxc_ehci.h>
+#include <mach/ipu-v3.h>
#include <asm/irq.h>
#include <asm/setup.h>
@@ -158,6 +160,41 @@ static iomux_v3_cfg_t mx51babbage_pads[] = {
MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK,
MX51_PAD_CSPI1_SS0__GPIO_4_24,
MX51_PAD_CSPI1_SS1__GPIO_4_25,
+
+ /* Display ...default setting of 11 allows us to allocate at maximum 2MB chunks of contiguous memory. For resolutions up to 1920x1080 32bpp we need much more memory, so make zone order configurable Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- arch/arm/Kconfig | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index db524e7..b3e070e 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1410,8 +1410,8 @@ config SPARSE_IRQ source "mm/Kconfig" config FORCE_MAX_ZONEORDER - int "Maximum zone order" if ARCH_SHMOBILE - range 11 64 if ARCH_SHMOBILE + int "Maximum zone order" if ARCH_SHMOBILE || ARCH_MX5 + range 11 64 if ARCH_SHMOBILE || ARCH_MX5 default "9" if SA1111 default "11" help -- 1.7.2.3 --
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-mx5/clock-mx51-mx53.c | 140 +++++++++++++++++++++++++++++++++++
1 files changed, 140 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
index 9fc65bb..f550d02 100644
--- a/arch/arm/mach-mx5/clock-mx51-mx53.c
+++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
@@ -39,6 +39,9 @@ static struct clk periph_apm_clk;
static struct clk ahb_clk;
static struct clk ipg_clk;
static struct clk usboh3_clk;
+static struct clk emi_fast_clk;
+static struct clk ipu_clk;
+static struct clk mipi_hsc1_clk;
#define MAX_DPLL_WAIT_TRIES 1000 /* 1000 * udelay(1) = 1ms */
@@ -688,6 +691,19 @@ static unsigned long clk_emi_slow_get_rate(struct clk *clk)
return clk_get_rate(clk->parent) / div;
}
+static unsigned long _clk_ddr_hf_get_rate(struct clk *clk)
+{
+ unsigned long rate;
+ u32 reg, div;
+
+ reg = __raw_readl(MXC_CCM_CBCDR);
+ div = ((reg & MXC_CCM_CBCDR_DDR_PODF_MASK) >>
+ MXC_CCM_CBCDR_DDR_PODF_OFFSET) + 1;
+ rate = clk_get_rate(clk->parent) / div;
+
+ return rate;
+}
+
/* External high frequency clock */
static struct clk ckih_clk = {
.get_rate = get_high_reference_clock_rate,
@@ -846,6 +862,109 @@ static struct clk emi_slow_clk = {
.get_rate = clk_emi_slow_get_rate,
};
+static int clk_ipu_enable(struct clk *clk)
+{
+ u32 reg;
+
+ _clk_ccgr_enable(clk);
+
+ /* Enable handshake with IPU when certain clock rates are changed */
+ reg = __raw_readl(MXC_CCM_CCDR);
+ reg &= ~MXC_CCM_CCDR_IPU_HS_MASK;
+ __raw_writel(reg, MXC_CCM_CCDR);
+
+ /* Enable handshake with IPU when LPM is entered */
+ reg = __raw_readl(MXC_CCM_CLPCR);
+ reg &= ~MXC_CCM_CLPCR_BYPASS_IPU_LPM_HS;
+ __raw_writel(reg, MXC_CCM_CLPCR);
+
+ return 0;
+}
+
+static void clk_ipu_disable(struct clk *clk)
+{
+ u32 reg;
+
+ _clk_ccgr_disable(clk);
+
+ /* Disable handshake with IPU whe dividers are changed */
+ reg = __raw_readl(MXC_CCM_CCDR);
+ reg |= ...The different modes can be useful for drivers. Currently there is
no way to expose the modes to sysfs, so export them.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/video/modedb.c | 7 ++++++-
include/linux/fb.h | 3 +++
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
index 0a4dbdc..82122a9 100644
--- a/drivers/video/modedb.c
+++ b/drivers/video/modedb.c
@@ -36,7 +36,7 @@ EXPORT_SYMBOL_GPL(fb_mode_option);
* Standard video mode definitions (taken from XFree86)
*/
-static const struct fb_videomode modedb[] = {
+const struct fb_videomode modedb[] = {
{
/* 640x400 @ 70 Hz, 31.5 kHz hsync */
NULL, 70, 640, 400, 39721, 40, 24, 39, 9, 96, 2,
@@ -277,6 +277,11 @@ static const struct fb_videomode modedb[] = {
},
};
+const struct fb_videomode *fb_modes = modedb;
+EXPORT_SYMBOL(fb_modes);
+const int num_fb_modes = ARRAY_SIZE(modedb);
+EXPORT_SYMBOL(num_fb_modes);
+
#ifdef CONFIG_FB_MODE_HELPERS
const struct fb_videomode vesa_modes[] = {
/* 0 640x350-85 VESA */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index d1631d3..e006172 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -1151,6 +1151,9 @@ struct fb_videomode {
extern const char *fb_mode_option;
extern const struct fb_videomode vesa_modes[];
+extern const struct fb_videomode *fb_modes;
+extern const int num_fb_modes;
+
struct fb_modelist {
struct list_head list;
struct fb_videomode mode;
--
1.7.2.3
--
Sascha Hauer <s.hauer@pengutronix.de> writes: After adding code to my efika sb machine file and your patchset, I've seen the light. Err, no. It was a penguin and a login prompt. I guess it means your patchset is working here. btw, would be nice to add some comments/docs about : - the meaning of the fields of the imx_ipuv3_platform_data struct. it's not clear - same for .display field of the ipuv3_fb_platform_data Arnaud --
>>>>> "Arnaud" == Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org> writes: Arnaud> Sascha Hauer <s.hauer@pengutronix.de> writes: Arnaud> Hi, >> The following series adds i.MX51 framebuffer support based on the >> IPUv3. It is not perfect but I decided it is good enough to open it >> for a wider audience and collect first reviews. I tested this on a >> babbage board using both outputs (VGA/DVI) with different >> resolutions up to 1680x1050 and different colour depths. I also >> tested it on one custom board using a fixed display setting. Arnaud> After adding code to my efika sb machine file and your patchset, I've Arnaud> seen the light. Err, no. It was a penguin and a login prompt. I guess Arnaud> it means your patchset is working here. Cool. Care to submit that machine file support? -- Bye, Peter Korsgaard --
