linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 8/8] pxa: add frame buffer on pxa910 ttc_dkb platform
@ 2009-11-10  8:12 Jun Nie
  2009-11-12  2:20 ` Jun Nie
  2009-11-16  9:35 ` Jun Nie
  0 siblings, 2 replies; 7+ messages in thread
From: Jun Nie @ 2009-11-10  8:12 UTC (permalink / raw)
  To: linux-arm-kernel

From beb28ecac687792ce01d19cdf022fc77948ac51f Mon Sep 17 00:00:00 2001
From: Jun Nie <njun@marvell.com>
Date: Tue, 10 Nov 2009 15:54:17 +0800
Subject: [PATCH] pxa: add frame buffer on pxa910 ttc_dkb platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa910_defconfig       |   39 ++++++++-
 arch/arm/mach-mmp/include/mach/pxa910.h |    8 ++
 arch/arm/mach-mmp/pxa910.c              |    4 +
 arch/arm/mach-mmp/ttc_dkb.c             |  140 +++++++++++++++++++++++++++++++
 4 files changed, 190 insertions(+), 1 deletions(-)

diff --git a/arch/arm/configs/pxa910_defconfig
b/arch/arm/configs/pxa910_defconfig
index 8c7e299..b9b1a85 100644
--- a/arch/arm/configs/pxa910_defconfig
+++ b/arch/arm/configs/pxa910_defconfig
@@ -578,7 +578,34 @@ CONFIG_SSB_POSSIBLE=y
 #
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
-# CONFIG_FB is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_PXA168=y
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set

 #
@@ -591,6 +618,16 @@ CONFIG_SSB_POSSIBLE=y
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+CONFIG_LOGO=y
+# CONFIG_LOGO_LINUX_MONO is not set
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_CLUT224=y
 # CONFIG_SOUND is not set
 # CONFIG_HID_SUPPORT is not set
 # CONFIG_USB_SUPPORT is not set
diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h
b/arch/arm/mach-mmp/include/mach/pxa910.h
index 6ae1ed7..7698793 100644
--- a/arch/arm/mach-mmp/include/mach/pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/pxa910.h
@@ -4,6 +4,7 @@
 #include <linux/i2c.h>
 #include <mach/devices.h>
 #include <plat/i2c.h>
+#include <video/pxa168fb.h>

 extern struct pxa_device_desc pxa910_device_uart1;
 extern struct pxa_device_desc pxa910_device_uart2;
@@ -13,6 +14,7 @@ extern struct pxa_device_desc pxa910_device_pwm1;
 extern struct pxa_device_desc pxa910_device_pwm2;
 extern struct pxa_device_desc pxa910_device_pwm3;
 extern struct pxa_device_desc pxa910_device_pwm4;
+extern struct pxa_device_desc pxa910_device_fb;

 static inline int pxa910_add_uart(int id)
 {
@@ -64,4 +66,10 @@ static inline int pxa910_add_pwm(int id)

 	return pxa_register_device(d, NULL, 0);
 }
+
+static inline int pxa910_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa910_device_fb, mi, sizeof(*mi));
+}
+
 #endif /* __ASM_MACH_PXA910_H */
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 5882ca6..48162a0 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -110,6 +110,8 @@ static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000);
 static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000);

+static APMU_CLK(lcd, LCD, 0x003f, 312000000);
+
 /* device and clock bindings */
 static struct clk_lookup pxa910_clkregs[] = {
 	INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL),
@@ -120,6 +122,7 @@ static struct clk_lookup pxa910_clkregs[] = {
 	INIT_CLKREG(&clk_pwm2, "pxa910-pwm.1", NULL),
 	INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa910-fb", "LCDCLK"),
 };

 static int __init pxa910_init(void)
@@ -174,3 +177,4 @@ PXA910_DEVICE(pwm1, "pxa910-pwm", 0, NONE,
0xd401a000, 0x10);
 PXA910_DEVICE(pwm2, "pxa910-pwm", 1, NONE, 0xd401a400, 0x10);
 PXA910_DEVICE(pwm3, "pxa910-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA910_DEVICE(pwm4, "pxa910-pwm", 3, NONE, 0xd401ac00, 0x10);
+PXA910_DEVICE(fb, "pxa910-fb", -1, LCD, 0xd420b000, 0x1c8);
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index dbd8cfd..06abf37 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -14,6 +14,8 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/onenand.h>
+#include <linux/delay.h>
+#include <video/pxa168fb.h>

 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -21,6 +23,7 @@
 #include <mach/addr-map.h>
 #include <mach/mfp-pxa910.h>
 #include <mach/pxa910.h>
+#include <mach/gpio.h>

 #include "common.h"

@@ -54,8 +57,142 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
 	DF_WEn_DF_WEn,
 	DF_REn_DF_REn,
 	DF_RDY0_DF_RDY0,
+
+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO81_LCD_FCLK,
+	GPIO82_LCD_LCLK,
+	GPIO83_LCD_PCLK,
+	GPIO84_LCD_DENA,
+	GPIO85_LCD_DD0,
+	GPIO86_LCD_DD1,
+	GPIO87_LCD_DD2,
+	GPIO88_LCD_DD3,
+	GPIO89_LCD_DD4,
+	GPIO90_LCD_DD5,
+	GPIO91_LCD_DD6,
+	GPIO92_LCD_DD7,
+	GPIO93_LCD_DD8,
+	GPIO94_LCD_DD9,
+	GPIO95_LCD_DD10,
+	GPIO96_LCD_DD11,
+	GPIO97_LCD_DD12,
+	GPIO98_LCD_DD13,
+	GPIO100_LCD_DD14,
+	GPIO101_LCD_DD15,
+	GPIO102_LCD_DD16,
+	GPIO103_LCD_DD17,
+	GPIO104_LCD_SPIDOUT,
+	GPIO105_LCD_SPIDIN,
+	GPIO107_LCD_CS1,
+	GPIO108_LCD_DCLK,
+	GPIO106_LCD_RESET,
+#endif
+};
+
+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x0801,
+	0x0800,
+	0x0200,
+	0x0304,
+	0x040e,
+	0x0903,
+	0x0b18,
+	0x0c53,
+	0x0d01,
+	0x0ee0,
+	0x0f01,
+	0x1058,
+	0x201e,
+	0x210a,
+	0x220a,
+	0x231e,
+	0x2400,
+	0x2532,
+	0x2600,
+	0x27ac,
+	0x2904,
+	0x2aa2,
+	0x2b45,
+	0x2c45,
+	0x2d15,
+	0x2e5a,
+	0x2fff,
+	0x306b,
+	0x310d,
+	0x3248,
+	0x3382,
+	0x34bd,
+	0x35e7,
+	0x3618,
+	0x3794,
+	0x3801,
+	0x395d,
+	0x3aae,
+	0x3bff,
+	0x07c9,		//auto power on
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x07d9,		//auto power off
+};
+
+static int tpo_lcd_power(struct pxa168fb_info *fbi, unsigned int
spi_gpio_cs, unsigned int spi_gpio_reset, int on)
+{
+	int err = 0;
+
+	if (on) {
+		if (spi_gpio_reset != -1) {
+			err = gpio_request(spi_gpio_reset, "TPO_LCD_SPI_RESET");
+			if (err) {
+				printk("failed to request GPIO for TPO LCD RESET\n");
+				return -1;
+			}
+			gpio_direction_output(spi_gpio_reset, 0);
+			msleep(100);
+			gpio_set_value(spi_gpio_reset, 1);
+			msleep(100);
+			gpio_free(spi_gpio_reset);
+		}
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdon,
ARRAY_SIZE(tpo_spi_cmdon), spi_gpio_cs, 0, 40);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 0);
+}
+
+static struct fb_videomode video_modes[] = {
+	/* lpj032l001b HVGA mode info */
+	[0] = {
+		.pixclock       = 100000,
+		.refresh        = 60,
+		.xres           = 320,
+		.yres           = 480,
+		.hsync_len      = 10,
+		.left_margin    = 15,
+		.right_margin   = 10,
+		.vsync_len      = 2,
+		.upper_margin   = 4,
+		.lower_margin   = 2,
+		.sync           = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
+	},
 };

