334 lines
7.7 KiB
C
334 lines
7.7 KiB
C
/* 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 <linux/android_pmem.h>
|
|
#include <linux/regulator/machine.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 <mach/perflock.h>
|
|
|
|
#include "board-htcleo.h"
|
|
#include "devices.h"
|
|
#include "proc_comm.h"
|
|
#include "dex_comm.h"
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
// SPI
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
static struct platform_device qsd_device_spi =
|
|
{
|
|
.name = "spi_qsd",
|
|
.id = 0,
|
|
};
|
|
|
|
/* 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[] =
|
|
{
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
// KGSL (HW3D support)#include <linux/android_pmem.h>
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
static struct resource msm_kgsl_resources[] =
|
|
{
|
|
{
|
|
.name = "kgsl_reg_memory",
|
|
.start = MSM_GPU_REG_PHYS,
|
|
.end = MSM_GPU_REG_PHYS + MSM_GPU_REG_SIZE - 1,
|
|
.flags = IORESOURCE_MEM,
|
|
},
|
|
{
|
|
.name = "kgsl_phys_memory",
|
|
.start = MSM_GPU_PHYS_BASE,
|
|
.end = MSM_GPU_PHYS_BASE + MSM_GPU_PHYS_SIZE - 1,
|
|
.flags = IORESOURCE_MEM,
|
|
},
|
|
{
|
|
.start = INT_GRAPHICS,
|
|
.end = INT_GRAPHICS,
|
|
.flags = IORESOURCE_IRQ,
|
|
},
|
|
};
|
|
|
|
static int htcleo_kgsl_power_rail_mode(int follow_clk)
|
|
{
|
|
int mode = follow_clk ? 0 : 1;
|
|
int rail_id = 0;
|
|
return msm_proc_comm(PCOM_CLK_REGIME_SEC_RAIL_CONTROL, &rail_id, &mode);
|
|
}
|
|
|
|
static int htcleo_kgsl_power(bool on)
|
|
{
|
|
int cmd;
|
|
int rail_id = 0;
|
|
|
|
cmd = on ? PCOM_CLK_REGIME_SEC_RAIL_ENABLE : PCOM_CLK_REGIME_SEC_RAIL_DISABLE;
|
|
return msm_proc_comm(cmd, &rail_id, 0);
|
|
}
|
|
|
|
static struct platform_device msm_kgsl_device =
|
|
{
|
|
.name = "kgsl",
|
|
.id = -1,
|
|
.resource = msm_kgsl_resources,
|
|
.num_resources = ARRAY_SIZE(msm_kgsl_resources),
|
|
};
|
|
|
|
static struct android_pmem_platform_data android_pmem_pdata = {
|
|
.name = "pmem",
|
|
.no_allocator = 0,
|
|
.cached = 1,
|
|
};
|
|
|
|
static struct android_pmem_platform_data android_pmem_adsp_pdata = {
|
|
.name = "pmem_adsp",
|
|
.no_allocator = 0,
|
|
.cached = 1,
|
|
};
|
|
|
|
static struct android_pmem_platform_data android_pmem_camera_pdata = {
|
|
.name = "pmem_camera",
|
|
.start = MSM_PMEM_CAMERA_BASE,
|
|
.size = MSM_PMEM_CAMERA_SIZE,
|
|
.no_allocator = 1,
|
|
.cached = 1,
|
|
};
|
|
|
|
static struct platform_device android_pmem_device = {
|
|
.name = "android_pmem",
|
|
.id = 0,
|
|
.dev = {
|
|
.platform_data = &android_pmem_pdata
|
|
},
|
|
};
|
|
|
|
static struct platform_device android_pmem_adsp_device = {
|
|
.name = "android_pmem",
|
|
.id = 1,
|
|
.dev = {
|
|
.platform_data = &android_pmem_adsp_pdata,
|
|
},
|
|
};
|
|
|
|
static struct platform_device android_pmem_camera_device = {
|
|
.name = "android_pmem",
|
|
.id = 2,
|
|
.dev = {
|
|
.platform_data = &android_pmem_camera_pdata,
|
|
},
|
|
};
|
|
|
|
static struct resource ram_console_resources[] = {
|
|
{
|
|
.start = MSM_RAM_CONSOLE_BASE,
|
|
.end = MSM_RAM_CONSOLE_BASE + MSM_RAM_CONSOLE_SIZE - 1,
|
|
.flags = IORESOURCE_MEM,
|
|
},
|
|
};
|
|
|
|
static struct platform_device ram_console_device = {
|
|
.name = "ram_console",
|
|
.id = -1,
|
|
.num_resources = ARRAY_SIZE(ram_console_resources),
|
|
.resource = ram_console_resources,
|
|
};
|
|
|
|
static struct platform_device *devices[] __initdata =
|
|
{
|
|
&ram_console_device,
|
|
#if !defined(CONFIG_MSM_SERIAL_DEBUGGER)
|
|
&msm_device_uart1,
|
|
#endif
|
|
// &bcm_bt_lpm_device,
|
|
// &msm_device_uart_dm1,
|
|
&msm_device_smd,
|
|
// &htcleo_rfkill,
|
|
// &msm_audio_device,
|
|
// &msm_device_hsusb,
|
|
// &usb_mass_storage_device,
|
|
// &android_usb_device,
|
|
&android_pmem_device,
|
|
&android_pmem_adsp_device,
|
|
&android_pmem_camera_device,
|
|
// &msm_device_i2c,
|
|
// &htcleo_backlight,
|
|
// &htcleo_headset,
|
|
&msm_kgsl_device,
|
|
// &capella_cm3602,
|
|
// &msm_camera_sensor_s5k3e2fx,
|
|
// &htcleo_flashlight_device,
|
|
// &htcleo_power,
|
|
&qsd_device_spi,
|
|
|
|
};
|
|
|
|
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);
|
|
|
|
init_dex_comm();
|
|
|
|
/* set the gpu power rail to manual mode so clk en/dis will not
|
|
* turn off gpu power, and hang it on resume */
|
|
htcleo_kgsl_power_rail_mode(0);
|
|
htcleo_kgsl_power(false);
|
|
mdelay(100);
|
|
htcleo_kgsl_power(true);
|
|
|
|
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;
|
|
}
|
|
|
|
#if defined(CONFIG_VERY_EARLY_CONSOLE)
|
|
#if defined(CONFIG_HTC_FB_CONSOLE)
|
|
int __init htc_fb_console_init(void);
|
|
#endif
|
|
#if defined(CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT)
|
|
int __init ram_console_early_init(void);
|
|
#endif
|
|
#endif
|
|
|
|
static void __init htcleo_map_io(void)
|
|
{
|
|
msm_map_common_io();
|
|
msm_clock_init();
|
|
|
|
#if defined(CONFIG_VERY_EARLY_CONSOLE)
|
|
// Init our consoles _really_ early
|
|
#if defined(CONFIG_HTC_FB_CONSOLE)
|
|
htc_fb_console_init();
|
|
#endif
|
|
#if defined(CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT)
|
|
ram_console_early_init();
|
|
#endif
|
|
#endif
|
|
|
|
}
|
|
|
|
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
|
|
.boot_params = (CONFIG_PHYS_OFFSET + 0x00000100),
|
|
.fixup = htcleo_fixup,
|
|
.map_io = htcleo_map_io,
|
|
.init_irq = msm_init_irq,
|
|
.init_machine = htcleo_init,
|
|
.timer = &msm_timer,
|
|
MACHINE_END
|