All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
@ 2009-11-10  8:12 ` Jun Nie
  0 siblings, 0 replies; 18+ messages in thread
From: Jun Nie @ 2009-11-10  8:12 UTC (permalink / raw)
  To: linux-arm-kernel

From 371f70316d6766c781a50818733bb39491a90200 Mon Sep 17 00:00:00 2001
From: Jun Nie <njun@marvell.com>
Date: Tue, 10 Nov 2009 15:58:28 +0800
Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa168_defconfig       |   86 ++++++++++++++++++++-
 arch/arm/mach-mmp/aspenite.c            |  131 +++++++++++++++++++++++++++++++
 arch/arm/mach-mmp/include/mach/pxa168.h |    8 ++
 arch/arm/mach-mmp/pxa168.c              |    3 +
 4 files changed, 226 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/pxa168_defconfig
b/arch/arm/configs/pxa168_defconfig
index db5faea..b736517 100644
--- a/arch/arm/configs/pxa168_defconfig
+++ b/arch/arm/configs/pxa168_defconfig
@@ -509,7 +509,49 @@ CONFIG_UNIX98_PTYS=y
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
-# CONFIG_I2C is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_CHARDEV is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE is not set
+CONFIG_I2C_GPIO=y
+# CONFIG_I2C_OCORES is not set
+CONFIG_I2C_PXA=y
+# CONFIG_I2C_PXA_SLAVE is not set
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_PCF8575 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
 # CONFIG_SPI is not set
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_GPIOLIB=y
@@ -523,6 +565,9 @@ CONFIG_GPIOLIB=y
 #
 # I2C GPIO expanders:
 #
+# CONFIG_GPIO_MAX732X is not set
+CONFIG_GPIO_PCA953X=y
+# CONFIG_GPIO_PCF857X is not set

 #
 # PCI GPIO expanders:
@@ -578,7 +623,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 is not set
+# CONFIG_FB_CFB_COPYAREA is not set
+# CONFIG_FB_CFB_IMAGEBLIT is not set
+# 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 +663,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/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index b422bb5..d0a1e37 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -17,6 +17,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/nand.h>
 #include <linux/i2c/pca953x.h>
+#include <linux/delay.h>

 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -66,6 +67,39 @@ static unsigned long common_pin_config[] __initdata = {
 	/* UART1 */
 	GPIO107_UART1_RXD,
 	GPIO108_UART1_TXD,
+
+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO56_LCD_FCLK_RD,
+	GPIO57_LCD_LCLK_A0,
+	GPIO58_LCD_PCLK_WR,
+	GPIO59_LCD_DENA_BIAS,
+	GPIO60_LCD_DD0,
+	GPIO61_LCD_DD1,
+	GPIO62_LCD_DD2,
+	GPIO63_LCD_DD3,
+	GPIO64_LCD_DD4,
+	GPIO65_LCD_DD5,
+	GPIO66_LCD_DD6,
+	GPIO67_LCD_DD7,
+	GPIO68_LCD_DD8,
+	GPIO69_LCD_DD9,
+	GPIO70_LCD_DD10,
+	GPIO71_LCD_DD11,
+	GPIO72_LCD_DD12,
+	GPIO73_LCD_DD13,
+	GPIO74_LCD_DD14,
+	GPIO75_LCD_DD15,
+
+	GPIO76_LCD_DD16,
+	GPIO77_LCD_DD17,
+	GPIO78_LCD_DD18,
+	GPIO79_LCD_DD19,
+	GPIO80_LCD_DD20,
+	GPIO81_LCD_DD21,
+	GPIO82_LCD_DD22,
+	GPIO83_LCD_DD23,
+#endif
 };

 static struct smc91x_platdata smc91x_info = {
@@ -95,6 +129,100 @@ static struct platform_device smc91x_device = {
 	.resource	= smc91x_resources,
 };

+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x080F,
+	0x0C5F,
+	0x1017,
+	0x1420,
+	0x1808,
+	0x1c20,
+	0x2020,
+	0x2420,
+	0x2820,
+	0x2c20,
+	0x3020,
+	0x3420,
+	0x3810,
+	0x3c10,
+	0x4010,
+	0x4415,
+	0x48aa,
+	0x4cff,
+	0x5086,
+	0x548d,
+	0x58d4,
+	0x5cfb,
+	0x602e,
+	0x645a,
+	0x6889,
+	0x6cfe,
+	0x705a,
+	0x749b,
+	0x78c5,
+	0x7cff,
+	0x80f0,
+	0x84f0,
+	0x8808,
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x0c5e,		//standby
+};
+
+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 err;
+			}
+			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, 1);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 1);
+}
+
+static struct fb_videomode video_modes_aspen[] = {
+	[0] = {
+		.pixclock       = 30120,
+		.refresh        = 60,
+		.xres           = 800,
+		.yres           = 480,
+		.hsync_len      = 1,
+		.left_margin    = 215,
+		.right_margin   = 40,
+		.vsync_len      = 1,
+		.upper_margin   = 34,
+		.lower_margin   = 10,
+		.sync           = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
+	},
+};
+
+struct pxa168fb_mach_info aspenite_lcd_info __initdata = {
+	.id                     = "Base-aspen",
+	.modes                  = video_modes_aspen,
+	.num_modes              = ARRAY_SIZE(video_modes_aspen),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_24,
+	.dumb_mode              = DUMB_MODE_RGB888,
+	.active                 = 1,
+	.spi_ctrl		= CFG_SCLKCNT(2) | CFG_TXBITS(16) | CFG_SPI_SEL(1) |
CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs		= GPIO_EXT1(14),
+	.spi_gpio_reset         = -1,
+	.pxa168fb_lcd_power     = tpo_lcd_power,
+};
+
+#endif
+
 #if defined(CONFIG_MTD_NAND) || defined(CONFIG_MTD_NAND_MODULE)
 static struct mtd_partition apn_nand_partitions[] = {
 	{
@@ -184,6 +312,9 @@ static void __init common_init(void)

 	/* on-chip devices */
 	pxa168_add_uart(1);
+#ifdef CONFIG_FB_PXA168
+	pxa168_add_fb(&aspenite_lcd_info);
+#endif

 	apn_init_nand();
 	pxa168_add_twsi(0, &pwri2c_info, ARRAY_AND_SIZE(aspenite_i2c_board_info));
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h
b/arch/arm/mach-mmp/include/mach/pxa168.h
index d117ceb..d43fb13 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.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 pxa168_device_uart1;
 extern struct pxa_device_desc pxa168_device_uart2;
@@ -14,6 +15,7 @@ extern struct pxa_device_desc pxa168_device_pwm2;
 extern struct pxa_device_desc pxa168_device_pwm3;
 extern struct pxa_device_desc pxa168_device_pwm4;
 extern struct pxa_device_desc pxa168_device_nand;
+extern struct pxa_device_desc pxa168_device_fb;

 static inline int pxa168_add_uart(int id)
 {
@@ -65,4 +67,10 @@ static inline int pxa168_add_pwm(int id)

 	return pxa_register_device(d, NULL, 0);
 }
+
+static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
+}
+
 #endif /* __ASM_MACH_PXA168_H */
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 59b393e..8be1e46 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -74,6 +74,7 @@ static APBC_CLK(pwm3, PXA168_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA168_PWM4, 1, 13000000);

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

 /* device and clock bindings */
 static struct clk_lookup pxa168_clkregs[] = {
@@ -86,6 +87,7 @@ static struct clk_lookup pxa168_clkregs[] = {
 	INIT_CLKREG(&clk_pwm2, "pxa168-pwm.1", NULL),
 	INIT_CLKREG(&clk_pwm3, "pxa168-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa168-pwm.3", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa168-fb", "LCDCLK"),
 };

 static int __init pxa168_init(void)
@@ -132,3 +134,4 @@ PXA168_DEVICE(pwm2, "pxa168-pwm", 1, NONE,
0xd401a400, 0x10);
 PXA168_DEVICE(pwm3, "pxa168-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA168_DEVICE(pwm4, "pxa168-pwm", 3, NONE, 0xd401ac00, 0x10);
 PXA168_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x200, 97, 99);
+PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
-- 
1.5.4.3

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

* [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
@ 2009-11-10  8:12 ` Jun Nie
  0 siblings, 0 replies; 18+ messages in thread
From: Jun Nie @ 2009-11-10  8:12 UTC (permalink / raw)
  To: linux-arm-kernel



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