+static struct pxa168fb_mach_info ttc_dkb_lcd_info __initdata = {
+	.id                     = "Base",
+	.modes                  = video_modes,
+	.num_modes              = ARRAY_SIZE(video_modes),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_18_SPI,
+	.dumb_mode              = DUMB_MODE_RGB666,
+	.active                 = 1,
+	.spi_ctrl               = CFG_SCLKCNT(16) | CFG_TXBITS(16) |
CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs            = -1,
+	.spi_gpio_reset		= mfp_to_gpio(MFP_PIN_GPIO106),
+	.invert_pixclock	= 1,
+	.pxa168fb_lcd_power	= tpo_lcd_power,
+};
+#endif
+
 #if defined(CONFIG_MTD_ONENAND) || defined(CONFIG_MTD_ONENAND_MODULE)
 static struct mtd_partition ttc_dkb_onenand_partitions[] = {
 	{
@@ -123,6 +260,9 @@ static void __init ttc_dkb_init(void)

 	/* on-chip devices */
 	pxa910_add_uart(1);
+#ifdef CONFIG_FB_PXA168
+	pxa910_add_fb(&ttc_dkb_lcd_info);
+#endif

 	/* off-chip devices */
 	ttc_dkb_init_onenand();
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 8/8] pxa: add frame buffer on pxa910 ttc_dkb platform
  2009-11-10  8:12 [PATCH 8/8] pxa: add frame buffer on pxa910 ttc_dkb platform Jun Nie
@ 2009-11-12  2:20 ` Jun Nie
  2009-11-12 22:21   ` Russell King - ARM Linux
  2009-11-16  9:35 ` Jun Nie
  1 sibling, 1 reply; 7+ messages in thread
From: Jun Nie @ 2009-11-12  2:20 UTC (permalink / raw)
  To: linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 10388 bytes --]

2009/11/10 Jun Nie <niej0001@gmail.com>:
> From beb28ecac687792ce01d19cdf022fc77948ac51f Mon Sep 17 00:00:00 2001
> From: Jun Nie <njun@marvell.com>
> Date: Tue, 10 Nov 2009 15:54:17 +0800
> Subject: [PATCH] pxa: add frame buffer on pxa910 ttc_dkb platform
>
> Signed-off-by: Jun Nie <njun@marvell.com>
> ---
>  arch/arm/configs/pxa910_defconfig       |   39 ++++++++-
>  arch/arm/mach-mmp/include/mach/pxa910.h |    8 ++
>  arch/arm/mach-mmp/pxa910.c              |    4 +
>  arch/arm/mach-mmp/ttc_dkb.c             |  140 +++++++++++++++++++++++++++++++
>  4 files changed, 190 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/configs/pxa910_defconfig
> b/arch/arm/configs/pxa910_defconfig
> index 8c7e299..b9b1a85 100644
> --- a/arch/arm/configs/pxa910_defconfig
> +++ b/arch/arm/configs/pxa910_defconfig
> @@ -578,7 +578,34 @@ CONFIG_SSB_POSSIBLE=y
>  #
>  # CONFIG_VGASTATE is not set
>  # CONFIG_VIDEO_OUTPUT_CONTROL is not set
> -# CONFIG_FB is not set
> +CONFIG_FB=y
> +# CONFIG_FIRMWARE_EDID is not set
> +# CONFIG_FB_DDC is not set
> +# CONFIG_FB_BOOT_VESA_SUPPORT is not set
> +CONFIG_FB_CFB_FILLRECT=y
> +CONFIG_FB_CFB_COPYAREA=y
> +CONFIG_FB_CFB_IMAGEBLIT=y
> +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
> +# CONFIG_FB_SYS_FILLRECT is not set
> +# CONFIG_FB_SYS_COPYAREA is not set
> +# CONFIG_FB_SYS_IMAGEBLIT is not set
> +# CONFIG_FB_FOREIGN_ENDIAN is not set
> +# CONFIG_FB_SYS_FOPS is not set
> +# CONFIG_FB_SVGALIB is not set
> +# CONFIG_FB_MACMODES is not set
> +# CONFIG_FB_BACKLIGHT is not set
> +# CONFIG_FB_MODE_HELPERS is not set
> +# CONFIG_FB_TILEBLITTING is not set
> +
> +#
> +# Frame buffer hardware drivers
> +#
> +# CONFIG_FB_S1D13XXX is not set
> +CONFIG_FB_PXA168=y
> +# CONFIG_FB_VIRTUAL is not set
> +# CONFIG_FB_METRONOME is not set
> +# CONFIG_FB_MB862XX is not set
> +# CONFIG_FB_BROADSHEET is not set
>  # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
>
>  #
> @@ -591,6 +618,16 @@ CONFIG_SSB_POSSIBLE=y
>  #
>  # CONFIG_VGA_CONSOLE is not set
>  CONFIG_DUMMY_CONSOLE=y
> +CONFIG_FRAMEBUFFER_CONSOLE=y
> +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
> +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
> +# CONFIG_FONTS is not set
> +CONFIG_FONT_8x8=y
> +CONFIG_FONT_8x16=y
> +CONFIG_LOGO=y
> +# CONFIG_LOGO_LINUX_MONO is not set
> +CONFIG_LOGO_LINUX_VGA16=y
> +CONFIG_LOGO_LINUX_CLUT224=y
>  # CONFIG_SOUND is not set
>  # CONFIG_HID_SUPPORT is not set
>  # CONFIG_USB_SUPPORT is not set
> diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h
> b/arch/arm/mach-mmp/include/mach/pxa910.h
> index 6ae1ed7..7698793 100644
> --- a/arch/arm/mach-mmp/include/mach/pxa910.h
> +++ b/arch/arm/mach-mmp/include/mach/pxa910.h
> @@ -4,6 +4,7 @@
>  #include <linux/i2c.h>
>  #include <mach/devices.h>
>  #include <plat/i2c.h>
> +#include <video/pxa168fb.h>
>
>  extern struct pxa_device_desc pxa910_device_uart1;
>  extern struct pxa_device_desc pxa910_device_uart2;
> @@ -13,6 +14,7 @@ extern struct pxa_device_desc pxa910_device_pwm1;
>  extern struct pxa_device_desc pxa910_device_pwm2;
>  extern struct pxa_device_desc pxa910_device_pwm3;
>  extern struct pxa_device_desc pxa910_device_pwm4;
> +extern struct pxa_device_desc pxa910_device_fb;
>
>  static inline int pxa910_add_uart(int id)
>  {
> @@ -64,4 +66,10 @@ static inline int pxa910_add_pwm(int id)
>
>        return pxa_register_device(d, NULL, 0);
>  }
> +
> +static inline int pxa910_add_fb(struct pxa168fb_mach_info *mi)
> +{
> +       return pxa_register_device(&pxa910_device_fb, mi, sizeof(*mi));
> +}
> +
>  #endif /* __ASM_MACH_PXA910_H */
> diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
> index 5882ca6..48162a0 100644
> --- a/arch/arm/mach-mmp/pxa910.c
> +++ b/arch/arm/mach-mmp/pxa910.c
> @@ -110,6 +110,8 @@ static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000);
>  static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000);
>  static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000);
>
> +static APMU_CLK(lcd, LCD, 0x003f, 312000000);
> +
>  /* device and clock bindings */
>  static struct clk_lookup pxa910_clkregs[] = {
>        INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL),
> @@ -120,6 +122,7 @@ static struct clk_lookup pxa910_clkregs[] = {
>        INIT_CLKREG(&clk_pwm2, "pxa910-pwm.1", NULL),
>        INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
>        INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
> +       INIT_CLKREG(&clk_lcd, "pxa910-fb", "LCDCLK"),
>  };
>
>  static int __init pxa910_init(void)
> @@ -174,3 +177,4 @@ PXA910_DEVICE(pwm1, "pxa910-pwm", 0, NONE,
> 0xd401a000, 0x10);
>  PXA910_DEVICE(pwm2, "pxa910-pwm", 1, NONE, 0xd401a400, 0x10);
>  PXA910_DEVICE(pwm3, "pxa910-pwm", 2, NONE, 0xd401a800, 0x10);
>  PXA910_DEVICE(pwm4, "pxa910-pwm", 3, NONE, 0xd401ac00, 0x10);
> +PXA910_DEVICE(fb, "pxa910-fb", -1, LCD, 0xd420b000, 0x1c8);
> diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
> index dbd8cfd..06abf37 100644
> --- a/arch/arm/mach-mmp/ttc_dkb.c
> +++ b/arch/arm/mach-mmp/ttc_dkb.c
> @@ -14,6 +14,8 @@
>  #include <linux/mtd/mtd.h>
>  #include <linux/mtd/partitions.h>
>  #include <linux/mtd/onenand.h>
> +#include <linux/delay.h>
> +#include <video/pxa168fb.h>
>
>  #include <asm/mach-types.h>
>  #include <asm/mach/arch.h>
> @@ -21,6 +23,7 @@
>  #include <mach/addr-map.h>
>  #include <mach/mfp-pxa910.h>
>  #include <mach/pxa910.h>
> +#include <mach/gpio.h>
>
>  #include "common.h"
>
> @@ -54,8 +57,142 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
>        DF_WEn_DF_WEn,
>        DF_REn_DF_REn,
>        DF_RDY0_DF_RDY0,
> +
> +#ifdef CONFIG_FB_PXA168
> +       /* LCD */
> +       GPIO81_LCD_FCLK,
> +       GPIO82_LCD_LCLK,
> +       GPIO83_LCD_PCLK,
> +       GPIO84_LCD_DENA,
> +       GPIO85_LCD_DD0,
> +       GPIO86_LCD_DD1,
> +       GPIO87_LCD_DD2,
> +       GPIO88_LCD_DD3,
> +       GPIO89_LCD_DD4,
> +       GPIO90_LCD_DD5,
> +       GPIO91_LCD_DD6,
> +       GPIO92_LCD_DD7,
> +       GPIO93_LCD_DD8,
> +       GPIO94_LCD_DD9,
> +       GPIO95_LCD_DD10,
> +       GPIO96_LCD_DD11,
> +       GPIO97_LCD_DD12,
> +       GPIO98_LCD_DD13,
> +       GPIO100_LCD_DD14,
> +       GPIO101_LCD_DD15,
> +       GPIO102_LCD_DD16,
> +       GPIO103_LCD_DD17,
> +       GPIO104_LCD_SPIDOUT,
> +       GPIO105_LCD_SPIDIN,
> +       GPIO107_LCD_CS1,
> +       GPIO108_LCD_DCLK,
> +       GPIO106_LCD_RESET,
> +#endif
> +};
> +
> +#ifdef CONFIG_FB_PXA168
> +static u16 tpo_spi_cmdon[] = {
> +       0x0801,
> +       0x0800,
> +       0x0200,
> +       0x0304,
> +       0x040e,
> +       0x0903,
> +       0x0b18,
> +       0x0c53,
> +       0x0d01,
> +       0x0ee0,
> +       0x0f01,
> +       0x1058,
> +       0x201e,
> +       0x210a,
> +       0x220a,
> +       0x231e,
> +       0x2400,
> +       0x2532,
> +       0x2600,
> +       0x27ac,
> +       0x2904,
> +       0x2aa2,
> +       0x2b45,
> +       0x2c45,
> +       0x2d15,
> +       0x2e5a,
> +       0x2fff,
> +       0x306b,
> +       0x310d,
> +       0x3248,
> +       0x3382,
> +       0x34bd,
> +       0x35e7,
> +       0x3618,
> +       0x3794,
> +       0x3801,
> +       0x395d,
> +       0x3aae,
> +       0x3bff,
> +       0x07c9,         //auto power on
> +};
> +
> +static u16 tpo_spi_cmdoff[] = {
> +       0x07d9,         //auto power off
> +};
> +
> +static int tpo_lcd_power(struct pxa168fb_info *fbi, unsigned int
> spi_gpio_cs, unsigned int spi_gpio_reset, int on)
> +{
> +       int err = 0;
> +
> +       if (on) {
> +               if (spi_gpio_reset != -1) {
> +                       err = gpio_request(spi_gpio_reset, "TPO_LCD_SPI_RESET");
> +                       if (err) {
> +                               printk("failed to request GPIO for TPO LCD RESET\n");
> +                               return -1;
> +                       }
> +                       gpio_direction_output(spi_gpio_reset, 0);
> +                       msleep(100);
> +                       gpio_set_value(spi_gpio_reset, 1);
> +                       msleep(100);
> +                       gpio_free(spi_gpio_reset);
> +               }
> +               return pxa168fb_spi_send(fbi, tpo_spi_cmdon,
> ARRAY_SIZE(tpo_spi_cmdon), spi_gpio_cs, 0, 40);
> +       } else
> +               return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
> ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 0);
> +}
> +
> +static struct fb_videomode video_modes[] = {
> +       /* lpj032l001b HVGA mode info */
> +       [0] = {
> +               .pixclock       = 100000,
> +               .refresh        = 60,
> +               .xres           = 320,
> +               .yres           = 480,
> +               .hsync_len      = 10,
> +               .left_margin    = 15,
> +               .right_margin   = 10,
> +               .vsync_len      = 2,
> +               .upper_margin   = 4,
> +               .lower_margin   = 2,
> +               .sync           = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
> +       },
>  };
>
> +static struct pxa168fb_mach_info ttc_dkb_lcd_info __initdata = {
> +       .id                     = "Base",
> +       .modes                  = video_modes,
> +       .num_modes              = ARRAY_SIZE(video_modes),
> +       .pix_fmt                = PIX_FMT_RGB565,
> +       .io_pin_allocation_mode = PIN_MODE_DUMB_18_SPI,
> +       .dumb_mode              = DUMB_MODE_RGB666,
> +       .active                 = 1,
> +       .spi_ctrl               = CFG_SCLKCNT(16) | CFG_TXBITS(16) |
> CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
> +       .spi_gpio_cs            = -1,
> +       .spi_gpio_reset         = mfp_to_gpio(MFP_PIN_GPIO106),
> +       .invert_pixclock        = 1,
> +       .pxa168fb_lcd_power     = tpo_lcd_power,
> +};
> +#endif
> +
>  #if defined(CONFIG_MTD_ONENAND) || defined(CONFIG_MTD_ONENAND_MODULE)
>  static struct mtd_partition ttc_dkb_onenand_partitions[] = {
>        {
> @@ -123,6 +260,9 @@ static void __init ttc_dkb_init(void)
>
>        /* on-chip devices */
>        pxa910_add_uart(1);
> +#ifdef CONFIG_FB_PXA168
> +       pxa910_add_fb(&ttc_dkb_lcd_info);
> +#endif
>
>        /* off-chip devices */
>        ttc_dkb_init_onenand();
> --
> 1.5.4.3
>

patch attached.

[-- Attachment #2: 0008-pxa-add-frame-buffer-on-pxa910-ttc_dkb-platform.patch --]
[-- Type: text/x-diff, Size: 8376 bytes --]

From beb28ecac687792ce01d19cdf022fc77948ac51f Mon Sep 17 00:00:00 2001
From: Jun Nie <njun@marvell.com>
Date: Tue, 10 Nov 2009 15:54:17 +0800
Subject: [PATCH] pxa: add frame buffer on pxa910 ttc_dkb platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa910_defconfig       |   39 ++++++++-
 arch/arm/mach-mmp/include/mach/pxa910.h |    8 ++
 arch/arm/mach-mmp/pxa910.c              |    4 +
 arch/arm/mach-mmp/ttc_dkb.c             |  140 +++++++++++++++++++++++++++++++
 4 files changed, 190 insertions(+), 1 deletions(-)

diff --git a/arch/arm/configs/pxa910_defconfig b/arch/arm/configs/pxa910_defconfig
index 8c7e299..b9b1a85 100644
--- a/arch/arm/configs/pxa910_defconfig
+++ b/arch/arm/configs/pxa910_defconfig
@@ -578,7 +578,34 @@ CONFIG_SSB_POSSIBLE=y
 #
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
-# CONFIG_FB is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_PXA168=y
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
@@ -591,6 +618,16 @@ CONFIG_SSB_POSSIBLE=y
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+CONFIG_LOGO=y
+# CONFIG_LOGO_LINUX_MONO is not set
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_CLUT224=y
 # CONFIG_SOUND is not set
 # CONFIG_HID_SUPPORT is not set
 # CONFIG_USB_SUPPORT is not set
diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h b/arch/arm/mach-mmp/include/mach/pxa910.h
index 6ae1ed7..7698793 100644
--- a/arch/arm/mach-mmp/include/mach/pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/pxa910.h
@@ -4,6 +4,7 @@
 #include <linux/i2c.h>
 #include <mach/devices.h>
 #include <plat/i2c.h>
+#include <video/pxa168fb.h>
 
 extern struct pxa_device_desc pxa910_device_uart1;
 extern struct pxa_device_desc pxa910_device_uart2;
@@ -13,6 +14,7 @@ extern struct pxa_device_desc pxa910_device_pwm1;
 extern struct pxa_device_desc pxa910_device_pwm2;
 extern struct pxa_device_desc pxa910_device_pwm3;
 extern struct pxa_device_desc pxa910_device_pwm4;
+extern struct pxa_device_desc pxa910_device_fb;
 
 static inline int pxa910_add_uart(int id)
 {
@@ -64,4 +66,10 @@ static inline int pxa910_add_pwm(int id)
 
 	return pxa_register_device(d, NULL, 0);
 }
+
+static inline int pxa910_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa910_device_fb, mi, sizeof(*mi));
+}
+
 #endif /* __ASM_MACH_PXA910_H */
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 5882ca6..48162a0 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -110,6 +110,8 @@ static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000);
 static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000);
 
+static APMU_CLK(lcd, LCD, 0x003f, 312000000);
+
 /* device and clock bindings */
 static struct clk_lookup pxa910_clkregs[] = {
 	INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL),
@@ -120,6 +122,7 @@ static struct clk_lookup pxa910_clkregs[] = {
 	INIT_CLKREG(&clk_pwm2, "pxa910-pwm.1", NULL),
 	INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa910-fb", "LCDCLK"),
 };
 
 static int __init pxa910_init(void)
@@ -174,3 +177,4 @@ PXA910_DEVICE(pwm1, "pxa910-pwm", 0, NONE, 0xd401a000, 0x10);
 PXA910_DEVICE(pwm2, "pxa910-pwm", 1, NONE, 0xd401a400, 0x10);
 PXA910_DEVICE(pwm3, "pxa910-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA910_DEVICE(pwm4, "pxa910-pwm", 3, NONE, 0xd401ac00, 0x10);
+PXA910_DEVICE(fb, "pxa910-fb", -1, LCD, 0xd420b000, 0x1c8);
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index dbd8cfd..06abf37 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -14,6 +14,8 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/onenand.h>
+#include <linux/delay.h>
+#include <video/pxa168fb.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -21,6 +23,7 @@
 #include <mach/addr-map.h>
 #include <mach/mfp-pxa910.h>
 #include <mach/pxa910.h>
+#include <mach/gpio.h>
 
 #include "common.h"
 
@@ -54,8 +57,142 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
 	DF_WEn_DF_WEn,
 	DF_REn_DF_REn,
 	DF_RDY0_DF_RDY0,
+
+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO81_LCD_FCLK,
+	GPIO82_LCD_LCLK,
+	GPIO83_LCD_PCLK,
+	GPIO84_LCD_DENA,
+	GPIO85_LCD_DD0,
+	GPIO86_LCD_DD1,
+	GPIO87_LCD_DD2,
+	GPIO88_LCD_DD3,
+	GPIO89_LCD_DD4,
+	GPIO90_LCD_DD5,
+	GPIO91_LCD_DD6,
+	GPIO92_LCD_DD7,
+	GPIO93_LCD_DD8,
+	GPIO94_LCD_DD9,
+	GPIO95_LCD_DD10,
+	GPIO96_LCD_DD11,
+	GPIO97_LCD_DD12,
+	GPIO98_LCD_DD13,
+	GPIO100_LCD_DD14,
+	GPIO101_LCD_DD15,
+	GPIO102_LCD_DD16,
+	GPIO103_LCD_DD17,
+	GPIO104_LCD_SPIDOUT,
+	GPIO105_LCD_SPIDIN,
+	GPIO107_LCD_CS1,
+	GPIO108_LCD_DCLK,
+	GPIO106_LCD_RESET,
+#endif
+};
+
+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x0801,
+	0x0800,
+	0x0200,
+	0x0304,
+	0x040e,
+	0x0903,
+	0x0b18,
+	0x0c53,
+	0x0d01,
+	0x0ee0,
+	0x0f01,
+	0x1058,
+	0x201e,
+	0x210a,
+	0x220a,
+	0x231e,
+	0x2400,
+	0x2532,
+	0x2600,
+	0x27ac,
+	0x2904,
+	0x2aa2,
+	0x2b45,
+	0x2c45,
+	0x2d15,
+	0x2e5a,
+	0x2fff,
+	0x306b,
+	0x310d,
+	0x3248,
+	0x3382,
+	0x34bd,
+	0x35e7,
+	0x3618,
+	0x3794,
+	0x3801,
+	0x395d,
+	0x3aae,
+	0x3bff,
+	0x07c9,		//auto power on
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x07d9,		//auto power off
+};
+
+static int tpo_lcd_power(struct pxa168fb_info *fbi, unsigned int spi_gpio_cs, unsigned int spi_gpio_reset, int on)
+{
+	int err = 0;
+
+	if (on) {
+		if (spi_gpio_reset != -1) {
+			err = gpio_request(spi_gpio_reset, "TPO_LCD_SPI_RESET");
+			if (err) {
+				printk("failed to request GPIO for TPO LCD RESET\n");
+				return -1;
+			}
+			gpio_direction_output(spi_gpio_reset, 0);
+			msleep(100);
+			gpio_set_value(spi_gpio_reset, 1);
+			msleep(100);
+			gpio_free(spi_gpio_reset);
+		}
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdon, ARRAY_SIZE(tpo_spi_cmdon), spi_gpio_cs, 0, 40);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff, ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 0);
+}
+
+static struct fb_videomode video_modes[] = {
+	/* lpj032l001b HVGA mode info */
+	[0] = {
+		.pixclock       = 100000,
+		.refresh        = 60,
+		.xres           = 320,
+		.yres           = 480,
+		.hsync_len      = 10,
+		.left_margin    = 15,
+		.right_margin   = 10,
+		.vsync_len      = 2,
+		.upper_margin   = 4,
+		.lower_margin   = 2,
+		.sync           = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
+	},
 };
 
+static struct pxa168fb_mach_info ttc_dkb_lcd_info __initdata = {
+	.id                     = "Base",
+	.modes                  = video_modes,
+	.num_modes              = ARRAY_SIZE(video_modes),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_18_SPI,
+	.dumb_mode              = DUMB_MODE_RGB666,
+	.active                 = 1,
+	.spi_ctrl               = CFG_SCLKCNT(16) | CFG_TXBITS(16) | CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs            = -1,
+	.spi_gpio_reset		= mfp_to_gpio(MFP_PIN_GPIO106),
+	.invert_pixclock	= 1,
+	.pxa168fb_lcd_power	= tpo_lcd_power,
+};
+#endif
+
 #if defined(CONFIG_MTD_ONENAND) || defined(CONFIG_MTD_ONENAND_MODULE)
 static struct mtd_partition ttc_dkb_onenand_partitions[] = {
 	{
@@ -123,6 +260,9 @@ static void __init ttc_dkb_init(void)
 
 	/* on-chip devices */
 	pxa910_add_uart(1);
+#ifdef CONFIG_FB_PXA168
+	pxa910_add_fb(&ttc_dkb_lcd_info);
+#endif
 
 	/* off-chip devices */
 	ttc_dkb_init_onenand();
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 8/8] pxa: add frame buffer on pxa910 ttc_dkb platform
  2009-11-12  2:20 ` Jun Nie
@ 2009-11-12 22:21   ` Russell King - ARM Linux
  0 siblings, 0 replies; 7+ messages in thread
From: Russell King - ARM Linux @ 2009-11-12 22:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Nov 12, 2009 at 10:20:20AM +0800, Jun Nie wrote:
> +static int tpo_lcd_power(struct pxa168fb_info *fbi, unsigned int spi_gpio_cs, unsigned int spi_gpio_reset, int on)
> +{
> +	int err = 0;
> +
> +	if (on) {
> +		if (spi_gpio_reset != -1) {
> +			err = gpio_request(spi_gpio_reset, "TPO_LCD_SPI_RESET");
> +			if (err) {
> +				printk("failed to request GPIO for TPO LCD RESET\n");
> +				return -1;

Do you really mean -EPERM here?  If not, use a proper error code such as
the one you got from gpio_request().  (Never, ever, use a literal "-1" as
an error indicator in the kernel.)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 8/8] pxa: add frame buffer on pxa910 ttc_dkb platform
  2009-11-10  8:12 [PATCH 8/8] pxa: add frame buffer on pxa910 ttc_dkb platform Jun Nie
  2009-11-12  2:20 ` Jun Nie
@ 2009-11-16  9:35 ` Jun Nie
  2009-11-19  9:04   ` Jun Nie
  1 sibling, 1 reply; 7+ messages in thread
From: Jun Nie @ 2009-11-16  9:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Jun Nie <njun@marvell.com>
Date: Fri, 13 Nov 2009 15:07:45 +0800
Subject: [PATCH] pxa: add frame buffer on pxa910 ttc_dkb platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa910_defconfig       |   39 ++++++++-
 arch/arm/mach-mmp/include/mach/pxa910.h |    8 ++
 arch/arm/mach-mmp/pxa910.c              |    4 +
 arch/arm/mach-mmp/ttc_dkb.c             |  144 +++++++++++++++++++++++++++++++
 4 files changed, 194 insertions(+), 1 deletions(-)

diff --git a/arch/arm/configs/pxa910_defconfig
b/arch/arm/configs/pxa910_defconfig
index 8c7e299..b9b1a85 100644
--- a/arch/arm/configs/pxa910_defconfig
+++ b/arch/arm/configs/pxa910_defconfig
@@ -578,7 +578,34 @@ CONFIG_SSB_POSSIBLE=y
 #
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
-# CONFIG_FB is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_PXA168=y
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set

 #
@@ -591,6 +618,16 @@ CONFIG_SSB_POSSIBLE=y
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+CONFIG_LOGO=y
+# CONFIG_LOGO_LINUX_MONO is not set
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_CLUT224=y
 # CONFIG_SOUND is not set
 # CONFIG_HID_SUPPORT is not set
 # CONFIG_USB_SUPPORT is not set
diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h
b/arch/arm/mach-mmp/include/mach/pxa910.h
index 6ae1ed7..7698793 100644
--- a/arch/arm/mach-mmp/include/mach/pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/pxa910.h
@@ -4,6 +4,7 @@
 #include <linux/i2c.h>
 #include <mach/devices.h>
 #include <plat/i2c.h>
+#include <video/pxa168fb.h>

 extern struct pxa_device_desc pxa910_device_uart1;
 extern struct pxa_device_desc pxa910_device_uart2;
@@ -13,6 +14,7 @@ extern struct pxa_device_desc pxa910_device_pwm1;
 extern struct pxa_device_desc pxa910_device_pwm2;
 extern struct pxa_device_desc pxa910_device_pwm3;
 extern struct pxa_device_desc pxa910_device_pwm4;
+extern struct pxa_device_desc pxa910_device_fb;

 static inline int pxa910_add_uart(int id)
 {
@@ -64,4 +66,10 @@ static inline int pxa910_add_pwm(int id)

 	return pxa_register_device(d, NULL, 0);
 }
+
+static inline int pxa910_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa910_device_fb, mi, sizeof(*mi));
+}
+
 #endif /* __ASM_MACH_PXA910_H */
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 5882ca6..48162a0 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -110,6 +110,8 @@ static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000);
 static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000);

