Skip to contentSkip to conversation

mx25: framebuffer support

PATCH Superseded Baruch Siach 4 participants 21 messages Feb 10, 2010 – Feb 17, 2010

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

cover mx25: framebuffer support

This set of patches adds support for the i.MX25 LCD controller block using the imxfb driver. Platform code for the i.MX25 PDK board is also added.

Tested on the i.MX25 PDK.

Baruch Siach (3):
imxfb: add support for i.MX25
mx25: add platform support for imxfb
mx25pdk: add LCD support

 arch/arm/mach-mx25/clock.c                  |   12 ++++++
 arch/arm/mach-mx25/devices.c                |   23 +++++++++++
 arch/arm/mach-mx25/devices.h                |    1 +
 arch/arm/mach-mx25/mx25pdk.c                |   55 +++++++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/iomux-mx25.h |    2 +
 arch/arm/plat-mxc/include/mach/mx25.h       |    2 +
 drivers/video/Kconfig                       |    2 +-
 7 files changed, 96 insertions(+), 1 deletions(-)
#1 lore raw

PATCH 1/3 imxfb: add support for i.MX25

---
 drivers/video/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/Kconfig +1 -1
index 5a5c303..7ff9acc 100644
@@ -402,7 +402,7 @@ config FB_SA1100
 
 config FB_IMX
 	tristate "Motorola i.MX LCD support"
-	depends on FB && (ARCH_MX1 || ARCH_MX2)
+	depends on FB && (ARCH_MX1 || ARCH_MX2 || ARCH_MX25)
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
Signature · 1 line
1.6.6.1
#2 lore raw

PATCH 1/3 imxfb: add support for i.MX25

Hi,

Quoted 10 lines · Baruch Siach
---
 drivers/video/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/Kconfig +0 -0
index 5a5c303..7ff9acc 100644

drivers/video/Kconfig config FB_SA1100 · line 405

Quoted 5 lines
drivers/video/Kconfig +1 -1
@@ -402,7 +402,7 @@ config FB_SA1100
 
 config FB_IMX
 	tristate "Motorola i.MX LCD support"
-	depends on FB && (ARCH_MX1 || ARCH_MX2)
+	depends on FB && (ARCH_MX1 || ARCH_MX2 || ARCH_MX25)

Can we make this

	depends on FB && HAVE_FB_IMX

and let the archs select HAVE_FB_IMX?

And is "FB" really necessary? The snipplet above is in an

	menuconfig FB
		...
	endmenu

block. (And there are many other items depending explicitly on FB.)

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#3 lore raw

PATCH 1/3 imxfb: add support for i.MX25

Hi Uwe,

Quoted 18 lines · Uwe Kleine-K?nig
Quoted 10 lines · Baruch Siach
---
 drivers/video/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/Kconfig +0 -0
index 5a5c303..7ff9acc 100644

drivers/video/Kconfig config FB_SA1100 · line 405

Quoted 5 lines
drivers/video/Kconfig +1 -1
@@ -402,7 +402,7 @@ config FB_SA1100
 
 config FB_IMX
 	tristate "Motorola i.MX LCD support"
-	depends on FB && (ARCH_MX1 || ARCH_MX2)
+	depends on FB && (ARCH_MX1 || ARCH_MX2 || ARCH_MX25)

Can we make this

Quoted 3 lines
	depends on FB && HAVE_FB_IMX

and let the archs select HAVE_FB_IMX?

I just wanted to do the minimal working change. Do you want me to send a patch updating each ARCH's Kconfig?

Quoted 7 lines

And is "FB" really necessary? The snipplet above is in an

	menuconfig FB
		...
	endmenu

block. (And there are many other items depending explicitly on FB.)

I don't know. As above, I'd rather do the minimal change.

baruch

Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#4 lore raw

PATCH 1/3 imxfb: add support for i.MX25

Hello Baruch,

Quoted 19 lines · Baruch Siach
Quoted 18 lines · Uwe Kleine-K?nig
Quoted 10 lines · Baruch Siach
---
 drivers/video/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/Kconfig +0 -0
index 5a5c303..7ff9acc 100644

drivers/video/Kconfig config FB_SA1100 · line 405

Quoted 5 lines
drivers/video/Kconfig +1 -1
@@ -402,7 +402,7 @@ config FB_SA1100
 
 config FB_IMX
 	tristate "Motorola i.MX LCD support"
-	depends on FB && (ARCH_MX1 || ARCH_MX2)
+	depends on FB && (ARCH_MX1 || ARCH_MX2 || ARCH_MX25)

Can we make this

Quoted 6 lines
Quoted 3 lines
	depends on FB && HAVE_FB_IMX

and let the archs select HAVE_FB_IMX?

I just wanted to do the minimal working change. Do you want me to send a patch updating each ARCH's Kconfig?

Of course this should go in a seperate patch, so this is your chance to increase your patch count even further :-)