* Re: [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
  2009-11-10  8:12 ` Jun Nie
@ 2009-11-12  2:19   ` Jun Nie
  -1 siblings, 0 replies; 18+ messages in thread
From: Jun Nie @ 2009-11-12  2:19 UTC (permalink / raw)
  To: linux-arm-kernel

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

2009/11/10 Jun Nie <niej0001@gmail.com>:
> From 371f70316d6766c781a50818733bb39491a90200 Mon Sep 17 00:00:00 2001
> From: Jun Nie <njun@marvell.com>
> Date: Tue, 10 Nov 2009 15:58:28 +0800
> Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform
>
> Signed-off-by: Jun Nie <njun@marvell.com>
> ---
>  arch/arm/configs/pxa168_defconfig       |   86 ++++++++++++++++++++-
>  arch/arm/mach-mmp/aspenite.c            |  131 +++++++++++++++++++++++++++++++
>  arch/arm/mach-mmp/include/mach/pxa168.h |    8 ++
>  arch/arm/mach-mmp/pxa168.c              |    3 +
>  4 files changed, 226 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/configs/pxa168_defconfig
> b/arch/arm/configs/pxa168_defconfig
> index db5faea..b736517 100644
> --- a/arch/arm/configs/pxa168_defconfig
> +++ b/arch/arm/configs/pxa168_defconfig
> @@ -509,7 +509,49 @@ CONFIG_UNIX98_PTYS=y
>  # CONFIG_R3964 is not set
>  # CONFIG_RAW_DRIVER is not set
>  # CONFIG_TCG_TPM is not set
> -# CONFIG_I2C is not set
> +CONFIG_I2C=y
> +CONFIG_I2C_BOARDINFO=y
> +# CONFIG_I2C_CHARDEV is not set
> +CONFIG_I2C_HELPER_AUTO=y
> +CONFIG_I2C_ALGOBIT=y
> +
> +#
> +# I2C Hardware Bus support
> +#
> +
> +#
> +# I2C system bus drivers (mostly embedded / system-on-chip)
> +#
> +# CONFIG_I2C_DESIGNWARE is not set
> +CONFIG_I2C_GPIO=y
> +# CONFIG_I2C_OCORES is not set
> +CONFIG_I2C_PXA=y
> +# CONFIG_I2C_PXA_SLAVE is not set
> +# CONFIG_I2C_SIMTEC is not set
> +
> +#
> +# External I2C/SMBus adapter drivers
> +#
> +# CONFIG_I2C_PARPORT_LIGHT is not set
> +# CONFIG_I2C_TAOS_EVM is not set
> +
> +#
> +# Other I2C/SMBus bus drivers
> +#
> +# CONFIG_I2C_PCA_PLATFORM is not set
> +# CONFIG_I2C_STUB is not set
> +
> +#
> +# Miscellaneous I2C Chip support
> +#
> +# CONFIG_DS1682 is not set
> +# CONFIG_SENSORS_PCF8574 is not set
> +# CONFIG_PCF8575 is not set
> +# CONFIG_SENSORS_TSL2550 is not set
> +# CONFIG_I2C_DEBUG_CORE is not set
> +# CONFIG_I2C_DEBUG_ALGO is not set
> +# CONFIG_I2C_DEBUG_BUS is not set
> +# CONFIG_I2C_DEBUG_CHIP is not set
>  # CONFIG_SPI is not set
>  CONFIG_ARCH_REQUIRE_GPIOLIB=y
>  CONFIG_GPIOLIB=y
> @@ -523,6 +565,9 @@ CONFIG_GPIOLIB=y
>  #
>  # I2C GPIO expanders:
>  #
> +# CONFIG_GPIO_MAX732X is not set
> +CONFIG_GPIO_PCA953X=y
> +# CONFIG_GPIO_PCF857X is not set
>
>  #
>  # PCI GPIO expanders:
> @@ -578,7 +623,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 is not set
> +# CONFIG_FB_CFB_COPYAREA is not set
> +# CONFIG_FB_CFB_IMAGEBLIT is not set
> +# 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 +663,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/aspenite.c b/arch/arm/mach-mmp/aspenite.c
> index b422bb5..d0a1e37 100644
> --- a/arch/arm/mach-mmp/aspenite.c
> +++ b/arch/arm/mach-mmp/aspenite.c
> @@ -17,6 +17,7 @@
>  #include <linux/mtd/partitions.h>
>  #include <linux/mtd/nand.h>
>  #include <linux/i2c/pca953x.h>
> +#include <linux/delay.h>
>
>  #include <asm/mach-types.h>
>  #include <asm/mach/arch.h>
> @@ -66,6 +67,39 @@ static unsigned long common_pin_config[] __initdata = {
>        /* UART1 */
>        GPIO107_UART1_RXD,
>        GPIO108_UART1_TXD,
> +
> +#ifdef CONFIG_FB_PXA168
> +       /* LCD */
> +       GPIO56_LCD_FCLK_RD,
> +       GPIO57_LCD_LCLK_A0,
> +       GPIO58_LCD_PCLK_WR,
> +       GPIO59_LCD_DENA_BIAS,
> +       GPIO60_LCD_DD0,
> +       GPIO61_LCD_DD1,
> +       GPIO62_LCD_DD2,
> +       GPIO63_LCD_DD3,
> +       GPIO64_LCD_DD4,
> +       GPIO65_LCD_DD5,
> +       GPIO66_LCD_DD6,
> +       GPIO67_LCD_DD7,
> +       GPIO68_LCD_DD8,
> +       GPIO69_LCD_DD9,
> +       GPIO70_LCD_DD10,
> +       GPIO71_LCD_DD11,
> +       GPIO72_LCD_DD12,
> +       GPIO73_LCD_DD13,
> +       GPIO74_LCD_DD14,
> +       GPIO75_LCD_DD15,
> +
> +       GPIO76_LCD_DD16,
> +       GPIO77_LCD_DD17,
> +       GPIO78_LCD_DD18,
> +       GPIO79_LCD_DD19,
> +       GPIO80_LCD_DD20,
> +       GPIO81_LCD_DD21,
> +       GPIO82_LCD_DD22,
> +       GPIO83_LCD_DD23,
> +#endif
>  };
>
>  static struct smc91x_platdata smc91x_info = {
> @@ -95,6 +129,100 @@ static struct platform_device smc91x_device = {
>        .resource       = smc91x_resources,
>  };
>
> +#ifdef CONFIG_FB_PXA168
> +static u16 tpo_spi_cmdon[] = {
> +       0x080F,
> +       0x0C5F,
> +       0x1017,
> +       0x1420,
> +       0x1808,
> +       0x1c20,
> +       0x2020,
> +       0x2420,
> +       0x2820,
> +       0x2c20,
> +       0x3020,
> +       0x3420,
> +       0x3810,
> +       0x3c10,
> +       0x4010,
> +       0x4415,
> +       0x48aa,
> +       0x4cff,
> +       0x5086,
> +       0x548d,
> +       0x58d4,
> +       0x5cfb,
> +       0x602e,
> +       0x645a,
> +       0x6889,
> +       0x6cfe,
> +       0x705a,
> +       0x749b,
> +       0x78c5,
> +       0x7cff,
> +       0x80f0,
> +       0x84f0,
> +       0x8808,
> +};
> +
> +static u16 tpo_spi_cmdoff[] = {
> +       0x0c5e,         //standby
> +};
> +
> +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 err;
> +                       }
> +                       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, 1);
> +       } else
> +               return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
> ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 1);
> +}
> +
> +static struct fb_videomode video_modes_aspen[] = {
> +       [0] = {
> +               .pixclock       = 30120,
> +               .refresh        = 60,
> +               .xres           = 800,
> +               .yres           = 480,
> +               .hsync_len      = 1,
> +               .left_margin    = 215,
> +               .right_margin   = 40,
> +               .vsync_len      = 1,
> +               .upper_margin   = 34,
> +               .lower_margin   = 10,
> +               .sync           = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
> +       },
> +};
> +
> +struct pxa168fb_mach_info aspenite_lcd_info __initdata = {
> +       .id                     = "Base-aspen",
> +       .modes                  = video_modes_aspen,
> +       .num_modes              = ARRAY_SIZE(video_modes_aspen),
> +       .pix_fmt                = PIX_FMT_RGB565,
> +       .io_pin_allocation_mode = PIN_MODE_DUMB_24,
> +       .dumb_mode              = DUMB_MODE_RGB888,
> +       .active                 = 1,
> +       .spi_ctrl               = CFG_SCLKCNT(2) | CFG_TXBITS(16) | CFG_SPI_SEL(1) |
> CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
> +       .spi_gpio_cs            = GPIO_EXT1(14),
> +       .spi_gpio_reset         = -1,
> +       .pxa168fb_lcd_power     = tpo_lcd_power,
> +};
> +
> +#endif
> +
>  #if defined(CONFIG_MTD_NAND) || defined(CONFIG_MTD_NAND_MODULE)
>  static struct mtd_partition apn_nand_partitions[] = {
>        {
> @@ -184,6 +312,9 @@ static void __init common_init(void)
>
>        /* on-chip devices */
>        pxa168_add_uart(1);
> +#ifdef CONFIG_FB_PXA168
> +       pxa168_add_fb(&aspenite_lcd_info);
> +#endif
>
>        apn_init_nand();
>        pxa168_add_twsi(0, &pwri2c_info, ARRAY_AND_SIZE(aspenite_i2c_board_info));
> diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h
> b/arch/arm/mach-mmp/include/mach/pxa168.h
> index d117ceb..d43fb13 100644
> --- a/arch/arm/mach-mmp/include/mach/pxa168.h
> +++ b/arch/arm/mach-mmp/include/mach/pxa168.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 pxa168_device_uart1;
>  extern struct pxa_device_desc pxa168_device_uart2;
> @@ -14,6 +15,7 @@ extern struct pxa_device_desc pxa168_device_pwm2;
>  extern struct pxa_device_desc pxa168_device_pwm3;
>  extern struct pxa_device_desc pxa168_device_pwm4;
>  extern struct pxa_device_desc pxa168_device_nand;
> +extern struct pxa_device_desc pxa168_device_fb;
>
>  static inline int pxa168_add_uart(int id)
>  {
> @@ -65,4 +67,10 @@ static inline int pxa168_add_pwm(int id)
>
>        return pxa_register_device(d, NULL, 0);
>  }
> +
> +static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
> +{
> +       return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
> +}
> +
>  #endif /* __ASM_MACH_PXA168_H */
> diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
> index 59b393e..8be1e46 100644
> --- a/arch/arm/mach-mmp/pxa168.c
> +++ b/arch/arm/mach-mmp/pxa168.c
> @@ -74,6 +74,7 @@ static APBC_CLK(pwm3, PXA168_PWM3, 1, 13000000);
>  static APBC_CLK(pwm4, PXA168_PWM4, 1, 13000000);
>
>  static APMU_CLK(nand, NAND, 0x1db, 208000000);
> +static APMU_CLK(lcd, LCD, 0x003f, 312000000);
>
>  /* device and clock bindings */
>  static struct clk_lookup pxa168_clkregs[] = {
> @@ -86,6 +87,7 @@ static struct clk_lookup pxa168_clkregs[] = {
>        INIT_CLKREG(&clk_pwm2, "pxa168-pwm.1", NULL),
>        INIT_CLKREG(&clk_pwm3, "pxa168-pwm.2", NULL),
>        INIT_CLKREG(&clk_pwm4, "pxa168-pwm.3", NULL),
> +       INIT_CLKREG(&clk_lcd, "pxa168-fb", "LCDCLK"),
>  };
>
>  static int __init pxa168_init(void)
> @@ -132,3 +134,4 @@ PXA168_DEVICE(pwm2, "pxa168-pwm", 1, NONE,
> 0xd401a400, 0x10);
>  PXA168_DEVICE(pwm3, "pxa168-pwm", 2, NONE, 0xd401a800, 0x10);
>  PXA168_DEVICE(pwm4, "pxa168-pwm", 3, NONE, 0xd401ac00, 0x10);
>  PXA168_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x200, 97, 99);
> +PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
> --
> 1.5.4.3
>
patch attached.

[-- Attachment #2: 0007-pxa-add-frame-buffer-on-pxa168-aspenite-platform.patch --]
[-- Type: text/x-diff, Size: 9596 bytes --]

From 371f70316d6766c781a50818733bb39491a90200 Mon Sep 17 00:00:00 2001
From: Jun Nie <njun@marvell.com>
Date: Tue, 10 Nov 2009 15:58:28 +0800
Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa168_defconfig       |   86 ++++++++++++++++++++-
 arch/arm/mach-mmp/aspenite.c            |  131 +++++++++++++++++++++++++++++++
 arch/arm/mach-mmp/include/mach/pxa168.h |    8 ++
 arch/arm/mach-mmp/pxa168.c              |    3 +
 4 files changed, 226 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/pxa168_defconfig b/arch/arm/configs/pxa168_defconfig
index db5faea..b736517 100644
--- a/arch/arm/configs/pxa168_defconfig
+++ b/arch/arm/configs/pxa168_defconfig
@@ -509,7 +509,49 @@ CONFIG_UNIX98_PTYS=y
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
-# CONFIG_I2C is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_CHARDEV is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE is not set
+CONFIG_I2C_GPIO=y
+# CONFIG_I2C_OCORES is not set
+CONFIG_I2C_PXA=y
+# CONFIG_I2C_PXA_SLAVE is not set
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_PCF8575 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
 # CONFIG_SPI is not set
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_GPIOLIB=y
@@ -523,6 +565,9 @@ CONFIG_GPIOLIB=y
 #
 # I2C GPIO expanders:
 #
+# CONFIG_GPIO_MAX732X is not set
+CONFIG_GPIO_PCA953X=y
+# CONFIG_GPIO_PCF857X is not set
 
 #
 # PCI GPIO expanders:
@@ -578,7 +623,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 is not set
+# CONFIG_FB_CFB_COPYAREA is not set
+# CONFIG_FB_CFB_IMAGEBLIT is not set
+# 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 +663,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/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index b422bb5..d0a1e37 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -17,6 +17,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/nand.h>
 #include <linux/i2c/pca953x.h>
+#include <linux/delay.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -66,6 +67,39 @@ static unsigned long common_pin_config[] __initdata = {
 	/* UART1 */
 	GPIO107_UART1_RXD,
 	GPIO108_UART1_TXD,
+
+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO56_LCD_FCLK_RD,
+	GPIO57_LCD_LCLK_A0,
+	GPIO58_LCD_PCLK_WR,
+	GPIO59_LCD_DENA_BIAS,
+	GPIO60_LCD_DD0,
+	GPIO61_LCD_DD1,
+	GPIO62_LCD_DD2,
+	GPIO63_LCD_DD3,
+	GPIO64_LCD_DD4,
+	GPIO65_LCD_DD5,
+	GPIO66_LCD_DD6,
+	GPIO67_LCD_DD7,
+	GPIO68_LCD_DD8,
+	GPIO69_LCD_DD9,
+	GPIO70_LCD_DD10,
+	GPIO71_LCD_DD11,
+	GPIO72_LCD_DD12,
+	GPIO73_LCD_DD13,
+	GPIO74_LCD_DD14,
+	GPIO75_LCD_DD15,
+
+	GPIO76_LCD_DD16,
+	GPIO77_LCD_DD17,
+	GPIO78_LCD_DD18,
+	GPIO79_LCD_DD19,
+	GPIO80_LCD_DD20,
+	GPIO81_LCD_DD21,
+	GPIO82_LCD_DD22,
+	GPIO83_LCD_DD23,
+#endif
 };
 
 static struct smc91x_platdata smc91x_info = {
@@ -95,6 +129,100 @@ static struct platform_device smc91x_device = {
 	.resource	= smc91x_resources,
 };
 
+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x080F,
+	0x0C5F,
+	0x1017,
+	0x1420,
+	0x1808,
+	0x1c20,
+	0x2020,
+	0x2420,
+	0x2820,
+	0x2c20,
+	0x3020,
+	0x3420,
+	0x3810,
+	0x3c10,
+	0x4010,
+	0x4415,
+	0x48aa,
+	0x4cff,
+	0x5086,
+	0x548d,
+	0x58d4,
+	0x5cfb,
+	0x602e,
+	0x645a,
+	0x6889,
+	0x6cfe,
+	0x705a,
+	0x749b,
+	0x78c5,
+	0x7cff,
+	0x80f0,
+	0x84f0,
+	0x8808,
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x0c5e,		//standby
+};
+
+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 err;
+			}
+			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, 1);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff, ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 1);
+}
+
+static struct fb_videomode video_modes_aspen[] = {
+	[0] = {
+		.pixclock       = 30120,
+		.refresh        = 60,
+		.xres           = 800,
+		.yres           = 480,
+		.hsync_len      = 1,
+		.left_margin    = 215,
+		.right_margin   = 40,
+		.vsync_len      = 1,
+		.upper_margin   = 34,
+		.lower_margin   = 10,
+		.sync           = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
+	},
+};
+
+struct pxa168fb_mach_info aspenite_lcd_info __initdata = {
+	.id                     = "Base-aspen",
+	.modes                  = video_modes_aspen,
+	.num_modes              = ARRAY_SIZE(video_modes_aspen),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_24,
+	.dumb_mode              = DUMB_MODE_RGB888,
+	.active                 = 1,
+	.spi_ctrl		= CFG_SCLKCNT(2) | CFG_TXBITS(16) | CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs		= GPIO_EXT1(14),
+	.spi_gpio_reset         = -1,
+	.pxa168fb_lcd_power     = tpo_lcd_power,
+};
+
+#endif
+
 #if defined(CONFIG_MTD_NAND) || defined(CONFIG_MTD_NAND_MODULE)
 static struct mtd_partition apn_nand_partitions[] = {
 	{
@@ -184,6 +312,9 @@ static void __init common_init(void)
 
 	/* on-chip devices */
 	pxa168_add_uart(1);
+#ifdef CONFIG_FB_PXA168
+	pxa168_add_fb(&aspenite_lcd_info);
+#endif
 
 	apn_init_nand();
 	pxa168_add_twsi(0, &pwri2c_info, ARRAY_AND_SIZE(aspenite_i2c_board_info));
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h b/arch/arm/mach-mmp/include/mach/pxa168.h
index d117ceb..d43fb13 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.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 pxa168_device_uart1;
 extern struct pxa_device_desc pxa168_device_uart2;
@@ -14,6 +15,7 @@ extern struct pxa_device_desc pxa168_device_pwm2;
 extern struct pxa_device_desc pxa168_device_pwm3;
 extern struct pxa_device_desc pxa168_device_pwm4;
 extern struct pxa_device_desc pxa168_device_nand;
+extern struct pxa_device_desc pxa168_device_fb;
 
 static inline int pxa168_add_uart(int id)
 {
@@ -65,4 +67,10 @@ static inline int pxa168_add_pwm(int id)
 
 	return pxa_register_device(d, NULL, 0);
 }
+
+static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
+}
+
 #endif /* __ASM_MACH_PXA168_H */
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 59b393e..8be1e46 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -74,6 +74,7 @@ static APBC_CLK(pwm3, PXA168_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA168_PWM4, 1, 13000000);
 
 static APMU_CLK(nand, NAND, 0x1db, 208000000);
+static APMU_CLK(lcd, LCD, 0x003f, 312000000);
 
 /* device and clock bindings */
 static struct clk_lookup pxa168_clkregs[] = {
@@ -86,6 +87,7 @@ static struct clk_lookup pxa168_clkregs[] = {
 	INIT_CLKREG(&clk_pwm2, "pxa168-pwm.1", NULL),
 	INIT_CLKREG(&clk_pwm3, "pxa168-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa168-pwm.3", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa168-fb", "LCDCLK"),
 };
 
 static int __init pxa168_init(void)
@@ -132,3 +134,4 @@ PXA168_DEVICE(pwm2, "pxa168-pwm", 1, NONE, 0xd401a400, 0x10);
 PXA168_DEVICE(pwm3, "pxa168-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA168_DEVICE(pwm4, "pxa168-pwm", 3, NONE, 0xd401ac00, 0x10);
 PXA168_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x200, 97, 99);
+PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
-- 
1.5.4.3


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

* [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
@ 2009-11-12  2:19   ` Jun Nie
  0 siblings, 0 replies; 18+ messages in thread
From: Jun Nie @ 2009-11-12  2:19 UTC (permalink / raw)
  To: linux-arm-kernel

2009/11/10 Jun Nie <niej0001@gmail.com>:
> From 371f70316d6766c781a50818733bb39491a90200 Mon Sep 17 00:00:00 2001
> From: Jun Nie <njun@marvell.com>
> Date: Tue, 10 Nov 2009 15:58:28 +0800
> Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform
>
> Signed-off-by: Jun Nie <njun@marvell.com>
> ---
> ?arch/arm/configs/pxa168_defconfig ? ? ? | ? 86 ++++++++++++++++++++-
> ?arch/arm/mach-mmp/aspenite.c ? ? ? ? ? ?| ?131 +++++++++++++++++++++++++++++++
> ?arch/arm/mach-mmp/include/mach/pxa168.h | ? ?8 ++
> ?arch/arm/mach-mmp/pxa168.c ? ? ? ? ? ? ?| ? ?3 +
> ?4 files changed, 226 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/configs/pxa168_defconfig
> b/arch/arm/configs/pxa168_defconfig
> index db5faea..b736517 100644
> --- a/arch/arm/configs/pxa168_defconfig
> +++ b/arch/arm/configs/pxa168_defconfig
> @@ -509,7 +509,49 @@ CONFIG_UNIX98_PTYS=y
> ?# CONFIG_R3964 is not set
> ?# CONFIG_RAW_DRIVER is not set
> ?# CONFIG_TCG_TPM is not set
> -# CONFIG_I2C is not set
> +CONFIG_I2C=y
> +CONFIG_I2C_BOARDINFO=y
> +# CONFIG_I2C_CHARDEV is not set
> +CONFIG_I2C_HELPER_AUTO=y
> +CONFIG_I2C_ALGOBIT=y
> +
> +#
> +# I2C Hardware Bus support
> +#
> +
> +#
> +# I2C system bus drivers (mostly embedded / system-on-chip)
> +#
> +# CONFIG_I2C_DESIGNWARE is not set
> +CONFIG_I2C_GPIO=y
> +# CONFIG_I2C_OCORES is not set
> +CONFIG_I2C_PXA=y
> +# CONFIG_I2C_PXA_SLAVE is not set
> +# CONFIG_I2C_SIMTEC is not set
> +
> +#
> +# External I2C/SMBus adapter drivers
> +#
> +# CONFIG_I2C_PARPORT_LIGHT is not set
> +# CONFIG_I2C_TAOS_EVM is not set
> +
> +#
> +# Other I2C/SMBus bus drivers
> +#
> +# CONFIG_I2C_PCA_PLATFORM is not set
> +# CONFIG_I2C_STUB is not set
> +
> +#
> +# Miscellaneous I2C Chip support
> +#
> +# CONFIG_DS1682 is not set
> +# CONFIG_SENSORS_PCF8574 is not set
> +# CONFIG_PCF8575 is not set
> +# CONFIG_SENSORS_TSL2550 is not set
> +# CONFIG_I2C_DEBUG_CORE is not set
> +# CONFIG_I2C_DEBUG_ALGO is not set
> +# CONFIG_I2C_DEBUG_BUS is not set
> +# CONFIG_I2C_DEBUG_CHIP is not set
> ?# CONFIG_SPI is not set
> ?CONFIG_ARCH_REQUIRE_GPIOLIB=y
> ?CONFIG_GPIOLIB=y
> @@ -523,6 +565,9 @@ CONFIG_GPIOLIB=y
> ?#
> ?# I2C GPIO expanders:
> ?#
> +# CONFIG_GPIO_MAX732X is not set
> +CONFIG_GPIO_PCA953X=y
> +# CONFIG_GPIO_PCF857X is not set
>
> ?#
> ?# PCI GPIO expanders:
> @@ -578,7 +623,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 is not set
> +# CONFIG_FB_CFB_COPYAREA is not set
> +# CONFIG_FB_CFB_IMAGEBLIT is not set
> +# 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 +663,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/aspenite.c b/arch/arm/mach-mmp/aspenite.c
> index b422bb5..d0a1e37 100644
> --- a/arch/arm/mach-mmp/aspenite.c
> +++ b/arch/arm/mach-mmp/aspenite.c
> @@ -17,6 +17,7 @@
> ?#include <linux/mtd/partitions.h>
> ?#include <linux/mtd/nand.h>
> ?#include <linux/i2c/pca953x.h>
> +#include <linux/delay.h>
>
> ?#include <asm/mach-types.h>
> ?#include <asm/mach/arch.h>
> @@ -66,6 +67,39 @@ static unsigned long common_pin_config[] __initdata = {
> ? ? ? ?/* UART1 */
> ? ? ? ?GPIO107_UART1_RXD,
> ? ? ? ?GPIO108_UART1_TXD,
> +
> +#ifdef CONFIG_FB_PXA168
> + ? ? ? /* LCD */
> + ? ? ? GPIO56_LCD_FCLK_RD,
> + ? ? ? GPIO57_LCD_LCLK_A0,
> + ? ? ? GPIO58_LCD_PCLK_WR,
> + ? ? ? GPIO59_LCD_DENA_BIAS,
> + ? ? ? GPIO60_LCD_DD0,
> + ? ? ? GPIO61_LCD_DD1,
> + ? ? ? GPIO62_LCD_DD2,
> + ? ? ? GPIO63_LCD_DD3,
> + ? ? ? GPIO64_LCD_DD4,
> + ? ? ? GPIO65_LCD_DD5,
> + ? ? ? GPIO66_LCD_DD6,
> + ? ? ? GPIO67_LCD_DD7,
> + ? ? ? GPIO68_LCD_DD8,
> + ? ? ? GPIO69_LCD_DD9,
> + ? ? ? GPIO70_LCD_DD10,
> + ? ? ? GPIO71_LCD_DD11,
> + ? ? ? GPIO72_LCD_DD12,
> + ? ? ? GPIO73_LCD_DD13,
> + ? ? ? GPIO74_LCD_DD14,
> + ? ? ? GPIO75_LCD_DD15,
> +
> + ? ? ? GPIO76_LCD_DD16,
> + ? ? ? GPIO77_LCD_DD17,
> + ? ? ? GPIO78_LCD_DD18,
> + ? ? ? GPIO79_LCD_DD19,
> + ? ? ? GPIO80_LCD_DD20,
> + ? ? ? GPIO81_LCD_DD21,
> + ? ? ? GPIO82_LCD_DD22,
> + ? ? ? GPIO83_LCD_DD23,
> +#endif
> ?};
>
> ?static struct smc91x_platdata smc91x_info = {
> @@ -95,6 +129,100 @@ static struct platform_device smc91x_device = {
> ? ? ? ?.resource ? ? ? = smc91x_resources,
> ?};
>
> +#ifdef CONFIG_FB_PXA168
> +static u16 tpo_spi_cmdon[] = {
> + ? ? ? 0x080F,
> + ? ? ? 0x0C5F,
> + ? ? ? 0x1017,
> + ? ? ? 0x1420,
> + ? ? ? 0x1808,
> + ? ? ? 0x1c20,
> + ? ? ? 0x2020,
> + ? ? ? 0x2420,
> + ? ? ? 0x2820,
> + ? ? ? 0x2c20,
> + ? ? ? 0x3020,
> + ? ? ? 0x3420,
> + ? ? ? 0x3810,
> + ? ? ? 0x3c10,
> + ? ? ? 0x4010,
> + ? ? ? 0x4415,
> + ? ? ? 0x48aa,
> + ? ? ? 0x4cff,
> + ? ? ? 0x5086,
> + ? ? ? 0x548d,
> + ? ? ? 0x58d4,
> + ? ? ? 0x5cfb,
> + ? ? ? 0x602e,
> + ? ? ? 0x645a,
> + ? ? ? 0x6889,
> + ? ? ? 0x6cfe,
> + ? ? ? 0x705a,
> + ? ? ? 0x749b,
> + ? ? ? 0x78c5,
> + ? ? ? 0x7cff,
> + ? ? ? 0x80f0,
> + ? ? ? 0x84f0,
> + ? ? ? 0x8808,
> +};
> +
> +static u16 tpo_spi_cmdoff[] = {
> + ? ? ? 0x0c5e, ? ? ? ? //standby
> +};
> +
> +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 err;
> + ? ? ? ? ? ? ? ? ? ? ? }
> + ? ? ? ? ? ? ? ? ? ? ? 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, 1);
> + ? ? ? } else
> + ? ? ? ? ? ? ? return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
> ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 1);
> +}
> +
> +static struct fb_videomode video_modes_aspen[] = {
> + ? ? ? [0] = {
> + ? ? ? ? ? ? ? .pixclock ? ? ? = 30120,
> + ? ? ? ? ? ? ? .refresh ? ? ? ?= 60,
> + ? ? ? ? ? ? ? .xres ? ? ? ? ? = 800,
> + ? ? ? ? ? ? ? .yres ? ? ? ? ? = 480,
> + ? ? ? ? ? ? ? .hsync_len ? ? ?= 1,
> + ? ? ? ? ? ? ? .left_margin ? ?= 215,
> + ? ? ? ? ? ? ? .right_margin ? = 40,
> + ? ? ? ? ? ? ? .vsync_len ? ? ?= 1,
> + ? ? ? ? ? ? ? .upper_margin ? = 34,
> + ? ? ? ? ? ? ? .lower_margin ? = 10,
> + ? ? ? ? ? ? ? .sync ? ? ? ? ? = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
> + ? ? ? },
> +};
> +
> +struct pxa168fb_mach_info aspenite_lcd_info __initdata = {
> + ? ? ? .id ? ? ? ? ? ? ? ? ? ? = "Base-aspen",
> + ? ? ? .modes ? ? ? ? ? ? ? ? ?= video_modes_aspen,
> + ? ? ? .num_modes ? ? ? ? ? ? ?= ARRAY_SIZE(video_modes_aspen),
> + ? ? ? .pix_fmt ? ? ? ? ? ? ? ?= PIX_FMT_RGB565,
> + ? ? ? .io_pin_allocation_mode = PIN_MODE_DUMB_24,
> + ? ? ? .dumb_mode ? ? ? ? ? ? ?= DUMB_MODE_RGB888,
> + ? ? ? .active ? ? ? ? ? ? ? ? = 1,
> + ? ? ? .spi_ctrl ? ? ? ? ? ? ? = CFG_SCLKCNT(2) | CFG_TXBITS(16) | CFG_SPI_SEL(1) |
> CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
> + ? ? ? .spi_gpio_cs ? ? ? ? ? ?= GPIO_EXT1(14),
> + ? ? ? .spi_gpio_reset ? ? ? ? = -1,
> + ? ? ? .pxa168fb_lcd_power ? ? = tpo_lcd_power,
> +};
> +
> +#endif
> +
> ?#if defined(CONFIG_MTD_NAND) || defined(CONFIG_MTD_NAND_MODULE)
> ?static struct mtd_partition apn_nand_partitions[] = {
> ? ? ? ?{
> @@ -184,6 +312,9 @@ static void __init common_init(void)
>
> ? ? ? ?/* on-chip devices */
> ? ? ? ?pxa168_add_uart(1);
> +#ifdef CONFIG_FB_PXA168
> + ? ? ? pxa168_add_fb(&aspenite_lcd_info);
> +#endif
>
> ? ? ? ?apn_init_nand();
> ? ? ? ?pxa168_add_twsi(0, &pwri2c_info, ARRAY_AND_SIZE(aspenite_i2c_board_info));
> diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h
> b/arch/arm/mach-mmp/include/mach/pxa168.h
> index d117ceb..d43fb13 100644
> --- a/arch/arm/mach-mmp/include/mach/pxa168.h
> +++ b/arch/arm/mach-mmp/include/mach/pxa168.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 pxa168_device_uart1;
> ?extern struct pxa_device_desc pxa168_device_uart2;
> @@ -14,6 +15,7 @@ extern struct pxa_device_desc pxa168_device_pwm2;
> ?extern struct pxa_device_desc pxa168_device_pwm3;
> ?extern struct pxa_device_desc pxa168_device_pwm4;
> ?extern struct pxa_device_desc pxa168_device_nand;
> +extern struct pxa_device_desc pxa168_device_fb;
>
> ?static inline int pxa168_add_uart(int id)
> ?{
> @@ -65,4 +67,10 @@ static inline int pxa168_add_pwm(int id)
>
> ? ? ? ?return pxa_register_device(d, NULL, 0);
> ?}
> +
> +static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
> +{
> + ? ? ? return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
> +}
> +
> ?#endif /* __ASM_MACH_PXA168_H */
> diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
> index 59b393e..8be1e46 100644
> --- a/arch/arm/mach-mmp/pxa168.c
> +++ b/arch/arm/mach-mmp/pxa168.c
> @@ -74,6 +74,7 @@ static APBC_CLK(pwm3, PXA168_PWM3, 1, 13000000);
> ?static APBC_CLK(pwm4, PXA168_PWM4, 1, 13000000);
>
> ?static APMU_CLK(nand, NAND, 0x1db, 208000000);
> +static APMU_CLK(lcd, LCD, 0x003f, 312000000);
>
> ?/* device and clock bindings */
> ?static struct clk_lookup pxa168_clkregs[] = {
> @@ -86,6 +87,7 @@ static struct clk_lookup pxa168_clkregs[] = {
> ? ? ? ?INIT_CLKREG(&clk_pwm2, "pxa168-pwm.1", NULL),
> ? ? ? ?INIT_CLKREG(&clk_pwm3, "pxa168-pwm.2", NULL),
> ? ? ? ?INIT_CLKREG(&clk_pwm4, "pxa168-pwm.3", NULL),
> + ? ? ? INIT_CLKREG(&clk_lcd, "pxa168-fb", "LCDCLK"),
> ?};
>
> ?static int __init pxa168_init(void)
> @@ -132,3 +134,4 @@ PXA168_DEVICE(pwm2, "pxa168-pwm", 1, NONE,
> 0xd401a400, 0x10);
> ?PXA168_DEVICE(pwm3, "pxa168-pwm", 2, NONE, 0xd401a800, 0x10);
> ?PXA168_DEVICE(pwm4, "pxa168-pwm", 3, NONE, 0xd401ac00, 0x10);
> ?PXA168_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x200, 97, 99);
> +PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
> --
> 1.5.4.3
>
patch attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-pxa-add-frame-buffer-on-pxa168-aspenite-platform.patch
Type: text/x-diff
Size: 9595 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091112/32b99903/attachment.bin>

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

* [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
@ 2009-11-16  9:34   ` Jun Nie
  0 siblings, 0 replies; 18+ messages in thread
From: Jun Nie @ 2009-11-16  9:34 UTC (permalink / raw)
  To: linux-arm-kernel

From: Jun Nie <njun@marvell.com>
Date: Fri, 13 Nov 2009 15:12:19 +0800
Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa168_defconfig       |   86 +++++++++++++++++++-
 arch/arm/mach-mmp/aspenite.c            |  136 +++++++++++++++++++++++++++++++
 arch/arm/mach-mmp/include/mach/pxa168.h |    8 ++
 arch/arm/mach-mmp/pxa168.c              |    3 +
 4 files changed, 231 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/pxa168_defconfig
b/arch/arm/configs/pxa168_defconfig
index db5faea..b736517 100644
--- a/arch/arm/configs/pxa168_defconfig
+++ b/arch/arm/configs/pxa168_defconfig
@@ -509,7 +509,49 @@ CONFIG_UNIX98_PTYS=y
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
-# CONFIG_I2C is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_CHARDEV is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE is not set
+CONFIG_I2C_GPIO=y
+# CONFIG_I2C_OCORES is not set
+CONFIG_I2C_PXA=y
+# CONFIG_I2C_PXA_SLAVE is not set
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_PCF8575 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
 # CONFIG_SPI is not set
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_GPIOLIB=y
@@ -523,6 +565,9 @@ CONFIG_GPIOLIB=y
 #
 # I2C GPIO expanders:
 #
+# CONFIG_GPIO_MAX732X is not set
+CONFIG_GPIO_PCA953X=y
+# CONFIG_GPIO_PCF857X is not set

 #
 # PCI GPIO expanders:
@@ -578,7 +623,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 is not set
+# CONFIG_FB_CFB_COPYAREA is not set
+# CONFIG_FB_CFB_IMAGEBLIT is not set
+# 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 +663,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/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 21cecfc..25d7050 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -17,6 +17,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/nand.h>
 #include <linux/i2c/pca953x.h>
+#include <linux/delay.h>

 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -66,6 +67,39 @@ static unsigned long common_pin_config[] __initdata = {
 	/* UART1 */
 	GPIO107_UART1_RXD,
 	GPIO108_UART1_TXD,
+
+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO56_LCD_FCLK_RD,
+	GPIO57_LCD_LCLK_A0,
+	GPIO58_LCD_PCLK_WR,
+	GPIO59_LCD_DENA_BIAS,
+	GPIO60_LCD_DD0,
+	GPIO61_LCD_DD1,
+	GPIO62_LCD_DD2,
+	GPIO63_LCD_DD3,
+	GPIO64_LCD_DD4,
+	GPIO65_LCD_DD5,
+	GPIO66_LCD_DD6,
+	GPIO67_LCD_DD7,
+	GPIO68_LCD_DD8,
+	GPIO69_LCD_DD9,
+	GPIO70_LCD_DD10,
+	GPIO71_LCD_DD11,
+	GPIO72_LCD_DD12,
+	GPIO73_LCD_DD13,
+	GPIO74_LCD_DD14,
+	GPIO75_LCD_DD15,
+
+	GPIO76_LCD_DD16,
+	GPIO77_LCD_DD17,
+	GPIO78_LCD_DD18,
+	GPIO79_LCD_DD19,
+	GPIO80_LCD_DD20,
+	GPIO81_LCD_DD21,
+	GPIO82_LCD_DD22,
+	GPIO83_LCD_DD23,
+#endif
 };

 static struct smc91x_platdata smc91x_info = {
@@ -95,6 +129,105 @@ static struct platform_device smc91x_device = {
 	.resource	= smc91x_resources,
 };

+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x080F,
+	0x0C5F,
+	0x1017,
+	0x1420,
+	0x1808,
+	0x1c20,
+	0x2020,
+	0x2420,
+	0x2820,
+	0x2c20,
+	0x3020,
+	0x3420,
+	0x3810,
+	0x3c10,
+	0x4010,
+	0x4415,
+	0x48aa,
+	0x4cff,
+	0x5086,
+	0x548d,
+	0x58d4,
+	0x5cfb,
+	0x602e,
+	0x645a,
+	0x6889,
+	0x6cfe,
+	0x705a,
+	0x749b,
+	0x78c5,
+	0x7cff,
+	0x80f0,
+	0x84f0,
+	0x8808,
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x0c5e,		/* standby */
+};
+
+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 err;
+			}
+			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, 1);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
+				ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 1);
+}
+
+static struct fb_videomode video_modes_aspen[] = {
+	[0] = {
+		.pixclock       = 30120,
+		.refresh        = 60,
+		.xres           = 800,
+		.yres           = 480,
+		.hsync_len      = 1,
+		.left_margin    = 215,
+		.right_margin   = 40,
+		.vsync_len      = 1,
+		.upper_margin   = 34,
+		.lower_margin   = 10,
+		.sync           = 0,
+	},
+};
+
+struct pxa168fb_mach_info aspenite_lcd_info __initdata = {
+	.id                     = "Base-aspen",
+	.modes                  = video_modes_aspen,
+	.num_modes              = ARRAY_SIZE(video_modes_aspen),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_24,
+	.dumb_mode              = DUMB_MODE_RGB888,
+	.active                 = 1,
+	.spi_ctrl		= CFG_SCLKCNT(2) | CFG_TXBITS(16) |
+		CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs		= GPIO_EXT1(14),
+	.spi_gpio_reset         = -1,
+	.invert_pixclock	= 1,
+	.pxa168fb_lcd_power     = tpo_lcd_power,
+};
+
+#endif
+
 #if defined(CONFIG_MTD_NAND) || defined(CONFIG_MTD_NAND_MODULE)
 static struct mtd_partition apn_nand_partitions[] = {
 	{
@@ -184,6 +317,9 @@ static void __init common_init(void)

 	/* on-chip devices */
 	pxa168_add_uart(1);
+#ifdef CONFIG_FB_PXA168
+	pxa168_add_fb(&aspenite_lcd_info);
+#endif

 	apn_init_nand();
 	pxa168_add_twsi(0, &pwri2c_info,
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h
b/arch/arm/mach-mmp/include/mach/pxa168.h
index d117ceb..d43fb13 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.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 pxa168_device_uart1;
 extern struct pxa_device_desc pxa168_device_uart2;
@@ -14,6 +15,7 @@ extern struct pxa_device_desc pxa168_device_pwm2;
 extern struct pxa_device_desc pxa168_device_pwm3;
 extern struct pxa_device_desc pxa168_device_pwm4;
 extern struct pxa_device_desc pxa168_device_nand;
+extern struct pxa_device_desc pxa168_device_fb;

 static inline int pxa168_add_uart(int id)
 {
@@ -65,4 +67,10 @@ static inline int pxa168_add_pwm(int id)

 	return pxa_register_device(d, NULL, 0);
 }
+
+static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
+}
+
 #endif /* __ASM_MACH_PXA168_H */
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 59b393e..8be1e46 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -74,6 +74,7 @@ static APBC_CLK(pwm3, PXA168_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA168_PWM4, 1, 13000000);

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

 /* device and clock bindings */
 static struct clk_lookup pxa168_clkregs[] = {
@@ -86,6 +87,7 @@ static struct clk_lookup pxa168_clkregs[] = {
 	INIT_CLKREG(&clk_pwm2, "pxa168-pwm.1", NULL),
 	INIT_CLKREG(&clk_pwm3, "pxa168-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa168-pwm.3", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa168-fb", "LCDCLK"),
 };

 static int __init pxa168_init(void)
@@ -132,3 +134,4 @@ PXA168_DEVICE(pwm2, "pxa168-pwm", 1, NONE,
0xd401a400, 0x10);
 PXA168_DEVICE(pwm3, "pxa168-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA168_DEVICE(pwm4, "pxa168-pwm", 3, NONE, 0xd401ac00, 0x10);
 PXA168_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x200, 97, 99);
+PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
-- 
1.5.4.3

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

* [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
@ 2009-11-16  9:34   ` Jun Nie
  0 siblings, 0 replies; 18+ messages in thread
From: Jun Nie @ 2009-11-16  9:34 UTC (permalink / raw)
  To: linux-arm-kernel

From: Jun Nie <njun@marvell.com>
Date: Fri, 13 Nov 2009 15:12:19 +0800
Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa168_defconfig       |   86 +++++++++++++++++++-
 arch/arm/mach-mmp/aspenite.c            |  136 +++++++++++++++++++++++++++++++
 arch/arm/mach-mmp/include/mach/pxa168.h |    8 ++
 arch/arm/mach-mmp/pxa168.c              |    3 +
 4 files changed, 231 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/pxa168_defconfig
b/arch/arm/configs/pxa168_defconfig
index db5faea..b736517 100644
--- a/arch/arm/configs/pxa168_defconfig
+++ b/arch/arm/configs/pxa168_defconfig
@@ -509,7 +509,49 @@ CONFIG_UNIX98_PTYS=y
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
-# CONFIG_I2C is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_CHARDEV is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE is not set
+CONFIG_I2C_GPIO=y
+# CONFIG_I2C_OCORES is not set
+CONFIG_I2C_PXA=y
+# CONFIG_I2C_PXA_SLAVE is not set
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_PCF8575 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
 # CONFIG_SPI is not set
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_GPIOLIB=y
@@ -523,6 +565,9 @@ CONFIG_GPIOLIB=y
 #
 # I2C GPIO expanders:
 #
+# CONFIG_GPIO_MAX732X is not set
+CONFIG_GPIO_PCA953X=y
+# CONFIG_GPIO_PCF857X is not set

 #
 # PCI GPIO expanders:
@@ -578,7 +623,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 is not set
+# CONFIG_FB_CFB_COPYAREA is not set
+# CONFIG_FB_CFB_IMAGEBLIT is not set
+# 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 +663,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/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 21cecfc..25d7050 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -17,6 +17,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/nand.h>
 #include <linux/i2c/pca953x.h>
+#include <linux/delay.h>

 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -66,6 +67,39 @@ static unsigned long common_pin_config[] __initdata = {
 	/* UART1 */
 	GPIO107_UART1_RXD,
 	GPIO108_UART1_TXD,
+
+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO56_LCD_FCLK_RD,
+	GPIO57_LCD_LCLK_A0,
+	GPIO58_LCD_PCLK_WR,
+	GPIO59_LCD_DENA_BIAS,
+	GPIO60_LCD_DD0,
+	GPIO61_LCD_DD1,
+	GPIO62_LCD_DD2,
+	GPIO63_LCD_DD3,
+	GPIO64_LCD_DD4,
+	GPIO65_LCD_DD5,
+	GPIO66_LCD_DD6,
+	GPIO67_LCD_DD7,
+	GPIO68_LCD_DD8,
+	GPIO69_LCD_DD9,
+	GPIO70_LCD_DD10,
+	GPIO71_LCD_DD11,
+	GPIO72_LCD_DD12,
+	GPIO73_LCD_DD13,
+	GPIO74_LCD_DD14,
+	GPIO75_LCD_DD15,
+
+	GPIO76_LCD_DD16,
+	GPIO77_LCD_DD17,
+	GPIO78_LCD_DD18,
+	GPIO79_LCD_DD19,
+	GPIO80_LCD_DD20,
+	GPIO81_LCD_DD21,
+	GPIO82_LCD_DD22,
+	GPIO83_LCD_DD23,
+#endif
 };

 static struct smc91x_platdata smc91x_info = {
@@ -95,6 +129,105 @@ static struct platform_device smc91x_device = {
 	.resource	= smc91x_resources,
 };

+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x080F,
+	0x0C5F,
+	0x1017,
+	0x1420,
+	0x1808,
+	0x1c20,
+	0x2020,
+	0x2420,
+	0x2820,
+	0x2c20,
+	0x3020,
+	0x3420,
+	0x3810,
+	0x3c10,
+	0x4010,
+	0x4415,
+	0x48aa,
+	0x4cff,
+	0x5086,
+	0x548d,
+	0x58d4,
+	0x5cfb,
+	0x602e,
+	0x645a,
+	0x6889,
+	0x6cfe,
+	0x705a,
+	0x749b,
+	0x78c5,
+	0x7cff,
+	0x80f0,
+	0x84f0,
+	0x8808,
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x0c5e,		/* standby */
+};
+
+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 err;
+			}
+			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, 1);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
+				ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 1);
+}
+
+static struct fb_videomode video_modes_aspen[] = {
+	[0] = {
+		.pixclock       = 30120,
+		.refresh        = 60,
+		.xres           = 800,
+		.yres           = 480,
+		.hsync_len      = 1,
+		.left_margin    = 215,
+		.right_margin   = 40,
+		.vsync_len      = 1,
+		.upper_margin   = 34,
+		.lower_margin   = 10,
+		.sync           = 0,
+	},
+};
+
+struct pxa168fb_mach_info aspenite_lcd_info __initdata = {
+	.id                     = "Base-aspen",
+	.modes                  = video_modes_aspen,
+	.num_modes              = ARRAY_SIZE(video_modes_aspen),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_24,
+	.dumb_mode              = DUMB_MODE_RGB888,
+	.active                 = 1,
+	.spi_ctrl		= CFG_SCLKCNT(2) | CFG_TXBITS(16) |
+		CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs		= GPIO_EXT1(14),
+	.spi_gpio_reset         = -1,
+	.invert_pixclock	= 1,
+	.pxa168fb_lcd_power     = tpo_lcd_power,
+};
+
+#endif
+
 #if defined(CONFIG_MTD_NAND) || defined(CONFIG_MTD_NAND_MODULE)
 static struct mtd_partition apn_nand_partitions[] = {
 	{
@@ -184,6 +317,9 @@ static void __init common_init(void)

 	/* on-chip devices */
 	pxa168_add_uart(1);
+#ifdef CONFIG_FB_PXA168
+	pxa168_add_fb(&aspenite_lcd_info);
+#endif

 	apn_init_nand();
 	pxa168_add_twsi(0, &pwri2c_info,
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h
b/arch/arm/mach-mmp/include/mach/pxa168.h
index d117ceb..d43fb13 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.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 pxa168_device_uart1;
 extern struct pxa_device_desc pxa168_device_uart2;
@@ -14,6 +15,7 @@ extern struct pxa_device_desc pxa168_device_pwm2;
 extern struct pxa_device_desc pxa168_device_pwm3;
 extern struct pxa_device_desc pxa168_device_pwm4;
 extern struct pxa_device_desc pxa168_device_nand;
+extern struct pxa_device_desc pxa168_device_fb;

 static inline int pxa168_add_uart(int id)
 {
@@ -65,4 +67,10 @@ static inline int pxa168_add_pwm(int id)

 	return pxa_register_device(d, NULL, 0);
 }
+
+static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
+}
+
 #endif /* __ASM_MACH_PXA168_H */
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 59b393e..8be1e46 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -74,6 +74,7 @@ static APBC_CLK(pwm3, PXA168_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA168_PWM4, 1, 13000000);

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

 /* device and clock bindings */
 static struct clk_lookup pxa168_clkregs[] = {
@@ -86,6 +87,7 @@ static struct clk_lookup pxa168_clkregs[] = {
 	INIT_CLKREG(&clk_pwm2, "pxa168-pwm.1", NULL),
 	INIT_CLKREG(&clk_pwm3, "pxa168-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa168-pwm.3", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa168-fb", "LCDCLK"),
 };

 static int __init pxa168_init(void)
@@ -132,3 +134,4 @@ PXA168_DEVICE(pwm2, "pxa168-pwm", 1, NONE,
0xd401a400, 0x10);
 PXA168_DEVICE(pwm3, "pxa168-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA168_DEVICE(pwm4, "pxa168-pwm", 3, NONE, 0xd401ac00, 0x10);
 PXA168_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x200, 97, 99);
+PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
-- 
1.5.4.3

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

* Re: [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
  2009-11-16  9:34   ` Jun Nie
@ 2009-11-17  6:29     ` Eric Miao
  -1 siblings, 0 replies; 18+ messages in thread
From: Eric Miao @ 2009-11-17  6:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 16, 2009 at 3:34 AM, Jun Nie <niej0001@gmail.com> wrote:
> From: Jun Nie <njun@marvell.com>
> Date: Fri, 13 Nov 2009 15:12:19 +0800
> Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform
>
> Signed-off-by: Jun Nie <njun@marvell.com>

Hi Jun,

All previous patches have been merged in 'topic/pxa168fb' branch for
testing purpose, and I'm having difficulties to merge these two. Could
you take a look into my tree and rebase these two?

Note - you need only reply these two mails instead of submitting
another set of patches, and do remember to attach the patch esp.
since you are using gmail web interface, which is going to mal-form
the patch.

Thanks.
- eric

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

* [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
@ 2009-11-17  6:29     ` Eric Miao
  0 siblings, 0 replies; 18+ messages in thread
From: Eric Miao @ 2009-11-17  6:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 16, 2009 at 3:34 AM, Jun Nie <niej0001@gmail.com> wrote:
> From: Jun Nie <njun@marvell.com>
> Date: Fri, 13 Nov 2009 15:12:19 +0800
> Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform
>
> Signed-off-by: Jun Nie <njun@marvell.com>

Hi Jun,

All previous patches have been merged in 'topic/pxa168fb' branch for
testing purpose, and I'm having difficulties to merge these two. Could
you take a look into my tree and rebase these two?

Note - you need only reply these two mails instead of submitting
another set of patches, and do remember to attach the patch esp.
since you are using gmail web interface, which is going to mal-form
the patch.

Thanks.
- eric

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

* Re: [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
  2009-11-17  6:29     ` Eric Miao
@ 2009-11-19  9:03       ` Jun Nie
  -1 siblings, 0 replies; 18+ messages in thread
From: Jun Nie @ 2009-11-19  9:03 UTC (permalink / raw)
  To: linux-arm-kernel

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

2009/11/17 Eric Miao <eric.y.miao@gmail.com>:
> On Mon, Nov 16, 2009 at 3:34 AM, Jun Nie <niej0001@gmail.com> wrote:
>> From: Jun Nie <njun@marvell.com>
>> Date: Fri, 13 Nov 2009 15:12:19 +0800
>> Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform
>>
>> Signed-off-by: Jun Nie <njun@marvell.com>
>
> Hi Jun,
>
> All previous patches have been merged in 'topic/pxa168fb' branch for
> testing purpose, and I'm having difficulties to merge these two. Could
> you take a look into my tree and rebase these two?
>
> Note - you need only reply these two mails instead of submitting
> another set of patches, and do remember to attach the patch esp.
> since you are using gmail web interface, which is going to mal-form
> the patch.
>
> Thanks.
> - eric
>

rebased
From: Jun Nie <njun@marvell.com>
Date: Tue, 17 Nov 2009 20:39:43 +0800
Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa168_defconfig       |   86 +++++++++++++++++++-
 arch/arm/mach-mmp/aspenite.c            |  136 +++++++++++++++++++++++++++++++
 arch/arm/mach-mmp/include/mach/pxa168.h |    8 ++
 arch/arm/mach-mmp/pxa168.c              |    4 +
 4 files changed, 232 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/pxa168_defconfig
b/arch/arm/configs/pxa168_defconfig
index db5faea..b736517 100644
--- a/arch/arm/configs/pxa168_defconfig
+++ b/arch/arm/configs/pxa168_defconfig
@@ -509,7 +509,49 @@ CONFIG_UNIX98_PTYS=y
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
-# CONFIG_I2C is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_CHARDEV is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE is not set
+CONFIG_I2C_GPIO=y
+# CONFIG_I2C_OCORES is not set
+CONFIG_I2C_PXA=y
+# CONFIG_I2C_PXA_SLAVE is not set
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_PCF8575 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
 # CONFIG_SPI is not set
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_GPIOLIB=y
@@ -523,6 +565,9 @@ CONFIG_GPIOLIB=y
 #
 # I2C GPIO expanders:
 #
+# CONFIG_GPIO_MAX732X is not set
+CONFIG_GPIO_PCA953X=y
+# CONFIG_GPIO_PCF857X is not set

 #
 # PCI GPIO expanders:
@@ -578,7 +623,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 is not set
+# CONFIG_FB_CFB_COPYAREA is not set
+# CONFIG_FB_CFB_IMAGEBLIT is not set
+# 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 +663,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/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index d1d4a0d..3bfe568 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -14,6 +14,7 @@
 #include <linux/platform_device.h>
 #include <linux/smc91x.h>
 #include <linux/i2c/pca953x.h>
+#include <linux/delay.h>

 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -61,6 +62,39 @@ static unsigned long common_pin_config[] __initdata = {
 	/* UART1 */
 	GPIO107_UART1_RXD,
 	GPIO108_UART1_TXD,
+
+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO56_LCD_FCLK_RD,
+	GPIO57_LCD_LCLK_A0,
+	GPIO58_LCD_PCLK_WR,
+	GPIO59_LCD_DENA_BIAS,
+	GPIO60_LCD_DD0,
+	GPIO61_LCD_DD1,
+	GPIO62_LCD_DD2,
+	GPIO63_LCD_DD3,
+	GPIO64_LCD_DD4,
+	GPIO65_LCD_DD5,
+	GPIO66_LCD_DD6,
+	GPIO67_LCD_DD7,
+	GPIO68_LCD_DD8,
+	GPIO69_LCD_DD9,
+	GPIO70_LCD_DD10,
+	GPIO71_LCD_DD11,
+	GPIO72_LCD_DD12,
+	GPIO73_LCD_DD13,
+	GPIO74_LCD_DD14,
+	GPIO75_LCD_DD15,
+
+	GPIO76_LCD_DD16,
+	GPIO77_LCD_DD17,
+	GPIO78_LCD_DD18,
+	GPIO79_LCD_DD19,
+	GPIO80_LCD_DD20,
+	GPIO81_LCD_DD21,
+	GPIO82_LCD_DD22,
+	GPIO83_LCD_DD23,
+#endif
 };

 static struct smc91x_platdata smc91x_info = {
@@ -90,6 +124,105 @@ static struct platform_device smc91x_device = {
 	.resource	= smc91x_resources,
 };

+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x080F,
+	0x0C5F,
+	0x1017,
+	0x1420,
+	0x1808,
+	0x1c20,
+	0x2020,
+	0x2420,
+	0x2820,
+	0x2c20,
+	0x3020,
+	0x3420,
+	0x3810,
+	0x3c10,
+	0x4010,
+	0x4415,
+	0x48aa,
+	0x4cff,
+	0x5086,
+	0x548d,
+	0x58d4,
+	0x5cfb,
+	0x602e,
+	0x645a,
+	0x6889,
+	0x6cfe,
+	0x705a,
+	0x749b,
+	0x78c5,
+	0x7cff,
+	0x80f0,
+	0x84f0,
+	0x8808,
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x0c5e,		/* standby */
+};
+
+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 err;
+			}
+			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, 1);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
+				ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 1);
+}
+
+static struct fb_videomode video_modes_aspen[] = {
+	[0] = {
+		.pixclock       = 30120,
+		.refresh        = 60,
+		.xres           = 800,
+		.yres           = 480,
+		.hsync_len      = 1,
+		.left_margin    = 215,
+		.right_margin   = 40,
+		.vsync_len      = 1,
+		.upper_margin   = 34,
+		.lower_margin   = 10,
+		.sync           = 0,
+	},
+};
+
+struct pxa168fb_mach_info aspenite_lcd_info __initdata = {
+	.id                     = "Base-aspen",
+	.modes                  = video_modes_aspen,
+	.num_modes              = ARRAY_SIZE(video_modes_aspen),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_24,
+	.dumb_mode              = DUMB_MODE_RGB888,
+	.active                 = 1,
+	.spi_ctrl		= CFG_SCLKCNT(2) | CFG_TXBITS(16) |
+		CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs		= GPIO_EXT1(14),
+	.spi_gpio_reset         = -1,
+	.invert_pixclock	= 1,
+	.pxa168fb_lcd_power     = tpo_lcd_power,
+};
+
+#endif
+
 static struct i2c_pxa_platform_data pwri2c_info __initdata = {
 	.use_pio		= 0,
 };
@@ -136,6 +269,9 @@ static void __init common_init(void)
 	pxa168_add_uart(1);
 	pxa168_add_twsi(0, &pwri2c_info,
 			ARRAY_AND_SIZE(aspenite_i2c_board_info));
+#ifdef CONFIG_FB_PXA168
+	pxa168_add_fb(&aspenite_lcd_info);
+#endif

 	/* off-chip devices */
 	platform_device_register(&smc91x_device);
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h
b/arch/arm/mach-mmp/include/mach/pxa168.h
index 6bf1f0e..a2ca47b 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.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 pxa168_device_uart1;
 extern struct pxa_device_desc pxa168_device_uart2;
@@ -13,6 +14,7 @@ extern struct pxa_device_desc pxa168_device_pwm1;
 extern struct pxa_device_desc pxa168_device_pwm2;
 extern struct pxa_device_desc pxa168_device_pwm3;
 extern struct pxa_device_desc pxa168_device_pwm4;
+extern struct pxa_device_desc pxa168_device_fb;

 static inline int pxa168_add_uart(int id)
 {
@@ -64,4 +66,10 @@ static inline int pxa168_add_pwm(int id)

 	return pxa_register_device(d, NULL, 0);
 }
+
+static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
+}
+
 #endif /* __ASM_MACH_PXA168_H */
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 71b1ae3..07a12ce 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -19,6 +19,7 @@
 #include <mach/addr-map.h>
 #include <mach/cputype.h>
 #include <mach/regs-apbc.h>
+#include <mach/regs-apmu.h>
 #include <mach/irqs.h>
 #include <mach/gpio.h>
 #include <mach/dma.h>
@@ -71,6 +72,7 @@ static APBC_CLK(pwm1, PXA168_PWM1, 1, 13000000);
 static APBC_CLK(pwm2, PXA168_PWM2, 1, 13000000);
 static APBC_CLK(pwm3, PXA168_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA168_PWM4, 1, 13000000);
+static APMU_CLK(lcd, LCD, 0x003f, 312000000);

 /* device and clock bindings */
 static struct clk_lookup pxa168_clkregs[] = {
@@ -82,6 +84,7 @@ static struct clk_lookup pxa168_clkregs[] = {
 	INIT_CLKREG(&clk_pwm2, "pxa168-pwm.1", NULL),
 	INIT_CLKREG(&clk_pwm3, "pxa168-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa168-pwm.3", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa168-fb", "LCDCLK"),
 };

 static int __init pxa168_init(void)
@@ -127,3 +130,4 @@ PXA168_DEVICE(pwm1, "pxa168-pwm", 0, NONE,
0xd401a000, 0x10);
 PXA168_DEVICE(pwm2, "pxa168-pwm", 1, NONE, 0xd401a400, 0x10);
 PXA168_DEVICE(pwm3, "pxa168-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA168_DEVICE(pwm4, "pxa168-pwm", 3, NONE, 0xd401ac00, 0x10);
+PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
-- 
1.5.4.3

[-- Attachment #2: 0007-pxa-add-frame-buffer-on-pxa168-aspenite-platform.patch --]
[-- Type: text/x-diff, Size: 9834 bytes --]

From a7992d0471895b4baf54236a909700b754f222ad Mon Sep 17 00:00:00 2001
From: Jun Nie <njun@marvell.com>
Date: Tue, 17 Nov 2009 20:39:43 +0800
Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa168_defconfig       |   86 +++++++++++++++++++-
 arch/arm/mach-mmp/aspenite.c            |  136 +++++++++++++++++++++++++++++++
 arch/arm/mach-mmp/include/mach/pxa168.h |    8 ++
 arch/arm/mach-mmp/pxa168.c              |    4 +
 4 files changed, 232 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/pxa168_defconfig b/arch/arm/configs/pxa168_defconfig
index db5faea..b736517 100644
--- a/arch/arm/configs/pxa168_defconfig
+++ b/arch/arm/configs/pxa168_defconfig
@@ -509,7 +509,49 @@ CONFIG_UNIX98_PTYS=y
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
-# CONFIG_I2C is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_CHARDEV is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE is not set
+CONFIG_I2C_GPIO=y
+# CONFIG_I2C_OCORES is not set
+CONFIG_I2C_PXA=y
+# CONFIG_I2C_PXA_SLAVE is not set
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_PCF8575 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
 # CONFIG_SPI is not set
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_GPIOLIB=y
@@ -523,6 +565,9 @@ CONFIG_GPIOLIB=y
 #
 # I2C GPIO expanders:
 #
+# CONFIG_GPIO_MAX732X is not set
+CONFIG_GPIO_PCA953X=y
+# CONFIG_GPIO_PCF857X is not set
 
 #
 # PCI GPIO expanders:
@@ -578,7 +623,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 is not set
+# CONFIG_FB_CFB_COPYAREA is not set
+# CONFIG_FB_CFB_IMAGEBLIT is not set
+# 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 +663,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/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index d1d4a0d..3bfe568 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -14,6 +14,7 @@
 #include <linux/platform_device.h>
 #include <linux/smc91x.h>
 #include <linux/i2c/pca953x.h>
+#include <linux/delay.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -61,6 +62,39 @@ static unsigned long common_pin_config[] __initdata = {
 	/* UART1 */
 	GPIO107_UART1_RXD,
 	GPIO108_UART1_TXD,
+
+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO56_LCD_FCLK_RD,
+	GPIO57_LCD_LCLK_A0,
+	GPIO58_LCD_PCLK_WR,
+	GPIO59_LCD_DENA_BIAS,
+	GPIO60_LCD_DD0,
+	GPIO61_LCD_DD1,
+	GPIO62_LCD_DD2,
+	GPIO63_LCD_DD3,
+	GPIO64_LCD_DD4,
+	GPIO65_LCD_DD5,
+	GPIO66_LCD_DD6,
+	GPIO67_LCD_DD7,
+	GPIO68_LCD_DD8,
+	GPIO69_LCD_DD9,
+	GPIO70_LCD_DD10,
+	GPIO71_LCD_DD11,
+	GPIO72_LCD_DD12,
+	GPIO73_LCD_DD13,
+	GPIO74_LCD_DD14,
+	GPIO75_LCD_DD15,
+
+	GPIO76_LCD_DD16,
+	GPIO77_LCD_DD17,
+	GPIO78_LCD_DD18,
+	GPIO79_LCD_DD19,
+	GPIO80_LCD_DD20,
+	GPIO81_LCD_DD21,
+	GPIO82_LCD_DD22,
+	GPIO83_LCD_DD23,
+#endif
 };
 
 static struct smc91x_platdata smc91x_info = {
@@ -90,6 +124,105 @@ static struct platform_device smc91x_device = {
 	.resource	= smc91x_resources,
 };
 
+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x080F,
+	0x0C5F,
+	0x1017,
+	0x1420,
+	0x1808,
+	0x1c20,
+	0x2020,
+	0x2420,
+	0x2820,
+	0x2c20,
+	0x3020,
+	0x3420,
+	0x3810,
+	0x3c10,
+	0x4010,
+	0x4415,
+	0x48aa,
+	0x4cff,
+	0x5086,
+	0x548d,
+	0x58d4,
+	0x5cfb,
+	0x602e,
+	0x645a,
+	0x6889,
+	0x6cfe,
+	0x705a,
+	0x749b,
+	0x78c5,
+	0x7cff,
+	0x80f0,
+	0x84f0,
+	0x8808,
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x0c5e,		/* standby */
+};
+
+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 err;
+			}
+			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, 1);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
+				ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 1);
+}
+
+static struct fb_videomode video_modes_aspen[] = {
+	[0] = {
+		.pixclock       = 30120,
+		.refresh        = 60,
+		.xres           = 800,
+		.yres           = 480,
+		.hsync_len      = 1,
+		.left_margin    = 215,
+		.right_margin   = 40,
+		.vsync_len      = 1,
+		.upper_margin   = 34,
+		.lower_margin   = 10,
+		.sync           = 0,
+	},
+};
+
+struct pxa168fb_mach_info aspenite_lcd_info __initdata = {
+	.id                     = "Base-aspen",
+	.modes                  = video_modes_aspen,
+	.num_modes              = ARRAY_SIZE(video_modes_aspen),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_24,
+	.dumb_mode              = DUMB_MODE_RGB888,
+	.active                 = 1,
+	.spi_ctrl		= CFG_SCLKCNT(2) | CFG_TXBITS(16) |
+		CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs		= GPIO_EXT1(14),
+	.spi_gpio_reset         = -1,
+	.invert_pixclock	= 1,
+	.pxa168fb_lcd_power     = tpo_lcd_power,
+};
+
+#endif
+
 static struct i2c_pxa_platform_data pwri2c_info __initdata = {
 	.use_pio		= 0,
 };
