Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83e560ee authored by Igor Grinberg's avatar Igor Grinberg Committed by Eric Miao
Browse files

[ARM] pxa/cm-x300: add TDO35S lcd support

parent 55052ea2
Loading
Loading
Loading
Loading
+57 −3
Original line number Original line Diff line number Diff line
@@ -26,6 +26,10 @@
#include <linux/i2c.h>
#include <linux/i2c.h>
#include <linux/i2c/pca953x.h>
#include <linux/i2c/pca953x.h>


#include <linux/spi/spi.h>
#include <linux/spi/spi_gpio.h>
#include <linux/spi/tdo24m.h>

#include <asm/mach-types.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/arch.h>
#include <asm/setup.h>
#include <asm/setup.h>
@@ -208,17 +212,18 @@ static void __init cm_x300_init_dm9000(void)
static inline void cm_x300_init_dm9000(void) {}
static inline void cm_x300_init_dm9000(void) {}
#endif
#endif


/* LCD */
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
static struct pxafb_mode_info cm_x300_lcd_modes[] = {
static struct pxafb_mode_info cm_x300_lcd_modes[] = {
	[0] = {
	[0] = {
		.pixclock	= 38000,
		.pixclock	= 38250,
		.bpp		= 16,
		.bpp		= 16,
		.xres		= 480,
		.xres		= 480,
		.yres		= 640,
		.yres		= 640,
		.hsync_len	= 8,
		.hsync_len	= 8,
		.vsync_len	= 2,
		.vsync_len	= 2,
		.left_margin	= 8,
		.left_margin	= 8,
		.upper_margin	= 0,
		.upper_margin	= 2,
		.right_margin	= 24,
		.right_margin	= 24,
		.lower_margin	= 4,
		.lower_margin	= 4,
		.cmap_greyscale	= 0,
		.cmap_greyscale	= 0,
@@ -240,7 +245,7 @@ static struct pxafb_mode_info cm_x300_lcd_modes[] = {


static struct pxafb_mach_info cm_x300_lcd = {
static struct pxafb_mach_info cm_x300_lcd = {
	.modes			= cm_x300_lcd_modes,
	.modes			= cm_x300_lcd_modes,
	.num_modes		= 2,
	.num_modes		= ARRAY_SIZE(cm_x300_lcd_modes),
	.lcd_conn		= LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
	.lcd_conn		= LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
};
};


@@ -252,6 +257,54 @@ static void __init cm_x300_init_lcd(void)
static inline void cm_x300_init_lcd(void) {}
static inline void cm_x300_init_lcd(void) {}
#endif
#endif


#if defined(CONFIG_SPI_GPIO) || defined(CONFIG_SPI_GPIO_MODULE)
#define GPIO_LCD_BASE	(144)
#define GPIO_LCD_DIN	(GPIO_LCD_BASE + 8)	/* aux_gpio3_0 */
#define GPIO_LCD_DOUT	(GPIO_LCD_BASE + 9)	/* aux_gpio3_1 */
#define GPIO_LCD_SCL	(GPIO_LCD_BASE + 10)	/* aux_gpio3_2 */
#define GPIO_LCD_CS	(GPIO_LCD_BASE + 11)	/* aux_gpio3_3 */
#define LCD_SPI_BUS_NUM	(1)

static struct spi_gpio_platform_data cm_x300_spi_gpio_pdata = {
	.sck		= GPIO_LCD_SCL,
	.mosi		= GPIO_LCD_DIN,
	.miso		= GPIO_LCD_DOUT,
	.num_chipselect	= 1,
};

static struct platform_device cm_x300_spi_gpio = {
	.name		= "spi_gpio",
	.id		= LCD_SPI_BUS_NUM,
	.dev		= {
		.platform_data	= &cm_x300_spi_gpio_pdata,
	},
};

static struct tdo24m_platform_data cm_x300_tdo24m_pdata = {
	.model = TDO35S,
};

static struct spi_board_info cm_x300_spi_devices[] __initdata = {
	{
		.modalias		= "tdo24m",
		.max_speed_hz		= 1000000,
		.bus_num		= LCD_SPI_BUS_NUM,
		.chip_select		= 0,
		.controller_data	= (void *) GPIO_LCD_CS,
		.platform_data		= &cm_x300_tdo24m_pdata,
	},
};

static void __init cm_x300_init_spi(void)
{
	spi_register_board_info(cm_x300_spi_devices,
				ARRAY_SIZE(cm_x300_spi_devices));
	platform_device_register(&cm_x300_spi_gpio);
}
#else
static inline void cm_x300_init_spi(void) {}
#endif

#if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
#if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
static struct mtd_partition cm_x300_nand_partitions[] = {
static struct mtd_partition cm_x300_nand_partitions[] = {
	[0] = {
	[0] = {
@@ -476,6 +529,7 @@ static void __init cm_x300_init(void)
	cm_x300_init_nand();
	cm_x300_init_nand();
	cm_x300_init_leds();
	cm_x300_init_leds();
	cm_x300_init_i2c();
	cm_x300_init_i2c();
	cm_x300_init_spi();
	cm_x300_init_rtc();
	cm_x300_init_rtc();
}
}