For now I'd do the following to minimize inter-tree dependencies:

* remove all explicit dependencies on FB in the above block
* define
config HAVE_FB_IMX
bool
just before config FB_IMX and add it to the latter's dependencies, such that it reads:

depends on HAVE_FB_IMX || ARCH_MX1 || ARCH_MX2

and when this change hit's Linus' tree let ARCH_MX1 and ARCH_MX2 select HAVE_FB_IMX, too and remove it from the list.

I don't care when you add ARCH_MX25 as everything is more or less orthogonal here.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#5 lore raw

PATCH v2 1/1 imxfb: add support for i.MX25

---
 arch/arm/mach-mx25/Kconfig |    1 +
 drivers/video/Kconfig      |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)
arch/arm/mach-mx25/Kconfig +1 -0
index cc28f56..3520d49 100644
@@ -4,6 +4,7 @@ comment "MX25 platforms:"
 
 config MACH_MX25_3DS
 	select ARCH_MXC_IOMUX_V3
+	select HAVE_FB_IMX
 	bool "Support MX25PDK (3DS) Platform"
 
 endif
drivers/video/Kconfig +4 -1
index 5a5c303..3371e34 100644
@@ -400,9 +400,12 @@ config FB_SA1100
 	  If you plan to use the LCD display with your SA-1100 system, say
 	  Y here.
 
+config HAVE_FB_IMX
+	bool
+
 config FB_IMX
 	tristate "Motorola i.MX LCD support"
-	depends on FB && (ARCH_MX1 || ARCH_MX2)
+	depends on HAVE_FB_IMX || ARCH_MX1 || ARCH_MX2
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
Signature · 1 line
1.6.6.1
#6 lore raw

PATCH v2 1/1 imxfb: add support for i.MX25

Hello Baruch,

did you verify that dropping "FB" works correctly? You should point out that FB was dropped on purpose and why it doesn't change anything in the commit log.

Other than that

Thanks
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#7 lore raw

PATCH v2 1/1 imxfb: add support for i.MX25

Hi Uwe,

Quoted 1 line · Uwe Kleine-K?nig

did you verify that dropping "FB" works correctly?

No, I didn't, and it doesn't. The "endmenu" at the end of drivers/video/Kconfig ends the "menu" block, not the "menuconfig" block, which does not require an explicit block end statement. So, the FB dependency is required. I'll post an updated patch shortly.

Quoted 3 lines

Other than that

Thanks for your review, comments, and ack.

baruch

Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#8 lore raw

PATCH 1/1 imxfb: add support for i.MX25

In reply to Uwe Kleine-König
---
 arch/arm/plat-mxc/Kconfig |    1 +
 drivers/video/Kconfig     |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)
arch/arm/plat-mxc/Kconfig +1 -0
index 8b0a1ee..2a049df 100644
@@ -24,6 +24,7 @@ config ARCH_MX25
 	bool "MX25-based"
 	select CPU_ARM926T
 	select COMMON_CLKDEV
+	select HAVE_FB_IMX
 	help
 	  This enables support for systems based on the Freescale i.MX25 family
 
drivers/video/Kconfig +4 -1
index 5a5c303..83d40ed 100644
@@ -400,9 +400,12 @@ config FB_SA1100
 	  If you plan to use the LCD display with your SA-1100 system, say
 	  Y here.
 
+config HAVE_FB_IMX
+	bool
+
 config FB_IMX
 	tristate "Motorola i.MX LCD support"
-	depends on FB && (ARCH_MX1 || ARCH_MX2)
+	depends on FB && (HAVE_FB_IMX || ARCH_MX1 || ARCH_MX2)
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
Signature · 1 line
1.6.6.1
#9 lore raw

PATCH 2/3 mx25: add platform support for imxfb

In reply to Baruch Siach
---
 arch/arm/mach-mx25/clock.c            |   12 ++++++++++++
 arch/arm/mach-mx25/devices.c          |   23 +++++++++++++++++++++++
 arch/arm/mach-mx25/devices.h          |    1 +
 arch/arm/plat-mxc/include/mach/mx25.h |    2 ++
 4 files changed, 38 insertions(+), 0 deletions(-)
arch/arm/mach-mx25/clock.c +12 -0
index 744b52a..56bf958 100644
@@ -124,6 +124,11 @@ static unsigned long get_rate_gpt(struct clk *clk)
 	return get_rate_per(5);
 }
 