@@ -136,6 +269,9 @@ static void __init common_init(void)
 	pxa168_add_uart(1);
 	pxa168_add_twsi(0, &pwri2c_info,
 			ARRAY_AND_SIZE(aspenite_i2c_board_info));
+#ifdef CONFIG_FB_PXA168
+	pxa168_add_fb(&aspenite_lcd_info);
+#endif
 
 	/* off-chip devices */
 	platform_device_register(&smc91x_device);
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h b/arch/arm/mach-mmp/include/mach/pxa168.h
index 6bf1f0e..a2ca47b 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.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 pxa168_device_uart1;
 extern struct pxa_device_desc pxa168_device_uart2;
@@ -13,6 +14,7 @@ extern struct pxa_device_desc pxa168_device_pwm1;
 extern struct pxa_device_desc pxa168_device_pwm2;
 extern struct pxa_device_desc pxa168_device_pwm3;
 extern struct pxa_device_desc pxa168_device_pwm4;
+extern struct pxa_device_desc pxa168_device_fb;
 
 static inline int pxa168_add_uart(int id)
 {
@@ -64,4 +66,10 @@ static inline int pxa168_add_pwm(int id)
 
 	return pxa_register_device(d, NULL, 0);
 }
+
+static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
+}
+
 #endif /* __ASM_MACH_PXA168_H */
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 71b1ae3..07a12ce 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -19,6 +19,7 @@
 #include <mach/addr-map.h>
 #include <mach/cputype.h>
 #include <mach/regs-apbc.h>
