| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 | /* *  linux/arch/arm/mach-pxa/balloon3.c * *  Support for Balloonboard.org Balloon3 board. * *  Author:	Nick Bane, Wookey, Jonathan McDowell *  Created:	June, 2006 *  Copyright:	Toby Churchill Ltd *  Derived from mainstone.c, by Nico Pitre * *  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/export.h>#include <linux/init.h>#include <linux/platform_device.h>#include <linux/interrupt.h>#include <linux/sched.h>#include <linux/bitops.h>#include <linux/fb.h>#include <linux/gpio.h>#include <linux/ioport.h>#include <linux/ucb1400.h>#include <linux/mtd/mtd.h>#include <linux/mtd/partitions.h>#include <linux/types.h>#include <linux/i2c/pcf857x.h>#include <linux/i2c/pxa-i2c.h>#include <linux/mtd/nand.h>#include <linux/mtd/physmap.h>#include <linux/regulator/max1586.h>#include <asm/setup.h>#include <asm/mach-types.h>#include <asm/irq.h>#include <asm/sizes.h>#include <asm/mach/arch.h>#include <asm/mach/map.h>#include <asm/mach/irq.h>#include <asm/mach/flash.h>#include <mach/pxa27x.h>#include <mach/balloon3.h>#include <mach/audio.h>#include <linux/platform_data/video-pxafb.h>#include <linux/platform_data/mmc-pxamci.h>#include <mach/udc.h>#include <mach/pxa27x-udc.h>#include <linux/platform_data/irda-pxaficp.h>#include <linux/platform_data/usb-ohci-pxa27x.h>#include "generic.h"#include "devices.h"/****************************************************************************** * Pin configuration ******************************************************************************/static unsigned long balloon3_pin_config[] __initdata = {	/* Select BTUART 'COM1/ttyS0' as IO option for pins 42/43/44/45 */	GPIO42_BTUART_RXD,	GPIO43_BTUART_TXD,	GPIO44_BTUART_CTS,	GPIO45_BTUART_RTS,	/* Reset, configured as GPIO wakeup source */	GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,};/****************************************************************************** * Compatibility: Parameter parsing ******************************************************************************/static unsigned long balloon3_irq_enabled;static unsigned long balloon3_features_present =		(1 << BALLOON3_FEATURE_OHCI) | (1 << BALLOON3_FEATURE_CF) |		(1 << BALLOON3_FEATURE_AUDIO) |		(1 << BALLOON3_FEATURE_TOPPOLY);int balloon3_has(enum balloon3_features feature){	return (balloon3_features_present & (1 << feature)) ? 1 : 0;}EXPORT_SYMBOL_GPL(balloon3_has);int __init parse_balloon3_features(char *arg){	if (!arg)		return 0;	return strict_strtoul(arg, 0, &balloon3_features_present);}early_param("balloon3_features", parse_balloon3_features);/****************************************************************************** * Compact Flash slot ******************************************************************************/#if	defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)static unsigned long balloon3_cf_pin_config[] __initdata = {	GPIO48_nPOE,	GPIO49_nPWE,	GPIO50_nPIOR,	GPIO51_nPIOW,	GPIO85_nPCE_1,	GPIO54_nPCE_2,	GPIO79_PSKTSEL,	GPIO55_nPREG,	GPIO56_nPWAIT,	GPIO57_nIOIS16,};static void __init balloon3_cf_init(void){	if (!balloon3_has(BALLOON3_FEATURE_CF))		return;	pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_cf_pin_config));}#elsestatic inline void balloon3_cf_init(void) {}#endif/****************************************************************************** * NOR Flash ******************************************************************************/#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)static struct mtd_partition balloon3_nor_partitions[] = {	{		.name		= "Flash",		.offset		= 0x00000000,		.size		= MTDPART_SIZ_FULL,	}};static struct physmap_flash_data balloon3_flash_data[] = {	{		.width		= 2,	/* bankwidth in bytes */		.parts		= balloon3_nor_partitions,		.nr_parts	= ARRAY_SIZE(balloon3_nor_partitions)	}};static struct resource balloon3_flash_resource = {	.start	= PXA_CS0_PHYS,	.end	= PXA_CS0_PHYS + SZ_64M - 1,	.flags	= IORESOURCE_MEM,};static struct platform_device balloon3_flash = {	.name		= "physmap-flash",	.id		= 0,	.resource	= &balloon3_flash_resource,	.num_resources	= 1,	.dev 		= {		.platform_data = balloon3_flash_data,	},};static void __init balloon3_nor_init(void){	platform_device_register(&balloon3_flash);}#elsestatic inline void balloon3_nor_init(void) {}#endif/****************************************************************************** * Audio and Touchscreen ******************************************************************************/#if	defined(CONFIG_TOUCHSCREEN_UCB1400) || \	defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)static unsigned long balloon3_ac97_pin_config[] __initdata = {	GPIO28_AC97_BITCLK,	GPIO29_AC97_SDATA_IN_0,	GPIO30_AC97_SDATA_OUT,	GPIO31_AC97_SYNC,	GPIO113_AC97_nRESET,	GPIO95_GPIO,};static struct ucb1400_pdata vpac270_ucb1400_pdata = {	.irq		= PXA_GPIO_TO_IRQ(BALLOON3_GPIO_CODEC_IRQ),};static struct platform_device balloon3_ucb1400_device = {	.name		= "ucb1400_core",	.id		= -1,	.dev		= {		.platform_data = &vpac270_ucb1400_pdata,	},};static void __init balloon3_ts_init(void){	if (!balloon3_has(BALLOON3_FEATURE_AUDIO))		return;	pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_ac97_pin_config));	pxa_set_ac97_info(NULL);	platform_device_register(&balloon3_ucb1400_device);}#elsestatic inline void balloon3_ts_init(void) {}#endif/****************************************************************************** * Framebuffer ******************************************************************************/#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)static unsigned long balloon3_lcd_pin_config[] __initdata = {	GPIOxx_LCD_TFT_16BPP,	GPIO99_GPIO,};static struct pxafb_mode_info balloon3_lcd_modes[] = {	{		.pixclock		= 38000,		.xres			= 480,		.yres			= 640,		.bpp			= 16,		.hsync_len		= 8,		.left_margin		= 8,		.right_margin		= 8,		.vsync_len		= 2,		.upper_margin		= 4,		.lower_margin		= 5,		.sync			= 0,	},};static struct pxafb_mach_info balloon3_lcd_screen = {	.modes			= balloon3_lcd_modes,	.num_modes		= ARRAY_SIZE(balloon3_lcd_modes),	.lcd_conn		= LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,};static void balloon3_backlight_power(int on){	gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on);
 |