Пример #1
0
static void __init bahamas_init(void)
{
	int rc;
	printk("bahamas_init() revision=%d\n", system_rev);

	/*
	 * Setup common MSM GPIOS
	 */
	sdc1_boot_reset();
//        printk("\n\nboard-mega.c: sdc1 boot reset\n\n");

	config_gpios();
//        printk("\n\nboard-mega.c: config gpios\n\n");

	msm_hw_reset_hook = bahamas_reset;
//        printk("\n\nboard-mega.c: msm hw reset hook\n\n");

	msm_acpu_clock_init(&bahamas_clock_data);
//        printk("\n\nmsm acpu clock init\n\n");
	perflock_init(&bahamas_perflock_data);
//        printk("\n\nperflock init\n\n");
	/* adjust GPIOs based on bootloader request */
	/* XXX: on Memphis,
	 *      GPIO#86 is H2W DAT / UART RX for HTC 11-Pin
	 *      GPIO#87 is H2W CLK / UART TX for HTC 11-Pin
	 *      We would need to use UART3 as debug port
	 *
	 * TODO: switch UART3 and H2W (for headset detect)
	 *       based on bootloader request.
	 */

/*#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
	if (!opt_disable_uart3)
		msm_serial_debug_init(MSM_UART3_PHYS, INT_UART3,
				      &msm_device_uart3.dev, 1);
#endif*/


	/* touchscreen must be powered before we enable i2c pullup */
#if 0 /* TODO: do some equivalent operations here */
	udelay(50);
	trout_gpio_write(NULL, TROUT_GPIO_I2C_PULL, 1);
#endif

	/* put the AF VCM in powerdown mode to avoid noise */
#if 0
	trout_gpio_write(NULL, TROUT_GPIO_VCM_PWDN, 1);
	mdelay(100);
	trout_i2c_sysdev_resume(NULL);
#endif

#if 0 /* TODO: do some equivalent operations here */
	if(sysdev_class_register(&trout_i2c_sysdev_class) == 0)
		sysdev_register(&trout_i2c_sys_device);
#endif

	#ifdef CONFIG_SERIAL_MSM_HS
	msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
	msm_add_serial_devices(3);
	#else
	msm_add_serial_devices(0);
	#endif

	msm_add_serial_devices(2);

	msm_add_usb_devices(NULL,NULL);

	//msm_change_usb_id(0x0bb4, 0x0c06);
	if (board_mcp_monodie())
		msm_add_mem_devices(&pmem_setting_monodie);
	else
		msm_add_mem_devices(&pmem_setting_dualdie);
	msm_init_pmic_vibrator();
//        printk("\n\nboard-mega.c: msm init pmic vibrator\n\n");

	bahamas_init_h2w_power_gpio();
//        printk("\n\nboard-mega.c: bahamas init h2w power gpio\n\n");
//#if 1
	rc = bahamas_init_mmc(system_rev);
//        printk("\n\nboard-mega.c: init mmc\n\n");
	if (rc)
		printk(KERN_CRIT "%s: MMC init failure (%d)\n", __func__, rc);
//#endif
	if(!system_rev)
		bahamas_reset_keys_device.dev.platform_data = &bahamas_reset_keys_pdata0;
	/*CC090319*/
/*	if  (bahamas_is_3M_camera())   {
		msm_camera_device_data.sinfo = &msm_camera_sensor_mt9t013;
		}
	else  {
		msm_camera_device_data.sinfo = &msm_camera_sensor_s5k4b2fx;
	}*/

	if(system_rev < 3) {
		if (panel_detect() == PANEL_WINTEK) {
			microp_data.num_pins   = ARRAY_SIZE(microp_pins_0_wint);
			microp_data.pin_config = microp_pins_0_wint;
		} else {
			microp_data.num_pins   = ARRAY_SIZE(microp_pins_0);
			microp_data.pin_config = microp_pins_0;
		}
		i2c_microp_devices.irq = 0;
	} else if (panel_detect() == PANEL_WINTEK) {
		microp_data.num_pins   = ARRAY_SIZE(microp_pins_1_wint);
		microp_data.pin_config = microp_pins_1_wint;
	}

/*~CC090319*/
	//platform_add_devices(devices, ARRAY_SIZE(devices));

	/* Read Config 8 200 (Full Speed USB Mode) */
	/*if (readl(MSM_SHARED_RAM_BASE + 0xFC054) & 0x200)
		bahamas_h2w_data.flags |= FULL_SPEED_USB;

	if (system_rev >= 3)
		bahamas_h2w_data.flags |= _35MM_MIC_DET_L2H;

/*	if (system_rev >= 5)
		i2c_register_board_info(0, i2c_sensor, ARRAY_SIZE(i2c_sensor));

	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
	i2c_register_board_info(0 ,&i2c_microp_devices, 1);

	/* SD card door should wake the device */
	//trout_gpio_irq_set_wake(TROUT_GPIO_TO_INT(TROUT_GPIO_SD_DOOR_N), 1);
	msm_hsusb_set_vbus_state(1);
}
static void __init bahamas_init(void)
{
	int rc;
	char *cid = NULL;

	printk("bahamas_init() revision = 0x%X\n", system_rev);
	printk(KERN_INFO "mfg_mode=%d\n", board_mfg_mode());
	msm_clock_init();
	board_get_cid_tag(&cid);

	/*
	* Setup common MSM GPIOS
	*/
	config_gpios();

	gpio_request(BAHAMAS_GPIO_CABLE_IN2, "gpio_cable_in2");
	gpio_request(BAHAMAS_GPIO_AUD_EXTMIC_SEL, "gpio_aud_extmic_sel");
	gpio_request(BAHAMAS_GPIO_WFM_ANT_SW, "gpio_wfm_ant_sw");

	msm_hw_reset_hook = bahamas_reset;

	msm_acpu_clock_init(&bahamas_clock_data);
#if defined(CONFIG_PERFLOCK)
	perflock_init(&bahamas_perflock_data);
#endif

#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
	if (!opt_disable_uart3)
		msm_serial_debug_init(MSM_UART3_PHYS, INT_UART3,
			&msm_device_uart3.dev, 1,
				MSM_GPIO_TO_INT(BAHAMAS_GPIO_UART3_RX));
#endif

	msm_add_devices();

#if defined(CONFIG_SERIAL_MSM_HS)
	msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
	msm_add_serial_devices(3);
#else
	msm_add_serial_devices(0);
#endif

	msm_add_serial_devices(2);
#if defined(CONFIG_USB_FUNCTION)
	msm_register_usb_phy_init_seq(bahamas_phy_init_seq);
	msm_add_usb_devices(bahamas_phy_reset, NULL);
#endif

#if defined(CONFIG_USB_ANDROID)
	android_usb_pdata.products[0].product_id =
		android_usb_pdata.product_id;
	android_usb_pdata.serial_number = board_serialno();
	msm_hsusb_pdata.serial_number = board_serialno();
	msm_device_hsusb.dev.platform_data = &msm_hsusb_pdata;
	platform_device_register(&msm_device_hsusb);
#if defined(CONFIG_USB_ANDROID_RNDIS)
	platform_device_register(&rndis_device);
#endif
	platform_device_register(&usb_mass_storage_device);
	platform_device_register(&android_usb_device);
#endif
	if (board_mcp_monodie())
		msm_add_mem_devices(&pmem_setting_monodie);
	else
		msm_add_mem_devices(&pmem_setting_dualdie);

	bahamas_init_h2w_power_gpio();

	rc = bahamas_init_mmc(system_rev);
	if (rc)
		printk(KERN_CRIT "%s: MMC init failure (%d)\n", __func__, rc);

	if(system_rev < 3) {
		if (panel_detect() == PANEL_WINTEK) {
			microp_data.num_pins	= ARRAY_SIZE(microp_pins_0_wint);
			microp_data.pin_config	= microp_pins_0_wint;
		} else {
			microp_data.num_pins	= ARRAY_SIZE(microp_pins_0);
			microp_data.pin_config	= microp_pins_0;
		}
			i2c_microp_devices.irq = 0;
		} else if (panel_detect() == PANEL_WINTEK) {
			microp_data.num_pins	= ARRAY_SIZE(microp_pins_1_wint);
			microp_data.pin_config	= microp_pins_1_wint;
	}

	msm_device_i2c_init();
	platform_add_devices(devices, ARRAY_SIZE(devices));

	if (system_rev >= 3)
		bahamas_h2w_data.flags |= _35MM_MIC_DET_L2H;

	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
	i2c_register_board_info(0 ,&i2c_microp_devices, 1);

	bahamas_init_keypad();
	bahamas_init_panel();

	msm_init_pmic_vibrator(3000);
}