+static unsigned long get_rate_lcdc(struct clk *clk)
+{
+	return get_rate_per(7);
+}
+
 static unsigned long get_rate_otg(struct clk *clk)
 {
 	return 48000000; /* FIXME */
@@ -167,6 +172,8 @@ DEFINE_CLOCK(cspi1_clk,  0, CCM_CGCR1,  5, get_rate_ipg, NULL, NULL);
 DEFINE_CLOCK(cspi2_clk,  0, CCM_CGCR1,  6, get_rate_ipg, NULL, NULL);
 DEFINE_CLOCK(cspi3_clk,  0, CCM_CGCR1,  7, get_rate_ipg, NULL, NULL);
 DEFINE_CLOCK(fec_ahb_clk, 0, CCM_CGCR0, 23, NULL,	 NULL, NULL);
+DEFINE_CLOCK(lcdc_ahb_clk, 0, CCM_CGCR0, 24, NULL,	 NULL, NULL);
+DEFINE_CLOCK(lcdc_per_clk, 0, CCM_CGCR0,  7, NULL,	 NULL, &lcdc_ahb_clk);
 DEFINE_CLOCK(uart1_clk,  0, CCM_CGCR2, 14, get_rate_uart, NULL, &uart_per_clk);
 DEFINE_CLOCK(uart2_clk,  0, CCM_CGCR2, 15, get_rate_uart, NULL, &uart_per_clk);
 DEFINE_CLOCK(uart3_clk,  0, CCM_CGCR2, 16, get_rate_uart, NULL, &uart_per_clk);
@@ -183,6 +190,7 @@ DEFINE_CLOCK(tsc_clk,	 0, CCM_CGCR2, 13, get_rate_ipg, NULL, NULL);
 DEFINE_CLOCK(i2c_clk,	 0, CCM_CGCR0,  6, get_rate_i2c, NULL, NULL);
 DEFINE_CLOCK(fec_clk,	 0, CCM_CGCR1, 15, get_rate_ipg, NULL, &fec_ahb_clk);
 DEFINE_CLOCK(dryice_clk, 0, CCM_CGCR1,  8, get_rate_ipg, NULL, NULL);
+DEFINE_CLOCK(lcdc_clk,	 0, CCM_CGCR1, 29, get_rate_lcdc, NULL, &lcdc_per_clk);
 
 #define _REGISTER_CLOCK(d, n, c)	\
 	{				\
@@ -216,6 +224,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk)
 	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk)
+	_REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
 };
 
 int __init mx25_clocks_init(void)
@@ -233,6 +242,9 @@ int __init mx25_clocks_init(void)
 	__raw_writel((0xf << 16) | (3 << 26), CRM_BASE + CCM_CGCR1);
 	__raw_writel((1 << 5), CRM_BASE + CCM_CGCR2);
 
+	/* Clock source for lcdc is upll */
+	__raw_writel(__raw_readl(CRM_BASE+0x64) | (1 << 7), CRM_BASE + 0x64);
+
 	mxc_timer_init(&gpt_clk, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54);
 
 	return 0;
arch/arm/mach-mx25/devices.c +23 -0
index b0b75fc..3f4b8a0 100644
@@ -477,3 +477,26 @@ struct platform_device mx25_rtc_device = {
 	.num_resources	= ARRAY_SIZE(mx25_rtc_resources),
 	.resource	= mx25_rtc_resources,
 };