+#include <mach/regs-apmu.h>
 #include <mach/irqs.h>
 #include <mach/gpio.h>
 #include <mach/dma.h>
@@ -71,6 +72,7 @@ static APBC_CLK(pwm1, PXA168_PWM1, 1, 13000000);
 static APBC_CLK(pwm2, PXA168_PWM2, 1, 13000000);
 static APBC_CLK(pwm3, PXA168_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA168_PWM4, 1, 13000000);
+static APMU_CLK(lcd, LCD, 0x003f, 312000000);
 
 /* device and clock bindings */
 static struct clk_lookup pxa168_clkregs[] = {
@@ -82,6 +84,7 @@ static struct clk_lookup pxa168_clkregs[] = {
 	INIT_CLKREG(&clk_pwm2, "pxa168-pwm.1", NULL),
 	INIT_CLKREG(&clk_pwm3, "pxa168-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa168-pwm.3", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa168-fb", "LCDCLK"),
 };
 
 static int __init pxa168_init(void)
@@ -127,3 +130,4 @@ PXA168_DEVICE(pwm1, "pxa168-pwm", 0, NONE, 0xd401a000, 0x10);
 PXA168_DEVICE(pwm2, "pxa168-pwm", 1, NONE, 0xd401a400, 0x10);
 PXA168_DEVICE(pwm3, "pxa168-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA168_DEVICE(pwm4, "pxa168-pwm", 3, NONE, 0xd401ac00, 0x10);
+PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
-- 
1.5.4.3


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

* [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
@ 2009-11-19  9:03       ` Jun Nie
  0 siblings, 0 replies; 18+ messages in thread
From: Jun Nie @ 2009-11-19  9:03 UTC (permalink / raw)
  To: linux-arm-kernel

2009/11/17 Eric Miao <eric.y.miao@gmail.com>:
> On Mon, Nov 16, 2009 at 3:34 AM, Jun Nie <niej0001@gmail.com> wrote:
>> From: Jun Nie <njun@marvell.com>
>> Date: Fri, 13 Nov 2009 15:12:19 +0800
>> Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform
>>
>> Signed-off-by: Jun Nie <njun@marvell.com>
>
> Hi Jun,
>
> All previous patches have been merged in 'topic/pxa168fb' branch for
> testing purpose, and I'm having difficulties to merge these two. Could
> you take a look into my tree and rebase these two?
>
> Note - you need only reply these two mails instead of submitting
> another set of patches, and do remember to attach the patch esp.
> since you are using gmail web interface, which is going to mal-form
> the patch.
>
> Thanks.
> - eric
>

rebased
From: Jun Nie <njun@marvell.com>
Date: Tue, 17 Nov 2009 20:39:43 +0800
Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa168_defconfig       |   86 +++++++++++++++++++-
 arch/arm/mach-mmp/aspenite.c            |  136 +++++++++++++++++++++++++++++++
 arch/arm/mach-mmp/include/mach/pxa168.h |    8 ++
 arch/arm/mach-mmp/pxa168.c              |    4 +
 4 files changed, 232 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/pxa168_defconfig
b/arch/arm/configs/pxa168_defconfig
index db5faea..b736517 100644
--- a/arch/arm/configs/pxa168_defconfig
+++ b/arch/arm/configs/pxa168_defconfig
@@ -509,7 +509,49 @@ CONFIG_UNIX98_PTYS=y
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
-# CONFIG_I2C is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_CHARDEV is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE is not set
+CONFIG_I2C_GPIO=y
+# CONFIG_I2C_OCORES is not set
+CONFIG_I2C_PXA=y
+# CONFIG_I2C_PXA_SLAVE is not set
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_PCF8575 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
 # CONFIG_SPI is not set
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_GPIOLIB=y
@@ -523,6 +565,9 @@ CONFIG_GPIOLIB=y
 #
 # I2C GPIO expanders:
 #
+# CONFIG_GPIO_MAX732X is not set
+CONFIG_GPIO_PCA953X=y
+# CONFIG_GPIO_PCF857X is not set

 #
 # PCI GPIO expanders:
@@ -578,7 +623,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 is not set
+# CONFIG_FB_CFB_COPYAREA is not set
+# CONFIG_FB_CFB_IMAGEBLIT is not set
+# 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 +663,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/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index d1d4a0d..3bfe568 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -14,6 +14,7 @@
 #include <linux/platform_device.h>
 #include <linux/smc91x.h>
 #include <linux/i2c/pca953x.h>
+#include <linux/delay.h>

 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -61,6 +62,39 @@ static unsigned long common_pin_config[] __initdata = {
 	/* UART1 */
 	GPIO107_UART1_RXD,
 	GPIO108_UART1_TXD,
+
+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO56_LCD_FCLK_RD,
+	GPIO57_LCD_LCLK_A0,
+	GPIO58_LCD_PCLK_WR,
+	GPIO59_LCD_DENA_BIAS,
+	GPIO60_LCD_DD0,
+	GPIO61_LCD_DD1,
+	GPIO62_LCD_DD2,
+	GPIO63_LCD_DD3,
+	GPIO64_LCD_DD4,
+	GPIO65_LCD_DD5,
+	GPIO66_LCD_DD6,
+	GPIO67_LCD_DD7,
+	GPIO68_LCD_DD8,
+	GPIO69_LCD_DD9,
+	GPIO70_LCD_DD10,
+	GPIO71_LCD_DD11,
+	GPIO72_LCD_DD12,
+	GPIO73_LCD_DD13,
+	GPIO74_LCD_DD14,
+	GPIO75_LCD_DD15,
+
+	GPIO76_LCD_DD16,
+	GPIO77_LCD_DD17,
+	GPIO78_LCD_DD18,
+	GPIO79_LCD_DD19,
+	GPIO80_LCD_DD20,
+	GPIO81_LCD_DD21,
+	GPIO82_LCD_DD22,
+	GPIO83_LCD_DD23,
+#endif
 };

 static struct smc91x_platdata smc91x_info = {
@@ -90,6 +124,105 @@ static struct platform_device smc91x_device = {
 	.resource	= smc91x_resources,
 };

+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x080F,
+	0x0C5F,
+	0x1017,
+	0x1420,
+	0x1808,
+	0x1c20,
+	0x2020,
+	0x2420,
+	0x2820,
+	0x2c20,
+	0x3020,
+	0x3420,
+	0x3810,
+	0x3c10,
+	0x4010,
+	0x4415,
+	0x48aa,
+	0x4cff,
+	0x5086,
+	0x548d,
+	0x58d4,
+	0x5cfb,
+	0x602e,
+	0x645a,
+	0x6889,
+	0x6cfe,
+	0x705a,
+	0x749b,
+	0x78c5,
+	0x7cff,
+	0x80f0,
+	0x84f0,
+	0x8808,
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x0c5e,		/* standby */
+};
+
+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 err;
+			}
+			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, 1);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
+				ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 1);
+}
+
+static struct fb_videomode video_modes_aspen[] = {
+	[0] = {
+		.pixclock       = 30120,
+		.refresh        = 60,
+		.xres           = 800,
+		.yres           = 480,
+		.hsync_len      = 1,
+		.left_margin    = 215,
+		.right_margin   = 40,
+		.vsync_len      = 1,
+		.upper_margin   = 34,
+		.lower_margin   = 10,
+		.sync           = 0,
+	},
+};
+
+struct pxa168fb_mach_info aspenite_lcd_info __initdata = {
+	.id                     = "Base-aspen",
+	.modes                  = video_modes_aspen,
+	.num_modes              = ARRAY_SIZE(video_modes_aspen),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_24,
+	.dumb_mode              = DUMB_MODE_RGB888,
+	.active                 = 1,
+	.spi_ctrl		= CFG_SCLKCNT(2) | CFG_TXBITS(16) |
+		CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs		= GPIO_EXT1(14),
+	.spi_gpio_reset         = -1,
+	.invert_pixclock	= 1,
+	.pxa168fb_lcd_power     = tpo_lcd_power,
+};
+
+#endif
+
 static struct i2c_pxa_platform_data pwri2c_info __initdata = {
 	.use_pio		= 0,
 };
@@ -136,6 +269,9 @@ static void __init common_init(void)
 	pxa168_add_uart(1);
 	pxa168_add_twsi(0, &pwri2c_info,
 			ARRAY_AND_SIZE(aspenite_i2c_board_info));
+#ifdef CONFIG_FB_PXA168
+	pxa168_add_fb(&aspenite_lcd_info);
+#endif

 	/* off-chip devices */
 	platform_device_register(&smc91x_device);
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h
b/arch/arm/mach-mmp/include/mach/pxa168.h
index 6bf1f0e..a2ca47b 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.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 pxa168_device_uart1;
 extern struct pxa_device_desc pxa168_device_uart2;
@@ -13,6 +14,7 @@ extern struct pxa_device_desc pxa168_device_pwm1;
 extern struct pxa_device_desc pxa168_device_pwm2;
 extern struct pxa_device_desc pxa168_device_pwm3;
 extern struct pxa_device_desc pxa168_device_pwm4;
+extern struct pxa_device_desc pxa168_device_fb;

 static inline int pxa168_add_uart(int id)
 {
@@ -64,4 +66,10 @@ static inline int pxa168_add_pwm(int id)

 	return pxa_register_device(d, NULL, 0);
 }
+
+static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
+}
+
 #endif /* __ASM_MACH_PXA168_H */
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 71b1ae3..07a12ce 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -19,6 +19,7 @@
 #include <mach/addr-map.h>
 #include <mach/cputype.h>
 #include <mach/regs-apbc.h>
+#include <mach/regs-apmu.h>
 #include <mach/irqs.h>
 #include <mach/gpio.h>
 #include <mach/dma.h>
@@ -71,6 +72,7 @@ static APBC_CLK(pwm1, PXA168_PWM1, 1, 13000000);
 static APBC_CLK(pwm2, PXA168_PWM2, 1, 13000000);
 static APBC_CLK(pwm3, PXA168_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA168_PWM4, 1, 13000000);
+static APMU_CLK(lcd, LCD, 0x003f, 312000000);

 /* device and clock bindings */
 static struct clk_lookup pxa168_clkregs[] = {
@@ -82,6 +84,7 @@ static struct clk_lookup pxa168_clkregs[] = {
 	INIT_CLKREG(&clk_pwm2, "pxa168-pwm.1", NULL),
 	INIT_CLKREG(&clk_pwm3, "pxa168-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa168-pwm.3", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa168-fb", "LCDCLK"),
 };

 static int __init pxa168_init(void)
@@ -127,3 +130,4 @@ PXA168_DEVICE(pwm1, "pxa168-pwm", 0, NONE,
0xd401a000, 0x10);
 PXA168_DEVICE(pwm2, "pxa168-pwm", 1, NONE, 0xd401a400, 0x10);
 PXA168_DEVICE(pwm3, "pxa168-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA168_DEVICE(pwm4, "pxa168-pwm", 3, NONE, 0xd401ac00, 0x10);
+PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
-- 
1.5.4.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-pxa-add-frame-buffer-on-pxa168-aspenite-platform.patch
Type: text/x-diff
Size: 9833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091119/f7127615/attachment-0001.bin>

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

* Re: [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
  2009-11-19  9:03       ` Jun Nie
@ 2009-11-19 16:29         ` Eric Miao
  -1 siblings, 0 replies; 18+ messages in thread
From: Eric Miao @ 2009-11-19 16:29 UTC (permalink / raw)
  To: linux-arm-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1253", Size: 947 bytes --]

> +       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 err;
> +                       }
> +                       gpio_direction_output(spi_gpio_reset, 0);
> +                       msleep(100);

This is really a loooong delay, there any specific reason for such a long
delay, I'm seeing this to slow down the boot up significantly?

Otherwise looks OK to me, and I prefer the defconfig file change to
be a separate patch please.
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±ýöÝzÿâžØ^n‡r¡ö¦zË\x1aëh™¨è­Ú&£ûàz¿äz¹Þ—ú+€Ê+zf£¢·hšˆ§~†­†Ûiÿÿïêÿ‘êçz_è®\x0fæj:+v‰¨þ)ߣøm

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

* [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
@ 2009-11-19 16:29         ` Eric Miao
  0 siblings, 0 replies; 18+ messages in thread
From: Eric Miao @ 2009-11-19 16:29 UTC (permalink / raw)
  To: linux-arm-kernel

> + ? ? ? 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 err;
> + ? ? ? ? ? ? ? ? ? ? ? }
> + ? ? ? ? ? ? ? ? ? ? ? gpio_direction_output(spi_gpio_reset, 0);
> + ? ? ? ? ? ? ? ? ? ? ? msleep(100);

This is really a loooong delay, there any specific reason for such a long
delay, I'm seeing this to slow down the boot up significantly?

Otherwise looks OK to me, and I prefer the defconfig file change to
be a separate patch please.

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

* Re: [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
  2009-11-19 16:29         ` Eric Miao
@ 2009-11-20  2:38           ` Jun Nie
  -1 siblings, 0 replies; 18+ messages in thread
From: Jun Nie @ 2009-11-20  2:38 UTC (permalink / raw)
  To: linux-arm-kernel

2009/11/20 Eric Miao <eric.y.miao@gmail.com>:
>> +       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 err;
>> +                       }
>> +                       gpio_direction_output(spi_gpio_reset, 0);
>> +                       msleep(100);
>
> This is really a loooong delay, there any specific reason for such a long
> delay, I'm seeing this to slow down the boot up significantly?
>
> Otherwise looks OK to me, and I prefer the defconfig file change to
> be a separate patch please.
>

Actually, This is just an example for other real products. There is no
such spi_reset pin on Aspenite , so machine info set it spi_gpio_reset
= -1. Or do you think we should delete these lines?

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

* [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
@ 2009-11-20  2:38           ` Jun Nie
  0 siblings, 0 replies; 18+ messages in thread
From: Jun Nie @ 2009-11-20  2:38 UTC (permalink / raw)
  To: linux-arm-kernel

2009/11/20 Eric Miao <eric.y.miao@gmail.com>:
>> + ? ? ? 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 err;
>> + ? ? ? ? ? ? ? ? ? ? ? }
>> + ? ? ? ? ? ? ? ? ? ? ? gpio_direction_output(spi_gpio_reset, 0);
>> + ? ? ? ? ? ? ? ? ? ? ? msleep(100);
>
> This is really a loooong delay, there any specific reason for such a long
> delay, I'm seeing this to slow down the boot up significantly?
>
> Otherwise looks OK to me, and I prefer the defconfig file change to
> be a separate patch please.
>

Actually, This is just an example for other real products. There is no
such spi_reset pin on Aspenite , so machine info set it spi_gpio_reset
== -1. Or do you think we should delete these lines?

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

* Re: [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
  2009-11-20  2:38           ` Jun Nie
@ 2009-11-20  4:56             ` Eric Miao
  -1 siblings, 0 replies; 18+ messages in thread
From: Eric Miao @ 2009-11-20  4:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Nov 19, 2009 at 8:38 PM, Jun Nie <niej0001@gmail.com> wrote:
> 2009/11/20 Eric Miao <eric.y.miao@gmail.com>:
>>> +       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 err;
>>> +                       }
>>> +                       gpio_direction_output(spi_gpio_reset, 0);
>>> +                       msleep(100);
>>
>> This is really a loooong delay, there any specific reason for such a long
>> delay, I'm seeing this to slow down the boot up significantly?
>>
>> Otherwise looks OK to me, and I prefer the defconfig file change to
>> be a separate patch please.
>>
>
> Actually, This is just an example for other real products. There is no
> such spi_reset pin on Aspenite , so machine info set it spi_gpio_reset
> = -1. Or do you think we should delete these lines?
>

I see no reason for it to stay there then, please remove.

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

* [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
@ 2009-11-20  4:56             ` Eric Miao
  0 siblings, 0 replies; 18+ messages in thread
From: Eric Miao @ 2009-11-20  4:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Nov 19, 2009 at 8:38 PM, Jun Nie <niej0001@gmail.com> wrote:
> 2009/11/20 Eric Miao <eric.y.miao@gmail.com>:
>>> + ? ? ? 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 err;
>>> + ? ? ? ? ? ? ? ? ? ? ? }
>>> + ? ? ? ? ? ? ? ? ? ? ? gpio_direction_output(spi_gpio_reset, 0);
>>> + ? ? ? ? ? ? ? ? ? ? ? msleep(100);
>>
>> This is really a loooong delay, there any specific reason for such a long
>> delay, I'm seeing this to slow down the boot up significantly?
>>
>> Otherwise looks OK to me, and I prefer the defconfig file change to
>> be a separate patch please.
>>
>
> Actually, This is just an example for other real products. There is no
> such spi_reset pin on Aspenite , so machine info set it spi_gpio_reset
> == -1. Or do you think we should delete these lines?
>

I see no reason for it to stay there then, please remove.

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

* Re: [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
  2009-11-20  4:56             ` Eric Miao
@ 2009-11-23  5:52               ` Jun Nie
  -1 siblings, 0 replies; 18+ messages in thread
From: Jun Nie @ 2009-11-23  5:52 UTC (permalink / raw)
  To: linux-arm-kernel

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

2009/11/20 Eric Miao <eric.y.miao@gmail.com>:
> On Thu, Nov 19, 2009 at 8:38 PM, Jun Nie <niej0001@gmail.com> wrote:
>> 2009/11/20 Eric Miao <eric.y.miao@gmail.com>:
>>>> +       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 err;
>>>> +                       }
>>>> +                       gpio_direction_output(spi_gpio_reset, 0);
>>>> +                       msleep(100);
>>>
>>> This is really a loooong delay, there any specific reason for such a long
>>> delay, I'm seeing this to slow down the boot up significantly?
>>>
>>> Otherwise looks OK to me, and I prefer the defconfig file change to
>>> be a separate patch please.
>>>
>>
>> Actually, This is just an example for other real products. There is no
>> such spi_reset pin on Aspenite , so machine info set it spi_gpio_reset
>> == -1. Or do you think we should delete these lines?
>>
>
> I see no reason for it to stay there then, please remove.
>

rebased to topic/pxa168fb branch of pxa git repository. changes include:
1. Delete redundant gpio operation in aspenite.c
2. change to include <linux/gpio.h>

From 6915f1d1abe0e0fe42c162f1392a00d722c5eccd Mon Sep 17 00:00:00 2001
From: Jun Nie <njun@marvell.com>
Date: Mon, 23 Nov 2009 09:56:07 +0800
Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa168_defconfig       |   86 +++++++++++++++++++++-
 arch/arm/mach-mmp/aspenite.c            |  125 +++++++++++++++++++++++++++++++
 arch/arm/mach-mmp/include/mach/pxa168.h |    7 ++
 arch/arm/mach-mmp/pxa168.c              |    3 +
 4 files changed, 219 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/pxa168_defconfig
b/arch/arm/configs/pxa168_defconfig
index db5faea..b736517 100644
--- a/arch/arm/configs/pxa168_defconfig
+++ b/arch/arm/configs/pxa168_defconfig
@@ -509,7 +509,49 @@ CONFIG_UNIX98_PTYS=y
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
-# CONFIG_I2C is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_CHARDEV is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE is not set
+CONFIG_I2C_GPIO=y
+# CONFIG_I2C_OCORES is not set
+CONFIG_I2C_PXA=y
+# CONFIG_I2C_PXA_SLAVE is not set
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_PCF8575 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
 # CONFIG_SPI is not set
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_GPIOLIB=y
@@ -523,6 +565,9 @@ CONFIG_GPIOLIB=y
 #
 # I2C GPIO expanders:
 #
+# CONFIG_GPIO_MAX732X is not set
+CONFIG_GPIO_PCA953X=y
+# CONFIG_GPIO_PCF857X is not set

 #
 # PCI GPIO expanders:
@@ -578,7 +623,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 is not set
+# CONFIG_FB_CFB_COPYAREA is not set
+# CONFIG_FB_CFB_IMAGEBLIT is not set
+# 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 +663,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/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index c7990b2..e101042 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -17,6 +17,8 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/nand.h>
 #include <linux/i2c/pca953x.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>

 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -66,6 +68,39 @@ static unsigned long common_pin_config[] __initdata = {
 	/* UART1 */
 	GPIO107_UART1_RXD,
 	GPIO108_UART1_TXD,
+
+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO56_LCD_FCLK_RD,
+	GPIO57_LCD_LCLK_A0,
+	GPIO58_LCD_PCLK_WR,
+	GPIO59_LCD_DENA_BIAS,
+	GPIO60_LCD_DD0,
+	GPIO61_LCD_DD1,
+	GPIO62_LCD_DD2,
+	GPIO63_LCD_DD3,
+	GPIO64_LCD_DD4,
+	GPIO65_LCD_DD5,
+	GPIO66_LCD_DD6,
+	GPIO67_LCD_DD7,
+	GPIO68_LCD_DD8,
+	GPIO69_LCD_DD9,
+	GPIO70_LCD_DD10,
+	GPIO71_LCD_DD11,
+	GPIO72_LCD_DD12,
+	GPIO73_LCD_DD13,
+	GPIO74_LCD_DD14,
+	GPIO75_LCD_DD15,
+
+	GPIO76_LCD_DD16,
+	GPIO77_LCD_DD17,
+	GPIO78_LCD_DD18,
+	GPIO79_LCD_DD19,
+	GPIO80_LCD_DD20,
+	GPIO81_LCD_DD21,
+	GPIO82_LCD_DD22,
+	GPIO83_LCD_DD23,
+#endif
 };

 static struct smc91x_platdata smc91x_info = {
@@ -95,6 +130,93 @@ static struct platform_device smc91x_device = {
 	.resource	= smc91x_resources,
 };

+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x080F,
+	0x0C5F,
+	0x1017,
+	0x1420,
+	0x1808,
+	0x1c20,
+	0x2020,
+	0x2420,
+	0x2820,
+	0x2c20,
+	0x3020,
+	0x3420,
+	0x3810,
+	0x3c10,
+	0x4010,
+	0x4415,
+	0x48aa,
+	0x4cff,
+	0x5086,
+	0x548d,
+	0x58d4,
+	0x5cfb,
+	0x602e,
+	0x645a,
+	0x6889,
+	0x6cfe,
+	0x705a,
+	0x749b,
+	0x78c5,
+	0x7cff,
+	0x80f0,
+	0x84f0,
+	0x8808,
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x0c5e,		/* standby */
+};
+
+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) {
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdon,
+				ARRAY_SIZE(tpo_spi_cmdon), spi_gpio_cs, 0, 1);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
+				ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 1);
+}
+
+static struct fb_videomode video_modes_aspen[] = {
+	[0] = {
+		.pixclock       = 30120,
+		.refresh        = 60,
+		.xres           = 800,
+		.yres           = 480,
+		.hsync_len      = 1,
+		.left_margin    = 215,
+		.right_margin   = 40,
+		.vsync_len      = 1,
+		.upper_margin   = 34,
+		.lower_margin   = 10,
+		.sync           = 0,
+	},
+};
+
+struct pxa168fb_mach_info aspenite_lcd_info __initdata = {
+	.id                     = "Base-aspen",
+	.modes                  = video_modes_aspen,
+	.num_modes              = ARRAY_SIZE(video_modes_aspen),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_24,
+	.dumb_mode              = DUMB_MODE_RGB888,
+	.active                 = 1,
+	.spi_ctrl		= CFG_SCLKCNT(2) | CFG_TXBITS(16) |
+		CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs		= GPIO_EXT1(14),
+	.spi_gpio_reset         = -1,
+	.invert_pixclock	= 1,
+	.pxa168fb_lcd_power     = tpo_lcd_power,
+};
+
+#endif
+
 #if defined(CONFIG_MTD_NAND) || defined(CONFIG_MTD_NAND_MODULE)
 static struct mtd_partition aspenite_nand_partitions[] = {
 	{
@@ -179,6 +301,9 @@ static void __init common_init(void)
 	pxa168_add_nand(&aspenite_nand_info);
 	pxa168_add_twsi(0, &pwri2c_info,
 		ARRAY_AND_SIZE(aspenite_i2c_board_info));
+#ifdef CONFIG_FB_PXA168
+	pxa168_add_fb(&aspenite_lcd_info);
+#endif

 	/* off-chip devices */
 	platform_device_register(&smc91x_device);
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h
b/arch/arm/mach-mmp/include/mach/pxa168.h
index 3ad612c..6c10c9e 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.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 pxa168_device_uart1;
 extern struct pxa_device_desc pxa168_device_uart2;
@@ -15,6 +16,7 @@ extern struct pxa_device_desc pxa168_device_pwm2;
 extern struct pxa_device_desc pxa168_device_pwm3;
 extern struct pxa_device_desc pxa168_device_pwm4;
 extern struct pxa_device_desc pxa168_device_nand;
+extern struct pxa_device_desc pxa168_device_fb;

 static inline int pxa168_add_uart(int id)
 {
@@ -71,4 +73,9 @@ static inline int pxa168_add_nand(struct
pxa3xx_nand_platform_data *info)
 {
 	return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
 }
+
+static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
+}
 #endif /* __ASM_MACH_PXA168_H */
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 37dbdde..a5f9c7d 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -74,6 +74,7 @@ static APBC_CLK(pwm3, PXA168_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA168_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 pxa168_clkregs[] = {
@@ -86,6 +87,7 @@ static struct clk_lookup pxa168_clkregs[] = {
 	INIT_CLKREG(&clk_pwm3, "pxa168-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa168-pwm.3", NULL),
 	INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa168-fb", "LCDCLK"),
 };

 static int __init pxa168_init(void)
@@ -132,3 +134,4 @@ PXA168_DEVICE(pwm2, "pxa168-pwm", 1, NONE,
0xd401a400, 0x10);
 PXA168_DEVICE(pwm3, "pxa168-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA168_DEVICE(pwm4, "pxa168-pwm", 3, NONE, 0xd401ac00, 0x10);
 PXA168_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x80, 97, 99);
+PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
-- 
1.5.4.3

[-- Attachment #2: 0001-pxa-add-frame-buffer-on-pxa168-aspenite-platform.patch --]
[-- Type: text/x-diff, Size: 9395 bytes --]

From 6915f1d1abe0e0fe42c162f1392a00d722c5eccd Mon Sep 17 00:00:00 2001
From: Jun Nie <njun@marvell.com>
Date: Mon, 23 Nov 2009 09:56:07 +0800
Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform

Signed-off-by: Jun Nie <njun@marvell.com>
---
 arch/arm/configs/pxa168_defconfig       |   86 +++++++++++++++++++++-
 arch/arm/mach-mmp/aspenite.c            |  125 +++++++++++++++++++++++++++++++
 arch/arm/mach-mmp/include/mach/pxa168.h |    7 ++
 arch/arm/mach-mmp/pxa168.c              |    3 +
 4 files changed, 219 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/pxa168_defconfig b/arch/arm/configs/pxa168_defconfig
index db5faea..b736517 100644
--- a/arch/arm/configs/pxa168_defconfig
+++ b/arch/arm/configs/pxa168_defconfig
@@ -509,7 +509,49 @@ CONFIG_UNIX98_PTYS=y
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
-# CONFIG_I2C is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_CHARDEV is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE is not set
+CONFIG_I2C_GPIO=y
+# CONFIG_I2C_OCORES is not set
+CONFIG_I2C_PXA=y
+# CONFIG_I2C_PXA_SLAVE is not set
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_PCF8575 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
 # CONFIG_SPI is not set
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_GPIOLIB=y
@@ -523,6 +565,9 @@ CONFIG_GPIOLIB=y
 #
 # I2C GPIO expanders:
 #
+# CONFIG_GPIO_MAX732X is not set
+CONFIG_GPIO_PCA953X=y
+# CONFIG_GPIO_PCF857X is not set
 
 #
 # PCI GPIO expanders:
@@ -578,7 +623,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 is not set
+# CONFIG_FB_CFB_COPYAREA is not set
+# CONFIG_FB_CFB_IMAGEBLIT is not set
+# 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 +663,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/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index c7990b2..e101042 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -17,6 +17,8 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/nand.h>
 #include <linux/i2c/pca953x.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -66,6 +68,39 @@ static unsigned long common_pin_config[] __initdata = {
 	/* UART1 */
 	GPIO107_UART1_RXD,
 	GPIO108_UART1_TXD,
+
+#ifdef CONFIG_FB_PXA168
+	/* LCD */
+	GPIO56_LCD_FCLK_RD,
+	GPIO57_LCD_LCLK_A0,
+	GPIO58_LCD_PCLK_WR,
+	GPIO59_LCD_DENA_BIAS,
+	GPIO60_LCD_DD0,
+	GPIO61_LCD_DD1,
+	GPIO62_LCD_DD2,
+	GPIO63_LCD_DD3,
+	GPIO64_LCD_DD4,
+	GPIO65_LCD_DD5,
+	GPIO66_LCD_DD6,
+	GPIO67_LCD_DD7,
+	GPIO68_LCD_DD8,
+	GPIO69_LCD_DD9,
+	GPIO70_LCD_DD10,
+	GPIO71_LCD_DD11,
+	GPIO72_LCD_DD12,
+	GPIO73_LCD_DD13,
+	GPIO74_LCD_DD14,
+	GPIO75_LCD_DD15,
+
+	GPIO76_LCD_DD16,
+	GPIO77_LCD_DD17,
+	GPIO78_LCD_DD18,
+	GPIO79_LCD_DD19,
+	GPIO80_LCD_DD20,
+	GPIO81_LCD_DD21,
+	GPIO82_LCD_DD22,
+	GPIO83_LCD_DD23,
+#endif
 };
 
 static struct smc91x_platdata smc91x_info = {
@@ -95,6 +130,93 @@ static struct platform_device smc91x_device = {
 	.resource	= smc91x_resources,
 };
 
+#ifdef CONFIG_FB_PXA168
+static u16 tpo_spi_cmdon[] = {
+	0x080F,
+	0x0C5F,
+	0x1017,
+	0x1420,
+	0x1808,
+	0x1c20,
+	0x2020,
+	0x2420,
+	0x2820,
+	0x2c20,
+	0x3020,
+	0x3420,
+	0x3810,
+	0x3c10,
+	0x4010,
+	0x4415,
+	0x48aa,
+	0x4cff,
+	0x5086,
+	0x548d,
+	0x58d4,
+	0x5cfb,
+	0x602e,
+	0x645a,
+	0x6889,
+	0x6cfe,
+	0x705a,
+	0x749b,
+	0x78c5,
+	0x7cff,
+	0x80f0,
+	0x84f0,
+	0x8808,
+};
+
+static u16 tpo_spi_cmdoff[] = {
+	0x0c5e,		/* standby */
+};
+
+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) {
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdon,
+				ARRAY_SIZE(tpo_spi_cmdon), spi_gpio_cs, 0, 1);
+	} else
+		return pxa168fb_spi_send(fbi, tpo_spi_cmdoff,
+				ARRAY_SIZE(tpo_spi_cmdoff), spi_gpio_cs, 0, 1);
+}
+
+static struct fb_videomode video_modes_aspen[] = {
+	[0] = {
+		.pixclock       = 30120,
+		.refresh        = 60,
+		.xres           = 800,
+		.yres           = 480,
+		.hsync_len      = 1,
+		.left_margin    = 215,
+		.right_margin   = 40,
+		.vsync_len      = 1,
+		.upper_margin   = 34,
+		.lower_margin   = 10,
+		.sync           = 0,
+	},
+};
+
+struct pxa168fb_mach_info aspenite_lcd_info __initdata = {
+	.id                     = "Base-aspen",
+	.modes                  = video_modes_aspen,
+	.num_modes              = ARRAY_SIZE(video_modes_aspen),
+	.pix_fmt                = PIX_FMT_RGB565,
+	.io_pin_allocation_mode = PIN_MODE_DUMB_24,
+	.dumb_mode              = DUMB_MODE_RGB888,
+	.active                 = 1,
+	.spi_ctrl		= CFG_SCLKCNT(2) | CFG_TXBITS(16) |
+		CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1),
+	.spi_gpio_cs		= GPIO_EXT1(14),
+	.spi_gpio_reset         = -1,
+	.invert_pixclock	= 1,
+	.pxa168fb_lcd_power     = tpo_lcd_power,
+};
+
+#endif
+
 #if defined(CONFIG_MTD_NAND) || defined(CONFIG_MTD_NAND_MODULE)
 static struct mtd_partition aspenite_nand_partitions[] = {
 	{
@@ -179,6 +301,9 @@ static void __init common_init(void)
 	pxa168_add_nand(&aspenite_nand_info);
 	pxa168_add_twsi(0, &pwri2c_info,
 		ARRAY_AND_SIZE(aspenite_i2c_board_info));
+#ifdef CONFIG_FB_PXA168
+	pxa168_add_fb(&aspenite_lcd_info);
+#endif
 
 	/* off-chip devices */
 	platform_device_register(&smc91x_device);
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h b/arch/arm/mach-mmp/include/mach/pxa168.h
index 3ad612c..6c10c9e 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.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 pxa168_device_uart1;
 extern struct pxa_device_desc pxa168_device_uart2;
@@ -15,6 +16,7 @@ extern struct pxa_device_desc pxa168_device_pwm2;
 extern struct pxa_device_desc pxa168_device_pwm3;
 extern struct pxa_device_desc pxa168_device_pwm4;
 extern struct pxa_device_desc pxa168_device_nand;
+extern struct pxa_device_desc pxa168_device_fb;
 
 static inline int pxa168_add_uart(int id)
 {
@@ -71,4 +73,9 @@ static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info)
 {
 	return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
 }
+
+static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
+{
+	return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
+}
 #endif /* __ASM_MACH_PXA168_H */
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 37dbdde..a5f9c7d 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -74,6 +74,7 @@ static APBC_CLK(pwm3, PXA168_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA168_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 pxa168_clkregs[] = {
@@ -86,6 +87,7 @@ static struct clk_lookup pxa168_clkregs[] = {
 	INIT_CLKREG(&clk_pwm3, "pxa168-pwm.2", NULL),
 	INIT_CLKREG(&clk_pwm4, "pxa168-pwm.3", NULL),
 	INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
+	INIT_CLKREG(&clk_lcd, "pxa168-fb", "LCDCLK"),
 };
 
 static int __init pxa168_init(void)
@@ -132,3 +134,4 @@ PXA168_DEVICE(pwm2, "pxa168-pwm", 1, NONE, 0xd401a400, 0x10);
 PXA168_DEVICE(pwm3, "pxa168-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA168_DEVICE(pwm4, "pxa168-pwm", 3, NONE, 0xd401ac00, 0x10);
 PXA168_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x80, 97, 99);
+PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
-- 
1.5.4.3


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

* [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform
@ 2009-11-23  5:52               ` Jun Nie
  0 siblings, 0 replies; 18+ messages in thread
From: Jun Nie @ 2009-11-23  5:52 UTC (permalink / raw)
  To: linux-arm-kernel

2009/11/20 Eric Miao <eric.y.miao@gmail.com>:
> On Thu, Nov 19, 2009 at 8:38 PM, Jun Nie <niej0001@gmail.com> wrote:
>> 2009/11/20 Eric Miao <eric.y.miao@gmail.com>:
>>>> + ? ? ? 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 err;
>>>> + ? ? ? ? ? ? ? ? ? ? ? }
>>>> + ? ? ? ? ? ? ? ? ? ? ? gpio_direction_output(spi_gpio_reset, 0);
>>>> + ? ? ? ? ? ? ? ? ? ? ? msleep(100);
>>>
>>> This is really a loooong delay, there any specific reason for such a long
>>> delay, I'm seeing this to slow down the boot up significantly?
>>>
>>> Otherwise looks OK to me, and I prefer the defconfig file change to
>>> be a separate patch please.
>>>
>>
>> Actually, This is just an example for other real products. There is no
>> such spi_reset pin on Aspenite , so machine info set it spi_gpio_reset
>> == -1. Or do you think we should delete these lines?
>>
>
> I see no reason for it to stay there then, please remove.
>

rebased to topic/pxa168fb branch of pxa git repository. changes include:
1. Delete redundant gpio operation in aspenite.c
2. change to include <linux/gpio.h>

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

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

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-10  8:12 [PATCH 7/8] pxa: add frame buffer on pxa168 aspenite platform Jun Nie
2009-11-10  8:12 ` Jun Nie
2009-11-12  2:19 ` Jun Nie
2009-11-12  2:19   ` Jun Nie
2009-11-16  9:34 ` Jun Nie
2009-11-16  9:34   ` Jun Nie
2009-11-17  6:29   ` Eric Miao
2009-11-17  6:29     ` Eric Miao
2009-11-19  9:03     ` Jun Nie
2009-11-19  9:03       ` Jun Nie
2009-11-19 16:29       ` Eric Miao
2009-11-19 16:29         ` Eric Miao
2009-11-20  2:38         ` Jun Nie
2009-11-20  2:38           ` Jun Nie
2009-11-20  4:56           ` Eric Miao
2009-11-20  4:56             ` Eric Miao
2009-11-23  5:52             ` Jun Nie
2009-11-23  5:52               ` Jun Nie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.