+static APMU_CLK(lcd, LCD, 0x003f, 312000000);
+
 /* device and clock bindings */
 static struct clk_lookup pxa910_clkregs[] = {
 	INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL),
@@ -120,6 +122,7 @@ static struct clk_lookup pxa910_clkregs[] = {
 	INIT_CLKREG(&clk_pwm2, "pxa910-pwm.1", NULL),
 	INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa910-fb", "LCDCLK"),
 };

 static int __init pxa910_init(void)
@@ -174,3 +177,4 @@ PXA910_DEVICE(pwm1, "pxa910-pwm", 0, NONE,
0xd401a000, 0x10);
 PXA910_DEVICE(pwm2, "pxa910-pwm", 1, NONE, 0xd401a400, 0x10);
 PXA910_DEVICE(pwm3, "pxa910-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA910_DEVICE(pwm4, "pxa910-pwm", 3, NONE, 0xd401ac00, 0x10);
+PXA910_DEVICE(fb, "pxa910-fb", -1, LCD, 0xd420b000, 0x1c8);
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index dbd8cfd..15e64b4 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -14,6 +14,8 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/onenand.h>
+#include <linux/delay.h>
+#include <video/pxa168fb.h>

 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -21,6 +23,7 @@
 #include <mach/addr-map.h>
 #include <mach/mfp-pxa910.h>
 #include <mach/pxa910.h>
+#include <mach/gpio.h>

 #include "common.h"

@@ -54,8 +57,146 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
 	DF_WEn_DF_WEn,
 	DF_REn_DF_REn,
 	DF_RDY0_DF_RDY0,
+
+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO81_LCD_FCLK,
+	GPIO82_LCD_LCLK,
+	GPIO83_LCD_PCLK,
+	GPIO84_LCD_DENA,
+	GPIO85_LCD_DD0,
+	GPIO86_LCD_DD1,
+	GPIO87_LCD_DD2,
+	GPIO88_LCD_DD3,
+	GPIO89_LCD_DD4,
+	GPIO90_LCD_DD5,
+	GPIO91_LCD_DD6,
+	GPIO92_LCD_DD7,
+	GPIO93_LCD_DD8,
+	GPIO94_LCD_DD9,
+	GPIO95_LCD_DD10,
+	GPIO96_LCD_DD11,
+	GPIO97_LCD_DD12,
+	GPIO98_LCD_DD13,
+	GPIO100_LCD_DD14,
+	GPIO101_LCD_DD15,
+	GPIO102_LCD_DD16,
+	GPIO103_LCD_DD17,
+	GPIO104_LCD_SPIDOUT,
+	GPIO105_LCD_SPIDIN,
+	GPIO107_LCD_CS1,
+	GPIO108_LCD_DCLK,
+	GPIO106_LCD_RESET,
+#endif
+};
+
+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x0801,
+	0x0800,
+	0x0200,
+	0x0304,
+	0x040e,
+	0x0903,
+	0x0b18,
+	0x0c53,
+	0x0d01,
+	0x0ee0,
+	0x0f01,
+	0x1058,
+	0x201e,
+	0x210a,
+	0x220a,
+	0x231e,
+	0x2400,
+	0x2532,
+	0x2600,
+	0x27ac,
+	0x2904,
+	0x2aa2,
+	0x2b45,
+	0x2c45,
+	0x2d15,
+	0x2e5a,
+	0x2fff,
+	0x306b,
+	0x310d,
+	0x3248,
+	0x3382,
+	0x34bd,
+	0x35e7,
+	0x3618,
+	0x3794,
+	0x3801,
+	0x395d,
+	0x3aae,
+	0x3bff,
+	0x07c9,		/* auto power on */
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x07d9,		/* auto power off */
+};
+
+static int tpo_lcd_power(struct pxa168fb_info *fbi, unsigned int spi_gpio_cs,
+		unsigned int spi_gpio_reset, int on)
+{
+	int err = 0;
+
+	if (on) {
+		if (spi_gpio_reset != -1) {
+			err = gpio_request(spi_gpio_reset, "TPO_LCD_SPI_RESET");
+			if (err) {
+				printk(KERN_ERR "failed to request GPIO for TPO LCD RESET\n");
+				return -EIO;
+			}
+			gpio_direction_output(spi_gpio_reset, 0);
+			msleep(100);
+			gpio_set_value(spi_gpio_reset, 1);
+			msleep(100);
+			gpio_free(spi_gpio_reset);
+		}
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdon,
+				ARRAY_SIZE(tpo_spi_cmdon), spi_gpio_cs, 0, 40);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
+				ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 0);
+}
+
+static struct fb_videomode video_modes[] = {
+	/* lpj032l001b HVGA mode info */
+	[0] = {
+		.pixclock       = 100000,
+		.refresh        = 60,
+		.xres           = 320,
+		.yres           = 480,
+		.hsync_len      = 10,
+		.left_margin    = 15,
+		.right_margin   = 10,
+		.vsync_len      = 2,
+		.upper_margin   = 4,
+		.lower_margin   = 2,
+		.sync           = 0,
+	},
 };

