483 lines
13 KiB
C
483 lines
13 KiB
C
/* linux/arch/arm/mach-msm/board-halibut.c
|
|
*
|
|
* Copyright (C) 2007 Google, Inc.
|
|
* Author: Brian Swetland <swetland@google.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/kernel.h>
|
|
#include <linux/init.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/input.h>
|
|
#include <linux/io.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/bootmem.h>
|
|
|
|
#include <mach/hardware.h>
|
|
#include <mach/irqs.h>
|
|
#include <mach/gpio.h>
|
|
#include <asm/mach-types.h>
|
|
#include <asm/mach/arch.h>
|
|
#include <asm/mach/map.h>
|
|
#include <asm/mach/flash.h>
|
|
#include <asm/setup.h>
|
|
|
|
#include <mach/irqs.h>
|
|
#include <mach/board.h>
|
|
#include <mach/msm_iomap.h>
|
|
#include <mach/msm_hsusb.h>
|
|
#include <mach/camera.h>
|
|
|
|
#include <linux/mtd/nand.h>
|
|
#include <linux/mtd/partitions.h>
|
|
#include <linux/i2c.h>
|
|
#include <linux/android_pmem.h>
|
|
#include <linux/usb/android_composite.h>
|
|
|
|
#include "devices.h"
|
|
#include "board-halibut.h"
|
|
#include "proc_comm.h"
|
|
|
|
static struct resource smc91x_resources[] = {
|
|
[0] = {
|
|
.start = 0x9C004300,
|
|
.end = 0x9C004400,
|
|
.flags = IORESOURCE_MEM,
|
|
},
|
|
[1] = {
|
|
.start = MSM_GPIO_TO_INT(49),
|
|
.end = MSM_GPIO_TO_INT(49),
|
|
.flags = IORESOURCE_IRQ,
|
|
},
|
|
};
|
|
|
|
static struct platform_device smc91x_device = {
|
|
.name = "smc91x",
|
|
.id = 0,
|
|
.num_resources = ARRAY_SIZE(smc91x_resources),
|
|
.resource = smc91x_resources,
|
|
};
|
|
|
|
static struct i2c_board_info i2c_devices[] = {
|
|
#ifdef CONFIG_MT9D112
|
|
{
|
|
I2C_BOARD_INFO("mt9d112", 0x78 >> 1),
|
|
},
|
|
#endif
|
|
#ifdef CONFIG_S5K3E2FX
|
|
{
|
|
I2C_BOARD_INFO("s5k3e2fx", 0x20 >> 1),
|
|
},
|
|
#endif
|
|
#ifdef CONFIG_MT9P012
|
|
{
|
|
I2C_BOARD_INFO("mt9p012", 0x6C >> 1),
|
|
},
|
|
#endif
|
|
#if defined(CONFIG_MT9T013) || defined(CONFIG_SENSORS_MT9T013)
|
|
{
|
|
I2C_BOARD_INFO("mt9t013", 0x6C), // 0x78>>1
|
|
},
|
|
#endif
|
|
};
|
|
|
|
#ifdef CONFIG_MSM_CAMERA
|
|
static uint32_t camera_off_gpio_table[] = {
|
|
/* parallel CAMERA interfaces */
|
|
PCOM_GPIO_CFG(0, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT0 */
|
|
PCOM_GPIO_CFG(1, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT1 */
|
|
PCOM_GPIO_CFG(2, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT2 */
|
|
PCOM_GPIO_CFG(3, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT3 */
|
|
PCOM_GPIO_CFG(4, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT4 */
|
|
PCOM_GPIO_CFG(5, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT5 */
|
|
PCOM_GPIO_CFG(6, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT6 */
|
|
PCOM_GPIO_CFG(7, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT7 */
|
|
PCOM_GPIO_CFG(8, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT8 */
|
|
PCOM_GPIO_CFG(9, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT9 */
|
|
PCOM_GPIO_CFG(10, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT10 */
|
|
PCOM_GPIO_CFG(11, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT11 */
|
|
PCOM_GPIO_CFG(12, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* PCLK */
|
|
PCOM_GPIO_CFG(13, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* HSYNC_IN */
|
|
PCOM_GPIO_CFG(14, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* VSYNC_IN */
|
|
PCOM_GPIO_CFG(15, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), /* MCLK */
|
|
};
|
|
|
|
static uint32_t camera_on_gpio_table[] = {
|
|
/* parallel CAMERA interfaces */
|
|
PCOM_GPIO_CFG(0, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT0 */
|
|
PCOM_GPIO_CFG(1, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT1 */
|
|
PCOM_GPIO_CFG(2, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT2 */
|
|
PCOM_GPIO_CFG(3, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT3 */
|
|
PCOM_GPIO_CFG(4, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT4 */
|
|
PCOM_GPIO_CFG(5, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT5 */
|
|
PCOM_GPIO_CFG(6, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT6 */
|
|
PCOM_GPIO_CFG(7, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT7 */
|
|
PCOM_GPIO_CFG(8, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT8 */
|
|
PCOM_GPIO_CFG(9, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT9 */
|
|
PCOM_GPIO_CFG(10, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT10 */
|
|
PCOM_GPIO_CFG(11, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT11 */
|
|
PCOM_GPIO_CFG(12, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_16MA), /* PCLK */
|
|
PCOM_GPIO_CFG(13, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* HSYNC_IN */
|
|
PCOM_GPIO_CFG(14, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* VSYNC_IN */
|
|
PCOM_GPIO_CFG(15, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_16MA), /* MCLK */
|
|
};
|
|
|
|
static void config_gpio_table(uint32_t *table, int len)
|
|
{
|
|
int n;
|
|
unsigned id;
|
|
for (n = 0; n < len; n++) {
|
|
id = table[n];
|
|
msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &id, 0);
|
|
}
|
|
}
|
|
|
|
static void config_camera_on_gpios(void)
|
|
{
|
|
config_gpio_table(camera_on_gpio_table,
|
|
ARRAY_SIZE(camera_on_gpio_table));
|
|
}
|
|
|
|
static void config_camera_off_gpios(void)
|
|
{
|
|
config_gpio_table(camera_off_gpio_table,
|
|
ARRAY_SIZE(camera_off_gpio_table));
|
|
}
|
|
|
|
static struct msm_camera_device_platform_data msm_camera_device_data = {
|
|
.camera_gpio_on = config_camera_on_gpios,
|
|
.camera_gpio_off = config_camera_off_gpios,
|
|
.ioext.mdcphy = MSM_MDC_PHYS,
|
|
.ioext.mdcsz = MSM_MDC_SIZE,
|
|
.ioext.appphy = MSM_CLK_CTL_PHYS,
|
|
.ioext.appsz = MSM_CLK_CTL_SIZE,
|
|
};
|
|
|
|
#ifdef CONFIG_MT9D112
|
|
static struct msm_camera_sensor_info msm_camera_sensor_mt9d112_data = {
|
|
.sensor_name = "mt9d112",
|
|
.sensor_reset = 89,
|
|
.sensor_pwd = 85,
|
|
.vcm_pwd = 0,
|
|
.pdata = &msm_camera_device_data,
|
|
};
|
|
|
|
static struct platform_device msm_camera_sensor_mt9d112 = {
|
|
.name = "msm_camera_mt9d112",
|
|
.dev = {
|
|
.platform_data = &msm_camera_sensor_mt9d112_data,
|
|
},
|
|
};
|
|
#endif
|
|
|
|
#ifdef CONFIG_S5K3E2FX
|
|
static struct msm_camera_sensor_info msm_camera_sensor_s5k3e2fx_data = {
|
|
.sensor_name = "s5k3e2fx",
|
|
.sensor_reset = 89,
|
|
.sensor_pwd = 85,
|
|
.vcm_pwd = 0,
|
|
.pdata = &msm_camera_device_data,
|
|
};
|
|
|
|
static struct platform_device msm_camera_sensor_s5k3e2fx = {
|
|
.name = "msm_camera_s5k3e2fx",
|
|
.dev = {
|
|
.platform_data = &msm_camera_sensor_s5k3e2fx_data,
|
|
},
|
|
};
|
|
#endif
|
|
|
|
#ifdef CONFIG_MT9P012
|
|
static struct msm_camera_sensor_info msm_camera_sensor_mt9p012_data = {
|
|
.sensor_name = "mt9p012",
|
|
.sensor_reset = 89,
|
|
.sensor_pwd = 85,
|
|
.vcm_pwd = 88,
|
|
.pdata = &msm_camera_device_data,
|
|
};
|
|
|
|
static struct platform_device msm_camera_sensor_mt9p012 = {
|
|
.name = "msm_camera_mt9p012",
|
|
.dev = {
|
|
.platform_data = &msm_camera_sensor_mt9p012_data,
|
|
},
|
|
};
|
|
#endif
|
|
|
|
#ifdef CONFIG_MT9T013
|
|
static struct msm_camera_sensor_info msm_camera_sensor_mt9t013_data = {
|
|
.sensor_name = "mt9t013",
|
|
.sensor_reset = 89,
|
|
.sensor_pwd = 85,
|
|
.vcm_pwd = 0,
|
|
.pdata = &msm_camera_device_data,
|
|
};
|
|
|
|
static struct platform_device msm_camera_sensor_mt9t013 = {
|
|
.name = "msm_camera_mt9t013",
|
|
.dev = {
|
|
.platform_data = &msm_camera_sensor_mt9t013_data,
|
|
},
|
|
};
|
|
#endif
|
|
#endif /*CONFIG_MSM_CAMERA*/
|
|
|
|
#define SND(desc, num) { .name = #desc, .id = num }
|
|
static struct snd_endpoint snd_endpoints_list[] = {
|
|
SND(HANDSET, 0),
|
|
SND(HEADSET, 2),
|
|
SND(SPEAKER, 6),
|
|
SND(BT, 12),
|
|
SND(CURRENT, 25),
|
|
};
|
|
#undef SND
|
|
|
|
static struct msm_snd_endpoints halibut_snd_endpoints = {
|
|
.endpoints = snd_endpoints_list,
|
|
.num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
|
|
};
|
|
|
|
static struct platform_device halibut_snd = {
|
|
.name = "msm_snd",
|
|
.id = -1,
|
|
.dev = {
|
|
.platform_data = &halibut_snd_endpoints
|
|
},
|
|
};
|
|
|
|
static struct android_pmem_platform_data android_pmem_pdata = {
|
|
.name = "pmem",
|
|
.start = MSM_PMEM_MDP_BASE,
|
|
.size = MSM_PMEM_MDP_SIZE,
|
|
.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 android_pmem_platform_data android_pmem_adsp_pdata = {
|
|
.name = "pmem_adsp",
|
|
.start = MSM_PMEM_ADSP_BASE,
|
|
.size = MSM_PMEM_ADSP_SIZE,
|
|
.no_allocator = 0,
|
|
.cached = 0,
|
|
};
|
|
|
|
static struct android_pmem_platform_data android_pmem_gpu0_pdata = {
|
|
.name = "pmem_gpu0",
|
|
.start = MSM_PMEM_GPU0_BASE,
|
|
.size = MSM_PMEM_GPU0_SIZE,
|
|
.no_allocator = 1,
|
|
.cached = 0,
|
|
};
|
|
|
|
static struct android_pmem_platform_data android_pmem_gpu1_pdata = {
|
|
.name = "pmem_gpu1",
|
|
.start = MSM_PMEM_GPU1_BASE,
|
|
.size = MSM_PMEM_GPU1_SIZE,
|
|
.no_allocator = 1,
|
|
.cached = 0,
|
|
};
|
|
|
|
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_gpu0_device = {
|
|
.name = "android_pmem",
|
|
.id = 2,
|
|
.dev = { .platform_data = &android_pmem_gpu0_pdata },
|
|
};
|
|
|
|
static struct platform_device android_pmem_gpu1_device = {
|
|
.name = "android_pmem",
|
|
.id = 3,
|
|
.dev = { .platform_data = &android_pmem_gpu1_pdata },
|
|
};
|
|
|
|
static struct platform_device android_pmem_camera_device = {
|
|
.name = "android_pmem",
|
|
.id = 4,
|
|
.dev = { .platform_data = &android_pmem_camera_pdata },
|
|
};
|
|
|
|
static int halibut_phy_init_seq[] = { 0x1D, 0x0D, 0x1D, 0x10, -1 };
|
|
|
|
static struct msm_hsusb_platform_data msm_hsusb_pdata = {
|
|
.phy_init_seq = halibut_phy_init_seq,
|
|
};
|
|
|
|
static struct usb_mass_storage_platform_data mass_storage_pdata = {
|
|
.nluns = 1,
|
|
.vendor = "Qualcomm",
|
|
.product = "Halibut",
|
|
.release = 0x0100,
|
|
};
|
|
|
|
static struct platform_device usb_mass_storage_device = {
|
|
.name = "usb_mass_storage",
|
|
.id = -1,
|
|
.dev = {
|
|
.platform_data = &mass_storage_pdata,
|
|
},
|
|
};
|
|
|
|
static char *usb_functions[] = { "usb_mass_storage" };
|
|
static char *usb_functions_adb[] = { "usb_mass_storage", "adb" };
|
|
|
|
static struct android_usb_product usb_products[] = {
|
|
{
|
|
.product_id = 0x0c01,
|
|
.num_functions = ARRAY_SIZE(usb_functions),
|
|
.functions = usb_functions,
|
|
},
|
|
{
|
|
.product_id = 0x0c02,
|
|
.num_functions = ARRAY_SIZE(usb_functions_adb),
|
|
.functions = usb_functions_adb,
|
|
},
|
|
};
|
|
|
|
static struct android_usb_platform_data android_usb_pdata = {
|
|
.vendor_id = 0x18d1,
|
|
.product_id = 0x0c01,
|
|
.version = 0x0100,
|
|
.serial_number = "42",
|
|
.product_name = "Halibutdroid",
|
|
.manufacturer_name = "Qualcomm",
|
|
.num_products = ARRAY_SIZE(usb_products),
|
|
.products = usb_products,
|
|
.num_functions = ARRAY_SIZE(usb_functions_adb),
|
|
.functions = usb_functions_adb,
|
|
};
|
|
|
|
static struct platform_device android_usb_device = {
|
|
.name = "android_usb",
|
|
.id = -1,
|
|
.dev = {
|
|
.platform_data = &android_usb_pdata,
|
|
},
|
|
};
|
|
|
|
static struct platform_device fish_battery_device = {
|
|
.name = "fish_battery",
|
|
};
|
|
|
|
static struct platform_device *devices[] __initdata = {
|
|
#if !defined(CONFIG_MSM_SERIAL_DEBUGGER)
|
|
&msm_device_uart3,
|
|
#endif
|
|
&msm_device_smd,
|
|
&msm_device_nand,
|
|
&msm_device_hsusb,
|
|
&usb_mass_storage_device,
|
|
&android_usb_device,
|
|
&msm_device_i2c,
|
|
&smc91x_device,
|
|
&halibut_snd,
|
|
#ifdef CONFIG_MT9T013
|
|
&msm_camera_sensor_mt9t013,
|
|
#endif
|
|
#ifdef CONFIG_MT9D112
|
|
&msm_camera_sensor_mt9d112,
|
|
#endif
|
|
#ifdef CONFIG_S5K3E2FX
|
|
&msm_camera_sensor_s5k3e2fx,
|
|
#endif
|
|
#ifdef CONFIG_MT9P012
|
|
&msm_camera_sensor_mt9p012,
|
|
#endif
|
|
&android_pmem_device,
|
|
&android_pmem_adsp_device,
|
|
&android_pmem_gpu0_device,
|
|
&android_pmem_gpu1_device,
|
|
&android_pmem_camera_device,
|
|
&fish_battery_device,
|
|
};
|
|
|
|
extern struct sys_timer msm_timer;
|
|
|
|
static void __init halibut_init_irq(void)
|
|
{
|
|
msm_init_irq();
|
|
}
|
|
|
|
static struct msm_acpu_clock_platform_data halibut_clock_data = {
|
|
.acpu_switch_time_us = 50,
|
|
.max_speed_delta_khz = 256000,
|
|
.vdd_switch_time_us = 62,
|
|
.power_collapse_khz = 19200000,
|
|
.wait_for_irq_khz = 128000000,
|
|
};
|
|
|
|
extern void msm_serial_debug_init(unsigned int base, int irq,
|
|
struct device *clk_device, int signal_irq);
|
|
|
|
static void __init halibut_init(void)
|
|
{
|
|
#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
|
|
msm_serial_debug_init(MSM_UART3_PHYS, INT_UART3,
|
|
&msm_device_uart3.dev, 1);
|
|
#endif
|
|
msm_device_hsusb.dev.platform_data = &msm_hsusb_pdata;
|
|
msm_acpu_clock_init(&halibut_clock_data);
|
|
#ifdef CONFIG_MSM_CAMERA
|
|
config_camera_off_gpios(); /* might not be necessary */
|
|
#endif
|
|
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
|
|
platform_add_devices(devices, ARRAY_SIZE(devices));
|
|
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
|
|
msm_hsusb_set_vbus_state(1);
|
|
}
|
|
|
|
static void __init halibut_fixup(struct machine_desc *desc, struct tag *tags,
|
|
char **cmdline, struct meminfo *mi)
|
|
{
|
|
mi->nr_banks = 1;
|
|
mi->bank[0].start = PHYS_OFFSET;
|
|
mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET);
|
|
mi->bank[0].size = (101*1024*1024);
|
|
}
|
|
|
|
static void __init halibut_map_io(void)
|
|
{
|
|
msm_map_common_io();
|
|
msm_clock_init();
|
|
}
|
|
|
|
MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)")
|
|
#ifdef CONFIG_MSM_DEBUG_UART
|
|
.phys_io = MSM_DEBUG_UART_PHYS,
|
|
.io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
|
|
#endif
|
|
.boot_params = 0x10000100,
|
|
.fixup = halibut_fixup,
|
|
.map_io = halibut_map_io,
|
|
.init_irq = halibut_init_irq,
|
|
.init_machine = halibut_init,
|
|
.timer = &msm_timer,
|
|
MACHINE_END
|