/* system_rev == higher 16bits of PCBID
XA -> 0000FFFF -> 0x0000
XB -> 0101FFFF -> 0x0101
XC -> 0202FFFF -> 0x0202
*/
static void __init supersonic_init(void)
{
	int ret;
	struct kobject *properties_kobj;

	printk("supersonic_init() revision=%d\n", system_rev);

	msm_hw_reset_hook = supersonic_reset;

	OJ_BMA_power();

	gpio_direction_output(SUPERSONIC_GPIO_PROXIMITY_EN_N, 0);

	msm_acpu_clock_init(&supersonic_clock_data);

	perflock_init(&supersonic_perflock_data);

#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
	msm_device_uart1.dev.platform_data = &msm_uart_debug_pdata;
	msm_serial_debug_init(MSM_UART1_PHYS, INT_UART1,
			      &msm_device_uart1.dev, 1, MSM_GPIO_TO_INT(SUPERSONIC_GPIO_UART1_RX));
#endif

#ifdef CONFIG_ARCH_QSD8X50
	bt_export_bd_address();
#endif

	/* set the gpu power rail to manual mode so clk en/dis will not
	 * turn off gpu power, and hang it on resume */
	supersonic_kgsl_power_rail_mode(0);
	supersonic_kgsl_power(true);

	#ifdef CONFIG_SERIAL_MSM_HS
	msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
	msm_device_uart_dm1.name = "msm_serial_hs_bcm";	/* for bcm */
	#endif

	config_gpio_table(camera_off_gpio_table,
		ARRAY_SIZE(camera_off_gpio_table));
	/*gpio_direction_output(SUPERSONIC_GPIO_TP_LS_EN, 0);*/
	gpio_direction_output(SUPERSONIC_GPIO_TP_EN, 0);

	supersonic_audio_init();
#ifdef CONFIG_MICROP_COMMON
	supersonic_microp_init();
#endif
	msm_device_i2c_init();

	platform_add_devices(devices, ARRAY_SIZE(devices));
	if (!opt_usb_h2w_sw) {
		msm_register_usb_phy_init_seq(supersonic_phy_init_seq);
		msm_register_uart_usb_switch(supersonic_uart_usb_switch);
		msm_add_usb_id_pin_gpio(SUPERSONIC_GPIO_USB_ID_PIN);
		msm_hsusb_set_product(supersonic_usb_products,
			ARRAY_SIZE(supersonic_usb_products));
		msm_add_usb_devices(msm_hsusb_8x50_phy_reset, NULL);
	}
	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));

	ret = supersonic_init_mmc(system_rev);
	if (ret != 0)
		pr_crit("%s: Unable to initialize MMC\n", __func__);

	properties_kobj = kobject_create_and_add("board_properties", NULL);
	if (properties_kobj)
		ret = sysfs_create_group(properties_kobj,
				&supersonic_properties_attr_group);
	if (!properties_kobj || ret)
		pr_err("failed to create board_properties\n");

	msm_init_pmic_vibrator();
	config_gpio_table(usb_phy_3v3_table, ARRAY_SIZE(usb_phy_3v3_table));
	config_gpio_table(usb_ID_PIN_table, ARRAY_SIZE(usb_ID_PIN_table));
	gpio_set_value(SUPERSONIC_USB_PHY_3V3_ENABLE, 1);

}
static void __init latte_init(void)
{
    int rc;
    char *cid = NULL;
    printk("latte_init() revision = 0x%X\n", system_rev);
    board_get_cid_tag(&cid);

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

    /* We need to set this pin to 0 only once on power-up; we will
     * not actually enable the chip until we apply power to it via
     * vreg.
     */
    gpio_direction_output(LATTE_GPIO_LS_EN, 0);
    /* disable power for cm3602 chip */
    __capella_cm3602_power(0);

    msm_hw_reset_hook = latte_reset;

    msm_acpu_clock_init(&latte_clock_data);
    perflock_init(&latte_perflock_data);

#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(LATTE_GPIO_UART3_RX));
#endif

    msm_add_devices();

#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_change_usb_id(0x0bb4, 0x0c10);
    */
    msm_add_usb_id_pin_gpio(LATTE_GPIO_USB_ID_PIN);

    msm_register_usb_phy_init_seq(espresso_phy_init_seq);
    msm_hsusb_set_product(espresso_usb_products,
                          ARRAY_SIZE(espresso_usb_products));
    msm_add_usb_devices(latte_phy_reset, latte_phy_shutdown);


    msm_add_mem_devices(&pmem_setting);

    msm_init_pmic_vibrator();
#ifdef CONFIG_MICROP_COMMON
    latte_microp_init();
#endif

    latte_init_h2w_power_gpio();

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

    /* register flashlight at new-XA above */
    platform_device_register(&latte_flashlight_device);

    /* probe camera driver */
    i2c_register_board_info(0, i2c_camera_devices, ARRAY_SIZE(i2c_camera_devices));

    msm_device_i2c.dev.platform_data = &latte_i2c_device_data;
    platform_add_devices(devices, ARRAY_SIZE(devices));
    i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));

    latte_init_keypad();
}
static void __init incrediblec_init(void)
{
	int ret;
	struct kobject *properties_kobj;

	printk("incrediblec_init() revision=%d, engineerid=%d\n", system_rev, engineerid);

	 msm_hw_reset_hook = incrediblec_reset;

	if (0 == engineerid || 0xF == engineerid) {
		mdp_pmem_pdata.start = MSM_PMEM_MDP_XA_BASE;
		android_pmem_adsp_pdata.start = MSM_PMEM_ADSP_XA_BASE;
                msm_kgsl_resources[1].start = MSM_GPU_MEM_XA_BASE;
                msm_kgsl_resources[1].end = MSM_GPU_MEM_XA_BASE + MSM_GPU_MEM_SIZE - 1;
	} else if (engineerid >= 3) {
		mdp_pmem_pdata.start = MSM_PMEM_MDP_BASE + MSM_MEM_128MB_OFFSET;
		android_pmem_adsp_pdata.start = MSM_PMEM_ADSP_BASE + MSM_MEM_128MB_OFFSET;
		msm_kgsl_resources[1].start = MSM_GPU_MEM_BASE;
		msm_kgsl_resources[1].end =  msm_kgsl_resources[1].start + MSM_GPU_MEM_SIZE - 1;
	}

	OJ_BMA_power();

	gpio_direction_output(INCREDIBLEC_GPIO_PROXIMITY_EN_N, 0);

	msm_acpu_clock_init(&incrediblec_clock_data);

	perflock_init(&incrediblec_perflock_data);

#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
	msm_serial_debug_init(MSM_UART1_PHYS, INT_UART1,
				&msm_device_uart1.dev, 1, INT_UART1_RX);
#endif

#ifdef CONFIG_ARCH_QSD8X50
	bt_export_bd_address();
#endif
	/* set the gpu power rail to manual mode so clk en/dis will not
	 * turn off gpu power, and hang it on resume */
	incrediblec_kgsl_power_rail_mode(0);
	incrediblec_kgsl_power(true);

	#ifdef CONFIG_SERIAL_MSM_HS
	msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
	msm_device_uart_dm1.name = "msm_serial_hs_bcm";	/* for bcm */
	#endif

	incrediblec_config_uart_gpios();

	config_gpio_table(camera_off_gpio_table,
		ARRAY_SIZE(camera_off_gpio_table));
	/*gpio_direction_output(INCREDIBLEC_GPIO_TP_LS_EN, 0);*/
	gpio_direction_output(INCREDIBLEC_GPIO_TP_EN, 0);

	incrediblec_audio_init();
	msm_device_i2c_init();
#ifdef CONFIG_MICROP_COMMON
	incrediblec_microp_init();
#endif

	msm_init_ums_lun(2); /*0: sd card, 1: moving nand*/
	msm_register_usb_phy_init_seq(incrediblec_phy_init_seq);
	msm_hsusb_set_product(incrediblec_usb_products,
		ARRAY_SIZE(incrediblec_usb_products));
	msm_register_uart_usb_switch(NULL);
	msm_add_usb_id_pin_gpio(INCREDIBLEC_GPIO_USB_ID_PIN);
	msm_add_usb_devices(msm_hsusb_8x50_phy_reset, NULL);

	if (system_rev >= 2) {
		microp_data.num_functions   = ARRAY_SIZE(microp_functions_1);
		microp_data.microp_function = microp_functions_1;
	}

	platform_add_devices(devices, ARRAY_SIZE(devices));
	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));

	ret = incrediblec_init_mmc(system_rev);
	if (ret != 0)
		pr_crit("%s: Unable to initialize MMC\n", __func__);

	properties_kobj = kobject_create_and_add("board_properties", NULL);
	if (properties_kobj)
		ret = sysfs_create_group(properties_kobj,
				&incrediblec_properties_attr_group);
	if (!properties_kobj || ret)
		pr_err("failed to create board_properties\n");

	msm_init_pmic_vibrator();

	config_gpio_table(incrediblec_usb_phy_3v3_table, ARRAY_SIZE(incrediblec_usb_phy_3v3_table));
	config_gpio_table(usb_ID_PIN_table, ARRAY_SIZE(usb_ID_PIN_table));
	gpio_direction_output(INCREDIBLEC_USB_PHY_3V3_ENABLE, 1);
}