+static struct pxa168fb_mach_info ttc_dkb_lcd_info __initdata = {
+	.id                     = "Base",
+	.modes                  = video_modes,
+	.num_modes              = ARRAY_SIZE(video_modes),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_18_SPI,
+	.dumb_mode              = DUMB_MODE_RGB666,
+	.active                 = 1,
+	.spi_ctrl               = CFG_SCLKCNT(16) | CFG_TXBITS(16) |
+		CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs            = -1,
+	.spi_gpio_reset		= mfp_to_gpio(MFP_PIN_GPIO106),
+	.invert_pixclock	= 1,
+	.pxa168fb_lcd_power	= tpo_lcd_power,
+};
+#endif
+
 #if defined(CONFIG_MTD_ONENAND) || defined(CONFIG_MTD_ONENAND_MODULE)
 static struct mtd_partition ttc_dkb_onenand_partitions[] = {
 	{
@@ -123,6 +264,9 @@ static void __init ttc_dkb_init(void)

 	/* on-chip devices */
 	pxa910_add_uart(1);
+#ifdef CONFIG_FB_PXA168
+	pxa910_add_fb(&ttc_dkb_lcd_info);
+#endif

 	/* off-chip devices */
 	ttc_dkb_init_onenand();
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 8/8] pxa: add frame buffer on pxa910 ttc_dkb platform
  2009-11-16  9:35 ` Jun Nie
@ 2009-11-19  9:04   ` Jun Nie
  2009-11-19  9:13     ` Russell King - ARM Linux
  0 siblings, 1 reply; 7+ messages in thread
From: Jun Nie @ 2009-11-19  9:04 UTC (permalink / raw)
  To: linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 18774 bytes --]

2009/11/16 Jun Nie <niej0001@gmail.com>:
> From: Jun Nie <njun@marvell.com>
> Date: Fri, 13 Nov 2009 15:07:45 +0800
> Subject: [PATCH] pxa: add frame buffer on pxa910 ttc_dkb platform
>
> Signed-off-by: Jun Nie <njun@marvell.com>
> ---
>  arch/arm/configs/pxa910_defconfig       |   39 ++++++++-
>  arch/arm/mach-mmp/include/mach/pxa910.h |    8 ++
>  arch/arm/mach-mmp/pxa910.c              |    4 +
>  arch/arm/mach-mmp/ttc_dkb.c             |  144 +++++++++++++++++++++++++++++++
>  4 files changed, 194 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/configs/pxa910_defconfig
> b/arch/arm/configs/pxa910_defconfig
> index 8c7e299..b9b1a85 100644
> --- a/arch/arm/configs/pxa910_defconfig
> +++ b/arch/arm/configs/pxa910_defconfig
> @@ -578,7 +578,34 @@ CONFIG_SSB_POSSIBLE=y
>  #
>  # CONFIG_VGASTATE is not set
>  # CONFIG_VIDEO_OUTPUT_CONTROL is not set
> -# CONFIG_FB is not set
> +CONFIG_FB=y
> +# CONFIG_FIRMWARE_EDID is not set
> +# CONFIG_FB_DDC is not set
> +# CONFIG_FB_BOOT_VESA_SUPPORT is not set
> +CONFIG_FB_CFB_FILLRECT=y
> +CONFIG_FB_CFB_COPYAREA=y
> +CONFIG_FB_CFB_IMAGEBLIT=y
> +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
> +# CONFIG_FB_SYS_FILLRECT is not set
> +# CONFIG_FB_SYS_COPYAREA is not set
> +# CONFIG_FB_SYS_IMAGEBLIT is not set
> +# CONFIG_FB_FOREIGN_ENDIAN is not set
> +# CONFIG_FB_SYS_FOPS is not set
> +# CONFIG_FB_SVGALIB is not set
> +# CONFIG_FB_MACMODES is not set
> +# CONFIG_FB_BACKLIGHT is not set
> +# CONFIG_FB_MODE_HELPERS is not set
> +# CONFIG_FB_TILEBLITTING is not set
> +
> +#
> +# Frame buffer hardware drivers
> +#
> +# CONFIG_FB_S1D13XXX is not set
> +CONFIG_FB_PXA168=y
> +# CONFIG_FB_VIRTUAL is not set
> +# CONFIG_FB_METRONOME is not set
> +# CONFIG_FB_MB862XX is not set
> +# CONFIG_FB_BROADSHEET is not set
>  # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
>
>  #
> @@ -591,6 +618,16 @@ CONFIG_SSB_POSSIBLE=y
>  #
>  # CONFIG_VGA_CONSOLE is not set
>  CONFIG_DUMMY_CONSOLE=y
> +CONFIG_FRAMEBUFFER_CONSOLE=y
> +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
> +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
> +# CONFIG_FONTS is not set
> +CONFIG_FONT_8x8=y
> +CONFIG_FONT_8x16=y
> +CONFIG_LOGO=y
> +# CONFIG_LOGO_LINUX_MONO is not set
> +CONFIG_LOGO_LINUX_VGA16=y
> +CONFIG_LOGO_LINUX_CLUT224=y
>  # CONFIG_SOUND is not set
>  # CONFIG_HID_SUPPORT is not set
>  # CONFIG_USB_SUPPORT is not set
> diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h
> b/arch/arm/mach-mmp/include/mach/pxa910.h
> index 6ae1ed7..7698793 100644
> --- a/arch/arm/mach-mmp/include/mach/pxa910.h
> +++ b/arch/arm/mach-mmp/include/mach/pxa910.h
> @@ -4,6 +4,7 @@
>  #include <linux/i2c.h>
>  #include <mach/devices.h>
>  #include <plat/i2c.h>
> +#include <video/pxa168fb.h>
>
>  extern struct pxa_device_desc pxa910_device_uart1;
>  extern struct pxa_device_desc pxa910_device_uart2;
> @@ -13,6 +14,7 @@ extern struct pxa_device_desc pxa910_device_pwm1;
>  extern struct pxa_device_desc pxa910_device_pwm2;
>  extern struct pxa_device_desc pxa910_device_pwm3;
>  extern struct pxa_device_desc pxa910_device_pwm4;
> +extern struct pxa_device_desc pxa910_device_fb;
>
>  static inline int pxa910_add_uart(int id)
>  {
> @@ -64,4 +66,10 @@ static inline int pxa910_add_pwm(int id)
>
>        return pxa_register_device(d, NULL, 0);
>  }
> +
> +static inline int pxa910_add_fb(struct pxa168fb_mach_info *mi)
> +{
> +       return pxa_register_device(&pxa910_device_fb, mi, sizeof(*mi));
> +}
> +
>  #endif /* __ASM_MACH_PXA910_H */
> diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
> index 5882ca6..48162a0 100644
> --- a/arch/arm/mach-mmp/pxa910.c
> +++ b/arch/arm/mach-mmp/pxa910.c
> @@ -110,6 +110,8 @@ static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000);
>  static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000);
>  static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000);
>
> +static APMU_CLK(lcd, LCD, 0x003f, 312000000);
> +
>  /* device and clock bindings */
>  static struct clk_lookup pxa910_clkregs[] = {
>        INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL),
> @@ -120,6 +122,7 @@ static struct clk_lookup pxa910_clkregs[] = {
>        INIT_CLKREG(&clk_pwm2, "pxa910-pwm.1", NULL),
>        INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
>        INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
> +       INIT_CLKREG(&clk_lcd, "pxa910-fb", "LCDCLK"),
>  };
>
>  static int __init pxa910_init(void)
> @@ -174,3 +177,4 @@ PXA910_DEVICE(pwm1, "pxa910-pwm", 0, NONE,
> 0xd401a000, 0x10);
>  PXA910_DEVICE(pwm2, "pxa910-pwm", 1, NONE, 0xd401a400, 0x10);
>  PXA910_DEVICE(pwm3, "pxa910-pwm", 2, NONE, 0xd401a800, 0x10);
>  PXA910_DEVICE(pwm4, "pxa910-pwm", 3, NONE, 0xd401ac00, 0x10);
> +PXA910_DEVICE(fb, "pxa910-fb", -1, LCD, 0xd420b000, 0x1c8);
> diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
> index dbd8cfd..15e64b4 100644
> --- a/arch/arm/mach-mmp/ttc_dkb.c
> +++ b/arch/arm/mach-mmp/ttc_dkb.c
> @@ -14,6 +14,8 @@
>  #include <linux/mtd/mtd.h>
>  #include <linux/mtd/partitions.h>
>  #include <linux/mtd/onenand.h>
> +#include <linux/delay.h>
> +#include <video/pxa168fb.h>
>
>  #include <asm/mach-types.h>
>  #include <asm/mach/arch.h>
> @@ -21,6 +23,7 @@
>  #include <mach/addr-map.h>
>  #include <mach/mfp-pxa910.h>
>  #include <mach/pxa910.h>
> +#include <mach/gpio.h>
>
>  #include "common.h"
>
> @@ -54,8 +57,146 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
>        DF_WEn_DF_WEn,
>        DF_REn_DF_REn,
>        DF_RDY0_DF_RDY0,
> +
> +#ifdef CONFIG_FB_PXA168
> +       /* LCD */
> +       GPIO81_LCD_FCLK,
> +       GPIO82_LCD_LCLK,
> +       GPIO83_LCD_PCLK,
> +       GPIO84_LCD_DENA,
> +       GPIO85_LCD_DD0,
> +       GPIO86_LCD_DD1,
> +       GPIO87_LCD_DD2,
> +       GPIO88_LCD_DD3,
> +       GPIO89_LCD_DD4,
> +       GPIO90_LCD_DD5,
> +       GPIO91_LCD_DD6,
> +       GPIO92_LCD_DD7,
> +       GPIO93_LCD_DD8,
> +       GPIO94_LCD_DD9,
> +       GPIO95_LCD_DD10,
> +       GPIO96_LCD_DD11,
> +       GPIO97_LCD_DD12,
> +       GPIO98_LCD_DD13,
> +       GPIO100_LCD_DD14,
> +       GPIO101_LCD_DD15,
> +       GPIO102_LCD_DD16,
> +       GPIO103_LCD_DD17,
> +       GPIO104_LCD_SPIDOUT,
> +       GPIO105_LCD_SPIDIN,
> +       GPIO107_LCD_CS1,
> +       GPIO108_LCD_DCLK,
> +       GPIO106_LCD_RESET,
> +#endif
> +};
> +
> +#ifdef CONFIG_FB_PXA168
> +static u16 tpo_spi_cmdon[] = {
> +       0x0801,
> +       0x0800,
> +       0x0200,
> +       0x0304,
> +       0x040e,
> +       0x0903,
> +       0x0b18,
> +       0x0c53,
> +       0x0d01,
> +       0x0ee0,
> +       0x0f01,
> +       0x1058,
> +       0x201e,
> +       0x210a,
> +       0x220a,
> +       0x231e,
> +       0x2400,
> +       0x2532,
> +       0x2600,
> +       0x27ac,
> +       0x2904,
> +       0x2aa2,
> +       0x2b45,
> +       0x2c45,
> +       0x2d15,
> +       0x2e5a,
> +       0x2fff,
> +       0x306b,
> +       0x310d,
> +       0x3248,
> +       0x3382,
> +       0x34bd,
> +       0x35e7,
> +       0x3618,
> +       0x3794,
> +       0x3801,
> +       0x395d,
> +       0x3aae,
> +       0x3bff,
> +       0x07c9,         /* auto power on */
> +};
> +
> +static u16 tpo_spi_cmdoff[] = {
> +       0x07d9,         /* auto power off */
> +};
> +
> +static int tpo_lcd_power(struct pxa168fb_info *fbi, unsigned int spi_gpio_cs,
> +               unsigned int spi_gpio_reset, int on)
> +{
> +       int err = 0;
> +
> +       if (on) {
> +               if (spi_gpio_reset != -1) {
> +                       err = gpio_request(spi_gpio_reset, "TPO_LCD_SPI_RESET");
> +                       if (err) {
> +                               printk(KERN_ERR "failed to request GPIO for TPO LCD RESET\n");
> +                               return -EIO;
> +                       }
> +                       gpio_direction_output(spi_gpio_reset, 0);
> +                       msleep(100);
> +                       gpio_set_value(spi_gpio_reset, 1);
> +                       msleep(100);
> +                       gpio_free(spi_gpio_reset);
> +               }
> +               return pxa168fb_spi_send(fbi, tpo_spi_cmdon,
> +                               ARRAY_SIZE(tpo_spi_cmdon), spi_gpio_cs, 0, 40);
> +       } else
> +               return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
> +                               ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 0);
> +}
> +
> +static struct fb_videomode video_modes[] = {
> +       /* lpj032l001b HVGA mode info */
> +       [0] = {
> +               .pixclock       = 100000,
> +               .refresh        = 60,
> +               .xres           = 320,
> +               .yres           = 480,
> +               .hsync_len      = 10,
> +               .left_margin    = 15,
> +               .right_margin   = 10,
> +               .vsync_len      = 2,
> +               .upper_margin   = 4,
> +               .lower_margin   = 2,
> +               .sync           = 0,
> +       },
>  };
>
> +static struct pxa168fb_mach_info ttc_dkb_lcd_info __initdata = {
> +       .id                     = "Base",
> +       .modes                  = video_modes,
> +       .num_modes              = ARRAY_SIZE(video_modes),
> +       .pix_fmt                = PIX_FMT_RGB565,
> +       .io_pin_allocation_mode = PIN_MODE_DUMB_18_SPI,
> +       .dumb_mode              = DUMB_MODE_RGB666,
> +       .active                 = 1,
> +       .spi_ctrl               = CFG_SCLKCNT(16) | CFG_TXBITS(16) |
> +               CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
> +       .spi_gpio_cs            = -1,
> +       .spi_gpio_reset         = mfp_to_gpio(MFP_PIN_GPIO106),
> +       .invert_pixclock        = 1,
> +       .pxa168fb_lcd_power     = tpo_lcd_power,
> +};
> +#endif
> +
>  #if defined(CONFIG_MTD_ONENAND) || defined(CONFIG_MTD_ONENAND_MODULE)
>  static struct mtd_partition ttc_dkb_onenand_partitions[] = {
>        {
> @@ -123,6 +264,9 @@ static void __init ttc_dkb_init(void)
>
>        /* on-chip devices */
>        pxa910_add_uart(1);
> +#ifdef CONFIG_FB_PXA168
> +       pxa910_add_fb(&ttc_dkb_lcd_info);
> +#endif
>
>        /* off-chip devices */
>        ttc_dkb_init_onenand();
> --
> 1.5.4.3
>

rebased
From 5dc9fd01c311d4f263f8a1c67f03c569f6dd2b81 Mon Sep 17 00:00:00 2001
From: Jun Nie <njun@marvell.com>
Date: Tue, 17 Nov 2009 20:14:01 +0800
Subject: [PATCH] pxa: add frame buffer on pxa910 ttc_dkb platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa910_defconfig       |   39 ++++++++-
 arch/arm/mach-mmp/include/mach/pxa910.h |    7 ++
 arch/arm/mach-mmp/pxa910.c              |    4 +
 arch/arm/mach-mmp/ttc_dkb.c             |  144 +++++++++++++++++++++++++++++++
 4 files changed, 193 insertions(+), 1 deletions(-)

diff --git a/arch/arm/configs/pxa910_defconfig
b/arch/arm/configs/pxa910_defconfig
index 8c7e299..b9b1a85 100644
--- a/arch/arm/configs/pxa910_defconfig
+++ b/arch/arm/configs/pxa910_defconfig
@@ -578,7 +578,34 @@ CONFIG_SSB_POSSIBLE=y
 #
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
-# CONFIG_FB is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_PXA168=y
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set

 #
@@ -591,6 +618,16 @@ CONFIG_SSB_POSSIBLE=y
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+CONFIG_LOGO=y
+# CONFIG_LOGO_LINUX_MONO is not set
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_CLUT224=y
 # CONFIG_SOUND is not set
 # CONFIG_HID_SUPPORT is not set
 # CONFIG_USB_SUPPORT is not set
diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h
b/arch/arm/mach-mmp/include/mach/pxa910.h
index 6ae1ed7..64148f2 100644
--- a/arch/arm/mach-mmp/include/mach/pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/pxa910.h
@@ -4,6 +4,7 @@
 #include <linux/i2c.h>
 #include <mach/devices.h>
 #include <plat/i2c.h>
+#include <video/pxa168fb.h>

 extern struct pxa_device_desc pxa910_device_uart1;
 extern struct pxa_device_desc pxa910_device_uart2;
@@ -13,6 +14,7 @@ extern struct pxa_device_desc pxa910_device_pwm1;
 extern struct pxa_device_desc pxa910_device_pwm2;
 extern struct pxa_device_desc pxa910_device_pwm3;
 extern struct pxa_device_desc pxa910_device_pwm4;
+extern struct pxa_device_desc pxa910_device_fb;

 static inline int pxa910_add_uart(int id)
 {
@@ -64,4 +66,9 @@ static inline int pxa910_add_pwm(int id)

 	return pxa_register_device(d, NULL, 0);
 }
+
+static inline int pxa910_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa910_device_fb, mi, sizeof(*mi));
+}
 #endif /* __ASM_MACH_PXA910_H */
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 5882ca6..48162a0 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -110,6 +110,8 @@ static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000);
 static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000);

+static APMU_CLK(lcd, LCD, 0x003f, 312000000);
+
 /* device and clock bindings */
 static struct clk_lookup pxa910_clkregs[] = {
 	INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL),
@@ -120,6 +122,7 @@ static struct clk_lookup pxa910_clkregs[] = {
 	INIT_CLKREG(&clk_pwm2, "pxa910-pwm.1", NULL),
 	INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa910-fb", "LCDCLK"),
 };

 static int __init pxa910_init(void)
@@ -174,3 +177,4 @@ PXA910_DEVICE(pwm1, "pxa910-pwm", 0, NONE,
0xd401a000, 0x10);
 PXA910_DEVICE(pwm2, "pxa910-pwm", 1, NONE, 0xd401a400, 0x10);
 PXA910_DEVICE(pwm3, "pxa910-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA910_DEVICE(pwm4, "pxa910-pwm", 3, NONE, 0xd401ac00, 0x10);
+PXA910_DEVICE(fb, "pxa910-fb", -1, LCD, 0xd420b000, 0x1c8);
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index 08cfef6..ac429cd 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -11,7 +11,10 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>

+#include <video/pxa168fb.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <mach/addr-map.h>
@@ -26,11 +29,152 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
 	/* UART2 */
 	GPIO47_UART2_RXD,
 	GPIO48_UART2_TXD,
+
+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO81_LCD_FCLK,
+	GPIO82_LCD_LCLK,
+	GPIO83_LCD_PCLK,
+	GPIO84_LCD_DENA,
+	GPIO85_LCD_DD0,
+	GPIO86_LCD_DD1,
+	GPIO87_LCD_DD2,
+	GPIO88_LCD_DD3,
+	GPIO89_LCD_DD4,
+	GPIO90_LCD_DD5,
+	GPIO91_LCD_DD6,
+	GPIO92_LCD_DD7,
+	GPIO93_LCD_DD8,
+	GPIO94_LCD_DD9,
+	GPIO95_LCD_DD10,
+	GPIO96_LCD_DD11,
+	GPIO97_LCD_DD12,
+	GPIO98_LCD_DD13,
+	GPIO100_LCD_DD14,
+	GPIO101_LCD_DD15,
+	GPIO102_LCD_DD16,
+	GPIO103_LCD_DD17,
+	GPIO104_LCD_SPIDOUT,
+	GPIO105_LCD_SPIDIN,
+	GPIO107_LCD_CS1,
+	GPIO108_LCD_DCLK,
+	GPIO106_LCD_RESET,
+#endif
+};
+
+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x0801,
+	0x0800,
+	0x0200,
+	0x0304,
+	0x040e,
+	0x0903,
+	0x0b18,
+	0x0c53,
+	0x0d01,
+	0x0ee0,
+	0x0f01,
+	0x1058,
+	0x201e,
+	0x210a,
+	0x220a,
+	0x231e,
+	0x2400,
+	0x2532,
+	0x2600,
+	0x27ac,
+	0x2904,
+	0x2aa2,
+	0x2b45,
+	0x2c45,
+	0x2d15,
+	0x2e5a,
+	0x2fff,
+	0x306b,
+	0x310d,
+	0x3248,
+	0x3382,
+	0x34bd,
+	0x35e7,
+	0x3618,
+	0x3794,
+	0x3801,
+	0x395d,
+	0x3aae,
+	0x3bff,
+	0x07c9,		/* auto power on */
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x07d9,		/* auto power off */
+};
+
+static int tpo_lcd_power(struct pxa168fb_info *fbi, unsigned int spi_gpio_cs,
+		unsigned int spi_gpio_reset, int on)
+{
+	int err = 0;
+
+	if (on) {
+		if (spi_gpio_reset != -1) {
+			err = gpio_request(spi_gpio_reset, "TPO_LCD_SPI_RESET");
+			if (err) {
+				printk(KERN_ERR "failed to request GPIO for TPO LCD RESET\n");
+				return -EIO;
+			}
+			gpio_direction_output(spi_gpio_reset, 0);
+			msleep(100);
+			gpio_set_value(spi_gpio_reset, 1);
+			msleep(100);
+			gpio_free(spi_gpio_reset);
+		}
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdon,
+				ARRAY_SIZE(tpo_spi_cmdon), spi_gpio_cs, 0, 40);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
+				ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 0);
+}
+
+static struct fb_videomode video_modes[] = {
+	/* lpj032l001b HVGA mode info */
+	[0] = {
+		.pixclock       = 100000,
+		.refresh        = 60,
+		.xres           = 320,
+		.yres           = 480,
+		.hsync_len      = 10,
+		.left_margin    = 15,
+		.right_margin   = 10,
+		.vsync_len      = 2,
+		.upper_margin   = 4,
+		.lower_margin   = 2,
+		.sync           = 0,
+	},
+};
+
+static struct pxa168fb_mach_info ttc_dkb_lcd_info __initdata = {
+	.id                     = "Base",
+	.modes                  = video_modes,
+	.num_modes              = ARRAY_SIZE(video_modes),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_18_SPI,
+	.dumb_mode              = DUMB_MODE_RGB666,
+	.active                 = 1,
+	.spi_ctrl               = CFG_SCLKCNT(16) | CFG_TXBITS(16) |
+		CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs            = -1,
+	.spi_gpio_reset		= mfp_to_gpio(MFP_PIN_GPIO106),
+	.invert_pixclock	= 1,
+	.pxa168fb_lcd_power	= tpo_lcd_power,
 };
+#endif

 static void __init ttc_dkb_init(void)
 {
 	mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
+#ifdef CONFIG_FB_PXA168
+	pxa910_add_fb(&ttc_dkb_lcd_info);
+#endif

 	/* on-chip devices */
 	pxa910_add_uart(1);
-- 
1.5.4.3

[-- Attachment #2: 0008-pxa-add-frame-buffer-on-pxa910-ttc_dkb-platform.patch --]
[-- Type: text/x-diff, Size: 8107 bytes --]

From 5dc9fd01c311d4f263f8a1c67f03c569f6dd2b81 Mon Sep 17 00:00:00 2001
From: Jun Nie <njun@marvell.com>
Date: Tue, 17 Nov 2009 20:14:01 +0800
Subject: [PATCH] pxa: add frame buffer on pxa910 ttc_dkb platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa910_defconfig       |   39 ++++++++-
 arch/arm/mach-mmp/include/mach/pxa910.h |    7 ++
 arch/arm/mach-mmp/pxa910.c              |    4 +
 arch/arm/mach-mmp/ttc_dkb.c             |  144 +++++++++++++++++++++++++++++++
 4 files changed, 193 insertions(+), 1 deletions(-)

diff --git a/arch/arm/configs/pxa910_defconfig b/arch/arm/configs/pxa910_defconfig
index 8c7e299..b9b1a85 100644
--- a/arch/arm/configs/pxa910_defconfig
+++ b/arch/arm/configs/pxa910_defconfig
@@ -578,7 +578,34 @@ CONFIG_SSB_POSSIBLE=y
 #
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
-# CONFIG_FB is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_PXA168=y
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
@@ -591,6 +618,16 @@ CONFIG_SSB_POSSIBLE=y
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+CONFIG_LOGO=y
+# CONFIG_LOGO_LINUX_MONO is not set
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_CLUT224=y
 # CONFIG_SOUND is not set
 # CONFIG_HID_SUPPORT is not set
 # CONFIG_USB_SUPPORT is not set
diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h b/arch/arm/mach-mmp/include/mach/pxa910.h
index 6ae1ed7..64148f2 100644
--- a/arch/arm/mach-mmp/include/mach/pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/pxa910.h
@@ -4,6 +4,7 @@
 #include <linux/i2c.h>
 #include <mach/devices.h>
 #include <plat/i2c.h>
+#include <video/pxa168fb.h>
 
 extern struct pxa_device_desc pxa910_device_uart1;
 extern struct pxa_device_desc pxa910_device_uart2;
@@ -13,6 +14,7 @@ extern struct pxa_device_desc pxa910_device_pwm1;
 extern struct pxa_device_desc pxa910_device_pwm2;
 extern struct pxa_device_desc pxa910_device_pwm3;
 extern struct pxa_device_desc pxa910_device_pwm4;
+extern struct pxa_device_desc pxa910_device_fb;
 
 static inline int pxa910_add_uart(int id)
 {
@@ -64,4 +66,9 @@ static inline int pxa910_add_pwm(int id)
 
 	return pxa_register_device(d, NULL, 0);
 }
+
+static inline int pxa910_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa910_device_fb, mi, sizeof(*mi));
+}
 #endif /* __ASM_MACH_PXA910_H */
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 5882ca6..48162a0 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -110,6 +110,8 @@ static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000);
 static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000);
 
+static APMU_CLK(lcd, LCD, 0x003f, 312000000);
+
 /* device and clock bindings */
 static struct clk_lookup pxa910_clkregs[] = {
 	INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL),
@@ -120,6 +122,7 @@ static struct clk_lookup pxa910_clkregs[] = {
 	INIT_CLKREG(&clk_pwm2, "pxa910-pwm.1", NULL),
 	INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa910-fb", "LCDCLK"),
 };
 
 static int __init pxa910_init(void)
@@ -174,3 +177,4 @@ PXA910_DEVICE(pwm1, "pxa910-pwm", 0, NONE, 0xd401a000, 0x10);
 PXA910_DEVICE(pwm2, "pxa910-pwm", 1, NONE, 0xd401a400, 0x10);
 PXA910_DEVICE(pwm3, "pxa910-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA910_DEVICE(pwm4, "pxa910-pwm", 3, NONE, 0xd401ac00, 0x10);
+PXA910_DEVICE(fb, "pxa910-fb", -1, LCD, 0xd420b000, 0x1c8);
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index 08cfef6..ac429cd 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -11,7 +11,10 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
 
+#include <video/pxa168fb.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <mach/addr-map.h>
@@ -26,11 +29,152 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
 	/* UART2 */
 	GPIO47_UART2_RXD,
 	GPIO48_UART2_TXD,
+
+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO81_LCD_FCLK,
+	GPIO82_LCD_LCLK,
+	GPIO83_LCD_PCLK,
+	GPIO84_LCD_DENA,
+	GPIO85_LCD_DD0,
+	GPIO86_LCD_DD1,
+	GPIO87_LCD_DD2,
+	GPIO88_LCD_DD3,
+	GPIO89_LCD_DD4,
+	GPIO90_LCD_DD5,
+	GPIO91_LCD_DD6,
+	GPIO92_LCD_DD7,
+	GPIO93_LCD_DD8,
+	GPIO94_LCD_DD9,
+	GPIO95_LCD_DD10,
+	GPIO96_LCD_DD11,
+	GPIO97_LCD_DD12,
+	GPIO98_LCD_DD13,
+	GPIO100_LCD_DD14,
+	GPIO101_LCD_DD15,
+	GPIO102_LCD_DD16,
+	GPIO103_LCD_DD17,
+	GPIO104_LCD_SPIDOUT,
+	GPIO105_LCD_SPIDIN,
+	GPIO107_LCD_CS1,
+	GPIO108_LCD_DCLK,
+	GPIO106_LCD_RESET,
+#endif
+};
+
+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x0801,
+	0x0800,
+	0x0200,
+	0x0304,
+	0x040e,
+	0x0903,
+	0x0b18,
+	0x0c53,
+	0x0d01,
+	0x0ee0,
+	0x0f01,
+	0x1058,
+	0x201e,
+	0x210a,
+	0x220a,
+	0x231e,
+	0x2400,
+	0x2532,
+	0x2600,
+	0x27ac,
+	0x2904,
+	0x2aa2,
+	0x2b45,
+	0x2c45,
+	0x2d15,
+	0x2e5a,
+	0x2fff,
+	0x306b,
+	0x310d,
+	0x3248,
+	0x3382,
+	0x34bd,
+	0x35e7,
+	0x3618,
+	0x3794,
+	0x3801,
+	0x395d,
+	0x3aae,
+	0x3bff,
+	0x07c9,		/* auto power on */
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x07d9,		/* auto power off */
+};
+
+static int tpo_lcd_power(struct pxa168fb_info *fbi, unsigned int spi_gpio_cs,
+		unsigned int spi_gpio_reset, int on)
+{
+	int err = 0;
+
+	if (on) {
+		if (spi_gpio_reset != -1) {
+			err = gpio_request(spi_gpio_reset, "TPO_LCD_SPI_RESET");
+			if (err) {
+				printk(KERN_ERR "failed to request GPIO for TPO LCD RESET\n");
+				return -EIO;
+			}
+			gpio_direction_output(spi_gpio_reset, 0);
+			msleep(100);
+			gpio_set_value(spi_gpio_reset, 1);
+			msleep(100);
+			gpio_free(spi_gpio_reset);
+		}
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdon,
+				ARRAY_SIZE(tpo_spi_cmdon), spi_gpio_cs, 0, 40);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
+				ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 0);
+}
+
+static struct fb_videomode video_modes[] = {
+	/* lpj032l001b HVGA mode info */
+	[0] = {
+		.pixclock       = 100000,
+		.refresh        = 60,
+		.xres           = 320,
+		.yres           = 480,
+		.hsync_len      = 10,
+		.left_margin    = 15,
+		.right_margin   = 10,
+		.vsync_len      = 2,
+		.upper_margin   = 4,
+		.lower_margin   = 2,
+		.sync           = 0,
+	},
+};
+
+static struct pxa168fb_mach_info ttc_dkb_lcd_info __initdata = {
+	.id                     = "Base",
+	.modes                  = video_modes,
+	.num_modes              = ARRAY_SIZE(video_modes),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_18_SPI,
+	.dumb_mode              = DUMB_MODE_RGB666,
+	.active                 = 1,
+	.spi_ctrl               = CFG_SCLKCNT(16) | CFG_TXBITS(16) |
+		CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs            = -1,
+	.spi_gpio_reset		= mfp_to_gpio(MFP_PIN_GPIO106),
+	.invert_pixclock	= 1,
+	.pxa168fb_lcd_power	= tpo_lcd_power,
 };
+#endif
 
 static void __init ttc_dkb_init(void)
 {
 	mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
+#ifdef CONFIG_FB_PXA168
+	pxa910_add_fb(&ttc_dkb_lcd_info);
+#endif
 
 	/* on-chip devices */
 	pxa910_add_uart(1);
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 8/8] pxa: add frame buffer on pxa910 ttc_dkb platform
  2009-11-19  9:04   ` Jun Nie
@ 2009-11-19  9:13     ` Russell King - ARM Linux
  2009-11-23  5:55       ` Jun Nie
  0 siblings, 1 reply; 7+ messages in thread
From: Russell King - ARM Linux @ 2009-11-19  9:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Nov 19, 2009 at 05:04:14PM +0800, Jun Nie wrote:
> > diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
> > index dbd8cfd..15e64b4 100644
> > --- a/arch/arm/mach-mmp/ttc_dkb.c
> > +++ b/arch/arm/mach-mmp/ttc_dkb.c
> > @@ -14,6 +14,8 @@
> >  #include <linux/mtd/mtd.h>
> >  #include <linux/mtd/partitions.h>
> >  #include <linux/mtd/onenand.h>
> > +#include <linux/delay.h>
> > +#include <video/pxa168fb.h>
> >
> >  #include <asm/mach-types.h>
> >  #include <asm/mach/arch.h>
> > @@ -21,6 +23,7 @@
> >  #include <mach/addr-map.h>
> >  #include <mach/mfp-pxa910.h>
> >  #include <mach/pxa910.h>
> > +#include <mach/gpio.h>

linux/gpio.h please.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 8/8] pxa: add frame buffer on pxa910 ttc_dkb platform
  2009-11-19  9:13     ` Russell King - ARM Linux
@ 2009-11-23  5:55       ` Jun Nie
  0 siblings, 0 replies; 7+ messages in thread
