static void emd_power_off(void) { EMD_MSG_INF("chr","emd_power_off\n"); #if defined(MTK_DT_SUPPORT) && !defined(EVDO_DT_SUPPORT) #ifdef CONFIG_PM_RUNTIME /* make sure usb device tree is waked up so that usb is ready */ usb11_auto_resume(); #endif #endif cm_do_md_power_off(); emd_status = EMD_STATE_NOT_READY; }
void cm_gpio_setup(void) { #if 1 mt_set_gpio_mode(GPIO_6280_USB_SW1, GPIO_MODE_00); mt_set_gpio_mode(GPIO_6280_USB_SW2, GPIO_MODE_00); mt_set_gpio_dir(GPIO_6280_USB_SW1, GPIO_DIR_OUT); mt_set_gpio_dir(GPIO_6280_USB_SW2, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_6280_USB_SW1, GPIO_OUT_ZERO); mt_set_gpio_out(GPIO_6280_USB_SW2, GPIO_OUT_ZERO); /* Press MT6280 DL key to enter download mode * GPIO_6280_KCOL0(GPIO_KCOL0)=0 */ mt_set_gpio_mode(GPIO_6280_KCOL0, GPIO_MODE_00); mt_set_gpio_dir(GPIO_6280_KCOL0, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_6280_KCOL0, GPIO_OUT_ZERO); /* Power on MT6280: * Pull high GPIO_6280_RST, 0->1 */ mt_set_gpio_mode(GPIO_6280_RST, GPIO_MODE_00); mt_set_gpio_dir(GPIO_6280_RST, GPIO_DIR_OUT); //mt_set_gpio_out(GPIO_6280_RST, GPIO_OUT_ZERO); //msleep(200); //mt_set_gpio_mode(GPIO_6280_RST, GPIO_MODE_00); //mt_set_gpio_dir(GPIO_6280_RST, GPIO_DIR_OUT); //mt_set_gpio_out(GPIO_6280_RST, GPIO_OUT_ONE); //msleep(10); /* Press MT6280 DL key to enter download mode * GPIO_6280_KCOL0(GPIO_KCOL0)=0 */ mt_set_gpio_mode(GPIO_6280_KCOL0, GPIO_MODE_00); mt_set_gpio_dir(GPIO_6280_KCOL0, GPIO_DIR_OUT); //mt_set_gpio_out(GPIO_6280_KCOL0, GPIO_OUT_ONE); cm_do_md_power_off(); cm_do_md_power_on(); //printk("[%s] 2modem download .. while(1)...\n", "mt6280"); #endif #if 0 // MD wake up AP pin mt_set_gpio_pull_enable(GPIO_DT_MD_WK_AP_PIN, !0); mt_set_gpio_pull_select(GPIO_DT_MD_WK_AP_PIN, 1); mt_set_gpio_dir(GPIO_DT_MD_WK_AP_PIN, 0); mt_set_gpio_mode(GPIO_DT_MD_WK_AP_PIN, GPIO_DT_MD_WK_AP_PIN_M_EINT); // EINT3 // AP wake up MD pin mt_set_gpio_mode(GPIO_DT_AP_WK_MD_PIN, GPIO_DT_AP_WK_MD_PIN_M_GPIO); // GPIO Mode mt_set_gpio_dir(GPIO_DT_AP_WK_MD_PIN, 1); mt_set_gpio_out(GPIO_DT_AP_WK_MD_PIN, 0); // Rest MD pin mt_set_gpio_mode(GPIO_DT_MD_RST_PIN, GPIO_DT_MD_RST_PIN_M_GPIO); //GPIO202 is reset pin mt_set_gpio_pull_enable(GPIO_DT_MD_RST_PIN, 0); mt_set_gpio_pull_select(GPIO_DT_MD_RST_PIN, 1); mt_set_gpio_dir(GPIO_DT_MD_RST_PIN, 1); mt_set_gpio_out(GPIO_DT_MD_RST_PIN, 0);// Default @ reset state // MD power key pin mt_set_gpio_mode(GPIO_DT_MD_PWR_KEY_PIN, GPIO_DT_MD_PWR_KEY_PIN_M_GPIO); //GPIO 200 is power key mt_set_gpio_pull_enable(GPIO_DT_MD_PWR_KEY_PIN, 0); mt_set_gpio_dir(GPIO_DT_MD_PWR_KEY_PIN, 0);// Using input floating //mt_set_gpio_out(GPIO_DT_MD_PWR_KEY_PIN, 1);// Default @ reset state // MD WDT irq pin mt_set_gpio_pull_enable(GPIO_DT_MD_WDT_PIN, !0); mt_set_gpio_pull_select(GPIO_DT_MD_WDT_PIN, 1); mt_set_gpio_dir(GPIO_DT_MD_WDT_PIN, 0); mt_set_gpio_mode(GPIO_DT_MD_WDT_PIN, GPIO_DT_MD_WDT_PIN_M_EINT); // EINT9 // MD Download pin //....... #endif }