/*
* arch/arm/mach-pxa/raumfeld.c
*
* Support for the following Raumfeld devices:
*
* * Controller
* * Connector
* * Speaker S/M
*
* See http://www.raumfeld.com for details.
*
* Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
*
* 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/init.h>
#include <linux/kernel.h>
#include <linux/sysdev.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/gpio.h>
#include <linux/smsc911x.h>
#include <linux/input.h>
#include <linux/rotary_encoder.h>
#include <linux/gpio_keys.h>
#include <linux/input/eeti_ts.h>
#include <linux/leds.h>
#include <linux/w1-gpio.h>
#include <linux/sched.h>
#include <linux/pwm_backlight.h>
#include <linux/i2c.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_gpio.h>
#include <linux/lis3lv02d.h>
#include <linux/pda_power.h>
#include <linux/power_supply.h>
#include <linux/pda_power.h>
#include <linux/power_supply.h>
#include <linux/regulator/max8660.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/consumer.h>
#include <linux/delay.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <mach/hardware.h>
#include <mach/pxa3xx-regs.h>
#include <mach/mfp-pxa3xx.h>
#include <mach/mfp-pxa300.h>
#include <mach/ohci.h>
#include <mach/pxafb.h>
#include <mach/mmc.h>
#include <plat/i2c.h>
#include <plat/pxa3xx_nand.h>
#include "generic.h"
#include "devices.h"
#include "clock.h"
/* common GPIO definitions */
/* inputs */
#define GPIO_ON_OFF (14)
#define GPIO_VOLENC_A (19)
#define GPIO_VOLENC_B (20)
#define GPIO_CHARGE_DONE (23)
#define GPIO_CHARGE_IND (27)
#define GPIO_TOUCH_IRQ (32)
#define GPIO_ETH_IRQ (40)
#define GPIO_SPI_MISO (98)
#define GPIO_ACCEL_IRQ (104)
#define GPIO_RESCUE_BOOT (115)
#define GPIO_DOCK_DETECT (116)
#define GPIO_KEY1 (117)
#define GPIO_KEY2 (118)
#define GPIO_KEY3 (119)
#define GPIO_CHARGE_USB_OK (112)
#define GPIO_CHARGE_DC_OK (101)
#define GPIO_CHARGE_USB_SUSP (102)
/* outputs */
#define GPIO_SHUTDOWN_SUPPLY (16)
#define GPIO_SHUTDOWN_BATT (18)
#define GPIO_CHRG_PEN2 (31)
#define GPIO_TFT_VA_EN (33)
#define GPIO_SPDIF_CS (34)
#define GPIO_LED2 (35)
#define GPIO_LED1 (36)
#define GPIO_SPDIF_RESET (38)
#define GPIO_SPI_CLK (95)
#define GPIO_MCLK_DAC_CS (96)
#define GPIO_SPI_MOSI (97)
#define GPIO_W1_PULLUP_ENABLE (105)
#define GPIO_DISPLAY_ENABLE (106)
#define GPIO_MCLK_RESET (111)
#define GPIO_W2W_RESET (113)
#define GPIO_W2W_PDN (114)
#define GPIO_CODEC_RESET (120)
#define GPIO_AUDIO_VA_ENABLE (124)
#define GPIO_ACCEL_CS (125)
#define GPIO_ONE_WIRE (126)
/*
* GPIO configurations
*/
static mfp_cfg_t raumfeld_controller_pin_config[] __initdata = {
/* UART1 */
GPIO77_UART1_RXD,
GPIO78_UART1_TXD,
GPIO79_UART1_CTS,
GPIO81_UART1_DSR,
GPIO83_UART1_DTR,
GPIO84_UART1_RTS,
/* UART3 */
GPIO110_UART3_RXD,
/* USB Host */
GPIO0_2_USBH_PEN,
GPIO1_2_USBH_PWR,
/* I2C */
GPIO21_I2C_SCL | MFP_LPM_FLOAT | MFP_PULL_FLOAT,
GPIO22_I2C_SDA | MFP_LPM_FLOAT | MFP_PULL_FLOAT,
/* SPI */
GPIO34_GPIO, /* SPDIF_CS */
GPIO96_GPIO, /* MCLK_CS */
GPIO125_GPIO, /* ACCEL_CS */
/* MMC */
GPIO3_MMC1_DAT0,
GPIO4_MMC1_DAT1,
GPIO5_MMC1_DAT2,
GPIO6_MMC1_DAT3,
GPIO7_MMC1_CLK,
GPIO8_MMC1_CMD,
/* One-wire */
GPIO126_GPIO | MFP_LPM_FLOAT,
GPIO105_GPIO | MFP_PULL_LOW | MFP_LPM_PULL_LOW,
/* CHRG_USB_OK */
GPIO101_GPIO | MFP_PULL_HIGH,
/* CHRG_USB_OK */
GPIO112_GPIO | MFP_PULL_HIGH,
/* CHRG_USB_SUSP */
GPIO102_GPIO,
/* DISPLAY_ENABLE */
GPIO106_GPIO,
/* DOCK_DETECT */
GPIO116_GPIO | MFP_LPM_FLOAT | MFP_PULL_FLOAT,
/* LCD */
GPIO54_LCD_LDD_0,
GPIO55_LCD_LDD_1,
GPIO56_LCD_LDD_2,
GPIO57_LCD_LDD_3,
GPIO58_LCD_LDD_4,
GPIO59_LCD_LDD_5,
GPIO60_LCD_LDD_6,
GPIO61_LCD_LDD_7,
GPIO62_LCD_LDD_8,
GPIO63_LCD_LDD_9,
GPIO64_LCD_LDD_10,
GPIO65_LCD_LDD_11,
GPIO66_LCD_LDD_12,
GPIO67_LCD_LDD_13,
GPIO68_LCD_LDD_14,
GPIO69_LCD_LDD_15,
GPIO70_LCD_LDD_16,
GPIO71_LCD_LDD_17,
GPIO72_LCD_FCLK,
GPIO73_LCD_LCLK,
GPIO74_LCD_PCLK,
GPIO75_LCD_BIAS,
};
static mfp_cfg_t raumfeld_connector_pin_config[] __initdata = {
/* UART1 */
GPIO77_UART1_RXD,
GPIO78_UART1_TXD,
GPIO79_UART1_CTS,
GPIO81_UART1_DSR,
GPIO83_UART1_DTR,
GPIO84_UART1_RTS,
/* UART3 */
GPIO110_UART3_RXD,
/* USB Host */
GPIO0_2_USBH_PEN,
GPIO1_2_USBH_PWR,
/* I2C */
GPIO21_I2C_SCL | MFP_LPM_FLOAT | MFP_PULL_FLOAT,
GPIO22_I2C_SDA | MFP_LPM_FLOAT | MFP_PULL_FLOAT,
/* SPI */
GPIO34_GPIO, /* SPDIF_CS */
GPIO96_GPIO, /* MCLK_CS */
GPIO125_GPIO, /* ACCEL_CS */
/* MMC */
GPIO3_MMC1_DAT0,
GPIO4_MMC1_DAT1,
GPIO5_MMC1_DAT2,
GPIO6_MMC1_DAT3,
GPIO7_MMC1_CLK,
GPIO8_MMC1_CMD,
/* Ethernet */
GPIO1_nCS2, /* CS */
GPIO40_GPIO | MFP_PULL_HIGH, /* IRQ */
/* SSP for I2S */
GPIO85_SSP1_SCLK,
GPIO89_SSP1_EXTCLK,
GPIO86_SSP1_FRM,
GPIO87_SSP1_TXD,
GPIO88_SSP1_RXD,
GPIO90_SSP1_SYSCLK,
/* SSP2 for S/PDIF */
GPIO25_SSP2_SCLK,
GPIO26_SSP2_FRM,
GPIO27_SSP2_TXD,
GPIO29_SSP2_EXTCLK,
/* LEDs */
GPIO35_GPIO | MFP_LPM