2019-06-04 08:11:33 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2005-11-06 14:27:52 +00:00
|
|
|
/*
|
|
|
|
* Support for Sharp SL-C6000x PDAs
|
|
|
|
* Model: (Tosa)
|
|
|
|
*
|
|
|
|
* Copyright (c) 2005 Dirk Opfer
|
|
|
|
*
|
|
|
|
* Based on code written by Sharp/Lineo for 2.4 kernels
|
|
|
|
*/
|
|
|
|
|
2015-03-09 11:03:00 +00:00
|
|
|
#include <linux/clkdev.h>
|
2005-11-06 14:27:52 +00:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/init.h>
|
2005-11-21 15:17:06 +00:00
|
|
|
#include <linux/platform_device.h>
|
2005-11-06 14:27:52 +00:00
|
|
|
#include <linux/major.h>
|
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <linux/interrupt.h>
|
2008-06-14 10:42:02 +00:00
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/fb.h>
|
2005-11-06 14:27:52 +00:00
|
|
|
#include <linux/mmc/host.h>
|
2008-06-14 10:42:02 +00:00
|
|
|
#include <linux/mfd/tc6393xb.h>
|
2008-06-27 09:38:44 +00:00
|
|
|
#include <linux/mfd/tmio.h>
|
2017-08-04 15:29:10 +00:00
|
|
|
#include <linux/mtd/rawnand.h>
|
2008-06-27 09:38:44 +00:00
|
|
|
#include <linux/mtd/partitions.h>
|
2008-11-24 21:57:27 +00:00
|
|
|
#include <linux/mtd/physmap.h>
|
2006-06-19 18:57:12 +00:00
|
|
|
#include <linux/pm.h>
|
2008-01-21 06:04:20 +00:00
|
|
|
#include <linux/gpio_keys.h>
|
|
|
|
#include <linux/input.h>
|
2008-04-12 19:16:16 +00:00
|
|
|
#include <linux/gpio.h>
|
2018-12-02 08:43:22 +00:00
|
|
|
#include <linux/gpio/machine.h>
|
2014-10-24 17:14:22 +00:00
|
|
|
#include <linux/power/gpio-charger.h>
|
2008-09-13 17:06:41 +00:00
|
|
|
#include <linux/spi/spi.h>
|
2010-11-23 01:12:15 +00:00
|
|
|
#include <linux/spi/pxa2xx_spi.h>
|
2010-01-01 07:28:21 +00:00
|
|
|
#include <linux/input/matrix_keypad.h>
|
2017-11-13 17:27:39 +00:00
|
|
|
#include <linux/platform_data/i2c-pxa.h>
|
2013-07-08 23:01:40 +00:00
|
|
|
#include <linux/reboot.h>
|
2014-04-13 21:54:58 +00:00
|
|
|
#include <linux/memblock.h>
|
2005-11-06 14:27:52 +00:00
|
|
|
|
|
|
|
#include <asm/setup.h>
|
|
|
|
#include <asm/mach-types.h>
|
2009-01-02 15:17:22 +00:00
|
|
|
|
2015-01-30 09:45:33 +00:00
|
|
|
#include "pxa25x.h"
|
2022-04-04 20:37:04 +00:00
|
|
|
#include "reset.h"
|
2012-08-24 13:16:48 +00:00
|
|
|
#include <linux/platform_data/irda-pxaficp.h>
|
|
|
|
#include <linux/platform_data/mmc-pxamci.h>
|
2015-01-30 09:45:33 +00:00
|
|
|
#include "udc.h"
|
|
|
|
#include "tosa_bt.h"
|
2019-09-01 22:02:08 +00:00
|
|
|
#include <linux/platform_data/asoc-pxa.h>
|
2022-04-04 20:37:04 +00:00
|
|
|
#include "smemc.h"
|
2005-11-06 14:27:52 +00:00
|
|
|
|
|
|
|
#include <asm/mach/arch.h>
|
2022-04-04 20:37:04 +00:00
|
|
|
#include "tosa.h"
|
2005-11-06 14:27:52 +00:00
|
|
|
|
|
|
|
#include <asm/hardware/scoop.h>
|
|
|
|
#include <asm/mach/sharpsl_param.h>
|
|
|
|
|
|
|
|
#include "generic.h"
|
2007-05-15 14:39:36 +00:00
|
|
|
#include "devices.h"
|
2005-11-06 14:27:52 +00:00
|
|
|
|
2008-04-10 10:00:32 +00:00
|
|
|
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 */
|
2008-06-09 12:23:50 +00:00
|
|
|
GPIO10_GPIO, /* nSD_INT */
|
2008-04-10 10:00:32 +00:00
|
|
|
|
|
|
|
/* 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 */
|
2010-01-01 07:28:21 +00:00
|
|
|
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 */
|
2008-04-10 10:00:32 +00:00
|
|
|
|
|
|
|
/* SPI */
|
|
|
|
GPIO81_SSP2_CLK_OUT,
|
|
|
|
GPIO82_SSP2_FRM_OUT,
|
|
|
|
GPIO83_SSP2_TXD,
|
2008-06-12 10:42:07 +00:00
|
|
|
|
2008-07-02 12:54:46 +00:00
|
|
|
/* IrDA is managed in other way */
|
|
|
|
GPIO46_GPIO,
|
|
|
|
GPIO47_GPIO,
|
2008-06-12 10:42:07 +00:00
|
|
|
};
|
|
|
|
|
2005-11-06 14:27:52 +00:00
|
|
|
/*
|
|
|
|
* 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,
|
2008-04-12 19:16:16 +00:00
|
|
|
.gpio_base = TOSA_SCOOP_GPIO_BASE,
|
2005-11-06 14:27:52 +00:00
|
|
|
};
|
|
|
|
|
2008-04-19 09:42:25 +00:00
|
|
|
static struct platform_device tosascoop_device = {
|
2005-11-06 14:27:52 +00:00
|
|
|
.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,
|
2008-04-12 19:16:16 +00:00
|
|
|
.gpio_base = TOSA_SCOOP_JC_GPIO_BASE,
|
2005-11-06 14:27:52 +00:00
|
|
|
};
|
|
|
|
|
2008-04-19 09:42:25 +00:00
|
|
|
static struct platform_device tosascoop_jc_device = {
|
2005-11-06 14:27:52 +00:00
|
|
|
.name = "sharp-scoop",
|
|
|
|
.id = 1,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &tosa_scoop_jc_setup,
|
|
|
|
.parent = &tosascoop_device.dev,
|
|
|
|
},
|
|
|
|
.num_resources = ARRAY_SIZE(tosa_scoop_jc_resources),
|
|
|
|
.resource = tosa_scoop_jc_resources,
|
|
|
|
};
|
|
|
|
|
2005-11-08 19:15:50 +00:00
|
|
|
/*
|
|
|
|
* PCMCIA
|
|
|
|
*/
|
2005-11-06 14:27:52 +00:00
|
|
|
static struct scoop_pcmcia_dev tosa_pcmcia_scoop[] = {
|
|
|
|
{
|
|
|
|
.dev = &tosascoop_device.dev,
|
|
|
|
.irq = TOSA_IRQ_GPIO_CF_IRQ,
|
|
|
|
.cd_irq = TOSA_IRQ_GPIO_CF_CD,
|
|
|
|
.cd_irq_str = "PCMCIA0 CD",
|
|
|
|
},{
|
|
|
|
.dev = &tosascoop_jc_device.dev,
|
|
|
|
.irq = TOSA_IRQ_GPIO_JC_CF_IRQ,
|
|
|
|
.cd_irq = -1,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2005-11-08 19:15:50 +00:00
|
|
|
static struct scoop_pcmcia_config tosa_pcmcia_config = {
|
|
|
|
.devs = &tosa_pcmcia_scoop[0],
|
|
|
|
.num_devs = 2,
|
|
|
|
};
|
|
|
|
|
2005-11-08 19:15:30 +00:00
|
|
|
/*
|
|
|
|
* USB Device Controller
|
|
|
|
*/
|
2020-01-23 15:50:13 +00:00
|
|
|
static struct gpiod_lookup_table tosa_udc_gpiod_table = {
|
|
|
|
.dev_id = "gpio-vbus",
|
|
|
|
.table = {
|
|
|
|
GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_USB_IN,
|
|
|
|
"vbus", GPIO_ACTIVE_LOW),
|
|
|
|
GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_USB_PULLUP,
|
|
|
|
"pullup", GPIO_ACTIVE_HIGH),
|
|
|
|
{ },
|
|
|
|
},
|
2005-11-08 19:15:30 +00:00
|
|
|
};
|
|
|
|
|
2011-02-14 12:33:18 +00:00
|
|
|
static struct platform_device tosa_gpio_vbus = {
|
|
|
|
.name = "gpio-vbus",
|
|
|
|
.id = -1,
|
|
|
|
};
|
|
|
|
|
2005-11-08 19:15:30 +00:00
|
|
|
/*
|
|
|
|
* MMC/SD Device
|
|
|
|
*/
|
2006-10-09 11:19:47 +00:00
|
|
|
static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void *data)
|
2005-11-08 19:15:30 +00:00
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
2008-06-09 12:23:50 +00:00
|
|
|
err = gpio_request(TOSA_GPIO_nSD_INT, "SD Int");
|
|
|
|
if (err) {
|
|
|
|
printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n");
|
|
|
|
goto err_gpio_int;
|
|
|
|
}
|
|
|
|
err = gpio_direction_input(TOSA_GPIO_nSD_INT);
|
|
|
|
if (err)
|
|
|
|
goto err_gpio_int_dir;
|
|
|
|
|
2008-04-12 19:16:16 +00:00
|
|
|
return 0;
|
|
|
|
|
2008-06-09 12:23:50 +00:00
|
|
|
err_gpio_int_dir:
|
|
|
|
gpio_free(TOSA_GPIO_nSD_INT);
|
|
|
|
err_gpio_int:
|
2008-01-23 14:05:58 +00:00
|
|
|
return err;
|
2005-11-08 19:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void tosa_mci_exit(struct device *dev, void *data)
|
|
|
|
{
|
2008-06-09 12:23:50 +00:00
|
|
|
gpio_free(TOSA_GPIO_nSD_INT);
|
2005-11-08 19:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct pxamci_platform_data tosa_mci_platform_data = {
|
2010-04-13 23:00:42 +00:00
|
|
|
.detect_delay_ms = 250,
|
2009-07-06 20:16:42 +00:00
|
|
|
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
|
|
|
|
.init = tosa_mci_init,
|
|
|
|
.exit = tosa_mci_exit,
|
2005-11-08 19:15:30 +00:00
|
|
|
};
|
|
|
|
|
2018-12-02 08:43:22 +00:00
|
|
|
static struct gpiod_lookup_table tosa_mci_gpio_table = {
|
|
|
|
.dev_id = "pxa2xx-mci.0",
|
|
|
|
.table = {
|
|
|
|
GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_nSD_DETECT,
|
|
|
|
"cd", GPIO_ACTIVE_LOW),
|
2019-09-11 20:31:51 +00:00
|
|
|
GPIO_LOOKUP("sharp-scoop.0", TOSA_GPIO_SD_WP - TOSA_SCOOP_GPIO_BASE,
|
2018-12-02 08:43:22 +00:00
|
|
|
"wp", GPIO_ACTIVE_LOW),
|
2019-09-11 20:31:51 +00:00
|
|
|
GPIO_LOOKUP("sharp-scoop.0", TOSA_GPIO_PWR_ON - TOSA_SCOOP_GPIO_BASE,
|
2018-12-02 08:43:27 +00:00
|
|
|
"power", GPIO_ACTIVE_HIGH),
|
2018-12-02 08:43:22 +00:00
|
|
|
{ },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2005-11-08 19:15:30 +00:00
|
|
|
/*
|
|
|
|
* Irda
|
|
|
|
*/
|
2008-06-12 10:42:07 +00:00
|
|
|
static void tosa_irda_transceiver_mode(struct device *dev, int mode)
|
|
|
|
{
|
|
|
|
if (mode & IR_OFF) {
|
|
|
|
gpio_set_value(TOSA_GPIO_IR_POWERDWN, 0);
|
2008-07-02 12:54:46 +00:00
|
|
|
pxa2xx_transceiver_mode(dev, mode);
|
2008-06-12 10:42:07 +00:00
|
|
|
gpio_direction_output(TOSA_GPIO_IRDA_TX, 0);
|
|
|
|
} else {
|
2008-07-02 12:54:46 +00:00
|
|
|
pxa2xx_transceiver_mode(dev, mode);
|
2008-06-12 10:42:07 +00:00
|
|
|
gpio_set_value(TOSA_GPIO_IR_POWERDWN, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-12 19:16:16 +00:00
|
|
|
static int tosa_irda_startup(struct device *dev)
|
2005-11-08 19:15:30 +00:00
|
|
|
{
|
2008-04-12 19:16:16 +00:00
|
|
|
int ret;
|
|
|
|
|
2008-06-12 10:42:07 +00:00
|
|
|
ret = gpio_request(TOSA_GPIO_IRDA_TX, "IrDA TX");
|
|
|
|
if (ret)
|
|
|
|
goto err_tx;
|
|
|
|
ret = gpio_direction_output(TOSA_GPIO_IRDA_TX, 0);
|
|
|
|
if (ret)
|
|
|
|
goto err_tx_dir;
|
|
|
|
|
2008-04-12 19:16:16 +00:00
|
|
|
ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown");
|
|
|
|
if (ret)
|
2008-06-12 10:42:07 +00:00
|
|
|
goto err_pwr;
|
2008-04-12 19:16:16 +00:00
|
|
|
|
|
|
|
ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0);
|
|
|
|
if (ret)
|
2008-06-12 10:42:07 +00:00
|
|
|
goto err_pwr_dir;
|
2008-04-12 19:16:16 +00:00
|
|
|
|
2008-06-12 10:42:07 +00:00
|
|
|
tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
|
2008-04-12 19:16:16 +00:00
|
|
|
|
2008-06-12 10:42:07 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_pwr_dir:
|
2008-04-12 19:16:16 +00:00
|
|
|
gpio_free(TOSA_GPIO_IR_POWERDWN);
|
2008-06-12 10:42:07 +00:00
|
|
|
err_pwr:
|
|
|
|
err_tx_dir:
|
|
|
|
gpio_free(TOSA_GPIO_IRDA_TX);
|
|
|
|
err_tx:
|
|
|
|
return ret;
|
2008-04-12 19:16:16 +00:00
|
|
|
}
|
|
|
|
|
2008-06-12 10:42:07 +00:00
|
|
|
static void tosa_irda_shutdown(struct device *dev)
|
2008-04-12 19:16:16 +00:00
|
|
|
{
|
2008-06-12 10:42:07 +00:00
|
|
|
tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
|
|
|
|
gpio_free(TOSA_GPIO_IR_POWERDWN);
|
|
|
|
gpio_free(TOSA_GPIO_IRDA_TX);
|
2005-11-08 19:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct pxaficp_platform_data tosa_ficp_platform_data = {
|
2009-07-17 10:50:43 +00:00
|
|
|
.gpio_pwdown = -1,
|
|
|
|
.transceiver_cap = IR_SIRMODE | IR_OFF,
|
|
|
|
.transceiver_mode = tosa_irda_transceiver_mode,
|
|
|
|
.startup = tosa_irda_startup,
|
|
|
|
.shutdown = tosa_irda_shutdown,
|
2005-11-08 19:15:30 +00:00
|
|
|
};
|
|
|
|
|
2008-06-14 10:43:36 +00:00
|
|
|
/*
|
|
|
|
* Tosa AC IN
|
|
|
|
*/
|
2020-08-27 08:48:28 +00:00
|
|
|
static struct gpiod_lookup_table tosa_power_gpiod_table = {
|
|
|
|
.dev_id = "gpio-charger",
|
|
|
|
.table = {
|
|
|
|
GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_AC_IN,
|
|
|
|
NULL, GPIO_ACTIVE_LOW),
|
|
|
|
{ },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2008-06-14 10:43:36 +00:00
|
|
|
static char *tosa_ac_supplied_to[] = {
|
|
|
|
"main-battery",
|
|
|
|
"backup-battery",
|
|
|
|
"jacket-battery",
|
|
|
|
};
|
|
|
|
|
2014-10-24 17:14:22 +00:00
|
|
|
static struct gpio_charger_platform_data tosa_power_data = {
|
|
|
|
.name = "charger",
|
|
|
|
.type = POWER_SUPPLY_TYPE_MAINS,
|
2008-06-14 10:43:36 +00:00
|
|
|
.supplied_to = tosa_ac_supplied_to,
|
|
|
|
.num_supplicants = ARRAY_SIZE(tosa_ac_supplied_to),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource tosa_power_resource[] = {
|
|
|
|
{
|
|
|
|
.name = "ac",
|
2011-10-10 08:03:51 +00:00
|
|
|
.start = PXA_GPIO_TO_IRQ(TOSA_GPIO_AC_IN),
|
|
|
|
.end = PXA_GPIO_TO_IRQ(TOSA_GPIO_AC_IN),
|
2008-06-14 10:43:36 +00:00
|
|
|
.flags = IORESOURCE_IRQ |
|
|
|
|
IORESOURCE_IRQ_HIGHEDGE |
|
|
|
|
IORESOURCE_IRQ_LOWEDGE,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device tosa_power_device = {
|
2014-10-24 17:14:22 +00:00
|
|
|
.name = "gpio-charger",
|
2008-06-14 10:43:36 +00:00
|
|
|
.id = -1,
|
|
|
|
.dev.platform_data = &tosa_power_data,
|
|
|
|
.resource = tosa_power_resource,
|
|
|
|
.num_resources = ARRAY_SIZE(tosa_power_resource),
|
|
|
|
};
|
|
|
|
|
2005-11-08 19:15:30 +00:00
|
|
|
/*
|
|
|
|
* Tosa Keyboard
|
|
|
|
*/
|
2010-01-01 07:28:21 +00:00
|
|
|
static const uint32_t tosakbd_keymap[] = {
|
2013-11-16 12:47:50 +00:00
|
|
|
KEY(0, 1, KEY_W),
|
|
|
|
KEY(0, 5, KEY_K),
|
|
|
|
KEY(0, 6, KEY_BACKSPACE),
|
|
|
|
KEY(0, 7, KEY_P),
|
|
|
|
KEY(1, 0, KEY_Q),
|
|
|
|
KEY(1, 1, KEY_E),
|
|
|
|
KEY(1, 2, KEY_T),
|
|
|
|
KEY(1, 3, KEY_Y),
|
|
|
|
KEY(1, 5, KEY_O),
|
|
|
|
KEY(1, 6, KEY_I),
|
|
|
|
KEY(1, 7, KEY_COMMA),
|
|
|
|
KEY(2, 0, KEY_A),
|
|
|
|
KEY(2, 1, KEY_D),
|
|
|
|
KEY(2, 2, KEY_G),
|
|
|
|
KEY(2, 3, KEY_U),
|
|
|
|
KEY(2, 5, KEY_L),
|
|
|
|
KEY(2, 6, KEY_ENTER),
|
|
|
|
KEY(2, 7, KEY_DOT),
|
|
|
|
KEY(3, 0, KEY_Z),
|
|
|
|
KEY(3, 1, KEY_C),
|
|
|
|
KEY(3, 2, KEY_V),
|
|
|
|
KEY(3, 3, KEY_J),
|
|
|
|
KEY(3, 4, TOSA_KEY_ADDRESSBOOK),
|
|
|
|
KEY(3, 5, TOSA_KEY_CANCEL),
|
|
|
|
KEY(3, 6, TOSA_KEY_CENTER),
|
|
|
|
KEY(3, 7, TOSA_KEY_OK),
|
|
|
|
KEY(3, 8, KEY_LEFTSHIFT),
|
|
|
|
KEY(4, 0, KEY_S),
|
|
|
|
KEY(4, 1, KEY_R),
|
|
|
|
KEY(4, 2, KEY_B),
|
|
|
|
KEY(4, 3, KEY_N),
|
|
|
|
KEY(4, 4, TOSA_KEY_CALENDAR),
|
|
|
|
KEY(4, 5, TOSA_KEY_HOMEPAGE),
|
|
|
|
KEY(4, 6, KEY_LEFTCTRL),
|
|
|
|
KEY(4, 7, TOSA_KEY_LIGHT),
|
|
|
|
KEY(4, 9, KEY_RIGHTSHIFT),
|
|
|
|
KEY(5, 0, KEY_TAB),
|
|
|
|
KEY(5, 1, KEY_SLASH),
|
|
|
|
KEY(5, 2, KEY_H),
|
|
|
|
KEY(5, 3, KEY_M),
|
|
|
|
KEY(5, 4, TOSA_KEY_MENU),
|
|
|
|
KEY(5, 6, KEY_UP),
|
|
|
|
KEY(5, 10, TOSA_KEY_FN),
|
|
|
|
KEY(6, 0, KEY_X),
|
|
|
|
KEY(6, 1, KEY_F),
|
|
|
|
KEY(6, 2, KEY_SPACE),
|
|
|
|
KEY(6, 3, KEY_APOSTROPHE),
|
|
|
|
KEY(6, 4, TOSA_KEY_MAIL),
|
|
|
|
KEY(6, 5, KEY_LEFT),
|
|
|
|
KEY(6, 6, KEY_DOWN),
|
|
|
|
KEY(6, 7, KEY_RIGHT),
|
2010-01-01 07:28:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct matrix_keymap_data tosakbd_keymap_data = {
|
|
|
|
.keymap = tosakbd_keymap,
|
|
|
|
.keymap_size = ARRAY_SIZE(tosakbd_keymap),
|
|
|
|
};
|
|
|
|
|
|
|
|
static const int tosakbd_col_gpios[] =
|
|
|
|
{ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68 };
|
|
|
|
static const int tosakbd_row_gpios[] =
|
|
|
|
{ 69, 70, 71, 72, 73, 74, 75 };
|
|
|
|
|
|
|
|
static struct matrix_keypad_platform_data tosakbd_pdata = {
|
|
|
|
.keymap_data = &tosakbd_keymap_data,
|
|
|
|
.row_gpios = tosakbd_row_gpios,
|
|
|
|
.col_gpios = tosakbd_col_gpios,
|
|
|
|
.num_row_gpios = ARRAY_SIZE(tosakbd_row_gpios),
|
|
|
|
.num_col_gpios = ARRAY_SIZE(tosakbd_col_gpios),
|
|
|
|
.col_scan_delay_us = 10,
|
|
|
|
.debounce_ms = 10,
|
|
|
|
.wakeup = 1,
|
|
|
|
};
|
|
|
|
|
2005-11-08 19:15:30 +00:00
|
|
|
static struct platform_device tosakbd_device = {
|
2010-01-01 07:28:21 +00:00
|
|
|
.name = "matrix-keypad",
|
2005-11-08 19:15:30 +00:00
|
|
|
.id = -1,
|
2010-01-01 07:28:21 +00:00
|
|
|
.dev = {
|
|
|
|
.platform_data = &tosakbd_pdata,
|
|
|
|
},
|
2005-11-08 19:15:30 +00:00
|
|
|
};
|
2005-11-06 14:27:52 +00:00
|
|
|
|
2008-01-21 06:04:20 +00:00
|
|
|
static struct gpio_keys_button tosa_gpio_keys[] = {
|
2008-04-12 19:02:50 +00:00
|
|
|
/*
|
|
|
|
* Two following keys are directly tied to "ON" button of tosa. Why?
|
|
|
|
* The first one can be used as a wakeup source, the second can't;
|
|
|
|
* also the first one is OR of ac_powered and on_button.
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
.type = EV_PWR,
|
|
|
|
.code = KEY_RESERVED,
|
|
|
|
.gpio = TOSA_GPIO_POWERON,
|
|
|
|
.desc = "Poweron",
|
|
|
|
.wakeup = 1,
|
|
|
|
.active_low = 1,
|
|
|
|
},
|
2008-01-21 06:04:20 +00:00
|
|
|
{
|
|
|
|
.type = EV_PWR,
|
|
|
|
.code = KEY_SUSPEND,
|
|
|
|
.gpio = TOSA_GPIO_ON_KEY,
|
|
|
|
.desc = "On key",
|
2008-04-12 19:02:50 +00:00
|
|
|
/*
|
|
|
|
* can't be used as wakeup
|
|
|
|
* .wakeup = 1,
|
|
|
|
*/
|
2008-01-21 06:04:20 +00:00
|
|
|
.active_low = 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.type = EV_KEY,
|
|
|
|
.code = TOSA_KEY_RECORD,
|
|
|
|
.gpio = TOSA_GPIO_RECORD_BTN,
|
|
|
|
.desc = "Record Button",
|
|
|
|
.wakeup = 1,
|
|
|
|
.active_low = 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.type = EV_KEY,
|
|
|
|
.code = TOSA_KEY_SYNC,
|
|
|
|
.gpio = TOSA_GPIO_SYNC,
|
|
|
|
.desc = "Sync Button",
|
|
|
|
.wakeup = 1,
|
|
|
|
.active_low = 1,
|
|
|
|
},
|
2008-09-11 00:28:51 +00:00
|
|
|
{
|
|
|
|
.type = EV_SW,
|
|
|
|
.code = SW_HEADPHONE_INSERT,
|
|
|
|
.gpio = TOSA_GPIO_EAR_IN,
|
|
|
|
.desc = "HeadPhone insert",
|
|
|
|
.active_low = 1,
|
|
|
|
.debounce_interval = 300,
|
|
|
|
},
|
2008-01-21 06:04:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_keys_platform_data tosa_gpio_keys_platform_data = {
|
|
|
|
.buttons = tosa_gpio_keys,
|
|
|
|
.nbuttons = ARRAY_SIZE(tosa_gpio_keys),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device tosa_gpio_keys_device = {
|
|
|
|
.name = "gpio-keys",
|
|
|
|
.id = -1,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &tosa_gpio_keys_platform_data,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2006-03-31 10:31:12 +00:00
|
|
|
/*
|
|
|
|
* Tosa LEDs
|
|
|
|
*/
|
2008-04-19 09:42:25 +00:00
|
|
|
static struct gpio_led tosa_gpio_leds[] = {
|
2008-04-12 19:17:02 +00:00
|
|
|
{
|
|
|
|
.name = "tosa:amber:charge",
|
|
|
|
.default_trigger = "main-battery-charging",
|
|
|
|
.gpio = TOSA_GPIO_CHRG_ERR_LED,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "tosa:green:mail",
|
|
|
|
.default_trigger = "nand-disk",
|
|
|
|
.gpio = TOSA_GPIO_NOTE_LED,
|
|
|
|
},
|
2008-04-19 09:42:06 +00:00
|
|
|
{
|
|
|
|
.name = "tosa:dual:wlan",
|
|
|
|
.default_trigger = "none",
|
|
|
|
.gpio = TOSA_GPIO_WLAN_LED,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "tosa:blue:bluetooth",
|
2008-07-05 08:02:48 +00:00
|
|
|
.default_trigger = "tosa-bt",
|
2008-04-19 09:42:06 +00:00
|
|
|
.gpio = TOSA_GPIO_BT_LED,
|
|
|
|
},
|
2008-04-12 19:17:02 +00:00
|
|
|
};
|
|
|
|
|
2008-04-19 09:42:25 +00:00
|
|
|
static struct gpio_led_platform_data tosa_gpio_leds_platform_data = {
|
2008-04-12 19:17:02 +00:00
|
|
|
.leds = tosa_gpio_leds,
|
|
|
|
.num_leds = ARRAY_SIZE(tosa_gpio_leds),
|
|
|
|
};
|
|
|
|
|
2006-03-31 10:31:12 +00:00
|
|
|
static struct platform_device tosaled_device = {
|
2008-04-12 19:17:02 +00:00
|
|
|
.name = "leds-gpio",
|
|
|
|
.id = -1,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &tosa_gpio_leds_platform_data,
|
|
|
|
},
|
2006-03-31 10:31:12 +00:00
|
|
|
};
|
|
|
|
|
2008-06-14 10:42:02 +00:00
|
|
|
/*
|
|
|
|
* Toshiba Mobile IO Controller
|
|
|
|
*/
|
|
|
|
static struct resource tc6393xb_resources[] = {
|
|
|
|
[0] = {
|
|
|
|
.start = TOSA_LCDC_PHYS,
|
|
|
|
.end = TOSA_LCDC_PHYS + 0x3ffffff,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
|
|
|
|
[1] = {
|
|
|
|
.start = TOSA_IRQ_GPIO_TC6393XB_INT,
|
|
|
|
.end = TOSA_IRQ_GPIO_TC6393XB_INT,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2022-05-07 12:33:31 +00:00
|
|
|
static struct gpiod_lookup_table tosa_battery_gpio_table = {
|
|
|
|
.dev_id = "wm97xx-battery",
|
|
|
|
.table = {
|
|
|
|
GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_BAT0_CRG,
|
|
|
|
"main battery full", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_BAT1_CRG,
|
|
|
|
"jacket battery full", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_BAT0_LOW,
|
|
|
|
"main battery low", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_BAT1_LOW,
|
|
|
|
"jacket battery low", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_JACKET_DETECT,
|
|
|
|
"jacket detect", GPIO_ACTIVE_HIGH),
|
|
|
|
{ },
|
|
|
|
},
|
|
|
|
};
|
2008-06-14 10:42:02 +00:00
|
|
|
|
|
|
|
static int tosa_tc6393xb_enable(struct platform_device *dev)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = gpio_request(TOSA_GPIO_TC6393XB_REST_IN, "tc6393xb #pclr");
|
|
|
|
if (rc)
|
|
|
|
goto err_req_pclr;
|
|
|
|
rc = gpio_request(TOSA_GPIO_TC6393XB_SUSPEND, "tc6393xb #suspend");
|
|
|
|
if (rc)
|
|
|
|
goto err_req_suspend;
|
2008-09-13 17:06:41 +00:00
|
|
|
rc = gpio_request(TOSA_GPIO_TC6393XB_L3V_ON, "tc6393xb l3v");
|
2008-06-14 10:42:02 +00:00
|
|
|
if (rc)
|
|
|
|
goto err_req_l3v;
|
|
|
|
rc = gpio_direction_output(TOSA_GPIO_TC6393XB_L3V_ON, 0);
|
|
|
|
if (rc)
|
|
|
|
goto err_dir_l3v;
|
|
|
|
rc = gpio_direction_output(TOSA_GPIO_TC6393XB_SUSPEND, 0);
|
|
|
|
if (rc)
|
|
|
|
goto err_dir_suspend;
|
|
|
|
rc = gpio_direction_output(TOSA_GPIO_TC6393XB_REST_IN, 0);
|
|
|
|
if (rc)
|
|
|
|
goto err_dir_pclr;
|
|
|
|
|
|
|
|
mdelay(1);
|
|
|
|
|
|
|
|
gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1);
|
|
|
|
|
|
|
|
mdelay(10);
|
|
|
|
|
|
|
|
gpio_set_value(TOSA_GPIO_TC6393XB_REST_IN, 1);
|
|
|
|
gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
err_dir_pclr:
|
|
|
|
err_dir_suspend:
|
|
|
|
err_dir_l3v:
|
|
|
|
gpio_free(TOSA_GPIO_TC6393XB_L3V_ON);
|
|
|
|
err_req_l3v:
|
|
|
|
gpio_free(TOSA_GPIO_TC6393XB_SUSPEND);
|
|
|
|
err_req_suspend:
|
|
|
|
gpio_free(TOSA_GPIO_TC6393XB_REST_IN);
|
|
|
|
err_req_pclr:
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int tosa_tc6393xb_disable(struct platform_device *dev)
|
|
|
|
{
|
|
|
|
gpio_free(TOSA_GPIO_TC6393XB_L3V_ON);
|
|
|
|
gpio_free(TOSA_GPIO_TC6393XB_SUSPEND);
|
|
|
|
gpio_free(TOSA_GPIO_TC6393XB_REST_IN);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int tosa_tc6393xb_resume(struct platform_device *dev)
|
|
|
|
{
|
|
|
|
gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1);
|
|
|
|
mdelay(10);
|
|
|
|
gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1);
|
|
|
|
mdelay(10);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int tosa_tc6393xb_suspend(struct platform_device *dev)
|
|
|
|
{
|
|
|
|
gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 0);
|
|
|
|
gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-06-27 09:38:44 +00:00
|
|
|
static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
|
|
|
|
|
|
|
|
static struct nand_bbt_descr tosa_tc6393xb_nand_bbt = {
|
|
|
|
.options = 0,
|
|
|
|
.offs = 4,
|
|
|
|
.len = 2,
|
|
|
|
.pattern = scan_ff_pattern
|
|
|
|
};
|
|
|
|
|
2017-11-21 21:43:49 +00:00
|
|
|
static const char * const probes[] = {
|
|
|
|
"cmdlinepart",
|
|
|
|
"ofpart",
|
|
|
|
"sharpslpart",
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2008-06-27 09:38:44 +00:00
|
|
|
static struct tmio_nand_data tosa_tc6393xb_nand_config = {
|
|
|
|
.badblock_pattern = &tosa_tc6393xb_nand_bbt,
|
2017-11-21 21:43:49 +00:00
|
|
|
.part_parsers = probes,
|
2008-06-27 09:38:44 +00:00
|
|
|
};
|
|
|
|
|
2008-11-26 22:25:09 +00:00
|
|
|
#ifdef CONFIG_MFD_TC6393XB
|
2008-10-28 15:40:37 +00:00
|
|
|
static struct fb_videomode tosa_tc6393xb_lcd_mode[] = {
|
|
|
|
{
|
|
|
|
.xres = 480,
|
|
|
|
.yres = 640,
|
|
|
|
.pixclock = 0x002cdf00,/* PLL divisor */
|
|
|
|
.left_margin = 0x004c,
|
|
|
|
.right_margin = 0x005b,
|
|
|
|
.upper_margin = 0x0001,
|
|
|
|
.lower_margin = 0x000d,
|
|
|
|
.hsync_len = 0x0002,
|
|
|
|
.vsync_len = 0x0001,
|
|
|
|
.sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
|
|
|
|
.vmode = FB_VMODE_NONINTERLACED,
|
|
|
|
},{
|
|
|
|
.xres = 240,
|
|
|
|
.yres = 320,
|
|
|
|
.pixclock = 0x00e7f203,/* PLL divisor */
|
|
|
|
.left_margin = 0x0024,
|
|
|
|
.right_margin = 0x002f,
|
|
|
|
.upper_margin = 0x0001,
|
|
|
|
.lower_margin = 0x000d,
|
|
|
|
.hsync_len = 0x0002,
|
|
|
|
.vsync_len = 0x0001,
|
|
|
|
.sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
|
|
|
|
.vmode = FB_VMODE_NONINTERLACED,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct tmio_fb_data tosa_tc6393xb_fb_config = {
|
|
|
|
.lcd_set_power = tc6393xb_lcd_set_power,
|
|
|
|
.lcd_mode = tc6393xb_lcd_mode,
|
|
|
|
.num_modes = ARRAY_SIZE(tosa_tc6393xb_lcd_mode),
|
|
|
|
.modes = &tosa_tc6393xb_lcd_mode[0],
|
|
|
|
.height = 82,
|
|
|
|
.width = 60,
|
|
|
|
};
|
2008-11-26 22:25:09 +00:00
|
|
|
#endif
|
2008-10-28 15:40:37 +00:00
|
|
|
|
2008-09-24 21:36:23 +00:00
|
|
|
static struct tc6393xb_platform_data tosa_tc6393xb_data = {
|
2008-06-14 10:42:02 +00:00
|
|
|
.scr_pll2cr = 0x0cc1,
|
|
|
|
.scr_gper = 0x3300,
|
|
|
|
|
|
|
|
.irq_base = IRQ_BOARD_START,
|
|
|
|
|
|
|
|
.enable = tosa_tc6393xb_enable,
|
|
|
|
.disable = tosa_tc6393xb_disable,
|
|
|
|
.suspend = tosa_tc6393xb_suspend,
|
|
|
|
.resume = tosa_tc6393xb_resume,
|
2008-06-27 09:38:44 +00:00
|
|
|
|
|
|
|
.nand_data = &tosa_tc6393xb_nand_config,
|
2008-11-26 22:25:09 +00:00
|
|
|
#ifdef CONFIG_MFD_TC6393XB
|
2008-10-28 15:40:37 +00:00
|
|
|
.fb_data = &tosa_tc6393xb_fb_config,
|
2008-11-26 22:25:09 +00:00
|
|
|
#endif
|
2008-09-24 21:46:10 +00:00
|
|
|
|
|
|
|
.resume_restore = 1,
|
2008-06-14 10:42:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static struct platform_device tc6393xb_device = {
|
|
|
|
.name = "tc6393xb",
|
|
|
|
.id = -1,
|
|
|
|
.dev = {
|
2008-09-24 21:36:23 +00:00
|
|
|
.platform_data = &tosa_tc6393xb_data,
|
2008-06-14 10:42:02 +00:00
|
|
|
},
|
|
|
|
.num_resources = ARRAY_SIZE(tc6393xb_resources),
|
|
|
|
.resource = tc6393xb_resources,
|
|
|
|
};
|
|
|
|
|
2008-07-05 08:02:48 +00:00
|
|
|
static struct tosa_bt_data tosa_bt_data = {
|
|
|
|
.gpio_pwr = TOSA_GPIO_BT_PWR_EN,
|
|
|
|
.gpio_reset = TOSA_GPIO_BT_RESET,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device tosa_bt_device = {
|
|
|
|
.name = "tosa-bt",
|
|
|
|
.id = -1,
|
|
|
|
.dev.platform_data = &tosa_bt_data,
|
|
|
|
};
|
|
|
|
|
2019-01-16 15:13:31 +00:00
|
|
|
static struct pxa2xx_spi_controller pxa_ssp_master_info = {
|
2008-09-13 17:06:41 +00:00
|
|
|
.num_chipselect = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct spi_board_info spi_board_info[] __initdata = {
|
|
|
|
{
|
|
|
|
.modalias = "tosa-lcd",
|
|
|
|
// .platform_data
|
|
|
|
.max_speed_hz = 28750,
|
|
|
|
.bus_num = 2,
|
|
|
|
.chip_select = 0,
|
|
|
|
.mode = SPI_MODE_0,
|
|
|
|
},
|
|
|
|
};
|
2008-07-05 08:02:48 +00:00
|
|
|
|
2008-11-24 21:57:27 +00:00
|
|
|
static struct mtd_partition sharpsl_rom_parts[] = {
|
|
|
|
{
|
|
|
|
.name ="Boot PROM Filesystem",
|
|
|
|
.offset = 0x00160000,
|
|
|
|
.size = MTDPART_SIZ_FULL,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct physmap_flash_data sharpsl_rom_data = {
|
|
|
|
.width = 2,
|
|
|
|
.nr_parts = ARRAY_SIZE(sharpsl_rom_parts),
|
|
|
|
.parts = sharpsl_rom_parts,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource sharpsl_rom_resources[] = {
|
|
|
|
{
|
|
|
|
.start = 0x00000000,
|
|
|
|
.end = 0x007fffff,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device sharpsl_rom_device = {
|
|
|
|
.name = "physmap-flash",
|
|
|
|
.id = -1,
|
|
|
|
.resource = sharpsl_rom_resources,
|
|
|
|
.num_resources = ARRAY_SIZE(sharpsl_rom_resources),
|
|
|
|
.dev.platform_data = &sharpsl_rom_data,
|
|
|
|
};
|
|
|
|
|
2011-02-22 23:29:10 +00:00
|
|
|
static struct platform_device wm9712_device = {
|
|
|
|
.name = "wm9712-codec",
|
|
|
|
.id = -1,
|
|
|
|
};
|
|
|
|
|
2011-12-15 02:57:22 +00:00
|
|
|
static struct platform_device tosa_audio_device = {
|
|
|
|
.name = "tosa-audio",
|
|
|
|
.id = -1,
|
|
|
|
};
|
|
|
|
|
2005-11-06 14:27:52 +00:00
|
|
|
static struct platform_device *devices[] __initdata = {
|
|
|
|
&tosascoop_device,
|
|
|
|
&tosascoop_jc_device,
|
2008-06-14 10:42:02 +00:00
|
|
|
&tc6393xb_device,
|
2008-06-14 10:43:36 +00:00
|
|
|
&tosa_power_device,
|
2005-11-08 19:15:30 +00:00
|
|
|
&tosakbd_device,
|
2008-01-21 06:04:20 +00:00
|
|
|
&tosa_gpio_keys_device,
|
2006-03-31 10:31:12 +00:00
|
|
|
&tosaled_device,
|
2008-07-05 08:02:48 +00:00
|
|
|
&tosa_bt_device,
|
2008-11-24 21:57:27 +00:00
|
|
|
&sharpsl_rom_device,
|
2011-02-22 23:29:10 +00:00
|
|
|
&wm9712_device,
|
2011-02-14 12:33:18 +00:00
|
|
|
&tosa_gpio_vbus,
|
2011-12-15 02:57:22 +00:00
|
|
|
&tosa_audio_device,
|
2005-11-06 14:27:52 +00:00
|
|
|
};
|
|
|
|
|
2006-06-19 18:57:12 +00:00
|
|
|
static void tosa_poweroff(void)
|
|
|
|
{
|
2013-07-08 23:01:40 +00:00
|
|
|
pxa_restart(REBOOT_GPIO, NULL);
|
2006-06-19 18:57:12 +00:00
|
|
|
}
|
|
|
|
|
2013-07-08 23:01:40 +00:00
|
|
|
static void tosa_restart(enum reboot_mode mode, const char *cmd)
|
2006-06-19 18:57:12 +00:00
|
|
|
{
|
2010-11-03 15:29:35 +00:00
|
|
|
uint32_t msc0 = __raw_readl(MSC0);
|
|
|
|
|
2006-06-19 18:57:12 +00:00
|
|
|
/* Bootloader magic for a reboot */
|
2010-11-03 15:29:35 +00:00
|
|
|
if((msc0 & 0xffff0000) == 0x7ff00000)
|
|
|
|
__raw_writel((msc0 & 0xffff) | 0x7ee00000, MSC0);
|
2006-06-19 18:57:12 +00:00
|
|
|
|
|
|
|
tosa_poweroff();
|
|
|
|
}
|
|
|
|
|
2005-11-06 14:27:52 +00:00
|
|
|
static void __init tosa_init(void)
|
|
|
|
{
|
2008-04-10 10:00:32 +00:00
|
|
|
pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config));
|
2009-11-09 05:34:08 +00:00
|
|
|
|
|
|
|
pxa_set_ffuart_info(NULL);
|
|
|
|
pxa_set_btuart_info(NULL);
|
|
|
|
pxa_set_stuart_info(NULL);
|
|
|
|
|
2008-04-10 10:00:32 +00:00
|
|
|
gpio_set_wake(MFP_PIN_GPIO1, 1);
|
|
|
|
/* We can't pass to gpio-keys since it will drop the Reset altfunc */
|
|
|
|
|
2009-05-06 01:43:18 +00:00
|
|
|
init_gpio_reset(TOSA_GPIO_ON_RESET, 0, 0);
|
2008-05-22 15:21:48 +00:00
|
|
|
|
2006-06-19 18:57:12 +00:00
|
|
|
pm_power_off = tosa_poweroff;
|
|
|
|
|
2005-11-06 14:27:52 +00:00
|
|
|
PCFR |= PCFR_OPDE;
|
|
|
|
|
2005-11-08 19:15:30 +00:00
|
|
|
/* enable batt_fault */
|
2005-11-06 14:27:52 +00:00
|
|
|
PMCR = 0x01;
|
|
|
|
|
2022-05-07 12:33:31 +00:00
|
|
|
gpiod_add_lookup_table(&tosa_battery_gpio_table);
|
|
|
|
|
2018-12-02 08:43:22 +00:00
|
|
|
gpiod_add_lookup_table(&tosa_mci_gpio_table);
|
2005-11-08 19:15:30 +00:00
|
|
|
pxa_set_mci_info(&tosa_mci_platform_data);
|
|
|
|
pxa_set_ficp_info(&tosa_ficp_platform_data);
|
2008-04-10 14:43:18 +00:00
|
|
|
pxa_set_i2c_info(NULL);
|
2009-04-03 11:45:49 +00:00
|
|
|
pxa_set_ac97_info(NULL);
|
2005-11-08 19:15:50 +00:00
|
|
|
platform_scoop_config = &tosa_pcmcia_config;
|
2005-11-06 14:27:52 +00:00
|
|
|
|
2008-09-13 17:06:41 +00:00
|
|
|
pxa2xx_set_spi_info(2, &pxa_ssp_master_info);
|
|
|
|
spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
|
|
|
|
|
2009-03-05 15:17:53 +00:00
|
|
|
clk_add_alias("CLK_CK3P6MI", tc6393xb_device.name, "GPIO11_CLK", NULL);
|
2008-09-10 09:30:37 +00:00
|
|
|
|
2020-01-23 15:50:13 +00:00
|
|
|
gpiod_add_lookup_table(&tosa_udc_gpiod_table);
|
2020-08-27 08:48:28 +00:00
|
|
|
gpiod_add_lookup_table(&tosa_power_gpiod_table);
|
2005-11-08 19:15:50 +00:00
|
|
|
platform_add_devices(devices, ARRAY_SIZE(devices));
|
2005-11-06 14:27:52 +00:00
|
|
|
}
|
|
|
|
|
2014-04-13 21:54:58 +00:00
|
|
|
static void __init fixup_tosa(struct tag *tags, char **cmdline)
|
2005-11-06 14:27:52 +00:00
|
|
|
{
|
|
|
|
sharpsl_save_param();
|
2014-04-13 21:54:58 +00:00
|
|
|
memblock_add(0xa0000000, SZ_64M);
|
2005-11-06 14:27:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MACHINE_START(TOSA, "SHARP Tosa")
|
|
|
|
.fixup = fixup_tosa,
|
2010-10-11 00:20:19 +00:00
|
|
|
.map_io = pxa25x_map_io,
|
2010-08-20 07:23:59 +00:00
|
|
|
.nr_irqs = TOSA_NR_IRQS,
|
2007-06-22 03:14:09 +00:00
|
|
|
.init_irq = pxa25x_init_irq,
|
2011-05-18 13:30:04 +00:00
|
|
|
.handle_irq = pxa25x_handle_irq,
|
2005-11-06 14:27:52 +00:00
|
|
|
.init_machine = tosa_init,
|
2012-11-08 19:40:59 +00:00
|
|
|
.init_time = pxa_timer_init,
|
2011-11-04 14:15:53 +00:00
|
|
|
.restart = tosa_restart,
|
2005-11-06 14:27:52 +00:00
|
|
|
MACHINE_END
|