| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  |  * Support for CompuLab EM-X270 platform | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  |  * Copyright (C) 2007, 2008 CompuLab, Ltd. | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  |  * Author: Mike Rapoport <mike@compulab.co.il> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU General Public License version 2 as | 
					
						
							|  |  |  |  * published by the Free Software Foundation. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/irq.h>
 | 
					
						
							|  |  |  | #include <linux/platform_device.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/dm9000.h>
 | 
					
						
							|  |  |  | #include <linux/rtc-v3020.h>
 | 
					
						
							|  |  |  | #include <linux/mtd/nand.h>
 | 
					
						
							|  |  |  | #include <linux/mtd/partitions.h>
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | #include <linux/input.h>
 | 
					
						
							|  |  |  | #include <linux/gpio_keys.h>
 | 
					
						
							|  |  |  | #include <linux/gpio.h>
 | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <asm/mach-types.h>
 | 
					
						
							|  |  |  | #include <asm/mach/arch.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-05 16:14:15 +01:00
										 |  |  | #include <mach/mfp-pxa27x.h>
 | 
					
						
							|  |  |  | #include <mach/pxa-regs.h>
 | 
					
						
							|  |  |  | #include <mach/pxa27x-udc.h>
 | 
					
						
							|  |  |  | #include <mach/audio.h>
 | 
					
						
							|  |  |  | #include <mach/pxafb.h>
 | 
					
						
							|  |  |  | #include <mach/ohci.h>
 | 
					
						
							|  |  |  | #include <mach/mmc.h>
 | 
					
						
							|  |  |  | #include <mach/pxa27x_keypad.h>
 | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "generic.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* GPIO IRQ usage */ | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | #define GPIO41_ETHIRQ		(41)
 | 
					
						
							|  |  |  | #define GPIO13_MMC_CD		(13)
 | 
					
						
							|  |  |  | #define EM_X270_ETHIRQ		IRQ_GPIO(GPIO41_ETHIRQ)
 | 
					
						
							|  |  |  | #define EM_X270_MMC_CD		IRQ_GPIO(GPIO13_MMC_CD)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* NAND control GPIOs */ | 
					
						
							|  |  |  | #define GPIO11_NAND_CS	(11)
 | 
					
						
							|  |  |  | #define GPIO56_NAND_RB	(56)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static unsigned long em_x270_pin_config[] = { | 
					
						
							|  |  |  | 	/* AC'97 */ | 
					
						
							|  |  |  | 	GPIO28_AC97_BITCLK, | 
					
						
							|  |  |  | 	GPIO29_AC97_SDATA_IN_0, | 
					
						
							|  |  |  | 	GPIO30_AC97_SDATA_OUT, | 
					
						
							|  |  |  | 	GPIO31_AC97_SYNC, | 
					
						
							|  |  |  | 	GPIO98_AC97_SYSCLK, | 
					
						
							|  |  |  | 	GPIO113_AC97_nRESET, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* BTUART */ | 
					
						
							|  |  |  | 	GPIO42_BTUART_RXD, | 
					
						
							|  |  |  | 	GPIO43_BTUART_TXD, | 
					
						
							|  |  |  | 	GPIO44_BTUART_CTS, | 
					
						
							|  |  |  | 	GPIO45_BTUART_RTS, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* STUART */ | 
					
						
							|  |  |  | 	GPIO46_STUART_RXD, | 
					
						
							|  |  |  | 	GPIO47_STUART_TXD, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* MCI controller */ | 
					
						
							|  |  |  | 	GPIO32_MMC_CLK, | 
					
						
							|  |  |  | 	GPIO112_MMC_CMD, | 
					
						
							|  |  |  | 	GPIO92_MMC_DAT_0, | 
					
						
							|  |  |  | 	GPIO109_MMC_DAT_1, | 
					
						
							|  |  |  | 	GPIO110_MMC_DAT_2, | 
					
						
							|  |  |  | 	GPIO111_MMC_DAT_3, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* LCD */ | 
					
						
							|  |  |  | 	GPIO58_LCD_LDD_0, | 
					
						
							|  |  |  | 	GPIO59_LCD_LDD_1, | 
					
						
							|  |  |  | 	GPIO60_LCD_LDD_2, | 
					
						
							|  |  |  | 	GPIO61_LCD_LDD_3, | 
					
						
							|  |  |  | 	GPIO62_LCD_LDD_4, | 
					
						
							|  |  |  | 	GPIO63_LCD_LDD_5, | 
					
						
							|  |  |  | 	GPIO64_LCD_LDD_6, | 
					
						
							|  |  |  | 	GPIO65_LCD_LDD_7, | 
					
						
							|  |  |  | 	GPIO66_LCD_LDD_8, | 
					
						
							|  |  |  | 	GPIO67_LCD_LDD_9, | 
					
						
							|  |  |  | 	GPIO68_LCD_LDD_10, | 
					
						
							|  |  |  | 	GPIO69_LCD_LDD_11, | 
					
						
							|  |  |  | 	GPIO70_LCD_LDD_12, | 
					
						
							|  |  |  | 	GPIO71_LCD_LDD_13, | 
					
						
							|  |  |  | 	GPIO72_LCD_LDD_14, | 
					
						
							|  |  |  | 	GPIO73_LCD_LDD_15, | 
					
						
							|  |  |  | 	GPIO74_LCD_FCLK, | 
					
						
							|  |  |  | 	GPIO75_LCD_LCLK, | 
					
						
							|  |  |  | 	GPIO76_LCD_PCLK, | 
					
						
							|  |  |  | 	GPIO77_LCD_BIAS, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* QCI */ | 
					
						
							|  |  |  | 	GPIO84_CIF_FV, | 
					
						
							|  |  |  | 	GPIO25_CIF_LV, | 
					
						
							|  |  |  | 	GPIO53_CIF_MCLK, | 
					
						
							|  |  |  | 	GPIO54_CIF_PCLK, | 
					
						
							|  |  |  | 	GPIO81_CIF_DD_0, | 
					
						
							|  |  |  | 	GPIO55_CIF_DD_1, | 
					
						
							|  |  |  | 	GPIO51_CIF_DD_2, | 
					
						
							|  |  |  | 	GPIO50_CIF_DD_3, | 
					
						
							|  |  |  | 	GPIO52_CIF_DD_4, | 
					
						
							|  |  |  | 	GPIO48_CIF_DD_5, | 
					
						
							|  |  |  | 	GPIO17_CIF_DD_6, | 
					
						
							|  |  |  | 	GPIO12_CIF_DD_7, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* I2C */ | 
					
						
							|  |  |  | 	GPIO117_I2C_SCL, | 
					
						
							|  |  |  | 	GPIO118_I2C_SDA, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Keypad */ | 
					
						
							|  |  |  | 	GPIO100_KP_MKIN_0	| WAKEUP_ON_LEVEL_HIGH, | 
					
						
							|  |  |  | 	GPIO101_KP_MKIN_1	| WAKEUP_ON_LEVEL_HIGH, | 
					
						
							|  |  |  | 	GPIO102_KP_MKIN_2	| WAKEUP_ON_LEVEL_HIGH, | 
					
						
							|  |  |  | 	GPIO34_KP_MKIN_3	| WAKEUP_ON_LEVEL_HIGH, | 
					
						
							|  |  |  | 	GPIO39_KP_MKIN_4	| WAKEUP_ON_LEVEL_HIGH, | 
					
						
							|  |  |  | 	GPIO99_KP_MKIN_5	| WAKEUP_ON_LEVEL_HIGH, | 
					
						
							|  |  |  | 	GPIO91_KP_MKIN_6	| WAKEUP_ON_LEVEL_HIGH, | 
					
						
							|  |  |  | 	GPIO36_KP_MKIN_7	| WAKEUP_ON_LEVEL_HIGH, | 
					
						
							|  |  |  | 	GPIO103_KP_MKOUT_0, | 
					
						
							|  |  |  | 	GPIO104_KP_MKOUT_1, | 
					
						
							|  |  |  | 	GPIO105_KP_MKOUT_2, | 
					
						
							|  |  |  | 	GPIO106_KP_MKOUT_3, | 
					
						
							|  |  |  | 	GPIO107_KP_MKOUT_4, | 
					
						
							|  |  |  | 	GPIO108_KP_MKOUT_5, | 
					
						
							|  |  |  | 	GPIO96_KP_MKOUT_6, | 
					
						
							|  |  |  | 	GPIO22_KP_MKOUT_7, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* SSP1 */ | 
					
						
							|  |  |  | 	GPIO26_SSP1_RXD, | 
					
						
							|  |  |  | 	GPIO23_SSP1_SCLK, | 
					
						
							|  |  |  | 	GPIO24_SSP1_SFRM, | 
					
						
							|  |  |  | 	GPIO57_SSP1_TXD, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* SSP2 */ | 
					
						
							|  |  |  | 	GPIO19_SSP2_SCLK, | 
					
						
							|  |  |  | 	GPIO14_SSP2_SFRM, | 
					
						
							|  |  |  | 	GPIO89_SSP2_TXD, | 
					
						
							|  |  |  | 	GPIO88_SSP2_RXD, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* SDRAM and local bus */ | 
					
						
							|  |  |  | 	GPIO15_nCS_1, | 
					
						
							|  |  |  | 	GPIO78_nCS_2, | 
					
						
							|  |  |  | 	GPIO79_nCS_3, | 
					
						
							|  |  |  | 	GPIO80_nCS_4, | 
					
						
							|  |  |  | 	GPIO49_nPWE, | 
					
						
							|  |  |  | 	GPIO18_RDY, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* GPIO */ | 
					
						
							|  |  |  | 	GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* power controls */ | 
					
						
							|  |  |  | 	GPIO20_GPIO	| MFP_LPM_DRIVE_LOW,	/* GPRS_PWEN */ | 
					
						
							|  |  |  | 	GPIO115_GPIO	| MFP_LPM_DRIVE_LOW,	/* WLAN_PWEN */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* NAND controls */ | 
					
						
							|  |  |  | 	GPIO11_GPIO	| MFP_LPM_DRIVE_HIGH,	/* NAND CE# */ | 
					
						
							|  |  |  | 	GPIO56_GPIO,				/* NAND Ready/Busy */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* interrupts */ | 
					
						
							|  |  |  | 	GPIO13_GPIO,	/* MMC card detect */ | 
					
						
							|  |  |  | 	GPIO41_GPIO,	/* DM9000 interrupt */ | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
 | 
					
						
							|  |  |  | static struct resource em_x270_dm9000_resource[] = { | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.start = PXA_CS2_PHYS, | 
					
						
							|  |  |  | 		.end   = PXA_CS2_PHYS + 3, | 
					
						
							|  |  |  | 		.flags = IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							|  |  |  | 		.start = PXA_CS2_PHYS + 8, | 
					
						
							|  |  |  | 		.end   = PXA_CS2_PHYS + 8 + 0x3f, | 
					
						
							|  |  |  | 		.flags = IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[2] = { | 
					
						
							|  |  |  | 		.start = EM_X270_ETHIRQ, | 
					
						
							|  |  |  | 		.end   = EM_X270_ETHIRQ, | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | 		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | static struct dm9000_plat_data em_x270_dm9000_platdata = { | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 	.flags		= DM9000_PLATF_32BITONLY, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | static struct platform_device em_x270_dm9000 = { | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 	.name		= "dm9000", | 
					
						
							|  |  |  | 	.id		= 0, | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | 	.num_resources	= ARRAY_SIZE(em_x270_dm9000_resource), | 
					
						
							|  |  |  | 	.resource	= em_x270_dm9000_resource, | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 	.dev		= { | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | 		.platform_data = &em_x270_dm9000_platdata, | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | static void __init em_x270_init_dm9000(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	platform_device_register(&em_x270_dm9000); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | static inline void em_x270_init_dm9000(void) {} | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | /* V3020 RTC */ | 
					
						
							|  |  |  | #if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE)
 | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | static struct resource em_x270_v3020_resource[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.start = PXA_CS4_PHYS, | 
					
						
							|  |  |  | 		.end   = PXA_CS4_PHYS + 3, | 
					
						
							|  |  |  | 		.flags = IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct v3020_platform_data em_x270_v3020_platdata = { | 
					
						
							|  |  |  | 	.leftshift = 0, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device em_x270_rtc = { | 
					
						
							|  |  |  | 	.name		= "v3020", | 
					
						
							|  |  |  | 	.num_resources	= ARRAY_SIZE(em_x270_v3020_resource), | 
					
						
							|  |  |  | 	.resource	= em_x270_v3020_resource, | 
					
						
							|  |  |  | 	.id		= -1, | 
					
						
							|  |  |  | 	.dev		= { | 
					
						
							|  |  |  | 		.platform_data = &em_x270_v3020_platdata, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | static void __init em_x270_init_rtc(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	platform_device_register(&em_x270_rtc); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | static inline void em_x270_init_rtc(void) {} | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | /* NAND flash */ | 
					
						
							|  |  |  | #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
 | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | static inline void nand_cs_on(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | 	gpio_set_value(GPIO11_NAND_CS, 0); | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void nand_cs_off(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	dsb(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | 	gpio_set_value(GPIO11_NAND_CS, 1); | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* hardware specific access to control-lines */ | 
					
						
							|  |  |  | static void em_x270_nand_cmd_ctl(struct mtd_info *mtd, int dat, | 
					
						
							|  |  |  | 				 unsigned int ctrl) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct nand_chip *this = mtd->priv; | 
					
						
							|  |  |  | 	unsigned long nandaddr = (unsigned long)this->IO_ADDR_W; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dsb(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (ctrl & NAND_CTRL_CHANGE) { | 
					
						
							|  |  |  | 		if (ctrl & NAND_ALE) | 
					
						
							|  |  |  | 			nandaddr |=  (1 << 3); | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 			nandaddr &= ~(1 << 3); | 
					
						
							|  |  |  | 		if (ctrl & NAND_CLE) | 
					
						
							|  |  |  | 			nandaddr |=  (1 << 2); | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 			nandaddr &= ~(1 << 2); | 
					
						
							|  |  |  | 		if (ctrl & NAND_NCE) | 
					
						
							|  |  |  | 			nand_cs_on(); | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 			nand_cs_off(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dsb(); | 
					
						
							|  |  |  | 	this->IO_ADDR_W = (void __iomem *)nandaddr; | 
					
						
							|  |  |  | 	if (dat != NAND_CMD_NONE) | 
					
						
							|  |  |  | 		writel(dat, this->IO_ADDR_W); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dsb(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* read device ready pin */ | 
					
						
							|  |  |  | static int em_x270_nand_device_ready(struct mtd_info *mtd) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	dsb(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | 	return gpio_get_value(GPIO56_NAND_RB); | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct mtd_partition em_x270_partition_info[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.name	= "em_x270-0", | 
					
						
							|  |  |  | 		.offset	= 0, | 
					
						
							|  |  |  | 		.size	= SZ_4M, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							|  |  |  | 		.name	= "em_x270-1", | 
					
						
							|  |  |  | 		.offset	= MTDPART_OFS_APPEND, | 
					
						
							|  |  |  | 		.size	= MTDPART_SIZ_FULL | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static const char *em_x270_part_probes[] = { "cmdlinepart", NULL }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct platform_nand_data em_x270_nand_platdata = { | 
					
						
							|  |  |  | 	.chip = { | 
					
						
							|  |  |  | 		.nr_chips = 1, | 
					
						
							|  |  |  | 		.chip_offset = 0, | 
					
						
							|  |  |  | 		.nr_partitions = ARRAY_SIZE(em_x270_partition_info), | 
					
						
							|  |  |  | 		.partitions = em_x270_partition_info, | 
					
						
							|  |  |  | 		.chip_delay = 20, | 
					
						
							|  |  |  | 		.part_probe_types = em_x270_part_probes, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	.ctrl = { | 
					
						
							|  |  |  | 		.hwcontrol = 0, | 
					
						
							|  |  |  | 		.dev_ready = em_x270_nand_device_ready, | 
					
						
							|  |  |  | 		.select_chip = 0, | 
					
						
							|  |  |  | 		.cmd_ctrl = em_x270_nand_cmd_ctl, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct resource em_x270_nand_resource[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.start = PXA_CS1_PHYS, | 
					
						
							|  |  |  | 		.end   = PXA_CS1_PHYS + 12, | 
					
						
							|  |  |  | 		.flags = IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device em_x270_nand = { | 
					
						
							|  |  |  | 	.name		= "gen_nand", | 
					
						
							|  |  |  | 	.num_resources	= ARRAY_SIZE(em_x270_nand_resource), | 
					
						
							|  |  |  | 	.resource	= em_x270_nand_resource, | 
					
						
							|  |  |  | 	.id		= -1, | 
					
						
							|  |  |  | 	.dev		= { | 
					
						
							|  |  |  | 		.platform_data = &em_x270_nand_platdata, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | static void __init em_x270_init_nand(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	int err; | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | 	err = gpio_request(GPIO11_NAND_CS, "NAND CS"); | 
					
						
							|  |  |  | 	if (err) { | 
					
						
							|  |  |  | 		pr_warning("EM-X270: failed to request NAND CS gpio\n"); | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	gpio_direction_output(GPIO11_NAND_CS, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	err = gpio_request(GPIO56_NAND_RB, "NAND R/B"); | 
					
						
							|  |  |  | 	if (err) { | 
					
						
							|  |  |  | 		pr_warning("EM-X270: failed to request NAND R/B gpio\n"); | 
					
						
							|  |  |  | 		gpio_free(GPIO11_NAND_CS); | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	gpio_direction_input(GPIO56_NAND_RB); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	platform_device_register(&em_x270_nand); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | static inline void em_x270_init_nand(void) {} | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* PXA27x OHCI controller setup */ | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
 | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | static int em_x270_ohci_init(struct device *dev) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	/* enable port 2 transiever */ | 
					
						
							|  |  |  | 	UP2OCR = UP2OCR_HXS | UP2OCR_HXOE; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct pxaohci_platform_data em_x270_ohci_platform_data = { | 
					
						
							|  |  |  | 	.port_mode	= PMM_PERPORT_MODE, | 
					
						
							| 
									
										
										
										
											2008-09-27 15:49:57 +08:00
										 |  |  | 	.flags		= ENABLE_PORT1 | ENABLE_PORT2 | POWER_CONTROL_LOW, | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 	.init		= em_x270_ohci_init, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | static void __init em_x270_init_ohci(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	pxa_set_ohci_info(&em_x270_ohci_platform_data); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | static inline void em_x270_init_ohci(void) {} | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | /* MCI controller setup */ | 
					
						
							|  |  |  | #if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
 | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | static int em_x270_mci_init(struct device *dev, | 
					
						
							|  |  |  | 			    irq_handler_t em_x270_detect_int, | 
					
						
							|  |  |  | 			    void *data) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | 	int err = request_irq(EM_X270_MMC_CD, em_x270_detect_int, | 
					
						
							|  |  |  | 			      IRQF_DISABLED | IRQF_TRIGGER_FALLING, | 
					
						
							|  |  |  | 			      "MMC card detect", data); | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 	if (err) { | 
					
						
							|  |  |  | 		printk(KERN_ERR "%s: can't request MMC card detect IRQ: %d\n", | 
					
						
							| 
									
										
										
										
											2008-03-04 15:08:02 -08:00
										 |  |  | 		       __func__, err); | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 		return err; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void em_x270_mci_setpower(struct device *dev, unsigned int vdd) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	   FIXME: current hardware implementation does not allow to | 
					
						
							|  |  |  | 	   enable/disable MMC power. This will be fixed in next HW releases, | 
					
						
							|  |  |  | 	   and we'll need to add implmentation here. | 
					
						
							|  |  |  | 	*/ | 
					
						
							|  |  |  | 	return; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void em_x270_mci_exit(struct device *dev, void *data) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | 	int irq = gpio_to_irq(GPIO13_MMC_CD); | 
					
						
							|  |  |  | 	free_irq(irq, data); | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct pxamci_platform_data em_x270_mci_platform_data = { | 
					
						
							|  |  |  | 	.ocr_mask	= MMC_VDD_28_29|MMC_VDD_29_30|MMC_VDD_30_31, | 
					
						
							|  |  |  | 	.init 		= em_x270_mci_init, | 
					
						
							|  |  |  | 	.setpower 	= em_x270_mci_setpower, | 
					
						
							|  |  |  | 	.exit		= em_x270_mci_exit, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | static void __init em_x270_init_mmc(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	pxa_set_mci_info(&em_x270_mci_platform_data); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | static inline void em_x270_init_mmc(void) {} | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | /* LCD 480x640 */ | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
 | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | static struct pxafb_mode_info em_x270_lcd_mode = { | 
					
						
							|  |  |  | 	.pixclock	= 50000, | 
					
						
							|  |  |  | 	.bpp		= 16, | 
					
						
							|  |  |  | 	.xres		= 480, | 
					
						
							|  |  |  | 	.yres		= 640, | 
					
						
							|  |  |  | 	.hsync_len	= 8, | 
					
						
							|  |  |  | 	.vsync_len	= 2, | 
					
						
							|  |  |  | 	.left_margin	= 8, | 
					
						
							|  |  |  | 	.upper_margin	= 0, | 
					
						
							|  |  |  | 	.right_margin	= 24, | 
					
						
							|  |  |  | 	.lower_margin	= 4, | 
					
						
							|  |  |  | 	.cmap_greyscale	= 0, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct pxafb_mach_info em_x270_lcd = { | 
					
						
							|  |  |  | 	.modes		= &em_x270_lcd_mode, | 
					
						
							|  |  |  | 	.num_modes	= 1, | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | 	.lcd_conn	= LCD_COLOR_TFT_16BPP, | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | static void __init em_x270_init_lcd(void) | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	set_pxa_fb_info(&em_x270_lcd); | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | } | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | static inline void em_x270_init_lcd(void) {} | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | #if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE)
 | 
					
						
							|  |  |  | static void __init em_x270_init_ac97(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-06-10 12:30:05 +01:00
										 |  |  | 	pxa_set_ac97_info(NULL); | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | } | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | static inline void em_x270_init_ac97(void) {} | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
 | 
					
						
							|  |  |  | static unsigned int em_x270_matrix_keys[] = { | 
					
						
							|  |  |  | 	KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B), | 
					
						
							|  |  |  | 	KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT), | 
					
						
							|  |  |  | 	KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D), | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | struct pxa27x_keypad_platform_data em_x270_keypad_info = { | 
					
						
							|  |  |  | 	/* code map for the matrix keys */ | 
					
						
							|  |  |  | 	.matrix_key_rows	= 3, | 
					
						
							|  |  |  | 	.matrix_key_cols	= 3, | 
					
						
							|  |  |  | 	.matrix_key_map		= em_x270_matrix_keys, | 
					
						
							|  |  |  | 	.matrix_key_map_size	= ARRAY_SIZE(em_x270_matrix_keys), | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void __init em_x270_init_keypad(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	pxa_set_keypad_info(&em_x270_keypad_info); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | static inline void em_x270_init_keypad(void) {} | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
 | 
					
						
							|  |  |  | static struct gpio_keys_button gpio_keys_button[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.desc	= "sleep/wakeup", | 
					
						
							|  |  |  | 		.code	= KEY_SUSPEND, | 
					
						
							|  |  |  | 		.type	= EV_PWR, | 
					
						
							|  |  |  | 		.gpio	= 1, | 
					
						
							|  |  |  | 		.wakeup	= 1, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | static struct gpio_keys_platform_data em_x270_gpio_keys_data = { | 
					
						
							|  |  |  | 	.buttons	= gpio_keys_button, | 
					
						
							|  |  |  | 	.nbuttons	= 1, | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | static struct platform_device em_x270_gpio_keys = { | 
					
						
							|  |  |  | 	.name		= "gpio-keys", | 
					
						
							|  |  |  | 	.id		= -1, | 
					
						
							|  |  |  | 	.dev		= { | 
					
						
							|  |  |  | 		.platform_data	= &em_x270_gpio_keys_data, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void __init em_x270_init_gpio_keys(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	platform_device_register(&em_x270_gpio_keys); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | static inline void em_x270_init_gpio_keys(void) {} | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void __init em_x270_init(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_pin_config)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	em_x270_init_dm9000(); | 
					
						
							|  |  |  | 	em_x270_init_rtc(); | 
					
						
							|  |  |  | 	em_x270_init_nand(); | 
					
						
							|  |  |  | 	em_x270_init_lcd(); | 
					
						
							|  |  |  | 	em_x270_init_mmc(); | 
					
						
							|  |  |  | 	em_x270_init_ohci(); | 
					
						
							|  |  |  | 	em_x270_init_keypad(); | 
					
						
							|  |  |  | 	em_x270_init_gpio_keys(); | 
					
						
							|  |  |  | 	em_x270_init_ac97(); | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-16 08:16:46 +01:00
										 |  |  | MACHINE_START(EM_X270, "Compulab EM-X270") | 
					
						
							| 
									
										
										
										
											2007-07-18 11:31:46 +01:00
										 |  |  | 	.boot_params	= 0xa0000100, | 
					
						
							|  |  |  | 	.phys_io	= 0x40000000, | 
					
						
							|  |  |  | 	.io_pg_offst	= (io_p2v(0x40000000) >> 18) & 0xfffc, | 
					
						
							|  |  |  | 	.map_io		= pxa_map_io, | 
					
						
							|  |  |  | 	.init_irq	= pxa27x_init_irq, | 
					
						
							|  |  |  | 	.timer		= &pxa_timer, | 
					
						
							|  |  |  | 	.init_machine	= em_x270_init, | 
					
						
							|  |  |  | MACHINE_END |