2010-08-27 14:00:39 +00:00
|
|
|
/* linux/arch/arm/mach-msm/board-htcleo.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Google, Inc.
|
|
|
|
* Copyright (C) 2009 HTC Corporation.
|
|
|
|
* Author: Dima Zavin <dima@android.com>
|
|
|
|
*
|
|
|
|
* This software is licensed under the terms of the GNU General Public
|
|
|
|
* License version 2, as published by the Free Software Foundation, and
|
|
|
|
* may be copied, distributed, and modified under those terms.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/gpio.h>
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/input.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/bootmem.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <../../../drivers/staging/android/timed_gpio.h>
|
|
|
|
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <asm/mach/map.h>
|
|
|
|
#include <asm/setup.h>
|
|
|
|
|
|
|
|
#include <mach/board.h>
|
|
|
|
#include <mach/hardware.h>
|
|
|
|
#include <mach/system.h>
|
|
|
|
#include <mach/msm_iomap.h>
|
|
|
|
|
|
|
|
#include "board-htcleo.h"
|
|
|
|
#include "devices.h"
|
|
|
|
|
|
|
|
/* Vibrator */
|
|
|
|
static struct timed_gpio timed_gpios[] = {
|
|
|
|
{
|
|
|
|
.name = "vibrator",
|
|
|
|
.gpio = HTCLEO_GPIO_VIBRATOR_ON,
|
|
|
|
.max_timeout = 15000,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct timed_gpio_platform_data timed_gpio_data = {
|
|
|
|
.num_gpios = ARRAY_SIZE(timed_gpios),
|
|
|
|
.gpios = timed_gpios,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device htcleo_timed_gpios = {
|
|
|
|
.name = "timed-gpio",
|
|
|
|
.id = -1,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &timed_gpio_data,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static struct i2c_board_info base_i2c_devices[] =
|
|
|
|
{
|
|
|
|
};
|
|
|
|
static struct platform_device *devices[] __initdata =
|
|
|
|
{
|
|
|
|
&msm_device_i2c,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct msm_acpu_clock_platform_data htcleo_clock_data = {
|
|
|
|
.acpu_switch_time_us = 20,
|
|
|
|
.max_speed_delta_khz = 256000,
|
|
|
|
.vdd_switch_time_us = 62,
|
|
|
|
.power_collapse_khz = 245000,
|
|
|
|
.wait_for_irq_khz = 245000,
|
|
|
|
// .wait_for_irq_khz = 19200, // TCXO
|
|
|
|
};
|
|
|
|
|
|
|
|
static void htcleo_reset(void)
|
|
|
|
{
|
|
|
|
// 25 - 16 = 9
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
writel(readl(MSM_GPIOCFG2_BASE + 0x504) | (1 << 9), MSM_GPIOCFG2_BASE + 0x504);// owner
|
|
|
|
gpio_set_value(HTCLEO_GPIO_PS_HOLD, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void do_grp_reset(void)
|
|
|
|
{
|
|
|
|
writel(0x20000, MSM_CLK_CTL_BASE + 0x214);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init htcleo_init(void)
|
|
|
|
{
|
|
|
|
volatile unsigned *bank6_in, *bank6_out;
|
|
|
|
printk("htcleo_init()\n");
|
|
|
|
|
|
|
|
msm_hw_reset_hook = htcleo_reset;
|
|
|
|
|
|
|
|
do_grp_reset();
|
|
|
|
|
|
|
|
msm_acpu_clock_init(&htcleo_clock_data);
|
|
|
|
|
|
|
|
platform_add_devices(devices, ARRAY_SIZE(devices));
|
|
|
|
|
|
|
|
i2c_register_board_info(0, base_i2c_devices, ARRAY_SIZE(base_i2c_devices));
|
|
|
|
|
|
|
|
platform_device_register(&htcleo_timed_gpios);
|
|
|
|
|
|
|
|
/* Blink the camera LED shortly to show that we're alive! */
|
|
|
|
|
|
|
|
bank6_in = (unsigned int*)(MSM_GPIO1_BASE + 0x0864);
|
|
|
|
bank6_out = (unsigned int*)(MSM_GPIO1_BASE + 0x0814);
|
|
|
|
*bank6_out = *bank6_in ^ 0x200000;
|
|
|
|
mdelay(50);
|
|
|
|
*bank6_out = *bank6_in | 0x200000;
|
|
|
|
mdelay(200);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init htcleo_fixup(struct machine_desc *desc, struct tag *tags,
|
|
|
|
char **cmdline, struct meminfo *mi)
|
|
|
|
{
|
|
|
|
mi->nr_banks = 1;
|
|
|
|
mi->bank[0].start = MSM_EBI1_BANK0_BASE;
|
|
|
|
mi->bank[0].node = PHYS_TO_NID(MSM_EBI1_BANK0_BASE);
|
|
|
|
mi->bank[0].size = MSM_EBI1_BANK0_SIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init htcleo_map_io(void)
|
|
|
|
{
|
|
|
|
msm_map_common_io();
|
|
|
|
msm_clock_init();
|
|
|
|
}
|
|
|
|
|
|
|
|
extern struct sys_timer msm_timer;
|
|
|
|
|
|
|
|
MACHINE_START(HTCLEO, "htcleo")
|
|
|
|
#ifdef CONFIG_MSM_DEBUG_UART
|
|
|
|
.phys_io = MSM_DEBUG_UART_PHYS,
|
|
|
|
.io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
|
|
|
|
#endif
|
2010-08-27 14:01:33 +00:00
|
|
|
.boot_params = (CONFIG_PHYS_OFFSET + 0x00000100),
|
2010-08-27 14:00:39 +00:00
|
|
|
.fixup = htcleo_fixup,
|
|
|
|
.map_io = htcleo_map_io,
|
|
|
|
.init_irq = msm_init_irq,
|
|
|
|
.init_machine = htcleo_init,
|
|
|
|
.timer = &msm_timer,
|
|
|
|
MACHINE_END
|