From: Jun Nie @ 2009-11-23  5:55 UTC (permalink / raw)
  To: linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 9603 bytes --]

2009/11/19 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> On Thu, Nov 19, 2009 at 05:04:14PM +0800, Jun Nie wrote:
>> > diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
>> > index dbd8cfd..15e64b4 100644
>> > --- a/arch/arm/mach-mmp/ttc_dkb.c
>> > +++ b/arch/arm/mach-mmp/ttc_dkb.c
>> > @@ -14,6 +14,8 @@
>> >  #include <linux/mtd/mtd.h>
>> >  #include <linux/mtd/partitions.h>
>> >  #include <linux/mtd/onenand.h>
>> > +#include <linux/delay.h>
>> > +#include <video/pxa168fb.h>
>> >
>> >  #include <asm/mach-types.h>
>> >  #include <asm/mach/arch.h>
>> > @@ -21,6 +23,7 @@
>> >  #include <mach/addr-map.h>
>> >  #include <mach/mfp-pxa910.h>
>> >  #include <mach/pxa910.h>
>> > +#include <mach/gpio.h>
>
> linux/gpio.h please.
>

Rebased to topic/pxa168fb branch of pxa git repository. Change is
minimize LCD reset time of gpio operation.

From 91479fe76e31686747b016d6667a14d3aec3b074 Mon Sep 17 00:00:00 2001
From: Jun Nie <njun@marvell.com>
Date: Mon, 23 Nov 2009 10:32:51 +0800
Subject: [PATCH] pxa: add frame buffer on pxa910 ttc_dkb platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa910_defconfig       |   39 ++++++++-
 arch/arm/mach-mmp/include/mach/pxa910.h |    7 ++
 arch/arm/mach-mmp/pxa910.c              |    3 +
 arch/arm/mach-mmp/ttc_dkb.c             |  144 +++++++++++++++++++++++++++++++
 4 files changed, 192 insertions(+), 1 deletions(-)

