aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-s3c6410
diff options
context:
space:
mode:
authorAndy Green <andy@openmoko.com>2008-11-21 11:56:55 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-11-21 11:56:55 +0000
commit2e704a0f4b2dd8d7d3402e65624a7307a44d3765 (patch)
tree9c4aca7503e2a7f16a3c7f3944c4d610a102f450 /arch/arm/mach-s3c6410
parent963296f3e297555cb93f1387d35b864d92e8709c (diff)
introduce-gta03-mach.patch
Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'arch/arm/mach-s3c6410')
-rw-r--r--arch/arm/mach-s3c6410/Kconfig7
-rw-r--r--arch/arm/mach-s3c6410/include/mach/om-gta03.h78
-rw-r--r--arch/arm/mach-s3c6410/mach-om-gta03.c377
3 files changed, 462 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c6410/Kconfig b/arch/arm/mach-s3c6410/Kconfig
index 1d501007002..4d5bbd62a5e 100644
--- a/arch/arm/mach-s3c6410/Kconfig
+++ b/arch/arm/mach-s3c6410/Kconfig
@@ -60,3 +60,10 @@ config SMDK6410_SD_CH1
channels 0 and 1 are the same.
endchoice
+
+config MACH_OPENMOKO_GTA03
+ bool "OM_GTA03"
+ select CPU_S3C6410
+ help
+ Machine support for the Openmoko GTA03
+
diff --git a/arch/arm/mach-s3c6410/include/mach/om-gta03.h b/arch/arm/mach-s3c6410/include/mach/om-gta03.h
new file mode 100644
index 00000000000..0928676a2d1
--- /dev/null
+++ b/arch/arm/mach-s3c6410/include/mach/om-gta03.h
@@ -0,0 +1,78 @@
+#ifndef _OM_GTA03_H
+#define _OM_GTA03_H
+
+#include <mach/gpio.h>
+#include <mach/irqs.h>
+#include <linux/pcf50633.h>
+
+/* Different hardware revisions, passed in ATAG_REVISION by u-boot */
+#define GTA03v1_SYSTEM_REV 0x00000001
+
+#define GTA03_GPIO_VIBRATOR_ON S3C64XX_GPF(13)
+#define GTA03_GPIO_CLKOUT S3C64XX_GPF(14)
+
+#define GTA03_GPIO_ACCEL_MISO S3C64XX_GPC(0)
+#define GTA03_GPIO_ACCEL_CLK S3C64XX_GPC(1)
+#define GTA03_GPIO_ACCEL_MOSI S3C64XX_GPC(2)
+
+#define GTA03_GPIO_LCM_MISO S3C64XX_GPC(4)
+#define GTA03_GPIO_LCM_CLK S3C64XX_GPC(5)
+#define GTA03_GPIO_LCM_MOSI S3C64XX_GPC(6)
+#define GTA03_GPIO_LCM_CS S3C64XX_GPC(7)
+
+#define GTA03_GPIO_BTPCM_SHARED_SCLK S3C64XX_GPE(0)
+#define GTA03_GPIO_BTPCM_SHARED_EXTCLK S3C64XX_GPE(1)
+#define GTA03_GPIO_BTPCM_SHARED_FSYNC S3C64XX_GPE(2)
+#define GTA03_GPIO_BTPCM_SHARED_SIN S3C64XX_GPE(3)
+#define GTA03_GPIO_BTPCM_SHARED_SOUT S3C64XX_GPE(4)
+
+#define GTA03_GPIO_WLAN_RESET S3C64XX_GPH(6)
+#define GTA03_GPIO_HDQ S3C64XX_GPH(7)
+#define GTA03_GPIO_WLAN_PWRDN S3C64XX_GPH(8)
+#define GTA03_GPIO_WLAN_OSC S3C64XX_GPH(9)
+
+#define GTA03_GPIO_VERSION0 S3C64XX_GPI(0)
+#define GTA03_GPIO_VERSION1 S3C64XX_GPI(1)
+#define GTA03_GPIO_VERSION2 S3C64XX_GPI(8)
+
+#define GTA03_GPIO_NWLAN_POWER S3C64XX_GPK(0)
+#define GTA03_GPIO_MODEN_ON S3C64XX_GPK(2)
+
+#define GTA03_GPIO_TP_RESET S3C64XX_GPM(0)
+#define GTA03_GPIO_GPS_LNA_EN S3C64XX_GPM(2)
+
+#define GTA03_GPIO_USB_FLT S3C64XX_GPM(4)
+#define GTA03_GPIO_USB_OC S3C64XX_GPM(5)
+
+#define GTA03_GPIO_ACCEL_INT1 S3C64XX_GPN(0)
+#define GTA03_GPIO_KEY_MINUS S3C64XX_GPN(1)
+#define GTA03_GPIO_KEY_PLUS S3C64XX_GPN(2)
+#define GTA03_GPIO_PWR_IND S3C64XX_GPN(3)
+#define GTA03_GPIO_PWR_IRQ S3C64XX_GPN(4)
+#define GTA03_GPIO_TOUCH S3C64XX_GPN(5)
+#define GTA03_GPIO_JACK_INSERT S3C64XX_GPN(6)
+#define GTA03_GPIO_GPS_INT S3C64XX_GPN(7)
+#define GTA03_GPIO_HOLD S3C64XX_GPN(8)
+#define GTA03_GPIO_WLAN_WAKEUP S3C64XX_GPN(9)
+#define GTA03_GPIO_ACCEL_INT2 S3C64XX_GPN(10)
+#define GTA03_GPIO_IO1 S3C64XX_GPN(11)
+#define GTA03_GPIO_NONKEYWAKE S3C64XX_GPN(12)
+
+#define GTA03_GPIO_N_MODEM_RESET S3C64XX_GPO(1)
+
+#define GTA03_IRQ_GSENSOR_1 IRQ_EINT0
+#define GTA03_IRQ_KEY_MINUS IRQ_EINT1
+#define GTA03_IRQ_KEY_PLUS IRQ_EINT2
+#define GTA03_IRQ_PWR_IND IRQ_EINT3
+#define GTA03_IRQ_PMU IRQ_EINT4
+#define GTA03_IRQ_AUX IRQ_EINT6
+#define GTA03_IRQ_nHOLD IRQ_EINT7
+#define GTA03v1_IRQ_nSIM_CD IRQ_EINT8
+#define GTA03_IRQ_PCF50633 IRQ_EINT9
+#define GTA03_IRQ_3D IRQ_EINT12
+#define GTA03_IRQ_GSENSOR_2 IRQ_EINT16
+#define GTA03v3_IRQ_nUSB_OC IRQ_EINT17
+#define GTA03v3_IRQ_nUSB_FLT IRQ_EINT18
+#define GTA03v3_IRQ_nGSM_OC IRQ_EINT19
+
+#endif /* _OM_GTA03_H */ \ No newline at end of file
diff --git a/arch/arm/mach-s3c6410/mach-om-gta03.c b/arch/arm/mach-s3c6410/mach-om-gta03.c
new file mode 100644
index 00000000000..cfc9fd54dd0
--- /dev/null
+++ b/arch/arm/mach-s3c6410/mach-om-gta03.c
@@ -0,0 +1,377 @@
+/* linux/arch/arm/mach-s3c6410/mach-smdk6410.c
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Andy Green <andy@openmoko.org>
+ *
+ * based on mach_smdk6410.c which is
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ * Ben Dooks <ben@simtec.co.uk>
+ * http://armlinux.simtec.co.uk/
+ *
+ * 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/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <mach/hardware.h>
+#include <mach/map.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include <plat/regs-serial.h>
+
+#include <plat/s3c6410.h>
+#include <plat/clock.h>
+#include <plat/devs.h>
+#include <plat/cpu.h>
+
+#include <plat/udc.h>
+#include <linux/i2c.h>
+#include <linux/backlight.h>
+#include <linux/regulator/machine.h>
+
+#include <linux/pcf50633.h>
+
+#include <linux/ts_filter_mean.h>
+#include <linux/ts_filter_median.h>
+
+#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg om_gta03_uartcfgs[] __initdata = {
+ [0] = {
+ .hwport = 0,
+ .flags = 0,
+ .ucon = 0x3c5,
+ .ulcon = 0x03,
+ .ufcon = 0x51,
+ },
+ [1] = {
+ .hwport = 1,
+ .flags = 0,
+ .ucon = 0x3c5,
+ .ulcon = 0x03,
+ .ufcon = 0x51,
+ },
+ [2] = {
+ .hwport = 2,
+ .flags = 0,
+ .ucon = 0x3c5,
+ .ulcon = 0x03,
+ .ufcon = 0x51,
+ },
+ [3] = {
+ .hwport = 3,
+ .flags = 0,
+ .ucon = 0x3c5,
+ .ulcon = 0x03,
+ .ufcon = 0x51,
+ },
+};
+
+struct map_desc om_gta03_iodesc[] = {};
+
+static struct resource om_gta03_button_resources[] = {
+ [0] = {
+ .start = GTA03_GPIO_AUX_KEY,
+ .end = GTA03_GPIO_AUX_KEY,
+ },
+ [1] = {
+ .start = GTA03_GPIO_HOLD_KEY,
+ .end = GTA03_GPIO_HOLD_KEY,
+ },
+ [2] = {
+ .start = GTA03_GPIO_JACK_INSERT,
+ .end = GTA03_GPIO_JACK_INSERT,
+ },
+ [3] = {
+ .start = GTA03_GPIO_PLUS_KEY,
+ .end = GTA03_GPIO_PLUS_KEY,
+ },
+ [4] = {
+ .start = GTA03_GPIO_MINUS_KEY,
+ .end = GTA03_GPIO_MINUS_KEY,
+ },
+};
+
+static struct platform_device om_gta03_button_dev = {
+ .name = "neo1973-button",
+ .num_resources = ARRAY_SIZE(om_gta03_button_resources),
+ .resource = om_gta03_button_resources,
+};
+
+
+/********************** PMU ***************************/
+
+/* PMU driver info */
+
+static int om_gta03_pmu_callback(struct device *dev, unsigned int feature,
+ enum pmu_event event)
+{
+#if 0
+ switch (feature) {
+ case PCF50633_FEAT_MBC:
+ switch (event) {
+ case PMU_EVT_CHARGER_IDLE:
+ gta02_charger_active_status = 0;
+ break;
+ case PMU_EVT_CHARGER_ACTIVE:
+ gta02_charger_active_status = 1;
+ break;
+ case PMU_EVT_USB_INSERT:
+ gta02_charger_online_status = 1;
+ break;
+ case PMU_EVT_USB_REMOVE:
+ gta02_charger_online_status = 0;
+ break;
+ case PMU_EVT_INSERT: /* adapter is unsused */
+ case PMU_EVT_REMOVE: /* adapter is unused */
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+
+ bq27000_charging_state_change(&bq27000_battery_device);
+#endif
+ return 0;
+}
+
+/* this is called when pc50633 is probed, unfortunately quite late in the
+ * day since it is an I2C bus device. Here we can belatedly define some
+ * platform devices with the advantage that we can mark the pcf50633 as the
+ * parent. This makes them get suspended and resumed with their parent
+ * the pcf50633 still around.
+ */
+
+static void om_gta03_pcf50633_attach_child_devices(struct device *parent_device)
+{
+#if 0
+ int n;
+
+ for (n = 0; n < ARRAY_SIZE(gta02_devices_pmu_children); n++)
+ gta02_devices_pmu_children[n]->dev.parent = parent_device;
+
+ mangle_glamo_res_by_system_rev();
+ platform_add_devices(gta02_devices_pmu_children,
+ ARRAY_SIZE(gta02_devices_pmu_children));
+#endif
+}
+
+
+
+
+struct pcf50633_platform_data om_gta03_pcf_pdata = {
+ .used_features = PCF50633_FEAT_MBC |
+ PCF50633_FEAT_BBC |
+ PCF50633_FEAT_RTC |
+ PCF50633_FEAT_CHGCUR |
+ PCF50633_FEAT_BATVOLT |
+ PCF50633_FEAT_BATTEMP |
+ PCF50633_FEAT_PWM_BL,
+ .onkey_seconds_sig_init = 4,
+ .onkey_seconds_shutdown = 8,
+ .cb = &om_gta03_pmu_callback,
+ .r_fix_batt = 10000,
+ .r_fix_batt_par = 10000,
+ .r_sense_milli = 220,
+ .flag_use_apm_emulation = 0,
+ .resumers = {
+ [0] = PCF50633_INT1_USBINS |
+ PCF50633_INT1_USBREM |
+ PCF50633_INT1_ALARM,
+ [1] = PCF50633_INT2_ONKEYF,
+ [2] = PCF50633_INT3_ONKEY1S
+ },
+ /* warning: these get rewritten during machine init below
+ * depending on pcb variant
+ */
+ .reg_init_data = {
+ [PCF50633_REGULATOR_AUTO] = {
+ .constraints = {
+ .min_uV = 3300000,
+ .max_uV = 3300000,
+ .valid_modes_mask = REGULATOR_MODE_NORMAL,
+ .apply_uV = 1,
+ .state_mem = {
+ .enabled = 1,
+ },
+ },
+ .num_consumer_supplies = 0,
+ },
+ [PCF50633_REGULATOR_DOWN1] = {
+ .constraints = {
+ .min_uV = 1300000,
+ .max_uV = 1600000,
+ .valid_modes_mask = REGULATOR_MODE_NORMAL,
+ .apply_uV = 1,
+ },
+ .num_consumer_supplies = 0,
+ },
+ [PCF50633_REGULATOR_DOWN2] = {
+ .constraints = {
+ .min_uV = 1800000,
+ .max_uV = 1800000,
+ .valid_modes_mask = REGULATOR_MODE_NORMAL,
+ .apply_uV = 1,
+ .state_mem = {
+ .enabled = 1,
+ },
+ },
+ .num_consumer_supplies = 0,
+ },
+ [PCF50633_REGULATOR_HCLDO] = {
+ .constraints = {
+ .min_uV = 2000000,
+ .max_uV = 3300000,
+ .valid_modes_mask = REGULATOR_MODE_NORMAL,
+ },
+ .num_consumer_supplies = 1,
+ .consumer_supplies = hcldo_consumers,
+ },
+ [PCF50633_REGULATOR_LDO1] = {
+ .constraints = {
+ .min_uV = 1300000,
+ .max_uV = 1300000,
+ .valid_modes_mask = REGULATOR_MODE_NORMAL,
+ .apply_uV = 1,
+ },
+ .num_consumer_supplies = 0,
+ },
+ [PCF50633_REGULATOR_LDO2] = {
+ .constraints = {
+ .min_uV = 3300000,
+ .max_uV = 3300000,
+ .valid_modes_mask = REGULATOR_MODE_NORMAL,
+ .apply_uV = 1,
+ },
+ .num_consumer_supplies = 0,
+ },
+ [PCF50633_REGULATOR_LDO3] = {
+ .constraints = {
+ .min_uV = 3000000,
+ .max_uV = 3000000,
+ .valid_modes_mask = REGULATOR_MODE_NORMAL,
+ .apply_uV = 1,
+ },
+ .num_consumer_supplies = 0,
+ },
+
+ [PCF50633_REGULATOR_LDO4] = {
+ .constraints = {
+ .min_uV = 3200000,
+ .max_uV = 3200000,
+ .valid_modes_mask = REGULATOR_MODE_NORMAL,
+ .apply_uV = 1,
+ },
+ .num_consumer_supplies = 1,
+ .consumer_supplies = ldo4_consumers,
+ },
+ [PCF50633_REGULATOR_LDO5] = {
+ .constraints = {
+ .min_uV = 1500000,
+ .max_uV = 1500000,
+ .valid_modes_mask = REGULATOR_MODE_NORMAL,
+ .apply_uV = 1,
+ },
+ .num_consumer_supplies = 1,
+ .consumer_supplies = ldo5_consumers,
+ },
+ [PCF50633_REGULATOR_LDO6] = {
+ .constraints = {
+ .min_uV = 0,
+ .max_uV = 3300000,
+ .valid_modes_mask = REGULATOR_MODE_NORMAL,
+ .state_mem = {
+ .enabled = 1,
+ },
+ },
+ .num_consumer_supplies = 0,
+ },
+ [PCF50633_REGULATOR_MEMLDO] = {
+ .constraints = {
+ .min_uV = 1800000,
+ .max_uV = 1800000,
+ .valid_modes_mask = REGULATOR_MODE_NORMAL,
+ .state_mem = {
+ .enabled = 1,
+ },
+ },
+ .num_consumer_supplies = 0,
+ },
+
+ },
+ .defer_resume_backlight = 1,
+ .resume_backlight_ramp_speed = 5,
+ .attach_child_devices = om_gta03_pcf50633_attach_child_devices,
+};
+
+
+static struct i2c_board_info om_gta03_i2c_devs[] __initdata = {
+ {
+ I2C_BOARD_INFO("pcf50633", 0x73),
+ .irq = GTA03_IRQ_PMU,
+ .platform_data = &om_gta03_pcf_pdata,
+ },
+};
+
+
+static struct platform_device *om_gta03_devices[] __initdata = {
+ &s3c_device_hsmmc0,
+ &s3c_device_i2c0,
+ &om_gta03_button_dev,
+};
+
+extern void s3c64xx_init_io(struct map_desc *, int);
+
+static void __init om_gta03_map_io(void)
+{
+ s3c64xx_init_io(om_gta03_iodesc, ARRAY_SIZE(om_gta03_6410_iodesc));
+ s3c24xx_init_clocks(12000000);
+ s3c24xx_init_uarts(om_gta03_uartcfgs, ARRAY_SIZE(om_gta03_uartcfgs));
+}
+
+static void __init om_gta03_machine_init(void)
+{
+ s3c_i2c0_set_platdata(NULL);
+
+ i2c_register_board_info(0, om_gta03_i2c_devs,
+ ARRAY_SIZE(om_gta03_i2c_devs));
+
+ platform_add_devices(om_gta03_devices, ARRAY_SIZE(om_gta03_devices));
+}
+
+MACHINE_START(MACH_TYPE_OPENMOKO_GTA03, "OM-GTA03")
+ /* Maintainer: Andy Green <andy@openmoko.com> */
+ .phys_io = S3C_PA_UART & 0xfff00000,
+ .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
+ .boot_params = S3C64XX_PA_SDRAM + 0x100,
+
+ .init_irq = s3c6410_init_irq,
+ .map_io = om_gta03_map_io,
+ .init_machine = om_gta03_machine_init,
+ .timer = &s3c24xx_timer,
+MACHINE_END
+