/*
* Support for Sharp SL-C6000x PDAs
* Model: (Tosa)
*
* Copyright (c) 2005 Dirk Opfer
*
* Based on code written by Sharp/Lineo for 2.4 kernels
*
* 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/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/major.h>
#include <linux/fs.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/fb.h>
#include <linux/mmc/host.h>
#include <linux/mfd/tc6393xb.h>
#include <linux/mfd/tmio.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h>
#include <linux/pm.h>
#include <linux/gpio_keys.h>
#include <linux/input.h>
#include <linux/gpio.h>
#include <linux/pda_power.h>
#include <linux/spi/spi.h>
#include <linux/spi/pxa2xx_spi.h>
#include <linux/input/matrix_keypad.h>
#include <linux/i2c/pxa-i2c.h>
#include <linux/usb/gpio_vbus.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
#include <mach/pxa25x.h>
#include <mach/reset.h>
#include <mach/irda.h>
#include <mach/mmc.h>
#include <mach/udc.h>
#include <mach/tosa_bt.h>
#include <mach/audio.h>
#include <mach/smemc.h>
#include <asm/mach/arch.h>
#include <mach/tosa.h>
#include <asm/hardware/scoop.h>
#include <asm/mach/sharpsl_param.h>
#include "generic.h"
#include "clock.h"
#include "devices.h"
static unsigned long tosa_pin_config[] = {
GPIO78_nCS_2, /* Scoop */
GPIO80_nCS_4, /* tg6393xb */
GPIO33_nCS_5, /* Scoop */
// GPIO76 CARD_VCC_ON1
GPIO19_GPIO, /* Reset out */
GPIO1_RST | WAKEUP_ON_EDGE_FALL,
GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* WAKE_UP */
GPIO2_GPIO | WAKEUP_ON_EDGE_BOTH, /* AC_IN */
GPIO3_GPIO | WAKEUP_ON_EDGE_FALL, /* RECORD */
GPIO4_GPIO | WAKEUP_ON_EDGE_FALL, /* SYNC */
GPIO20_GPIO, /* EAR_IN */
GPIO22_GPIO, /* On */
GPIO5_GPIO, /* USB_IN */
GPIO32_GPIO, /* Pen IRQ */
GPIO7_GPIO, /* Jacket Detect */
GPIO14_GPIO, /* BAT0_CRG */
GPIO12_GPIO, /* BAT1_CRG */
GPIO17_GPIO, /* BAT0_LOW */
GPIO84_GPIO, /* BAT1_LOW */
GPIO38_GPIO, /* BAT_LOCK */
GPIO11_3_6MHz,
GPIO15_GPIO, /* TC6393XB IRQ */
GPIO18_RDY,
GPIO27_GPIO, /* LCD Sync */
/* MMC */
GPIO6_MMC_CLK,
GPIO8_MMC_CS0,
GPIO9_GPIO, /* Detect */
GPIO10_GPIO, /* nSD_INT */
/* CF */
GPIO13_GPIO, /* CD_IRQ */
GPIO21_GPIO, /* Main Slot IRQ */
GPIO36_GPIO, /* Jacket Slot IRQ */
GPIO48_nPOE,
GPIO49_nPWE,
GPIO50_nPIOR,
GPIO51_nPIOW,
GPIO52_nPCE_1,
GPIO53_nPCE_2,
GPIO54_nPSKTSEL,
GPIO55_nPREG,
GPIO56_nPWAIT,
GPIO57_nIOIS16,
/* AC97 */
GPIO31_AC97_SYNC,
GPIO30_AC97_SDATA_OUT,
GPIO28_AC97_BITCLK,
GPIO29_AC97_SDATA_IN_0,
// GPIO79 nAUD_IRQ
/* FFUART */
GPIO34_FFUART_RXD,
GPIO35_FFUART_CTS,
GPIO37_FFUART_DSR,
GPIO39_FFUART_TXD,
GPIO40_FFUART_DTR,
GPIO41_FFUART_RTS,
/* BTUART */
GPIO42_BTUART_RXD,
GPIO43_BTUART_TXD,
GPIO44_BTUART_CTS,
GPIO45_BTUART_RTS,
/* Keybd */
GPIO58_GPIO | MFP_LPM_DRIVE_LOW, /* Column 0 */
GPIO59_GPIO | MFP_LPM_DRIVE_LOW, /* Column 1 */
GPIO60_GPIO | MFP_LPM_DRIVE_LOW, /* Column 2 */
GPIO61_GPIO | MFP_LPM_DRIVE_LOW, /* Column 3 */
GPIO62_GPIO | MFP_LPM_DRIVE_LOW, /* Column 4 */
GPIO63_GPIO | MFP_LPM_DRIVE_LOW, /* Column 5 */
GPIO64_GPIO | MFP_LPM_DRIVE_LOW, /* Column 6 */
GPIO65_GPIO | MFP_LPM_DRIVE_LOW, /* Column 7 */
GPIO66_GPIO | MFP_LPM_DRIVE_LOW, /* Column 8 */
GPIO67_GPIO | MFP_LPM_DRIVE_LOW, /* Column 9 */
GPIO68_GPIO | MFP_LPM_DRIVE_LOW, /* Column 10 */
GPIO69_GPIO | MFP_LPM_DRIVE_LOW, /* Row 0 */
GPIO70_GPIO | MFP_LPM_DRIVE_LOW, /* Row 1 */
GPIO71_GPIO | MFP_LPM_DRIVE_LOW, /* Row 2 */
GPIO72_GPIO | MFP_LPM_DRIVE_LOW, /* Row 3 */
GPIO73_GPIO | MFP_LPM_DRIVE_LOW, /* Row 4 */
GPIO74_GPIO | MFP_LPM_DRIVE_LOW, /* Row 5 */
GPIO75_GPIO | MFP_LPM_DRIVE_LOW, /* Row 6 */
/* SPI */
GPIO81_SSP2_CLK_OUT,
GPIO82_SSP2_FRM_OUT,
GPIO83_SSP2_TXD,
/* IrDA is managed in other way */
GPIO46_GPIO,
GPIO47_GPIO,
};
/*
* SCOOP Device
*/
static struct resource tosa_scoop_resources[] = {
[0] = {
.start = TOSA_CF_PHYS,
.end = TOSA_CF_PHYS + 0xfff,
.flags = IORESOURCE_MEM,
},
};
static struct scoop_config tosa_scoop_setup = {
.io_dir = TOSA_SCOOP_IO_DIR,
.gpio_base = TOSA_SCOOP_GPIO_BASE,
};
static struct platform_device tosascoop_device = {
.name = "sharp-scoop",
.id = 0,
.dev = {
.platform_data = &tosa_scoop_setup,
},
.num_resources = ARRAY_SIZE(tosa_scoop_resources),
.resource = tosa_scoop_resources,
};
/*
* SCOOP Device Jacket
*/
static struct resource tosa_scoop_jc_resources[] = {
[0] = {
.start = TOSA_SCOOP_PHYS + 0x40,
.end = TOSA_SCOOP_PHYS + 0xfff,
.flags = IORESOURCE_MEM,
},
};
static struct scoop_config tosa_scoop_jc_setup = {
.io_dir = TOSA_SCOOP_JC_IO_DIR,
.gpio_base = TOS