diff --git a/arch/arm/configs/pxa910_defconfig
b/arch/arm/configs/pxa910_defconfig
index 8c7e299..b9b1a85 100644
--- a/arch/arm/configs/pxa910_defconfig
+++ b/arch/arm/configs/pxa910_defconfig
@@ -578,7 +578,34 @@ CONFIG_SSB_POSSIBLE=y
 #
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
-# CONFIG_FB is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_PXA168=y
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set

 #
@@ -591,6 +618,16 @@ CONFIG_SSB_POSSIBLE=y
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+CONFIG_LOGO=y
+# CONFIG_LOGO_LINUX_MONO is not set
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_CLUT224=y
 # CONFIG_SOUND is not set
 # CONFIG_HID_SUPPORT is not set
 # CONFIG_USB_SUPPORT is not set
diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h
b/arch/arm/mach-mmp/include/mach/pxa910.h
index 4f0b4ec..0236182 100644
--- a/arch/arm/mach-mmp/include/mach/pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/pxa910.h
@@ -5,6 +5,7 @@
 #include <mach/devices.h>
 #include <plat/i2c.h>
 #include <plat/pxa3xx_nand.h>
+#include <video/pxa168fb.h>

 extern struct pxa_device_desc pxa910_device_uart1;
 extern struct pxa_device_desc pxa910_device_uart2;
