| 1 |
/* linux/arch/arm/mach-msm/board-htcdiamond.c |
| 2 |
* |
| 3 |
* Copyright (C) 2007 Google, Inc. |
| 4 |
* Author: Brian Swetland <swetland@google.com>, |
| 5 |
* Octavian Voicu, Martijn Stolk |
| 6 |
* |
| 7 |
* This software is licensed under the terms of the GNU General Public |
| 8 |
* License version 2, as published by the Free Software Foundation, and |
| 9 |
* may be copied, distributed, and modified under those terms. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
*/ |
| 17 |
|
| 18 |
#include <linux/kernel.h> |
| 19 |
#include <linux/init.h> |
| 20 |
#include <linux/platform_device.h> |
| 21 |
#include <linux/input.h> |
| 22 |
|
| 23 |
#include <linux/mtd/nand.h> |
| 24 |
#include <linux/mtd/partitions.h> |
| 25 |
#include <linux/i2c.h> |
| 26 |
#include <linux/mm.h> |
| 27 |
#include <linux/gpio_event.h> |
| 28 |
|
| 29 |
|
| 30 |
#include <mach/hardware.h> |
| 31 |
#include <asm/mach-types.h> |
| 32 |
#include <asm/mach/arch.h> |
| 33 |
#include <asm/mach/map.h> |
| 34 |
#include <asm/mach/flash.h> |
| 35 |
#include <asm/mach/mmc.h> |
| 36 |
#include <asm/setup.h> |
| 37 |
|
| 38 |
#include <mach/board.h> |
| 39 |
#include <mach/msm_iomap.h> |
| 40 |
#include <mach/system.h> |
| 41 |
#include <mach/msm_fb.h> |
| 42 |
#include <mach/msm_hsusb.h> |
| 43 |
#include <mach/msm_serial_hs.h> |
| 44 |
#include <mach/vreg.h> |
| 45 |
#include <mach/htc_battery.h> |
| 46 |
#include <mach/htc_pwrsink.h> |
| 47 |
#include <mach/board_htc.h> |
| 48 |
|
| 49 |
#include <mach/gpio.h> |
| 50 |
#include <mach/io.h> |
| 51 |
#include <linux/delay.h> |
| 52 |
#ifdef CONFIG_HTC_HEADSET |
| 53 |
#include <mach/htc_headset.h> |
| 54 |
#endif |
| 55 |
|
| 56 |
#include "proc_comm_wince.h" |
| 57 |
#include "devices.h" |
| 58 |
#include "htc_hw.h" |
| 59 |
#include "board-htcdiamond.h" |
| 60 |
|
| 61 |
static int halibut_ffa; |
| 62 |
module_param_named(ffa, halibut_ffa, int, S_IRUGO | S_IWUSR | S_IWGRP); |
| 63 |
|
| 64 |
static int banks=1; |
| 65 |
module_param(banks, int, S_IRUGO | S_IWUSR | S_IWGRP); |
| 66 |
static int adb=1; |
| 67 |
module_param(adb, int, S_IRUGO | S_IWUSR | S_IWGRP); |
| 68 |
|
| 69 |
static void htcdiamond_device_specific_fixes(void); |
| 70 |
|
| 71 |
extern int init_mmc(void); |
| 72 |
extern void msm_init_pmic_vibrator(void); |
| 73 |
|
| 74 |
static int usb_phy_init_seq_diam100[] = { |
| 75 |
0x40, 0x31, /* Leave this pair out for USB Host Mode */ |
| 76 |
0x1D, 0x0D, |
| 77 |
0x1D, 0x10, |
| 78 |
-1 |
| 79 |
}; |
| 80 |
|
| 81 |
static int usb_phy_init_seq_diam800[] = { |
| 82 |
0x04, 0x48, /* Host mode is unsure for diam800 */ |
| 83 |
0x3A, 0x10, |
| 84 |
0x3B, 0x10, |
| 85 |
-1 |
| 86 |
}; |
| 87 |
|
| 88 |
static void usb_phy_reset(void) |
| 89 |
{ |
| 90 |
gpio_set_value(0x64, 0); |
| 91 |
mdelay(1); |
| 92 |
gpio_set_value(0x64, 1); |
| 93 |
mdelay(3); |
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
#define PCOM_GPIO_CFG(a,b,c,d,e) DEX_GPIO_CFG(a,b,c,d,e,0) |
| 98 |
static struct msm_gpio_config camera_off_gpio_table[] = { |
| 99 |
/* CAMERA */ |
| 100 |
PCOM_GPIO_CFG(2, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT2 */ |
| 101 |
PCOM_GPIO_CFG(3, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT3 */ |
| 102 |
PCOM_GPIO_CFG(4, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT4 */ |
| 103 |
PCOM_GPIO_CFG(5, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT5 */ |
| 104 |
PCOM_GPIO_CFG(6, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT6 */ |
| 105 |
PCOM_GPIO_CFG(7, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT7 */ |
| 106 |
PCOM_GPIO_CFG(8, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT8 */ |
| 107 |
PCOM_GPIO_CFG(9, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT9 */ |
| 108 |
PCOM_GPIO_CFG(10, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT10 */ |
| 109 |
PCOM_GPIO_CFG(11, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT11 */ |
| 110 |
PCOM_GPIO_CFG(12, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* PCLK */ |
| 111 |
PCOM_GPIO_CFG(13, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* HSYNC_IN */ |
| 112 |
PCOM_GPIO_CFG(14, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* VSYNC_IN */ |
| 113 |
PCOM_GPIO_CFG(15, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* MCLK */ |
| 114 |
}; |
| 115 |
|
| 116 |
static struct msm_gpio_config camera_on_gpio_table[] = { |
| 117 |
/* CAMERA */ |
| 118 |
PCOM_GPIO_CFG(2, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT2 */ |
| 119 |
PCOM_GPIO_CFG(3, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT3 */ |
| 120 |
PCOM_GPIO_CFG(4, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT4 */ |
| 121 |
PCOM_GPIO_CFG(5, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT5 */ |
| 122 |
PCOM_GPIO_CFG(6, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT6 */ |
| 123 |
PCOM_GPIO_CFG(7, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT7 */ |
| 124 |
PCOM_GPIO_CFG(8, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT8 */ |
| 125 |
PCOM_GPIO_CFG(9, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT9 */ |
| 126 |
PCOM_GPIO_CFG(10, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT10 */ |
| 127 |
PCOM_GPIO_CFG(11, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* DAT11 */ |
| 128 |
PCOM_GPIO_CFG(12, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_16MA), /* PCLK */ |
| 129 |
PCOM_GPIO_CFG(13, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* HSYNC_IN */ |
| 130 |
PCOM_GPIO_CFG(14, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), /* VSYNC_IN */ |
| 131 |
PCOM_GPIO_CFG(15, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_16MA), /* MCLK */ |
| 132 |
}; |
| 133 |
|
| 134 |
static void config_gpio_table(struct msm_gpio_config *table, int len) |
| 135 |
{ |
| 136 |
int n; |
| 137 |
struct msm_gpio_config id; |
| 138 |
for(n = 0; n < len; n++) { |
| 139 |
id = table[n]; |
| 140 |
msm_gpio_set_function( id ); |
| 141 |
} |
| 142 |
} |
| 143 |
|
| 144 |
static void config_camera_on_gpios(void) |
| 145 |
{ |
| 146 |
config_gpio_table(camera_on_gpio_table, |
| 147 |
ARRAY_SIZE(camera_on_gpio_table)); |
| 148 |
} |
| 149 |
|
| 150 |
static void config_camera_off_gpios(void) |
| 151 |
{ |
| 152 |
config_gpio_table(camera_off_gpio_table, |
| 153 |
ARRAY_SIZE(camera_off_gpio_table)); |
| 154 |
} |
| 155 |
|
| 156 |
/* |
| 157 |
static struct msm_camera_device_platform_data msm_camera_device = { |
| 158 |
.sensor_reset = RAPH100_CAM1_RST, |
| 159 |
.sensor_pwd = RAPH100_CAM_PWD, |
| 160 |
//.vcm_pwd = VCM_PWDN; //Lens power |
| 161 |
.config_gpio_on = config_camera_on_gpios, |
| 162 |
.config_gpio_off = config_camera_off_gpios, |
| 163 |
}; |
| 164 |
|
| 165 |
static struct platform_device camera_dev = { |
| 166 |
.name = "camera", |
| 167 |
.dev = { |
| 168 |
.platform_data = &msm_camera_device, |
| 169 |
}, |
| 170 |
}; |
| 171 |
*/ |
| 172 |
|
| 173 |
#ifdef CONFIG_MSM_CAMERA |
| 174 |
static struct msm_camera_device_platform_data msm_camera_device_data = { |
| 175 |
.camera_gpio_on = config_camera_on_gpios, |
| 176 |
.camera_gpio_off = config_camera_off_gpios, |
| 177 |
.ioext.mdcphy = MSM_MDC_PHYS, |
| 178 |
.ioext.mdcsz = MSM_MDC_SIZE, |
| 179 |
.ioext.appphy = MSM_CLK_CTL_PHYS, |
| 180 |
.ioext.appsz = MSM_CLK_CTL_SIZE, |
| 181 |
}; |
| 182 |
|
| 183 |
#ifdef CONFIG_MT9T013 |
| 184 |
int camera_set_state(int on) { |
| 185 |
int rc; |
| 186 |
struct vreg *vrg; |
| 187 |
//Do nothing yet on poweroff |
| 188 |
if(!on) |
| 189 |
return 0; |
| 190 |
gpio_request(RAPH100_CAM1_RST, "mt9t013"); |
| 191 |
gpio_direction_output(RAPH100_CAM1_RST, on); |
| 192 |
gpio_request(0x1e, "mt9t013"); |
| 193 |
gpio_direction_output(0x1e, !on); |
| 194 |
|
| 195 |
struct msm_dex_command dex = { .cmd = PCOM_PMIC_CAM_ON }; |
| 196 |
// struct msm_dex_command dex = { .cmd = PCOM_NOTIFY_ARM9_REBOOT }; |
| 197 |
msm_proc_comm_wince(&dex, 0); |
| 198 |
mdelay(0x15e); |
| 199 |
} |
| 200 |
|
| 201 |
static struct msm_camera_sensor_info msm_camera_sensor_mt9t013_data = { |
| 202 |
.sensor_name = "mt9t013", |
| 203 |
.sensor_reset = RAPH100_CAM1_RST, |
| 204 |
.sensor_pwd = RAPH100_CAM_PWD, |
| 205 |
//.vcm_pwd = TROUT_GPIO_VCM_PWDN, |
| 206 |
.pdata = &msm_camera_device_data, |
| 207 |
.set_state = camera_set_state, |
| 208 |
}; |
| 209 |
|
| 210 |
static struct platform_device msm_camera_sensor_mt9t013 = { |
| 211 |
.name = "msm_camera_mt9t013", |
| 212 |
.dev = { |
| 213 |
.platform_data = &msm_camera_sensor_mt9t013_data, |
| 214 |
}, |
| 215 |
}; |
| 216 |
#endif |
| 217 |
#endif |
| 218 |
|
| 219 |
|
| 220 |
static struct i2c_board_info i2c_devices[] = { |
| 221 |
{ |
| 222 |
// LED & Backlight controller |
| 223 |
I2C_BOARD_INFO("microp-klt", 0x66), |
| 224 |
}, |
| 225 |
{ |
| 226 |
I2C_BOARD_INFO("mt9t013", 0x6c>>1), |
| 227 |
}, |
| 228 |
{ |
| 229 |
// Raphael NaviPad (cy8c20434) |
| 230 |
I2C_BOARD_INFO("raph_navi_pad", 0x62), |
| 231 |
}, |
| 232 |
{ |
| 233 |
// Accelerometer |
| 234 |
I2C_BOARD_INFO("kionix-kxsd9", 0x18), |
| 235 |
}, |
| 236 |
|
| 237 |
}; |
| 238 |
|
| 239 |
static smem_batt_t msm_battery_pdata = { |
| 240 |
.gpio_battery_detect = RAPH100_BAT_IRQ, |
| 241 |
.gpio_charger_enable = RAPH100_CHARGE_EN_N, |
| 242 |
.gpio_charger_current_select = RAPH100_USB_AC_PWR, |
| 243 |
.smem_offset = 0xfc140, |
| 244 |
.smem_field_size = 4, |
| 245 |
}; |
| 246 |
|
| 247 |
static struct platform_device raphael_rfkill = { |
| 248 |
.name = "htcraphael_rfkill", |
| 249 |
.id = -1, |
| 250 |
}; |
| 251 |
|
| 252 |
#define SND(num, desc) { .name = desc, .id = num } |
| 253 |
static struct snd_endpoint snd_endpoints_list[] = { |
| 254 |
SND(0, "HANDSET"), |
| 255 |
SND(1, "SPEAKER"), |
| 256 |
SND(2, "HEADSET"), |
| 257 |
SND(3, "BT"), |
| 258 |
SND(44, "BT_EC_OFF"), |
| 259 |
SND(10, "HEADSET_AND_SPEAKER"), |
| 260 |
SND(256, "CURRENT"), |
| 261 |
}; |
| 262 |
#undef SND |
| 263 |
|
| 264 |
static struct msm_snd_endpoints raphael_snd_endpoints = { |
| 265 |
.endpoints = snd_endpoints_list, |
| 266 |
.num = ARRAY_SIZE(snd_endpoints_list), |
| 267 |
}; |
| 268 |
|
| 269 |
static struct platform_device raphael_snd = { |
| 270 |
.name = "msm_snd", |
| 271 |
.id = -1, |
| 272 |
.dev = { |
| 273 |
.platform_data = &raphael_snd_endpoints, |
| 274 |
}, |
| 275 |
}; |
| 276 |
|
| 277 |
static struct platform_device raphael_gps = { |
| 278 |
.name = "gps_rfkill", |
| 279 |
}; |
| 280 |
|
| 281 |
static struct pwr_sink diamond_pwrsink_table[] = { |
| 282 |
{ |
| 283 |
.id = PWRSINK_AUDIO, |
| 284 |
.ua_max = 90000, |
| 285 |
}, |
| 286 |
{ |
| 287 |
.id = PWRSINK_BACKLIGHT, |
| 288 |
.ua_max = 128000, |
| 289 |
}, |
| 290 |
{ |
| 291 |
.id = PWRSINK_LED_BUTTON, |
| 292 |
.ua_max = 17000, |
| 293 |
}, |
| 294 |
{ |
| 295 |
.id = PWRSINK_LED_KEYBOARD, |
| 296 |
.ua_max = 22000, |
| 297 |
}, |
| 298 |
{ |
| 299 |
.id = PWRSINK_GP_CLK, |
| 300 |
.ua_max = 30000, |
| 301 |
}, |
| 302 |
{ |
| 303 |
.id = PWRSINK_BLUETOOTH, |
| 304 |
.ua_max = 15000, |
| 305 |
}, |
| 306 |
{ |
| 307 |
.id = PWRSINK_CAMERA, |
| 308 |
.ua_max = 0, |
| 309 |
}, |
| 310 |
{ |
| 311 |
.id = PWRSINK_SDCARD, |
| 312 |
.ua_max = 0, |
| 313 |
}, |
| 314 |
{ |
| 315 |
.id = PWRSINK_VIDEO, |
| 316 |
.ua_max = 0, |
| 317 |
}, |
| 318 |
{ |
| 319 |
.id = PWRSINK_WIFI, |
| 320 |
.ua_max = 200000, |
| 321 |
}, |
| 322 |
{ |
| 323 |
.id = PWRSINK_SYSTEM_LOAD, |
| 324 |
.ua_max = 100000, |
| 325 |
.percent_util = 38, |
| 326 |
}, |
| 327 |
}; |
| 328 |
|
| 329 |
static struct pwr_sink_platform_data diamond_pwrsink_data = { |
| 330 |
.num_sinks = ARRAY_SIZE(diamond_pwrsink_table), |
| 331 |
.sinks = diamond_pwrsink_table, |
| 332 |
.suspend_late = NULL, |
| 333 |
.resume_early = NULL, |
| 334 |
.suspend_early = NULL, |
| 335 |
.resume_late = NULL, |
| 336 |
}; |
| 337 |
|
| 338 |
static struct platform_device diamond_pwr_sink = { |
| 339 |
.name = "htc_pwrsink", |
| 340 |
.id = -1, |
| 341 |
.dev = { |
| 342 |
.platform_data = &diamond_pwrsink_data, |
| 343 |
}, |
| 344 |
}; |
| 345 |
|
| 346 |
|
| 347 |
#ifdef CONFIG_HTC_HEADSET |
| 348 |
|
| 349 |
static void h2w_config_cpld(int route); |
| 350 |
static void h2w_init_cpld(void); |
| 351 |
static struct h2w_platform_data diamond_h2w_data = { |
| 352 |
.cable_in1 = 18,//TROUT_GPIO_CABLE_IN1, |
| 353 |
.cable_in2 = 45,//TROUT_GPIO_CABLE_IN2, |
| 354 |
.h2w_clk = 46,//TROUT_GPIO_H2W_CLK_GPI, |
| 355 |
.h2w_data = 31,//TROUT_GPIO_H2W_DAT_GPI, |
| 356 |
.debug_uart = H2W_UART3, |
| 357 |
.config_cpld = h2w_config_cpld, |
| 358 |
.init_cpld = h2w_init_cpld, |
| 359 |
.headset_mic_35mm = 17, |
| 360 |
}; |
| 361 |
|
| 362 |
static void h2w_config_cpld(int route) |
| 363 |
{ |
| 364 |
switch (route) { |
| 365 |
case H2W_UART3: |
| 366 |
gpio_set_value(0, 1); |
| 367 |
break; |
| 368 |
case H2W_GPIO: |
| 369 |
gpio_set_value(0, 0); |
| 370 |
break; |
| 371 |
} |
| 372 |
} |
| 373 |
|
| 374 |
static void h2w_init_cpld(void) |
| 375 |
{ |
| 376 |
h2w_config_cpld(H2W_UART3); |
| 377 |
gpio_set_value(diamond_h2w_data.h2w_clk, 0); |
| 378 |
gpio_set_value(diamond_h2w_data.h2w_data, 0); |
| 379 |
} |
| 380 |
|
| 381 |
static struct platform_device diamond_h2w = { |
| 382 |
.name = "h2w", |
| 383 |
.id = -1, |
| 384 |
.dev = { |
| 385 |
.platform_data = &diamond_h2w_data, |
| 386 |
}, |
| 387 |
}; |
| 388 |
#endif |
| 389 |
|
| 390 |
static struct platform_device *devices[] __initdata = { |
| 391 |
&diamond_pwr_sink, |
| 392 |
&raphael_rfkill, |
| 393 |
&msm_device_smd, |
| 394 |
&msm_device_nand, |
| 395 |
&msm_device_i2c, |
| 396 |
&msm_device_rtc, |
| 397 |
&msm_device_htc_hw, |
| 398 |
#if !defined(CONFIG_MSM_SERIAL_DEBUGGER) && !defined(CONFIG_HTC_HEADSET) |
| 399 |
// &msm_device_uart1, |
| 400 |
#endif |
| 401 |
#ifdef CONFIG_SERIAL_MSM_HS |
| 402 |
&msm_device_uart_dm2, |
| 403 |
#endif |
| 404 |
&msm_device_htc_battery, |
| 405 |
&msm_camera_sensor_mt9t013, |
| 406 |
&raphael_snd, |
| 407 |
&raphael_gps,// disable until it works |
| 408 |
#ifdef CONFIG_HTC_HEADSET |
| 409 |
&diamond_h2w, |
| 410 |
#endif |
| 411 |
}; |
| 412 |
|
| 413 |
extern struct sys_timer msm_timer; |
| 414 |
|
| 415 |
static void __init halibut_init_irq(void) |
| 416 |
{ |
| 417 |
msm_init_irq(); |
| 418 |
} |
| 419 |
|
| 420 |
static struct msm_acpu_clock_platform_data halibut_clock_data = { |
| 421 |
.acpu_switch_time_us = 50, |
| 422 |
.max_speed_delta_khz = 256000, |
| 423 |
.vdd_switch_time_us = 62, |
| 424 |
.power_collapse_khz = 19200000, |
| 425 |
.wait_for_irq_khz = 128000000, |
| 426 |
}; |
| 427 |
|
| 428 |
void msm_serial_debug_init(unsigned int base, int irq, |
| 429 |
const char *clkname, int signal_irq); |
| 430 |
|
| 431 |
#ifdef CONFIG_SERIAL_MSM_HS |
| 432 |
static struct msm_serial_hs_platform_data msm_uart_dm2_pdata = { |
| 433 |
.wakeup_irq = MSM_GPIO_TO_INT(21), |
| 434 |
.inject_rx_on_wakeup = 1, |
| 435 |
.rx_to_inject = 0x32, |
| 436 |
}; |
| 437 |
#endif |
| 438 |
|
| 439 |
void msm_arch_idle(void); |
| 440 |
static void htcraphael_reset(void) |
| 441 |
{ |
| 442 |
struct msm_dex_command dex = { .cmd = PCOM_RESET_ARM9 }; |
| 443 |
// struct msm_dex_command dex = { .cmd = PCOM_NOTIFY_ARM9_REBOOT }; |
| 444 |
msm_proc_comm_wince(&dex, 0); |
| 445 |
mdelay(0x15e); |
| 446 |
gpio_configure(25, GPIOF_OWNER_ARM11); |
| 447 |
gpio_direction_output(25, 0); |
| 448 |
printk(KERN_INFO "%s: Soft reset done.\n", __func__); |
| 449 |
while(1) |
| 450 |
msm_arch_idle(); |
| 451 |
} |
| 452 |
|
| 453 |
static void htcraphael_set_vibrate(uint32_t val) |
| 454 |
{ |
| 455 |
struct msm_dex_command vibra; |
| 456 |
|
| 457 |
if (val == 0) { |
| 458 |
vibra.cmd = PCOM_VIBRA_OFF; |
| 459 |
msm_proc_comm_wince(&vibra, 0); |
| 460 |
} else if (val > 0) { |
| 461 |
if (val == 1 || val > 0xb22) |
| 462 |
val = 0xb22; |
| 463 |
writel(val, MSM_SHARED_RAM_BASE + 0xfc130); |
| 464 |
vibra.cmd = PCOM_VIBRA_ON; |
| 465 |
msm_proc_comm_wince(&vibra, 0); |
| 466 |
} |
| 467 |
} |
| 468 |
|
| 469 |
static htc_hw_pdata_t msm_htc_hw_pdata = { |
| 470 |
.set_vibrate = htcraphael_set_vibrate, |
| 471 |
.battery_smem_offset = 0xfc140, //XXX: raph800 |
| 472 |
.battery_smem_field_size = 4, |
| 473 |
}; |
| 474 |
|
| 475 |
static void __init halibut_init(void) |
| 476 |
{ |
| 477 |
int i; |
| 478 |
|
| 479 |
// Fix data in arrays depending on GSM/CDMA version |
| 480 |
htcdiamond_device_specific_fixes(); |
| 481 |
|
| 482 |
msm_acpu_clock_init(&halibut_clock_data); |
| 483 |
msm_proc_comm_wince_init(); |
| 484 |
|
| 485 |
// Register hardware reset hook |
| 486 |
msm_hw_reset_hook = htcraphael_reset; |
| 487 |
|
| 488 |
// Device pdata overrides |
| 489 |
msm_device_htc_hw.dev.platform_data = &msm_htc_hw_pdata; |
| 490 |
msm_device_htc_battery.dev.platform_data = &msm_battery_pdata; |
| 491 |
|
| 492 |
if(machine_is_htcdiamond()) |
| 493 |
msm_add_usb_devices(usb_phy_reset, NULL, usb_phy_init_seq_diam100); |
| 494 |
else |
| 495 |
msm_add_usb_devices(usb_phy_reset, NULL, usb_phy_init_seq_diam800); |
| 496 |
#ifdef CONFIG_SERIAL_MSM_HS |
| 497 |
msm_device_uart_dm2.dev.platform_data = &msm_uart_dm2_pdata; |
| 498 |
#endif |
| 499 |
|
| 500 |
#ifndef CONFIG_MACH_SAPPHIRE |
| 501 |
msm_init_pmic_vibrator(); |
| 502 |
#endif |
| 503 |
|
| 504 |
// Register devices |
| 505 |
platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 506 |
|
| 507 |
// Register I2C devices |
| 508 |
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices)); |
| 509 |
|
| 510 |
// Initialize SD controllers |
| 511 |
init_mmc(); |
| 512 |
|
| 513 |
/* TODO: detect vbus and correctly notify USB about its presence |
| 514 |
* For now we just declare that VBUS is present at boot and USB |
| 515 |
* copes, but this is not ideal. |
| 516 |
*/ |
| 517 |
msm_hsusb_set_vbus_state(1); |
| 518 |
|
| 519 |
/* A little vibrating welcome */ |
| 520 |
for (i=0; i<2; i++) { |
| 521 |
htcraphael_set_vibrate(1); |
| 522 |
mdelay(150); |
| 523 |
htcraphael_set_vibrate(0); |
| 524 |
mdelay(75); |
| 525 |
} |
| 526 |
} |
| 527 |
|
| 528 |
static void __init halibut_map_io(void) |
| 529 |
{ |
| 530 |
msm_map_common_io(); |
| 531 |
msm_clock_init(); |
| 532 |
} |
| 533 |
|
| 534 |
static void __init htcdiamond_fixup(struct machine_desc *desc, struct tag *tags, |
| 535 |
char **cmdline, struct meminfo *mi) |
| 536 |
{ |
| 537 |
mi->nr_banks = 1; |
| 538 |
mi->bank[0].start = PAGE_ALIGN(PHYS_OFFSET); |
| 539 |
mi->bank[0].node = PHYS_TO_NID(mi->bank[0].start); |
| 540 |
mi->bank[0].size = (107 * 1024 * 1024); // Why 107? See board-htcdiamond.h |
| 541 |
/* TODO: detect whether a 2nd memory bank is actually present, not all devices have it */ |
| 542 |
// for now use a kernel parameter |
| 543 |
if(banks==2) { |
| 544 |
mi->nr_banks++; |
| 545 |
mi->bank[1].start = PAGE_ALIGN(PHYS_OFFSET + 0x10000000); |
| 546 |
mi->bank[1].node = PHYS_TO_NID(mi->bank[1].start); |
| 547 |
mi->bank[1].size = (128 * 1024 * 1024); |
| 548 |
} |
| 549 |
printk(KERN_INFO "fixup: nr_banks = %d\n", mi->nr_banks); |
| 550 |
printk(KERN_INFO "fixup: bank0 start=%08lx, node=%08x, size=%08lx\n", mi->bank[0].start, mi->bank[0].node, mi->bank[0].size); |
| 551 |
if (mi->nr_banks > 1) |
| 552 |
printk(KERN_INFO "fixup: bank1 start=%08lx, node=%08x, size=%08lx\n", mi->bank[1].start, mi->bank[1].node, mi->bank[1].size); |
| 553 |
} |
| 554 |
|
| 555 |
/* Already implemented for the Raphael board, to facilitate differences between GSM/CDMA */ |
| 556 |
static void htcdiamond_device_specific_fixes(void) |
| 557 |
{ |
| 558 |
if (machine_is_htcdiamond()) { |
| 559 |
msm_htc_hw_pdata.battery_smem_offset = 0xfc110; |
| 560 |
msm_htc_hw_pdata.battery_smem_field_size = 2; |
| 561 |
msm_battery_pdata.smem_offset = 0xfc110; |
| 562 |
msm_battery_pdata.smem_field_size = 2; |
| 563 |
} |
| 564 |
if (machine_is_htcdiamond_cdma()) { |
| 565 |
msm_htc_hw_pdata.battery_smem_offset = 0xfc140; |
| 566 |
msm_htc_hw_pdata.battery_smem_field_size = 4; |
| 567 |
msm_battery_pdata.smem_offset = 0xfc140; |
| 568 |
msm_battery_pdata.smem_field_size = 4; |
| 569 |
} |
| 570 |
} |
| 571 |
|
| 572 |
MACHINE_START(HTCDIAMOND, "HTC Diamond GSM phone (aka HTC Touch Diamond)") |
| 573 |
.fixup = htcdiamond_fixup, |
| 574 |
.boot_params = 0x10000100, |
| 575 |
.map_io = halibut_map_io, |
| 576 |
.init_irq = halibut_init_irq, |
| 577 |
.init_machine = halibut_init, |
| 578 |
.timer = &msm_timer, |
| 579 |
MACHINE_END |
| 580 |
|
| 581 |
MACHINE_START(HTCDIAMOND_CDMA, "HTC Diamond CDMA phone (aka HTC Touch Diamond)") |
| 582 |
.fixup = htcdiamond_fixup, |
| 583 |
.boot_params = 0x10000100, |
| 584 |
.map_io = halibut_map_io, |
| 585 |
.init_irq = halibut_init_irq, |
| 586 |
.init_machine = halibut_init, |
| 587 |
.timer = &msm_timer, |
| 588 |
MACHINE_END |