void target_init(void) { target_shutdown_for_rtc_alarm(); dprintf(INFO, "target_init()\n"); setup_fpga(); /* Setting Debug LEDs ON */ debug_led_write(0xFF); #if (!ENABLE_NANDWRITE) keys_init(); keypad_init(); #endif /* Display splash screen if enabled */ #if DISPLAY_SPLASH_SCREEN display_init(); dprintf(SPEW, "Diplay initialized\n"); display_image_on_screen(); #endif if (mmc_boot_main(MMC_SLOT, MSM_SDC1_BASE)) { dprintf(CRITICAL, "mmc init failed!"); ASSERT(0); } }
void target_init(void) { unsigned base_addr; unsigned char slot; dprintf(INFO, "target_init()\n"); /* Initialize PMIC driver */ pmic.read = (pm8921_read_func) & pa1_ssbi2_read_bytes; pmic.write = (pm8921_write_func) & pa1_ssbi2_write_bytes; pm8921_init(&pmic); /* Keypad init */ keys_init(); keypad_init(); /* Display splash screen if enabled */ #if DISPLAY_SPLASH_SCREEN if ((platform_id == MSM8960) || (platform_id == MSM8660A) || (platform_id == MSM8260A) || (platform_id == APQ8060A) || (platform_id == MSM8230) || (platform_id == MSM8630) || (platform_id == MSM8930) || (platform_id == APQ8030) || (platform_id == MSM8227) || (platform_id == MSM8627)) { panel_backlight_on(); display_init(); dprintf(SPEW, "Diplay initialized\n"); display_image_on_screen(); } #endif if ((platform_id == MSM8960) || (platform_id == MSM8660A) || (platform_id == MSM8260A) || (platform_id == APQ8060A)) /* Enable Hardware CE */ platform_ce_type = CRYPTO_ENGINE_TYPE_HW; /* Trying Slot 1 first */ slot = 1; base_addr = mmc_sdc_base[slot - 1]; if (mmc_boot_main(slot, base_addr)) { /* Trying Slot 3 next */ slot = 3; base_addr = mmc_sdc_base[slot - 1]; if (mmc_boot_main(slot, base_addr)) { dprintf(CRITICAL, "mmc init failed!"); ASSERT(0); } } }
void target_display_init(const char *panel_name) { uint32_t fb_addr = MIPI_FB_ADDR; struct fbcon_config *config = NULL; config = (struct fbcon_config*)malloc(sizeof(struct fbcon_config)); config->base = fb_addr; config->width = 540; config->height = 960; config->stride = config->width; config->bpp = 24; config->format = DSI_VIDEO_DST_FORMAT_RGB888; config->update_start = NULL; config->update_done = NULL; fbcon_setup(config); display_image_on_screen(); }
int msm_display_init(struct msm_fb_panel_data *pdata) { int ret = NO_ERROR; panel = pdata; if (!panel) { ret = ERR_INVALID_ARGS; goto msm_display_init_out; } /* Enable clock */ if (pdata->clk_func) ret = pdata->clk_func(1); if (ret) goto msm_display_init_out; /* Turn on panel */ if (pdata->power_func) ret = pdata->power_func(1); if (ret) goto msm_display_init_out; ret = msm_fb_alloc(&(panel->fb)); if (ret) goto msm_display_init_out; fbcon_setup(&(panel->fb)); display_image_on_screen(); ret = msm_display_config(); if (ret) goto msm_display_init_out; ret = msm_display_on(); if (ret) goto msm_display_init_out; msm_display_init_out: return ret; }
void target_init(void) { unsigned offset; struct flash_info *flash_info; struct ptentry *board_part_list; unsigned total_num_of_blocks; unsigned next_ptr_start_adr = 0; unsigned blocks_per_1MB = 8; /* Default value of 2k page size on 256MB flash drive*/ int i; dprintf(INFO, "target_init()\n"); #if (!ENABLE_NANDWRITE) keys_init(); keypad_init(); #endif /* Display splash screen if enabled */ #if DISPLAY_SPLASH_SCREEN display_init(); dprintf(SPEW, "Diplay initialized\n"); display_image_on_screen(); #endif if (target_is_emmc_boot()) { /* Must wait for modem-up before we can intialize MMC. */ while (readl(MSM_SHARED_BASE + 0x14) != 1); if(mmc_boot_main(MMC_SLOT, MSM_SDC3_BASE)) { dprintf(CRITICAL, "mmc init failed!"); ASSERT(0); } return; } ptable_init(&flash_ptable); smem_ptable_init(); flash_init(); flash_info = flash_get_info(); ASSERT(flash_info); offset = smem_get_apps_flash_start(); if (offset == 0xffffffff) while(1); total_num_of_blocks = flash_info->num_blocks; blocks_per_1MB = (1 << 20) / (flash_info->block_size); if (flash_ecc_bch_enabled()) board_part_list = board_part_list_bchecc; else board_part_list = board_part_list_default; for (i = 0; i < num_parts; i++) { struct ptentry *ptn = &board_part_list[i]; unsigned len = ((ptn->length) * blocks_per_1MB); if(ptn->start != 0) ASSERT(ptn->start == DIFF_START_ADDR); ptn->start = next_ptr_start_adr; if(ptn->length == VARIABLE_LENGTH) { unsigned length_for_prt = 0; unsigned j; for (j = i+1; j < num_parts; j++) { struct ptentry *temp_ptn = &board_part_list[j]; ASSERT(temp_ptn->length != VARIABLE_LENGTH); length_for_prt += ((temp_ptn->length) * blocks_per_1MB); } len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt); ASSERT(len >= 0); } next_ptr_start_adr = ptn->start + len; ptable_add(&flash_ptable, ptn->name, offset + ptn->start, len, ptn->flags, TYPE_APPS_PARTITION, PERM_WRITEABLE); } smem_add_modem_partitions(&flash_ptable); ptable_dump(&flash_ptable); flash_set_ptable(&flash_ptable); }
static void msm8960_backlight_on(void) { struct pm8921_gpio backlight_pwm = { .direction = PM_GPIO_DIR_OUT, .output_buffer = 0, .output_value = 0, .pull = PM_GPIO_PULL_NO, .vin_sel = 2, .out_strength = PM_GPIO_STRENGTH_HIGH, .function = PM_GPIO_FUNC_1, .inv_int_pol = 0, }; int rc = pm8921_gpio_config(PM_GPIO(24), &backlight_pwm); if (rc) dprintf(CRITICAL, "FAIL pm8921_gpio_config(): rc=%d.\n", rc); } /* Pull DISP_RST_N high to get panel out of reset */ static void msm8960_mipi_panel_reset(void) { struct pm8921_gpio gpio43_param = { .direction = PM_GPIO_DIR_OUT, .output_buffer = 0, .output_value = 1, .pull = PM_GPIO_PULL_UP_30, .vin_sel = 2, .out_strength = PM_GPIO_STRENGTH_HIGH, .function = PM_GPIO_FUNC_PAIRED, .inv_int_pol = 0, .disable_pin = 0, }; pm8921_gpio_config(PM_GPIO(43), &gpio43_param); } static int msm8960_mipi_panel_clock(int enable) { if (enable) { mdp_clock_init(); mmss_clock_init(); } else if(!target_cont_splash_screen()) { mmss_clock_disable(); } return 0; } static int msm8960_mipi_panel_power(int enable) { if (enable) { msm8960_backlight_on(); /* Turn on LDO8 for lcd1 mipi vdd */ pm8921_ldo_set_voltage(LDO_8, LDO_VOLTAGE_3_0V); /* Turn on LDO23 for lcd1 mipi vddio */ pm8921_ldo_set_voltage(LDO_23, LDO_VOLTAGE_1_8V); /* Turn on LDO2 for vdda_mipi_dsi */ pm8921_ldo_set_voltage(LDO_2, LDO_VOLTAGE_1_2V); msm8960_mipi_panel_reset(); } return 0; } void display_init(void) { dprintf(CRITICAL, "display_init\n"); switch (board_target_id()) { case LINUX_MACHTYPE_8064_CDP: lvds_chimei_wxga_init(&(panel.panel_info)); panel.clk_func = apq8064_lvds_clock; panel.power_func = apq8064_lvds_panel_power; panel.fb.base = 0x80B00000; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_44; break; case LINUX_MACHTYPE_8064_MTP: mipi_toshiba_video_wsvga_init(&(panel.panel_info)); panel.clk_func = fusion3_mtp_clock; panel.power_func = fusion3_mtp_panel_power; panel.fb.base = 0x89000000; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_44; break; case LINUX_MACHTYPE_8960_CDP: case LINUX_MACHTYPE_8960_MTP: case LINUX_MACHTYPE_8960_FLUID: case LINUX_MACHTYPE_8960_LIQUID: mipi_toshiba_video_wsvga_init(&(panel.panel_info)); panel.clk_func = msm8960_mipi_panel_clock; panel.power_func = msm8960_mipi_panel_power; panel.fb.base = 0x89000000; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_42; break; default: return; }; if (msm_display_init(&panel)) { dprintf(CRITICAL, "Display init failed!\n"); return; } display_image_on_screen(); display_enable = 1; } void display_shutdown(void) { if (display_enable) msm_display_off(); }
static void msm8960_backlight_on(void) { struct pm8921_gpio backlight_pwm = { .direction = PM_GPIO_DIR_OUT, .output_buffer = 0, .output_value = 0, .pull = PM_GPIO_PULL_NO, .vin_sel = 2, .out_strength = PM_GPIO_STRENGTH_HIGH, .function = PM_GPIO_FUNC_1, .inv_int_pol = 0, }; int rc = pm8921_gpio_config(PM_GPIO(24), &backlight_pwm); if (rc) dprintf(CRITICAL, "FAIL pm8921_gpio_config(): rc=%d.\n", rc); } /* Pull DISP_RST_N high to get panel out of reset */ static void msm8960_mipi_panel_reset(void) { struct pm8921_gpio gpio43_param = { .direction = PM_GPIO_DIR_OUT, .output_buffer = 0, .output_value = 1, .pull = PM_GPIO_PULL_UP_30, .vin_sel = 2, .out_strength = PM_GPIO_STRENGTH_HIGH, .function = PM_GPIO_FUNC_PAIRED, .inv_int_pol = 0, .disable_pin = 0, }; pm8921_gpio_config(PM_GPIO(43), &gpio43_param); } static int msm8960_mipi_panel_clock(int enable) { if (enable) { mdp_clock_init(); mmss_clock_init(); } else if(!target_cont_splash_screen()) { mmss_clock_disable(); } return 0; } static int msm8960_liquid_mipi_panel_clock(int enable) { if (enable) { mdp_clock_init(); liquid_mmss_clock_init(); /* 240 MHZ MIPI-DSI clk */ } else if(!target_cont_splash_screen()) { mmss_clock_disable(); } return 0; } static int msm8960_mipi_panel_power(int enable) { if (enable) { msm8960_backlight_on(); /* Turn on LDO8 for lcd1 mipi vdd */ pm8921_ldo_set_voltage(LDO_8, LDO_VOLTAGE_3_0V); /* Turn on LDO23 for lcd1 mipi vddio */ pm8921_ldo_set_voltage(LDO_23, LDO_VOLTAGE_1_8V); /* Turn on LDO2 for vdda_mipi_dsi */ pm8921_ldo_set_voltage(LDO_2, LDO_VOLTAGE_1_2V); msm8960_mipi_panel_reset(); } return 0; } #define PM_GPIO_VIN_VPH 0 /* 3v ~ 4.4v */ #define PM_GPIO_VIN_BB 1 /* ~3.3v */ #define PM_GPIO_VIN_S4 2 /* 1.8v */ #define PM_GPIO_VIN_L15 3 static int msm8960_liquid_mipi_panel_power(int enable) { if (enable) { static int gpio17, gpio21, gpio43 ; int rc; struct pm8921_gpio gpio_config = { .direction = PM_GPIO_DIR_OUT, .output_buffer = 0, .output_value = 1, .pull = PM_GPIO_PULL_NO, .vin_sel = PM_GPIO_VIN_S4, .out_strength = PM_GPIO_STRENGTH_HIGH, .function = PM_GPIO_FUNC_NORMAL, .inv_int_pol = 0, .disable_pin = 0, }; /* Note: PWM is controlled by PM-GPIO#24 */ gpio17 = PM_GPIO(17); /* ext_3p3v */ gpio21 = PM_GPIO(21); /* disp power enable_n , vin=VPH-PWR */ gpio43 = PM_GPIO(43); /* Displays Enable (rst_n) */ gpio_config.output_value = 1; rc = pm8921_gpio_config(gpio17, &gpio_config); mdelay(100); gpio_config.output_value = 0; /* disp disable (resx=0) */ rc = pm8921_gpio_config(gpio43, &gpio_config); mdelay(100); gpio_config.output_value = 0; gpio_config.vin_sel = PM_GPIO_VIN_VPH; /* VPH_PWR */ /* disp power enable_n */ rc = pm8921_gpio_config(gpio21, &gpio_config); mdelay(100); gpio_config.output_value = 1; gpio_config.vin_sel = PM_GPIO_VIN_S4; /* disp enable */ rc = pm8921_gpio_config(gpio43, &gpio_config); mdelay(100); pm8921_low_voltage_switch_enable(lvs_4); /* S4 1.8 V */ /* Turn on LDO2 for vdda_mipi_dsi */ pm8921_ldo_set_voltage(LDO_2, LDO_VOLTAGE_1_2V); msm8960_backlight_on(); } return 0; } void display_init(void) { int target_id = board_target_id(); dprintf(INFO, "display_init(),target_id=%d.\n", target_id); switch (target_id) { case LINUX_MACHTYPE_8960_LIQUID: mipi_chimei_video_wxga_init(&(panel.panel_info)); /* * mipi_chimei_wxga panel not supported yet in LK. * However, MIPI clocks and power should be set in LK. */ panel.clk_func = msm8960_liquid_mipi_panel_clock; panel.power_func = msm8960_liquid_mipi_panel_power; panel.fb.base = MIPI_FB_ADDR; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_44; break; case LINUX_MACHTYPE_8064_CDP: lvds_chimei_wxga_init(&(panel.panel_info)); panel.clk_func = apq8064_lvds_clock; panel.power_func = apq8064_lvds_panel_power; panel.fb.base = 0x80B00000; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_44; break; case LINUX_MACHTYPE_8064_MTP: mipi_toshiba_video_wsvga_init(&(panel.panel_info)); panel.clk_func = fusion3_mtp_clock; panel.power_func = fusion3_mtp_panel_power; panel.fb.base = 0x89000000; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_44; break; case LINUX_MACHTYPE_8960_CDP: case LINUX_MACHTYPE_8960_MTP: case LINUX_MACHTYPE_8960_FLUID: mipi_toshiba_video_wsvga_init(&(panel.panel_info)); panel.clk_func = msm8960_mipi_panel_clock; panel.power_func = msm8960_mipi_panel_power; panel.fb.base = 0x89000000; panel.fb.width = panel.panel_info.xres; panel.fb.height = panel.panel_info.yres; panel.fb.stride = panel.panel_info.xres; panel.fb.bpp = panel.panel_info.bpp; panel.fb.format = FB_FORMAT_RGB888; panel.mdp_rev = MDP_REV_42; break; default: return; }; if (msm_display_init(&panel)) { dprintf(CRITICAL, "Display init failed!\n"); return; } display_image_on_screen(); display_enable = 1; } void display_shutdown(void) { if (display_enable) msm_display_off(); }