@@ -15,6 +16,7 @@ extern struct pxa_device_desc pxa910_device_pwm2;
 extern struct pxa_device_desc pxa910_device_pwm3;
 extern struct pxa_device_desc pxa910_device_pwm4;
 extern struct pxa_device_desc pxa910_device_nand;
+extern struct pxa_device_desc pxa910_device_fb;

 static inline int pxa910_add_uart(int id)
 {
@@ -71,4 +73,9 @@ static inline int pxa910_add_nand(struct
pxa3xx_nand_platform_data *info)
 {
 	return pxa_register_device(&pxa910_device_nand, info, sizeof(*info));
 }
+
+static inline int pxa910_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa910_device_fb, mi, sizeof(*mi));
+}
 #endif /* __ASM_MACH_PXA910_H */
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index d404950..7b91ea6 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -111,6 +111,7 @@ static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000);

 static APMU_CLK(nand, NAND, 0x01db, 208000000);
+static APMU_CLK(lcd, LCD, 0x003f, 312000000);

 /* device and clock bindings */
 static struct clk_lookup pxa910_clkregs[] = {
@@ -123,6 +124,7 @@ static struct clk_lookup pxa910_clkregs[] = {
 	INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
 	INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa910-fb", "LCDCLK"),
 };

 static int __init pxa910_init(void)
@@ -178,3 +180,4 @@ PXA910_DEVICE(pwm2, "pxa910-pwm", 1, NONE,
0xd401a400, 0x10);
 PXA910_DEVICE(pwm3, "pxa910-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA910_DEVICE(pwm4, "pxa910-pwm", 3, NONE, 0xd401ac00, 0x10);
 PXA910_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x80, 97, 99);
+PXA910_DEVICE(fb, "pxa910-fb", -1, LCD, 0xd420b000, 0x1c8);
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index bb26cb5..d3e7e1f 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -14,7 +14,10 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/onenand.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>

+#include <video/pxa168fb.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
@@ -31,6 +34,37 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
 	GPIO47_UART2_RXD,
 	GPIO48_UART2_TXD,

+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO81_LCD_FCLK,
+	GPIO82_LCD_LCLK,
+	GPIO83_LCD_PCLK,
+	GPIO84_LCD_DENA,
+	GPIO85_LCD_DD0,
+	GPIO86_LCD_DD1,
+	GPIO87_LCD_DD2,
+	GPIO88_LCD_DD3,
+	GPIO89_LCD_DD4,
+	GPIO90_LCD_DD5,
+	GPIO91_LCD_DD6,
+	GPIO92_LCD_DD7,
+	GPIO93_LCD_DD8,
+	GPIO94_LCD_DD9,
+	GPIO95_LCD_DD10,
+	GPIO96_LCD_DD11,
+	GPIO97_LCD_DD12,
+	GPIO98_LCD_DD13,
+	GPIO100_LCD_DD14,
+	GPIO101_LCD_DD15,
+	GPIO102_LCD_DD16,
+	GPIO103_LCD_DD17,
+	GPIO104_LCD_SPIDOUT,
+	GPIO105_LCD_SPIDIN,
+	GPIO107_LCD_CS1,
+	GPIO108_LCD_DCLK,
+	GPIO106_LCD_RESET,
+#endif
+
 	/* DFI */
 	DF_IO0_ND_IO0,
 	DF_IO1_ND_IO1,
@@ -56,6 +90,113 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
 	DF_RDY0_DF_RDY0,
 };