+
+static struct resource mx25_fb_resources[] = {
+	{
+		.start	= MX25_LCDC_BASE_ADDR,
+		.end	= MX25_LCDC_BASE_ADDR + 0xfff,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= MX25_INT_LCDC,
+		.end	= MX25_INT_LCDC,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device mx25_fb_device = {
+	.name		= "imx-fb",
+	.id		= 0,
+	.resource	= mx25_fb_resources,
+	.num_resources	= ARRAY_SIZE(mx25_fb_resources),
+	.dev		= {
+		.coherent_dma_mask = 0xFFFFFFFF,
+	},
+};
arch/arm/mach-mx25/devices.h +1 -0
index 37e6a08..39560e1 100644
@@ -20,3 +20,4 @@ extern struct platform_device mxc_i2c_device2;
 extern struct platform_device mx25_fec_device;
 extern struct platform_device mxc_nand_device;
 extern struct platform_device mx25_rtc_device;
+extern struct platform_device mx25_fb_device;
arch/arm/plat-mxc/include/mach/mx25.h +2 -0
index 215c4d8..f29798d 100644
@@ -44,9 +44,11 @@
 #define MX25_FEC_BASE_ADDR		0x50038000
 #define MX25_NFC_BASE_ADDR		0xbb000000
 #define MX25_DRYICE_BASE_ADDR		0x53ffc000
+#define MX25_LCDC_BASE_ADDR		0x53fbc000
 
 #define MX25_INT_DRYICE	25
 #define MX25_INT_FEC	57
 #define MX25_INT_NANDFC	33
+#define MX25_INT_LCDC	39
 
 #endif /* __MACH_MX25_H__ */
Signature · 1 line
1.6.6.1
#10 lore raw

PATCH 2/3 mx25: add platform support for imxfb

Hi,

arch/arm/mach-mx25/clock.c int __init mx25_clocks_init(void) · line 247

Quoted 7 lines · Baruch Siach
arch/arm/mach-mx25/clock.c +3 -0
@@ -233,6 +242,9 @@ int __init mx25_clocks_init(void)
 	__raw_writel((0xf << 16) | (3 << 26), CRM_BASE + CCM_CGCR1);
 	__raw_writel((1 << 5), CRM_BASE + CCM_CGCR2);
 
+	/* Clock source for lcdc is upll */
+	__raw_writel(__raw_readl(CRM_BASE+0x64) | (1 << 7), CRM_BASE + 0x64);
+

0x64? Please define a register name for that constant. Ditto for 7.

Note I didn't look in the hardware manual, but I wonder if that should better go in the enable routine for lcdc?

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#11 lore raw

PATCH 2/3 mx25: add platform support for imxfb

Hi Uwe,

Quoted 9 lines · Uwe Kleine-K?nig

arch/arm/mach-mx25/clock.c int __init mx25_clocks_init(void) · line 247

Quoted 7 lines · Baruch Siach
arch/arm/mach-mx25/clock.c +3 -0
@@ -233,6 +242,9 @@ int __init mx25_clocks_init(void)
 	__raw_writel((0xf << 16) | (3 << 26), CRM_BASE + CCM_CGCR1);
 	__raw_writel((1 << 5), CRM_BASE + CCM_CGCR2);
 
+	/* Clock source for lcdc is upll */
+	__raw_writel(__raw_readl(CRM_BASE+0x64) | (1 << 7), CRM_BASE + 0x64);
+

0x64? Please define a register name for that constant.

I just followed the precedence set in the get_rate_per() routine above. Defining a register name is obviously better.

Quoted 1 line

Ditto for 7.

See arch/arm/mach-mx3/clock.c:mx31_clocks_init() and arch/arm/mach-mx3/clock-imx35.c:mx35_clocks_init(). This is probably a matter for a separate cleanup patch.

Quoted 2 lines

Note I didn't look in the hardware manual, but I wonder if that should better go in the enable routine for lcdc?

OK. I'll do it there.

baruch

Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#12 lore raw

PATCH 2/3 mx25: add platform support for imxfb

Hi Uwe,

Quoted 6 lines · Baruch Siach
Quoted 5 lines · Uwe Kleine-K?nig
Quoted 4 lines · Baruch Siach
arch/arm/mach-mx25/clock.c +0 -0
@@ -233,6 +242,9 @@ int __init mx25_clocks_init(void)
 	__raw_writel((0xf << 16) | (3 << 26), CRM_BASE + CCM_CGCR1);
 	__raw_writel((1 << 5), CRM_BASE + CCM_CGCR2);
 
Quoted 7 lines
Quoted 5 lines

arch/arm/mach-mx25/clock.c int __init mx25_clocks_init(void) · line 247

Quoted 3 lines
arch/arm/mach-mx25/clock.c +3 -0
+	/* Clock source for lcdc is upll */
+	__raw_writel(__raw_readl(CRM_BASE+0x64) | (1 << 7), CRM_BASE + 0x64);
+

Note I didn't look in the hardware manual, but I wonder if that should better go in the enable routine for lcdc?

OK. I'll do it there.

Oops. I now see that the mx25 DEFINE_CLOCK() macro doesn't allow you currently to set an arbitrary .enable routine (following the mx27/mx31/mx35 clock implementation). So this gets a little tricky, and I'm not sure it worth the trouble. What do you think?

baruch

Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#13 lore raw

PATCH 3/3 mx25pdk: add LCD support

In reply to Baruch Siach
---
 arch/arm/mach-mx25/mx25pdk.c                |   55 +++++++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/iomux-mx25.h |    2 +
 2 files changed, 57 insertions(+), 0 deletions(-)
arch/arm/mach-mx25/mx25pdk.c +55 -0
index f4e8b98..6d9dd33 100644
@@ -35,6 +35,7 @@
 #include <mach/imx-uart.h>
 #include <mach/mx25.h>
 #include <mach/mxc_nand.h>
+#include <mach/imxfb.h>
 #include "devices.h"
 #include <mach/iomux.h>
 
@@ -54,6 +55,31 @@ static struct pad_desc mx25pdk_pads[] = {
 	MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
 	MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */
 	MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */
+
+	/* LCD */
+	MX25_PAD_LD0__LD0,
+	MX25_PAD_LD1__LD1,
+	MX25_PAD_LD2__LD2,
+	MX25_PAD_LD3__LD3,
+	MX25_PAD_LD4__LD4,
+	MX25_PAD_LD5__LD5,
+	MX25_PAD_LD6__LD6,
+	MX25_PAD_LD7__LD7,
+	MX25_PAD_LD8__LD8,
+	MX25_PAD_LD9__LD9,
+	MX25_PAD_LD10__LD10,
+	MX25_PAD_LD11__LD11,
+	MX25_PAD_LD12__LD12,
+	MX25_PAD_LD13__LD13,
+	MX25_PAD_LD14__LD14,
+	MX25_PAD_LD15__LD15,
+	MX25_PAD_GPIO_E__LD16,
+	MX25_PAD_GPIO_F__LD17,
+	MX25_PAD_HSYNC__HSYNC,
+	MX25_PAD_VSYNC__VSYNC,
+	MX25_PAD_LSCLK__LSCLK,
+	MX25_PAD_OE_ACD__OE_ACD,
+	MX25_PAD_CONTRAST__CONTRAST,
 };
 
 static struct fec_platform_data mx25_fec_pdata = {
@@ -83,6 +109,34 @@ static struct mxc_nand_platform_data mx25pdk_nand_board_info = {
 	.flash_bbt	= 1,
 };
 
+static struct imx_fb_videomode mx25pdk_modes[] = {
+	{
+		.mode	= {
+			.name		= "CRT-VGA",
+			.refresh	= 60,
+			.xres		= 640,
+			.yres		= 480,
+			.pixclock	= 39683,
+			.left_margin	= 45,
+			.right_margin	= 114,
+			.upper_margin	= 33,
+			.lower_margin	= 11,
+			.hsync_len	= 1,
+			.vsync_len	= 1,
+		},
+		.bpp	= 16,
+		.pcr	= 0xFA208B80,
+	},
+};
+
+static struct imx_fb_platform_data mx25pdk_fb_pdata = {
+	.mode		= mx25pdk_modes,
+	.num_modes	= ARRAY_SIZE(mx25pdk_modes),
+	.pwmr		= 0x00A903FF,
+	.lscr1		= 0x00120300,
+	.dmacr		= 0x00020010,
+};
+
 static void __init mx25pdk_init(void)
 {
 	mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads,
@@ -92,6 +146,7 @@ static void __init mx25pdk_init(void)
 	mxc_register_device(&mxc_usbh2, NULL);
 	mxc_register_device(&mxc_nand_device, &mx25pdk_nand_board_info);
 	mxc_register_device(&mx25_rtc_device, NULL);
+	mxc_register_device(&mx25_fb_device, &mx25pdk_fb_pdata);
 
 	mx25pdk_fec_reset();
 	mxc_register_device(&mx25_fec_device, &mx25_fec_pdata);
arch/arm/plat-mxc/include/mach/iomux-mx25.h +2 -0
index 9af494f..5418d52 100644
@@ -462,9 +462,11 @@
 #define MX25_PAD_GPIO_C__CAN2_TX	IOMUX_PAD(0x3f8, 0x1fc, 0x16, 0, 0, PAD_CTL_PUS_22K_UP)
 
 #define MX25_PAD_GPIO_D__GPIO_D		IOMUX_PAD(0x3fc, 0x200, 0x10, 0, 0, NO_PAD_CTRL)
+#define MX25_PAD_GPIO_E__LD16		IOMUX_PAD(0x400, 0x204, 0x02, 0, 0, NO_PAD_CTRL)
 #define MX25_PAD_GPIO_D__CAN2_RX	IOMUX_PAD(0x3fc, 0x200, 0x16, 0x484, 1, PAD_CTL_PUS_22K_UP)
 
 #define MX25_PAD_GPIO_E__GPIO_E		IOMUX_PAD(0x400, 0x204, 0x10, 0, 0, NO_PAD_CTRL)
+#define MX25_PAD_GPIO_F__LD17		IOMUX_PAD(0x404, 0x208, 0x02, 0, 0, NO_PAD_CTRL)
 #define MX25_PAD_GPIO_E__AUD7_TXD	IOMUX_PAD(0x400, 0x204, 0x14, 0, 0, NO_PAD_CTRL)
 
 #define MX25_PAD_GPIO_F__GPIO_F		IOMUX_PAD(0x404, 0x208, 0x10, 0, 0, NO_PAD_CTRL)
Signature · 1 line
1.6.6.1
#14 lore raw

cover mx25: framebuffer support

In reply to Baruch Siach

Ping?

I'd really like to see this merged in .34.

Thanks,
baruch

Quoted 18 lines · Baruch Siach

This set of patches adds support for the i.MX25 LCD controller block using the imxfb driver. Platform code for the i.MX25 PDK board is also added.

Tested on the i.MX25 PDK.

Baruch Siach (3):
imxfb: add support for i.MX25
mx25: add platform support for imxfb
mx25pdk: add LCD support

 arch/arm/mach-mx25/clock.c                  |   12 ++++++
 arch/arm/mach-mx25/devices.c                |   23 +++++++++++
 arch/arm/mach-mx25/devices.h                |    1 +
 arch/arm/mach-mx25/mx25pdk.c                |   55 +++++++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/iomux-mx25.h |    2 +
 arch/arm/plat-mxc/include/mach/mx25.h       |    2 +
 drivers/video/Kconfig                       |    2 +-
 7 files changed, 96 insertions(+), 1 deletions(-)
Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#15 lore raw

cover mx25: framebuffer support

Hi,

Quoted 3 lines · Baruch Siach

Ping?

I'd really like to see this merged in .34.

if no one feels responsible for taking this stuff you might want to try sending it to Andrew Morton (CC'ed). Just a general advice I really don't know this framebuffer.

Regards,

Florian Tobias Schandinat

Quoted 20 lines · Baruch Siach
Quoted 18 lines

This set of patches adds support for the i.MX25 LCD controller block using the imxfb driver. Platform code for the i.MX25 PDK board is also added.

Tested on the i.MX25 PDK.

Baruch Siach (3):
imxfb: add support for i.MX25
mx25: add platform support for imxfb
mx25pdk: add LCD support

 arch/arm/mach-mx25/clock.c                  |   12 ++++++
 arch/arm/mach-mx25/devices.c                |   23 +++++++++++
 arch/arm/mach-mx25/devices.h                |    1 +
 arch/arm/mach-mx25/mx25pdk.c                |   55 +++++++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/iomux-mx25.h |    2 +
 arch/arm/plat-mxc/include/mach/mx25.h       |    2 +
 drivers/video/Kconfig                       |    2 +-
 7 files changed, 96 insertions(+), 1 deletions(-)
maintainer
#16 lore raw

cover mx25: framebuffer support

In reply to Baruch Siach
Quoted 3 lines · Baruch Siach

Ping?

I'd really like to see this merged in .34.

I'll take care of it. Can you repost the whole series, please? It's always hard to pick the correct patches from a thread with -v2 and -v3 patches posted in between.

Sascha

Signature · 4 lines
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 |
#17 lore raw

PATCH 1/3 imxfb: add support for i.MX25

The commit also introduces the HAVE_FB_IMX config that is to be selected from the MX25 platform config. Once this commit gets merged, the two other i.MX archs, ARCH_MX1 and ARCH_MX2, should follow this one.

---
 arch/arm/plat-mxc/Kconfig |    1 +
 drivers/video/Kconfig     |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)
arch/arm/plat-mxc/Kconfig +1 -0
index 8b0a1ee..2a049df 100644
@@ -24,6 +24,7 @@ config ARCH_MX25
 	bool "MX25-based"
 	select CPU_ARM926T
 	select COMMON_CLKDEV
+	select HAVE_FB_IMX
 	help
 	  This enables support for systems based on the Freescale i.MX25 family
 
drivers/video/Kconfig +4 -1
index 5a5c303..83d40ed 100644
@@ -400,9 +400,12 @@ config FB_SA1100
 	  If you plan to use the LCD display with your SA-1100 system, say
 	  Y here.
 
+config HAVE_FB_IMX
+	bool
+
 config FB_IMX
 	tristate "Motorola i.MX LCD support"
-	depends on FB && (ARCH_MX1 || ARCH_MX2)
+	depends on FB && (HAVE_FB_IMX || ARCH_MX1 || ARCH_MX2)
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
Signature · 1 line
1.6.6.1
#18 lore raw

PATCH 2/3 mx25: add platform support for imxfb

In reply to Sascha Hauer
---
 arch/arm/mach-mx25/clock.c            |   12 ++++++++++++
 arch/arm/mach-mx25/devices.c          |   23 +++++++++++++++++++++++
 arch/arm/mach-mx25/devices.h          |    1 +
 arch/arm/plat-mxc/include/mach/mx25.h |    2 ++
 4 files changed, 38 insertions(+), 0 deletions(-)
arch/arm/mach-mx25/clock.c +12 -0
index 744b52a..56bf958 100644
@@ -124,6 +124,11 @@ static unsigned long get_rate_gpt(struct clk *clk)
 	return get_rate_per(5);
 }
 
+static unsigned long get_rate_lcdc(struct clk *clk)
+{
+	return get_rate_per(7);
+}
+
 static unsigned long get_rate_otg(struct clk *clk)
 {
 	return 48000000; /* FIXME */
@@ -167,6 +172,8 @@ DEFINE_CLOCK(cspi1_clk,  0, CCM_CGCR1,  5, get_rate_ipg, NULL, NULL);
 DEFINE_CLOCK(cspi2_clk,  0, CCM_CGCR1,  6, get_rate_ipg, NULL, NULL);
 DEFINE_CLOCK(cspi3_clk,  0, CCM_CGCR1,  7, get_rate_ipg, NULL, NULL);
 DEFINE_CLOCK(fec_ahb_clk, 0, CCM_CGCR0, 23, NULL,	 NULL, NULL);
+DEFINE_CLOCK(lcdc_ahb_clk, 0, CCM_CGCR0, 24, NULL,	 NULL, NULL);
+DEFINE_CLOCK(lcdc_per_clk, 0, CCM_CGCR0,  7, NULL,	 NULL, &lcdc_ahb_clk);
 DEFINE_CLOCK(uart1_clk,  0, CCM_CGCR2, 14, get_rate_uart, NULL, &uart_per_clk);
 DEFINE_CLOCK(uart2_clk,  0, CCM_CGCR2, 15, get_rate_uart, NULL, &uart_per_clk);
 DEFINE_CLOCK(uart3_clk,  0, CCM_CGCR2, 16, get_rate_uart, NULL, &uart_per_clk);
@@ -183,6 +190,7 @@ DEFINE_CLOCK(tsc_clk,	 0, CCM_CGCR2, 13, get_rate_ipg, NULL, NULL);
 DEFINE_CLOCK(i2c_clk,	 0, CCM_CGCR0,  6, get_rate_i2c, NULL, NULL);
 DEFINE_CLOCK(fec_clk,	 0, CCM_CGCR1, 15, get_rate_ipg, NULL, &fec_ahb_clk);
 DEFINE_CLOCK(dryice_clk, 0, CCM_CGCR1,  8, get_rate_ipg, NULL, NULL);
+DEFINE_CLOCK(lcdc_clk,	 0, CCM_CGCR1, 29, get_rate_lcdc, NULL, &lcdc_per_clk);
 
 #define _REGISTER_CLOCK(d, n, c)	\
 	{				\
@@ -216,6 +224,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk)
 	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk)
+	_REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
 };
 
 int __init mx25_clocks_init(void)
@@ -233,6 +242,9 @@ int __init mx25_clocks_init(void)
 	__raw_writel((0xf << 16) | (3 << 26), CRM_BASE + CCM_CGCR1);
 	__raw_writel((1 << 5), CRM_BASE + CCM_CGCR2);
 
+	/* Clock source for lcdc is upll */
+	__raw_writel(__raw_readl(CRM_BASE+0x64) | (1 << 7), CRM_BASE + 0x64);
+
 	mxc_timer_init(&gpt_clk, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54);
 
 	return 0;
arch/arm/mach-mx25/devices.c +23 -0
index b0b75fc..3f4b8a0 100644
@@ -477,3 +477,26 @@ struct platform_device mx25_rtc_device = {
 	.num_resources	= ARRAY_SIZE(mx25_rtc_resources),
 	.resource	= mx25_rtc_resources,
 };
+
+static struct resource mx25_fb_resources[] = {
+	{
+		.start	= MX25_LCDC_BASE_ADDR,
+		.end	= MX25_LCDC_BASE_ADDR + 0xfff,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= MX25_INT_LCDC,
+		.end	= MX25_INT_LCDC,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device mx25_fb_device = {
+	.name		= "imx-fb",
+	.id		= 0,
+	.resource	= mx25_fb_resources,
+	.num_resources	= ARRAY_SIZE(mx25_fb_resources),
+	.dev		= {
+		.coherent_dma_mask = 0xFFFFFFFF,
+	},
+};
arch/arm/mach-mx25/devices.h +1 -0
index 37e6a08..39560e1 100644
@@ -20,3 +20,4 @@ extern struct platform_device mxc_i2c_device2;
 extern struct platform_device mx25_fec_device;
 extern struct platform_device mxc_nand_device;
 extern struct platform_device mx25_rtc_device;
+extern struct platform_device mx25_fb_device;
arch/arm/plat-mxc/include/mach/mx25.h +2 -0
index 215c4d8..f29798d 100644
@@ -44,9 +44,11 @@
 #define MX25_FEC_BASE_ADDR		0x50038000
 #define MX25_NFC_BASE_ADDR		0xbb000000
 #define MX25_DRYICE_BASE_ADDR		0x53ffc000
+#define MX25_LCDC_BASE_ADDR		0x53fbc000
 
 #define MX25_INT_DRYICE	25
 #define MX25_INT_FEC	57
 #define MX25_INT_NANDFC	33
+#define MX25_INT_LCDC	39
 
 #endif /* __MACH_MX25_H__ */
Signature · 1 line
1.6.6.1
#19 lore raw

PATCH 3/3 mx25pdk: add LCD support

In reply to Sascha Hauer
---
 arch/arm/mach-mx25/mx25pdk.c                |   55 +++++++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/iomux-mx25.h |    2 +
 2 files changed, 57 insertions(+), 0 deletions(-)
arch/arm/mach-mx25/mx25pdk.c +55 -0
index f4e8b98..6d9dd33 100644
@@ -35,6 +35,7 @@
 #include <mach/imx-uart.h>
 #include <mach/mx25.h>
 #include <mach/mxc_nand.h>
+#include <mach/imxfb.h>
 #include "devices.h"
 #include <mach/iomux.h>
 
@@ -54,6 +55,31 @@ static struct pad_desc mx25pdk_pads[] = {
 	MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
 	MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */
 	MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */
+
+	/* LCD */
+	MX25_PAD_LD0__LD0,
+	MX25_PAD_LD1__LD1,
+	MX25_PAD_LD2__LD2,
+	MX25_PAD_LD3__LD3,
+	MX25_PAD_LD4__LD4,
+	MX25_PAD_LD5__LD5,
+	MX25_PAD_LD6__LD6,
+	MX25_PAD_LD7__LD7,
+	MX25_PAD_LD8__LD8,
+	MX25_PAD_LD9__LD9,
+	MX25_PAD_LD10__LD10,
+	MX25_PAD_LD11__LD11,
+	MX25_PAD_LD12__LD12,
+	MX25_PAD_LD13__LD13,
+	MX25_PAD_LD14__LD14,
+	MX25_PAD_LD15__LD15,
+	MX25_PAD_GPIO_E__LD16,
+	MX25_PAD_GPIO_F__LD17,
+	MX25_PAD_HSYNC__HSYNC,
+	MX25_PAD_VSYNC__VSYNC,
+	MX25_PAD_LSCLK__LSCLK,
+	MX25_PAD_OE_ACD__OE_ACD,
+	MX25_PAD_CONTRAST__CONTRAST,
 };
 
 static struct fec_platform_data mx25_fec_pdata = {
@@ -83,6 +109,34 @@ static struct mxc_nand_platform_data mx25pdk_nand_board_info = {
 	.flash_bbt	= 1,
 };
 
+static struct imx_fb_videomode mx25pdk_modes[] = {
+	{
+		.mode	= {
+			.name		= "CRT-VGA",
+			.refresh	= 60,
+			.xres		= 640,
+			.yres		= 480,
+			.pixclock	= 39683,
+			.left_margin	= 45,
+			.right_margin	= 114,
+			.upper_margin	= 33,
+			.lower_margin	= 11,
+			.hsync_len	= 1,
+			.vsync_len	= 1,
+		},
+		.bpp	= 16,
+		.pcr	= 0xFA208B80,
+	},
+};
+
+static struct imx_fb_platform_data mx25pdk_fb_pdata = {
+	.mode		= mx25pdk_modes,
+	.num_modes	= ARRAY_SIZE(mx25pdk_modes),
+	.pwmr		= 0x00A903FF,
+	.lscr1		= 0x00120300,
+	.dmacr		= 0x00020010,
+};
+
 static void __init mx25pdk_init(void)
 {
 	mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads,
@@ -92,6 +146,7 @@ static void __init mx25pdk_init(void)
 	mxc_register_device(&mxc_usbh2, NULL);
 	mxc_register_device(&mxc_nand_device, &mx25pdk_nand_board_info);
 	mxc_register_device(&mx25_rtc_device, NULL);
+	mxc_register_device(&mx25_fb_device, &mx25pdk_fb_pdata);
 
 	mx25pdk_fec_reset();
 	mxc_register_device(&mx25_fec_device, &mx25_fec_pdata);
arch/arm/plat-mxc/include/mach/iomux-mx25.h +2 -0
index 9af494f..5418d52 100644
@@ -462,9 +462,11 @@
 #define MX25_PAD_GPIO_C__CAN2_TX	IOMUX_PAD(0x3f8, 0x1fc, 0x16, 0, 0, PAD_CTL_PUS_22K_UP)
 
 #define MX25_PAD_GPIO_D__GPIO_D		IOMUX_PAD(0x3fc, 0x200, 0x10, 0, 0, NO_PAD_CTRL)
+#define MX25_PAD_GPIO_E__LD16		IOMUX_PAD(0x400, 0x204, 0x02, 0, 0, NO_PAD_CTRL)
 #define MX25_PAD_GPIO_D__CAN2_RX	IOMUX_PAD(0x3fc, 0x200, 0x16, 0x484, 1, PAD_CTL_PUS_22K_UP)
 
 #define MX25_PAD_GPIO_E__GPIO_E		IOMUX_PAD(0x400, 0x204, 0x10, 0, 0, NO_PAD_CTRL)
+#define MX25_PAD_GPIO_F__LD17		IOMUX_PAD(0x404, 0x208, 0x02, 0, 0, NO_PAD_CTRL)
 #define MX25_PAD_GPIO_E__AUD7_TXD	IOMUX_PAD(0x400, 0x204, 0x14, 0, 0, NO_PAD_CTRL)
 
 #define MX25_PAD_GPIO_F__GPIO_F		IOMUX_PAD(0x404, 0x208, 0x10, 0, 0, NO_PAD_CTRL)
Signature · 1 line
1.6.6.1
#20 lore raw

cover mx25: framebuffer support

In reply to Sascha Hauer

Hi Sascha,

Quoted 8 lines · Sascha Hauer
Quoted 3 lines · Baruch Siach

Ping?

I'd really like to see this merged in .34.

I'll take care of it. Can you repost the whole series, please? It's always hard to pick the correct patches from a thread with -v2 and -v3 patches posted in between.

Posted, thanks.

baruch

Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -