From: njun@marvell.com (Jun Nie) Date: Mon, 23 Nov 2009 09:56:07 +0800 Subject: [PATCH] pxa: add frame buffer on pxa168 aspenite platform Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Signed-off-by: Jun Nie --- 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=3Dy # CONFIG_R3964 is not set # CONFIG_RAW_DRIVER is not set # CONFIG_TCG_TPM is not set -# CONFIG_I2C is not set +CONFIG_I2C=3Dy +CONFIG_I2C_BOARDINFO=3Dy +# CONFIG_I2C_CHARDEV is not set +CONFIG_I2C_HELPER_AUTO=3Dy +CONFIG_I2C_ALGOBIT=3Dy + +# +# I2C Hardware Bus support +# + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +# CONFIG_I2C_DESIGNWARE is not set +CONFIG_I2C_GPIO=3Dy +# CONFIG_I2C_OCORES is not set +CONFIG_I2C_PXA=3Dy +# 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=3Dy CONFIG_GPIOLIB=3Dy @@ -523,6 +565,9 @@ CONFIG_GPIOLIB=3Dy # # I2C GPIO expanders: # +# CONFIG_GPIO_MAX732X is not set +CONFIG_GPIO_PCA953X=3Dy +# CONFIG_GPIO_PCF857X is not set # # PCI GPIO expanders: @@ -578,7 +623,34 @@ CONFIG_SSB_POSSIBLE=3Dy # # CONFIG_VGASTATE is not set # CONFIG_VIDEO_OUTPUT_CONTROL is not set -# CONFIG_FB is not set +CONFIG_FB=3Dy +# 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=3Dy +# 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=3Dy # # CONFIG_VGA_CONSOLE is not set CONFIG_DUMMY_CONSOLE=3Dy +CONFIG_FRAMEBUFFER_CONSOLE=3Dy +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=3Dy +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=3Dy +CONFIG_FONT_8x16=3Dy +CONFIG_LOGO=3Dy +# CONFIG_LOGO_LINUX_MONO is not set +CONFIG_LOGO_LINUX_VGA16=3Dy +CONFIG_LOGO_LINUX_CLUT224=3Dy # 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 #include #include +#include +#include #include #include @@ -66,6 +68,39 @@ static unsigned long common_pin_config[] __initdata =3D = { /* 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 =3D { @@ -95,6 +130,93 @@ static struct platform_device smc91x_device =3D { .resource =3D smc91x_resources, }; +#ifdef CONFIG_FB_PXA168 +static u16 tpo_spi_cmdon[] =3D { + 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[] =3D { + 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 =3D 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[] =3D { + [0] =3D { + .pixclock =3D 30120, + .refresh =3D 60, + .xres =3D 800, + .yres =3D 480, + .hsync_len =3D 1, + .left_margin =3D 215, + .right_margin =3D 40, + .vsync_len =3D 1, + .upper_margin =3D 34, + .lower_margin =3D 10, + .sync =3D 0, + }, +}; + +struct pxa168fb_mach_info aspenite_lcd_info __initdata =3D { + .id =3D "Base-aspen", + .modes =3D video_modes_aspen, + .num_modes =3D ARRAY_SIZE(video_modes_aspen), + .pix_fmt =3D PIX_FMT_RGB565, + .io_pin_allocation_mode =3D PIN_MODE_DUMB_24, + .dumb_mode =3D DUMB_MODE_RGB888, + .active =3D 1, + .spi_ctrl =3D CFG_SCLKCNT(2) | CFG_TXBITS(16) | + CFG_SPI_SEL(1) | CFG_SPI_3W4WB(1) | CFG_SPI_ENA(1), + .spi_gpio_cs =3D GPIO_EXT1(14), + .spi_gpio_reset =3D -1, + .invert_pixclock =3D 1, + .pxa168fb_lcd_power =3D tpo_lcd_power, +}; + +#endif + #if defined(CONFIG_MTD_NAND) || defined(CONFIG_MTD_NAND_MODULE) static struct mtd_partition aspenite_nand_partitions[] =3D { { @@ -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 #include #include +#include