+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x0801,
+	0x0800,
+	0x0200,
+	0x0304,
+	0x040e,
+	0x0903,
+	0x0b18,
+	0x0c53,
+	0x0d01,
+	0x0ee0,
+	0x0f01,
+	0x1058,
+	0x201e,
+	0x210a,
+	0x220a,
+	0x231e,
+	0x2400,
+	0x2532,
+	0x2600,
+	0x27ac,
+	0x2904,
+	0x2aa2,
+	0x2b45,
+	0x2c45,
+	0x2d15,
+	0x2e5a,
+	0x2fff,
+	0x306b,
+	0x310d,
+	0x3248,
+	0x3382,
+	0x34bd,
+	0x35e7,
+	0x3618,
+	0x3794,
+	0x3801,
+	0x395d,
+	0x3aae,
+	0x3bff,
+	0x07c9,		/* auto power on */
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x07d9,		/* auto power off */
+};
+
+static int tpo_lcd_power(struct pxa168fb_info *fbi, unsigned int spi_gpio_cs,
+		unsigned int spi_gpio_reset, int on)
+{
+	int err = 0;
+
+	if (on) {
+		if (spi_gpio_reset != -1) {
+			err = gpio_request(spi_gpio_reset, "TPO_LCD_SPI_RESET");
+			if (err) {
+				printk(KERN_ERR "failed to request GPIO for TPO LCD RESET\n");
+				return -EIO;
+			}
+			gpio_direction_output(spi_gpio_reset, 0);
+			msleep(1);
+			gpio_set_value(spi_gpio_reset, 1);
+			msleep(11);
+			gpio_free(spi_gpio_reset);
+		}
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdon,
+				ARRAY_SIZE(tpo_spi_cmdon), spi_gpio_cs, 0, 40);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
+				ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 0);
+}
+
+static struct fb_videomode video_modes[] = {
+	/* lpj032l001b HVGA mode info */
+	[0] = {
+		.pixclock       = 100000,
+		.refresh        = 60,
+		.xres           = 320,
+		.yres           = 480,
+		.hsync_len      = 10,
+		.left_margin    = 15,
+		.right_margin   = 10,
+		.vsync_len      = 2,
+		.upper_margin   = 4,
+		.lower_margin   = 2,
+		.sync           = 0,
+	},
+};
+
+static struct pxa168fb_mach_info ttc_dkb_lcd_info __initdata = {
+	.id                     = "Base",
+	.modes                  = video_modes,
+	.num_modes              = ARRAY_SIZE(video_modes),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_18_SPI,
+	.dumb_mode              = DUMB_MODE_RGB666,
+	.active                 = 1,
+	.spi_ctrl               = CFG_SCLKCNT(16) | CFG_TXBITS(16) |
+		CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs            = -1,
+	.spi_gpio_reset		= mfp_to_gpio(MFP_PIN_GPIO106),
+	.invert_pixclock	= 1,
+	.pxa168fb_lcd_power	= tpo_lcd_power,
+};
+#endif
+
 static struct mtd_partition ttc_dkb_onenand_partitions[] = {
 	{
 		.name		= "bootloader",
@@ -118,6 +259,9 @@ static void __init ttc_dkb_init(void)

 	/* on-chip devices */
 	pxa910_add_uart(1);
+#ifdef CONFIG_FB_PXA168
+	pxa910_add_fb(&ttc_dkb_lcd_info);
+#endif

 	/* off-chip devices */
 	platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
-- 
1.5.4.3

[-- Attachment #2: 0002-pxa-add-frame-buffer-on-pxa910-ttc_dkb-platform.patch --]
[-- Type: text/x-diff, Size: 8411 bytes --]

From 91479fe76e31686747b016d6667a14d3aec3b074 Mon Sep 17 00:00:00 2001
From: Jun Nie <njun@marvell.com>
Date: Mon, 23 Nov 2009 10:32:51 +0800
Subject: [PATCH] pxa: add frame buffer on pxa910 ttc_dkb platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa910_defconfig       |   39 ++++++++-
 arch/arm/mach-mmp/include/mach/pxa910.h |    7 ++
 arch/arm/mach-mmp/pxa910.c              |    3 +
 arch/arm/mach-mmp/ttc_dkb.c             |  144 +++++++++++++++++++++++++++++++
 4 files changed, 192 insertions(+), 1 deletions(-)

diff --git a/arch/arm/configs/pxa910_defconfig b/arch/arm/configs/pxa910_defconfig
index 8c7e299..b9b1a85 100644
--- a/arch/arm/configs/pxa910_defconfig
+++ b/arch/arm/configs/pxa910_defconfig
@@ -578,7 +578,34 @@ CONFIG_SSB_POSSIBLE=y
 #
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
-# CONFIG_FB is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_PXA168=y
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
@@ -591,6 +618,16 @@ CONFIG_SSB_POSSIBLE=y
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+CONFIG_LOGO=y
+# CONFIG_LOGO_LINUX_MONO is not set
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_CLUT224=y
 # CONFIG_SOUND is not set
 # CONFIG_HID_SUPPORT is not set
 # CONFIG_USB_SUPPORT is not set
diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h b/arch/arm/mach-mmp/include/mach/pxa910.h
index 4f0b4ec..0236182 100644
--- a/arch/arm/mach-mmp/include/mach/pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/pxa910.h
@@ -5,6 +5,7 @@
 #include <mach/devices.h>
 #include <plat/i2c.h>
 #include <plat/pxa3xx_nand.h>
+#include <video/pxa168fb.h>
 
 extern struct pxa_device_desc pxa910_device_uart1;
 extern struct pxa_device_desc pxa910_device_uart2;
@@ -15,6 +16,7 @@ extern struct pxa_device_desc pxa910_device_pwm2;
 extern struct pxa_device_desc pxa910_device_pwm3;
 extern struct pxa_device_desc pxa910_device_pwm4;
 extern struct pxa_device_desc pxa910_device_nand;
+extern struct pxa_device_desc pxa910_device_fb;
 
 static inline int pxa910_add_uart(int id)
 {
@@ -71,4 +73,9 @@ static inline int pxa910_add_nand(struct pxa3xx_nand_platform_data *info)
 {
 	return pxa_register_device(&pxa910_device_nand, info, sizeof(*info));
 }
+
+static inline int pxa910_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa910_device_fb, mi, sizeof(*mi));
+}
 #endif /* __ASM_MACH_PXA910_H */
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index d404950..7b91ea6 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -111,6 +111,7 @@ static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000);
 
 static APMU_CLK(nand, NAND, 0x01db, 208000000);
+static APMU_CLK(lcd, LCD, 0x003f, 312000000);
 
 /* device and clock bindings */
 static struct clk_lookup pxa910_clkregs[] = {
@@ -123,6 +124,7 @@ static struct clk_lookup pxa910_clkregs[] = {
 	INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
 	INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa910-fb", "LCDCLK"),
 };
 
 static int __init pxa910_init(void)
@@ -178,3 +180,4 @@ PXA910_DEVICE(pwm2, "pxa910-pwm", 1, NONE, 0xd401a400, 0x10);
 PXA910_DEVICE(pwm3, "pxa910-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA910_DEVICE(pwm4, "pxa910-pwm", 3, NONE, 0xd401ac00, 0x10);
 PXA910_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x80, 97, 99);
+PXA910_DEVICE(fb, "pxa910-fb", -1, LCD, 0xd420b000, 0x1c8);
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index bb26cb5..d3e7e1f 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -14,7 +14,10 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/onenand.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
 
+#include <video/pxa168fb.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
@@ -31,6 +34,37 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
 	GPIO47_UART2_RXD,
 	GPIO48_UART2_TXD,
 
+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO81_LCD_FCLK,
+	GPIO82_LCD_LCLK,
+	GPIO83_LCD_PCLK,
+	GPIO84_LCD_DENA,
+	GPIO85_LCD_DD0,
+	GPIO86_LCD_DD1,
+	GPIO87_LCD_DD2,
+	GPIO88_LCD_DD3,
+	GPIO89_LCD_DD4,
+	GPIO90_LCD_DD5,
+	GPIO91_LCD_DD6,
+	GPIO92_LCD_DD7,
+	GPIO93_LCD_DD8,
+	GPIO94_LCD_DD9,
+	GPIO95_LCD_DD10,
+	GPIO96_LCD_DD11,
+	GPIO97_LCD_DD12,
+	GPIO98_LCD_DD13,
+	GPIO100_LCD_DD14,
+	GPIO101_LCD_DD15,
+	GPIO102_LCD_DD16,
+	GPIO103_LCD_DD17,
+	GPIO104_LCD_SPIDOUT,
+	GPIO105_LCD_SPIDIN,
+	GPIO107_LCD_CS1,
+	GPIO108_LCD_DCLK,
+	GPIO106_LCD_RESET,
+#endif
+
 	/* DFI */
 	DF_IO0_ND_IO0,
 	DF_IO1_ND_IO1,
@@ -56,6 +90,113 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
 	DF_RDY0_DF_RDY0,
 };
 
+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x0801,
+	0x0800,
+	0x0200,
+	0x0304,
+	0x040e,
+	0x0903,
+	0x0b18,
+	0x0c53,
+	0x0d01,
+	0x0ee0,
+	0x0f01,
+	0x1058,
+	0x201e,
+	0x210a,
+	0x220a,
+	0x231e,
+	0x2400,
+	0x2532,
+	0x2600,
+	0x27ac,
+	0x2904,
+	0x2aa2,
+	0x2b45,
+	0x2c45,
+	0x2d15,
+	0x2e5a,
+	0x2fff,
+	0x306b,
+	0x310d,
+	0x3248,
+	0x3382,
+	0x34bd,
+	0x35e7,
+	0x3618,
+	0x3794,
+	0x3801,
+	0x395d,
+	0x3aae,
+	0x3bff,
+	0x07c9,		/* auto power on */
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x07d9,		/* auto power off */
+};
+
+static int tpo_lcd_power(struct pxa168fb_info *fbi, unsigned int spi_gpio_cs,
+		unsigned int spi_gpio_reset, int on)
+{
+	int err = 0;
+
+	if (on) {
+		if (spi_gpio_reset != -1) {
+			err = gpio_request(spi_gpio_reset, "TPO_LCD_SPI_RESET");
+			if (err) {
+				printk(KERN_ERR "failed to request GPIO for TPO LCD RESET\n");
+				return -EIO;
+			}
+			gpio_direction_output(spi_gpio_reset, 0);
+			msleep(1);
+			gpio_set_value(spi_gpio_reset, 1);
+			msleep(11);
+			gpio_free(spi_gpio_reset);
+		}
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdon,
+				ARRAY_SIZE(tpo_spi_cmdon), spi_gpio_cs, 0, 40);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
+				ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 0);
+}
+
+static struct fb_videomode video_modes[] = {
+	/* lpj032l001b HVGA mode info */
+	[0] = {
+		.pixclock       = 100000,
+		.refresh        = 60,
+		.xres           = 320,
+		.yres           = 480,
+		.hsync_len      = 10,
+		.left_margin    = 15,
+		.right_margin   = 10,
+		.vsync_len      = 2,
+		.upper_margin   = 4,
+		.lower_margin   = 2,
+		.sync           = 0,
+	},
+};
+
+static struct pxa168fb_mach_info ttc_dkb_lcd_info __initdata = {
+	.id                     = "Base",
+	.modes                  = video_modes,
+	.num_modes              = ARRAY_SIZE(video_modes),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_18_SPI,
+	.dumb_mode              = DUMB_MODE_RGB666,
+	.active                 = 1,
+	.spi_ctrl               = CFG_SCLKCNT(16) | CFG_TXBITS(16) |
+		CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs            = -1,
+	.spi_gpio_reset		= mfp_to_gpio(MFP_PIN_GPIO106),
+	.invert_pixclock	= 1,
+	.pxa168fb_lcd_power	= tpo_lcd_power,
+};
+#endif
+
 static struct mtd_partition ttc_dkb_onenand_partitions[] = {
 	{
 		.name		= "bootloader",
@@ -118,6 +259,9 @@ static void __init ttc_dkb_init(void)
 
 	/* on-chip devices */
 	pxa910_add_uart(1);
+#ifdef CONFIG_FB_PXA168
+	pxa910_add_fb(&ttc_dkb_lcd_info);
+#endif
 
 	/* off-chip devices */
 	platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-11-23  5:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-10  8:12 [PATCH 8/8] pxa: add frame buffer on pxa910 ttc_dkb platform Jun Nie
2009-11-12  2:20 ` Jun Nie
2009-11-12 22:21   ` Russell King - ARM Linux
2009-11-16  9:35 ` Jun Nie
2009-11-19  9:04   ` Jun Nie
2009-11-19  9:13     ` Russell King - ARM Linux
2009-11-23  5:55       ` Jun Nie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).